summaryrefslogtreecommitdiff
path: root/pango/testfonts.c
diff options
context:
space:
mode:
authorHans Breuer <hans@breuer.org>2001-09-21 19:51:32 +0000
committerHans Breuer <hans@src.gnome.org>2001-09-21 19:51:32 +0000
commit2437d8fca72e6da68e08e855034178dcad4c1102 (patch)
tree5f31dd72200d8c6092f6acba90f3a14bd6a8df7d /pango/testfonts.c
parentcab449096df5d3e2029719ab212ea3701e9f3b87 (diff)
downloadpango-2437d8fca72e6da68e08e855034178dcad4c1102.tar.gz
updated externals
2001-09-21 Hans Breuer <hans@breuer.org> * pango/pango.def : updated externals * pango/makefile.msc : build ft2 backend too. * pango/pangowin32-fontmap.c - Convert PangoWin32FamilyEntry into PangoWin32Family deriving from PangoFontFamily. - Convert PangoWin32FontEntry into PangoWin32Face deriving from PangoFontFace. - Change the list_families() method of the PangoWin32FontMap to list PangoFontFamily * rather than names. * pango/pangowin32.c : reflect PangoFontDescription api change * pango/pangowin32.h : don't include pango.h but only the required headers * modules/basic/basic-win32.c : #include "pango-engine.h" * pango/testfonts.c : reflect recent pango api changes
Diffstat (limited to 'pango/testfonts.c')
-rw-r--r--pango/testfonts.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/pango/testfonts.c b/pango/testfonts.c
index 6cb11ea3..42982fd6 100644
--- a/pango/testfonts.c
+++ b/pango/testfonts.c
@@ -72,13 +72,12 @@ calc_duration (GTimeVal *tv1, GTimeVal *tv0)
int main (int argc, char **argv)
{
PangoFontMap *fontmap = pango_win32_font_map_for_display();
- PangoFontDescription** descs;
PangoCoverage * coverage = NULL;
PangoFont* font = NULL;
+ PangoFontFamily** families;
int nb;
int i;
- gchar* family = NULL;
- gchar** families;
+ gchar* family_name = NULL;
gchar* lang = gtk_get_default_language ();
HDC hdc = NULL;
int line = 0;
@@ -119,7 +118,7 @@ int main (int argc, char **argv)
}
desc = pango_font_description_from_string(s->str);
- family = g_strdup(desc->family_name);
+ family_name = pango_font_description_get_family (desc);
font = pango_font_map_load_font (fontmap, desc);
@@ -132,22 +131,27 @@ int main (int argc, char **argv)
g_object_unref (G_OBJECT (font));
}
- pango_font_map_list_fonts (fontmap, family, &descs, &nb);
+ pango_font_map_list_families (fontmap, &families, &nb);
hdc = pre_render(my_font_size * 64, 3 * my_font_size * nb / 2);
for (i = 0; i < nb; i++)
{
+ PangoFontDescription *desc = pango_font_description_new ();
+ char *family_name = pango_font_family_get_name (families[i]);
+ PangoWeight weight = pango_font_description_get_weight (desc);
+ PangoStyle style = pango_font_description_get_style (desc);
+
g_print ("Family: %s; Style: %d; Weight: %d\n",
- descs[i]->family_name,
- descs[i]->style,
- descs[i]->weight);
+ family_name, style, weight);
+
+ pango_font_description_set_family (desc, family_name);
/* give it an arbitray size to load it */
- descs[i]->size = my_font_size * PANGO_SCALE;
+ pango_font_description_set_size (desc, my_font_size * PANGO_SCALE);
g_get_current_time (&tv0);
- font = pango_font_map_load_font (fontmap, descs[i]);
+ font = pango_font_map_load_font (fontmap, desc);
g_get_current_time (&tv1);
g_print ("\tpango_font_map_load_font took %.3f sec\n", calc_duration (&tv1, &tv0));
@@ -170,7 +174,7 @@ int main (int argc, char **argv)
context = pango_win32_get_context ();
pango_context_set_language (context, lang);
pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
- pango_context_set_font_description (context, descs[i]);
+ pango_context_set_font_description (context, desc);
glyphs = pango_glyph_string_new ();
item = pango_item_new ();
@@ -183,12 +187,12 @@ int main (int argc, char **argv)
{
/* the positioning isn't correct */
char * name = g_strdup_printf ("%s (%s%s)",
- descs[i]->family_name,
- descs[i]->weight == PANGO_WEIGHT_NORMAL ? "n" :
- (descs[i]->weight == PANGO_WEIGHT_HEAVY ? "h" :
- (descs[i]->weight > PANGO_WEIGHT_NORMAL ? "b" : "l")),
- descs[i]->style == PANGO_STYLE_OBLIQUE ? "o" :
- (descs[i]->style == PANGO_STYLE_ITALIC ? "i" : "n"));
+ family_name,
+ weight == PANGO_WEIGHT_NORMAL ? "n" :
+ (weight == PANGO_WEIGHT_HEAVY ? "h" :
+ (weight > PANGO_WEIGHT_NORMAL ? "b" : "l")),
+ style == PANGO_STYLE_OBLIQUE ? "o" :
+ (style == PANGO_STYLE_ITALIC ? "i" : "n"));
TextOut (hdc, 0, line, name, strlen(name));
g_get_current_time (&tv0);
@@ -206,20 +210,19 @@ int main (int argc, char **argv)
pango_coverage_unref (coverage);
g_object_unref (G_OBJECT (font));
}
+ pango_font_description_free (desc);
}
if (hdc)
post_render (hdc, "pango-fonts.bmp");
- pango_font_descriptions_free (descs, nb);
-
pango_font_map_list_families (fontmap, &families, &nb);
for (i = 0; i < nb; i++)
{
//g_print ("%s\n", families[i]);
}
- pango_font_map_free_families (families, nb);
+ //pango_font_map_free_families (families, nb);
return 0;
}