Skip to content

Commit

Permalink
* Unifont as font fallback
Browse files Browse the repository at this point in the history
Renamed widgets cjkv_ => uni_
Start widget name or comment with uni_ if it can be filled with trans-
lated strings of multiple languages simultaneously (usually ListBoxes).

For licensing information on Unifont.ttf, visit http://unifoundry.com .

Libertine from now on is treated as special font for certain languages
and no longer the default font. It lacks support for too many glyphs.

This also removes the UMing font since Unifont has full CJKV support.
  • Loading branch information
ChrisOelmueller committed Apr 21, 2012
1 parent c97b7a9 commit e607f54
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 45 deletions.
Binary file removed content/fonts/UMing.ttc
Binary file not shown.
Binary file added content/fonts/Unifont.ttf
Binary file not shown.
6 changes: 3 additions & 3 deletions content/fonts/libertine.fontdef
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ color: 255,255,255
antialias: 1


[Font/14_black_cjkv]
[Font/16_black_unifont]

type: truetype
source: content/fonts/UMing.ttc
size: 15
source: content/fonts/Unifont.ttf
size: 16
color: 68,42,2
antialias: 1
38 changes: 19 additions & 19 deletions content/fonts/uming.fontdef → content/fonts/unifont.fontdef
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Font/13]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 14
color: 255,255,255
antialias: 1
Expand All @@ -10,7 +10,7 @@ antialias: 1
[Font/14]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 15
color: 255,255,255
antialias: 1
Expand All @@ -19,16 +19,16 @@ antialias: 1
[Font/mainmenu]

type: truetype
source: content/fonts/UMing.ttc
size: 25
source: content/fonts/Unifont.ttf
size: 22
color: 255,255,255
antialias: 1


[Font/18]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 18
color: 255,255,255
antialias: 1
Expand All @@ -37,7 +37,7 @@ antialias: 1
[Font/small]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 17
color: 255,255,255
antialias: 1
Expand All @@ -46,7 +46,7 @@ antialias: 1
[Font/14_black]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 15
color: 68,42,2
antialias: 1
Expand All @@ -55,7 +55,7 @@ antialias: 1
[Font/18_black]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 19
color: 68,42,2
antialias: 1
Expand All @@ -64,7 +64,7 @@ antialias: 1
[Font/small_black]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 16
color: 68,42,2
antialias: 1
Expand All @@ -73,7 +73,7 @@ antialias: 1
[Font/large]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 24
color: 255,255,255
antialias: 1
Expand All @@ -82,7 +82,7 @@ antialias: 1
[Font/large_load]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 34
color: 120,100,65
antialias: 1
Expand All @@ -91,7 +91,7 @@ antialias: 1
[Font/headline]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 18
color: 68,42,2
antialias: 1
Expand All @@ -100,7 +100,7 @@ antialias: 1
[Font/tooltip]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 15
color: 68,42,2
antialias: 1
Expand All @@ -109,7 +109,7 @@ antialias: 1
[Font/message]

type: truetype
source: content/fonts/UMing.ttc
source: content/fonts/Unifont.ttf
size: 15
color: 255,255,255
antialias: 1
Expand All @@ -118,16 +118,16 @@ antialias: 1
[Font/small_tooltip]

type: truetype
source: content/fonts/UMing.ttc
size: 13
source: content/fonts/Unifont.ttf
size: 15
color: 255,255,255
antialias: 1


[Font/14_black_cjkv]
[Font/16_black_unifont]

type: truetype
source: content/fonts/UMing.ttc
size: 15
source: content/fonts/Unifont.ttf
size: 16
color: 68,42,2
antialias: 1
2 changes: 1 addition & 1 deletion content/gui/xml/mainmenu/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
<HBox>
<Label text="Select language:" name="language_label" />
<ScrollArea min_size="165,180" >
<ListBox name="cjkv_language" is_focusable="0" />
<ListBox name="uni_language" is_focusable="0" />
</ScrollArea>
</HBox>
</VBox>
Expand Down
8 changes: 4 additions & 4 deletions content/gui/xml/mainmenu/singleplayer/sp_scenario.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
<VBox name="language_hbox">
<Label text="Select a language:" name="select_lang_lbl" wrap_text="1" max_size="140,40" min_size="140,20"/>
<ScrollArea max_size="140,200" min_size="140,200" horizontal_scrollbar="0" name="lang_list_area">
<ListBox name="cjkv_langlist" is_focusable="0"/>
<ListBox name="uni_langlist" is_focusable="0"/>
</ScrollArea>
</VBox>
</HBox>

<VBox name="map_info">
<Label name="cjkv_map_author" wrap_text="1" max_size="300,40" />
<Label name="cjkv_map_difficulty" wrap_text="1" max_size="300,20" />
<Label name="cjkv_map_desc" wrap_text="1" max_size="300,120" min_size="300,120"/>
<Label name="uni_map_author" wrap_text="1" max_size="300,40" />
<Label name="uni_map_difficulty" wrap_text="1" max_size="300,20" />
<Label name="uni_map_desc" wrap_text="1" max_size="300,120" min_size="300,120"/>
<!--
<ScrollArea name="map_description_area" position="5,380"> </ScrollArea>
-->
Expand Down
38 changes: 34 additions & 4 deletions horizons/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ def get_by_value(self, value):
"fi" : u'Suomi',
"fr" : u'Français',
"gl" : u'Galego',
"hi" : u'मानक हिन्दी',
"hr" : u'Hrvatski',
"hu" : u'Magyar',
"it" : u'Italiano',
Expand All @@ -534,10 +535,39 @@ def get_by_value(self, value):
})

