diff options
author | Owen Taylor <otaylor@redhat.com> | 2001-06-26 19:13:28 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2001-06-26 19:13:28 +0000 |
commit | 9c41176796502c33fec770dc5952bdcdc9db3783 (patch) | |
tree | e2c561525c5cdbe96aae959634e2cb3feceb3b8e /pango/pangowin32.c | |
parent | ac5989fb0fec8273fd4955611b6efb0317d138c1 (diff) | |
download | pango-9c41176796502c33fec770dc5952bdcdc9db3783.tar.gz |
Couple of bug fixes for the last change.
Tue Jun 26 15:11:30 2001 Owen Taylor <otaylor@redhat.com>
* pango/pango-context.c (font_set_get_font)
pango/pango-context.c (add_engines): Couple of
bug fixes for the last change.
* configure.in: Abort out when AM_PATH_GLIB fails.
Diffstat (limited to 'pango/pangowin32.c')
-rw-r--r-- | pango/pangowin32.c | 83 |
1 files changed, 5 insertions, 78 deletions
diff --git a/pango/pangowin32.c b/pango/pangowin32.c index cd6c8388..b7b885d4 100644 --- a/pango/pangowin32.c +++ b/pango/pangowin32.c @@ -753,51 +753,6 @@ get_font_metrics_from_string (PangoFont *font, g_free (embedding_levels); } -typedef struct { - const char *lang; - const char *str; -} LangInfo; - -int -lang_info_compare (const void *key, const void *val) -{ - const LangInfo *lang_info = val; - - return strncmp (key, lang_info->lang, 2); -} - -/* The following array is supposed to contain enough text to tickle all necessary fonts for each - * of the languages in the following. Yes, it's pretty lame. Not all of the languages - * in the following have sufficient text to excercise all the accents for the language, and - * there are obviously many more languages to include as well. - */ -LangInfo lang_texts[] = { - { "ar", "Arabic السلام عليكم" }, - { "cs", "Czech (česky) Dobrý den" }, - { "da", "Danish (Dansk) Hej, Goddag" }, - { "el", "Greek (Ελληνικά) Γειά σας" }, - { "en", "English Hello" }, - { "eo", "Esperanto Saluton" }, - { "es", "Spanish (Español) ¡Hola!" }, - { "et", "Estonian Tere, Tervist" }, - { "fi", "Finnish (Suomi) Hei, Hyvää päivää" }, - { "fr", "French (Français)" }, - { "de", "German Grüß Gott" }, - { "iw", "Hebrew שלום" }, - { "il", "Italiano Ciao, Buon giorno" }, - { "ja", "Japanese (日本語) こんにちは, コンニチハ" }, - { "ko", "Korean (한글) 안녕하세요, 안녕하십니까" }, - { "mt", "Maltese Ċaw, Saħħa" }, - { "nl", "Nederlands, Vlaams Hallo, Dag" }, - { "no", "Norwegian (Norsk) Hei, God dag" }, - { "pl", "Polish Dzień dobry, Hej" }, - { "ru", "Russian (Русский)" }, - { "sk", "Slovak Dobrý deň" }, - { "sv", "Swedish (Svenska) Hej på dej" }, - { "tr", "Turkish (Türkçe) Merhaba" }, - { "zh", "Chinese (中文,普通话,汉语)" } -}; - static void pango_win32_font_get_metrics (PangoFont *font, PangoLanguage *lang, @@ -807,42 +762,14 @@ pango_win32_font_get_metrics (PangoFont *font, PangoWin32Font *win32font = (PangoWin32Font *)font; GSList *tmp_list; - const char *lang_str = pango_language_to_string (lang); - PangoLanguage *lookup_lang; - const char *str; + const char *sample_str = pango_language_get_sample_string (language); - if (lang) - { - LangInfo *lang_info = bsearch (lang_str, lang_texts, - G_N_ELEMENTS (lang_texts), sizeof (LangInfo), - lang_info_compare); - - if (lang_info) - { - lookup_lang = pango_language_from_string (lang_info->lang); - str = lang_info->str; - } - else - { - lookup_lang = pango_language_to_string ("UNKNOWN"); - str = "French (Français)"; /* Assume iso-8859-1 */ - } - } - else - { - lookup_lang = pango_language_to_string ("NONE"); - - /* Complete junk - */ - str = "السلام عليكم česky Ελληνικά Français 日本語 한글 Русский 中文,普通话,汉语 Türkçe"; - } - tmp_list = win32font->metrics_by_lang; while (tmp_list) { info = tmp_list->data; - if (info->lang == lookup_lang) /* We _don't_ need strcmp */ + if (info->sample_str == sample_str) /* We _don't_ need strcmp */ break; tmp_list = tmp_list->next; @@ -857,11 +784,11 @@ pango_win32_font_get_metrics (PangoFont *font, win32font->metrics_by_lang = g_slist_prepend (win32font->metrics_by_lang, info); info = g_new (PangoWin32MetricsInfo, 1); - info->lang = lookup_lang; + info->sample_str = sample_str; win32font->metrics_by_lang = g_slist_prepend (win32font->metrics_by_lang, info); - get_font_metrics_from_string (font, lang, str, &info->metrics); + get_font_metrics_from_string (font, lang, sample_str, &info->metrics); /* lovely copy&paste programming (from pangox.c) */ /* This is sort of a sledgehammer solution, but we cache this @@ -869,7 +796,7 @@ pango_win32_font_get_metrics (PangoFont *font, * chars in "0123456789" */ context = pango_win32_get_context (); - pango_context_set_language (context, lookup_lang); + pango_context_set_language (context, lang); layout = pango_layout_new (context); pango_layout_set_text (layout, "0123456789", -1); |