FONTDEFS = {
'ja' : 'uming',
'ko' : 'uming',
'vi' : 'uming',
'zh_CN': 'uming',
# "af"
"bg" : 'libertine',
# "ca"
"ca@valencia" : 'libertine',
"cs" : 'libertine',
"da" : 'libertine',
"de" : 'libertine',
"en" : 'libertine',
"es" : 'libertine',
"et" : 'libertine',
"el" : 'libertine',
"fi" : 'libertine',
"fr" : 'libertine',
"gl" : 'libertine',
# "hi"
"hr" : 'libertine',
"hu" : 'libertine',
"it" : 'libertine',
# "ja"
"lt" : 'libertine',
# "ko"
"nb" : 'libertine',
"nl" : 'libertine',
"pl" : 'libertine',
"pt_BR" : 'libertine',
"pt" : 'libertine',
"ro" : 'libertine',
"ru" : 'libertine',
"sl" : 'libertine',
"sv" : 'libertine',
"tr" : 'libertine',
# "vi"
# "zh_CN"
}

AUTO_CONTINUE_CAMPAIGN=True
2 changes: 1 addition & 1 deletion horizons/engine/settingshandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def update_autosave_interval(*args):

languages = find_available_languages().keys()

self._setting.createAndAddEntry(UH_MODULE, "Language", "cjkv_language",
self._setting.createAndAddEntry(UH_MODULE, "Language", "uni_language",
applyfunction=self.update_languages,
initialdata= [LANGUAGENAMES[x] for x in sorted(languages)])
self._setting.createAndAddEntry(UH_MODULE, "VolumeMusic", "volume_music",
Expand Down
14 changes: 7 additions & 7 deletions horizons/gui/modules/singleplayermenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def _update_infos():
maps_display.sort(key=prefer_tutorial)
self.current.files.sort(key=prefer_tutorial)
#add all locales to lang list, select current locale as default and sort
lang_list = self.current.findChild(name="cjkv_langlist")
lang_list = self.current.findChild(name="uni_langlist")
self.active_right_side.distributeInitialData({ 'maplist' : maps_display, })
# select first entry
self.active_right_side.distributeData({ 'maplist' : 0, })
Expand Down Expand Up @@ -275,17 +275,17 @@ def _update_translation_infos(new_map_name):
except InvalidScenarioFileFormat as e:
self._show_invalid_scenario_file_popup(e)
return
self.current.findChild(name="cjkv_map_difficulty").text = \
self.current.findChild(name="uni_map_difficulty").text = \
_("Difficulty: {difficulty}").format(difficulty=difficulty) #xgettext:python-format
self.current.findChild(name="cjkv_map_author").text = \
self.current.findChild(name="uni_map_author").text = \
_("Author: {author}").format(author=author) #xgettext:python-format
self.current.findChild(name="cjkv_map_desc").text = \
self.current.findChild(name="uni_map_desc").text = \
_("Description: {desc}").format(desc=desc) #xgettext:python-format

self.active_right_side.findChild(name="cjkv_langlist").mapEvents({
'cjkv_langlist/action': _update_infos
self.active_right_side.findChild(name="uni_langlist").mapEvents({
'uni_langlist/action': _update_infos
})
self.active_right_side.findChild(name="cjkv_langlist").capture(_update_infos, event_name="keyPressed")
self.active_right_side.findChild(name="uni_langlist").capture(_update_infos, event_name="keyPressed")
_update_infos()
#hide and show current window to keep bugs away from us
#if we don't do this, translation_label doesn't hide even if
Expand Down
4 changes: 2 additions & 2 deletions horizons/gui/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def load_uh_widget(filename, style=None, center_widget=False):
for w in widget.findChildren():
if w.name.startswith("headline") or w.name == "name":
w.stylize('headline')
elif w.name.startswith("cjkv") or w.comment.startswith("cjkv"):
w.font = '14_black_cjkv'
elif w.name.startswith("uni_") or w.comment.startswith("uni_"):
w.font = '16_black_unifont'
if center_widget:
widget.position_technique = "automatic" # "center:center"

Expand Down
6 changes: 2 additions & 4 deletions horizons/i18n/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ def find_available_languages():
return languages

def get_fontdef_for_locale(locale):
"""Returns path to the fontdef file for a locale. Libertine is default."""
fontdef_file = 'libertine'
if locale in FONTDEFS.iterkeys():
fontdef_file = FONTDEFS[locale]
"""Returns path to the fontdef file for a locale. Unifont is default."""
fontdef_file = FONTDEFS.get(locale, 'unifont')
return u'content/fonts/{filename}.fontdef'.format(filename = fontdef_file)

0 comments on commit e607f54

Please sign in to comment.