summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Breuer <hans@breuer.org>2001-11-23 13:12:51 +0000
committerHans Breuer <hans@src.gnome.org>2001-11-23 13:12:51 +0000
commitb4b11e4ba669ddfdb54e7da737f9b9b0f22b9e9f (patch)
tree1b57c4eee70532bfa12651d12a131e7488c68026
parenta2c1ae618174619a2b99a7f8e765713be249c5e2 (diff)
downloadpango-b4b11e4ba669ddfdb54e7da737f9b9b0f22b9e9f.tar.gz
removed the arbitrary limit to 10 fonts. Instead make the command line
2001-11-23 Hans Breuer <hans@breuer.org> * testfonts.c : removed the arbitrary limit to 10 fonts. Instead make the command line params useful again and reduce the default result bitmap size by decreasing the default font size. * pango/pangowin32-fontcache.c (pango_win32_font_cache_load): Don't always turn on anti-aliasing. Respect the users settings from 'Properties of Display/Effects'. * pango/makefile.msc : updated, version 0.22 * pango/pango.def : updated externals * pango/font.c pango/pango-coverage.c pango-utils.c pango/pangowin32.c pango/shape.c : coding style and static correctness
-rw-r--r--ChangeLog18
-rw-r--r--ChangeLog.pre-1-018
-rw-r--r--ChangeLog.pre-1-1018
-rw-r--r--ChangeLog.pre-1-218
-rw-r--r--ChangeLog.pre-1-418
-rw-r--r--ChangeLog.pre-1-618
-rw-r--r--ChangeLog.pre-1-818
-rw-r--r--pango/fonts.c3
-rw-r--r--pango/makefile.msc15
-rw-r--r--pango/pango-coverage.c12
-rw-r--r--pango/pango-utils.c8
-rw-r--r--pango/pango.def9
-rw-r--r--pango/pangowin32-fontcache.c5
-rw-r--r--pango/pangowin32.c14
-rw-r--r--pango/querymodules.c30
-rw-r--r--pango/shape.c9
-rw-r--r--pango/testfonts.c221
17 files changed, 314 insertions, 138 deletions
diff --git a/ChangeLog b/ChangeLog
index b0b9cc8b..b97a3efe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2001-11-23 Hans Breuer <hans@breuer.org>
+
+ * testfonts.c : removed the arbitrary limit to 10 fonts.
+ Instead make the command line params useful again and reduce
+ the default result bitmap size by decreasing the default
+ font size.
+
+ * pango/pangowin32-fontcache.c (pango_win32_font_cache_load):
+ Don't always turn on anti-aliasing. Respect the users settings
+ from 'Properties of Display/Effects'.
+
+ * pango/makefile.msc : updated, version 0.22
+ * pango/pango.def : updated externals
+
+ * pango/font.c pango/pango-coverage.c pango-utils.c
+ pango/pangowin32.c pango/shape.c :
+ coding style and static correctness
+
2001-11-22 Matthias Clasen <matthiasc@poet.de>
* docs/pango-sections.txt: Remove duplicates.
diff --git a/ChangeLog.pre-1-0 b/ChangeLog.pre-1-0
index b0b9cc8b..b97a3efe 100644
--- a/ChangeLog.pre-1-0
+++ b/ChangeLog.pre-1-0
@@ -1,3 +1,21 @@
+2001-11-23 Hans Breuer <hans@breuer.org>
+
+ * testfonts.c : removed the arbitrary limit to 10 fonts.
+ Instead make the command line params useful again and reduce
+ the default result bitmap size by decreasing the default
+ font size.
+
+ * pango/pangowin32-fontcache.c (pango_win32_font_cache_load):
+ Don't always turn on anti-aliasing. Respect the users settings
+ from 'Properties of Display/Effects'.
+
+ * pango/makefile.msc : updated, version 0.22
+ * pango/pango.def : updated externals
+
+ * pango/font.c pango/pango-coverage.c pango-utils.c
+ pango/pangowin32.c pango/shape.c :
+ coding style and static correctness
+
2001-11-22 Matthias Clasen <matthiasc@poet.de>
* docs/pango-sections.txt: Remove duplicates.
diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10
index b0b9cc8b..b97a3efe 100644
--- a/ChangeLog.pre-1-10
+++ b/ChangeLog.pre-1-10
@@ -1,3 +1,21 @@
+2001-11-23 Hans Breuer <hans@breuer.org>
+
+ * testfonts.c : removed the arbitrary limit to 10 fonts.
+ Instead make the command line params useful again and reduce
+ the default result bitmap size by decreasing the default
+ font size.
+
+ * pango/pangowin32-fontcache.c (pango_win32_font_cache_load):
+ Don't always turn on anti-aliasing. Respect the users settings
+ from 'Properties of Display/Effects'.
+
+ * pango/makefile.msc : updated, version 0.22
+ * pango/pango.def : updated externals
+
+ * pango/font.c pango/pango-coverage.c pango-utils.c
+ pango/pangowin32.c pango/shape.c :
+ coding style and static correctness
+
2001-11-22 Matthias Clasen <matthiasc@poet.de>
* docs/pango-sections.txt: Remove duplicates.
diff --git a/ChangeLog.pre-1-2 b/ChangeLog.pre-1-2
index b0b9cc8b..b97a3efe 100644
--- a/ChangeLog.pre-1-2
+++ b/ChangeLog.pre-1-2
@@ -1,3 +1,21 @@
+2001-11-23 Hans Breuer <hans@breuer.org>
+
+ * testfonts.c : removed the arbitrary limit to 10 fonts.
+ Instead make the command line params useful again and reduce
+ the default result bitmap size by decreasing the default
+ font size.
+
+ * pango/pangowin32-fontcache.c (pango_win32_font_cache_load):
+ Don't always turn on anti-aliasing. Respect the users settings
+ from 'Properties of Display/Effects'.
+
+ * pango/makefile.msc : updated, version 0.22
+ * pango/pango.def : updated externals
+
+ * pango/font.c pango/pango-coverage.c pango-utils.c
+ pango/pangowin32.c pango/shape.c :
+ coding style and static correctness
+
2001-11-22 Matthias Clasen <matthiasc@poet.de>
* docs/pango-sections.txt: Remove duplicates.
diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4
index b0b9cc8b..b97a3efe 100644
--- a/ChangeLog.pre-1-4
+++ b/ChangeLog.pre-1-4
@@ -1,3 +1,21 @@
+2001-11-23 Hans Breuer <hans@breuer.org>
+
+ * testfonts.c : removed the arbitrary limit to 10 fonts.
+ Instead make the command line params useful again and reduce
+ the default result bitmap size by decreasing the default
+ font size.
+
+ * pango/pangowin32-fontcache.c (pango_win32_font_cache_load):
+ Don't always turn on anti-aliasing. Respect the users settings
+ from 'Properties of Display/Effects'.
+
+ * pango/makefile.msc : updated, version 0.22
+ * pango/pango.def : updated externals
+
+ * pango/font.c pango/pango-coverage.c pango-utils.c
+ pango/pangowin32.c pango/shape.c :
+ coding style and static correctness
+
2001-11-22 Matthias Clasen <matthiasc@poet.de>
* docs/pango-sections.txt: Remove duplicates.
diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6
index b0b9cc8b..b97a3efe 100644
--- a/ChangeLog.pre-1-6
+++ b/ChangeLog.pre-1-6
@@ -1,3 +1,21 @@
+2001-11-23 Hans Breuer <hans@breuer.org>
+
+ * testfonts.c : removed the arbitrary limit to 10 fonts.
+ Instead make the command line params useful again and reduce
+ the default result bitmap size by decreasing the default
+ font size.
+
+ * pango/pangowin32-fontcache.c (pango_win32_font_cache_load):
+ Don't always turn on anti-aliasing. Respect the users settings
+ from 'Properties of Display/Effects'.
+
+ * pango/makefile.msc : updated, version 0.22
+ * pango/pango.def : updated externals
+
+ * pango/font.c pango/pango-coverage.c pango-utils.c
+ pango/pangowin32.c pango/shape.c :
+ coding style and static correctness
+
2001-11-22 Matthias Clasen <matthiasc@poet.de>
* docs/pango-sections.txt: Remove duplicates.
diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8
index b0b9cc8b..b97a3efe 100644
--- a/ChangeLog.pre-1-8
+++ b/ChangeLog.pre-1-8
@@ -1,3 +1,21 @@
+2001-11-23 Hans Breuer <hans@breuer.org>
+
+ * testfonts.c : removed the arbitrary limit to 10 fonts.
+ Instead make the command line params useful again and reduce
+ the default result bitmap size by decreasing the default
+ font size.
+
+ * pango/pangowin32-fontcache.c (pango_win32_font_cache_load):
+ Don't always turn on anti-aliasing. Respect the users settings
+ from 'Properties of Display/Effects'.
+
+ * pango/makefile.msc : updated, version 0.22
+ * pango/pango.def : updated externals
+
+ * pango/font.c pango/pango-coverage.c pango-utils.c
+ pango/pangowin32.c pango/shape.c :
+ coding style and static correctness
+
2001-11-22 Matthias Clasen <matthiasc@poet.de>
* docs/pango-sections.txt: Remove duplicates.
diff --git a/pango/fonts.c b/pango/fonts.c
index f55f1be6..e693605e 100644
--- a/pango/fonts.c
+++ b/pango/fonts.c
@@ -652,7 +652,8 @@ pango_font_description_hash (const PangoFontDescription *desc)
* Frees a font description returned from pango_font_describe()
* or pango_font_description_copy().
**/
-void pango_font_description_free (PangoFontDescription *desc)
+void
+pango_font_description_free (PangoFontDescription *desc)
{
if (desc)
{
diff --git a/pango/makefile.msc b/pango/makefile.msc
index 51aa9165..16f62ee9 100644
--- a/pango/makefile.msc
+++ b/pango/makefile.msc
@@ -1,12 +1,12 @@
TOP = ../..
-!INCLUDE $(TOP)/build/win32/make.msc
+!INCLUDE $(TOP)/glib/build/win32/make.msc
!IFNDEF PERL
PERL = perl
!ENDIF
# Possibly override Pango version from build/win32/module.defs
-PANGO_VER = 0.21
+PANGO_VER = 0.22
# INCLUDES = -I .. -I .
# DEFINES = -DPACKAGE=\"Pango\" -DVERSION=\"$(PANGO_VER)\"
@@ -46,7 +46,7 @@ PKG_CFLAGS = -I.. -I. -I$(PRJ_TOP) \
-DPACKAGE=\"Pango\" -DVERSION=\"$(PANGO_VER)\" \
-DPANGO_ENABLE_BACKEND -DPANGO_ENABLE_ENGINE \
$(GLIB_CFLAGS) $(LIBICONV_CFLAGS) \
- $(FREETYPE2_CFLAGS) $(DIRENT_CFLAGS) \
+ $(FREETYPE2_CFLAGS) \
$(X11_CFLAGS) -DSYSCONFDIR=\"/etc\"
!IFDEF OBJS_pango
@@ -60,8 +60,8 @@ PKG_LINK = $(GLIB_LIBS) $(LIBICONV_LIBS) \
!ENDIF
!IFDEF OBJS_pangoft2
-PKG_LINK = $(GLIB_LIBS) $(LIBICONV_LIBS) $(FREETYPE2_LIBS) $(DIRENT_LIBS) \
- pango-$(PANGO_VER).lib
+PKG_LINK = $(GLIB_LIBS) $(LIBICONV_LIBS) $(FREETYPE2_LIBS) \
+ pango-$(PANGO_VER).lib mini-xft/mini-xft.lib
!ENDIF
!IFDEF OBJS_pangox
@@ -70,13 +70,12 @@ PKG_LINK = $(GLIB_LIBS) $(LIBICONV_LIBS) \
!ENDIF
!IF DEFINED (OBJS_querymodules) || DEFINED (OBJS_testfonts)
-PKG_LINK = $(GLIB_LIBS) $(LIBICONV_LIBS) $(DIRENT_LIBS) \
+PKG_LINK = $(GLIB_LIBS) $(LIBICONV_LIBS) \
pango-$(PANGO_VER).lib pangowin32-$(PANGO_VER).lib
!ENDIF
!IFDEF OBJS_pango
OBJECTS = \
-# backend.obj \
break.obj \
fonts.obj \
glyphstring.obj \
@@ -86,6 +85,7 @@ OBJECTS = \
pango-color.obj \
pango-context.obj \
pango-coverage.obj \
+ pango-fontset.obj \
pango-fontmap.obj \
pango-intset.obj \
pango-item.obj \
@@ -128,7 +128,6 @@ OBJECTS = \
OBJECTS = \
module-defs-ft2.obj \
pangoft2.obj \
- pangoft2-fontcache.obj \
pangoft2-fontmap.obj \
basic-ft2.obj
!ENDIF
diff --git a/pango/pango-coverage.c b/pango/pango-coverage.c
index c0c10145..953cdfce 100644
--- a/pango/pango-coverage.c
+++ b/pango/pango-coverage.c
@@ -197,9 +197,10 @@ pango_coverage_get (PangoCoverage *coverage,
*
* Modify a particular index within @coverage
**/
-void pango_coverage_set (PangoCoverage *coverage,
- int index,
- PangoCoverageLevel level)
+void
+pango_coverage_set (PangoCoverage *coverage,
+ int index,
+ PangoCoverageLevel level)
{
int block_index, i;
guchar *data;
@@ -253,8 +254,9 @@ void pango_coverage_set (PangoCoverage *coverage,
* value of the current coverage for the index and the coverage for
* the corresponding index in @other.
**/
-void pango_coverage_max (PangoCoverage *coverage,
- PangoCoverage *other)
+void
+pango_coverage_max (PangoCoverage *coverage,
+ PangoCoverage *other)
{
int block_index, i;
int old_blocks;
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index 1d81ee7f..587a286d 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -1262,13 +1262,13 @@ pango_get_mirror_char (gunichar ch,
#endif /* HAVE_FRIBIDI */
-guint
+static guint
alias_hash (struct PangoAlias *alias)
{
return g_str_hash (alias->alias);
}
-gboolean
+static gboolean
alias_equal (struct PangoAlias *alias1,
struct PangoAlias *alias2)
{
@@ -1277,7 +1277,7 @@ alias_equal (struct PangoAlias *alias1,
}
-void
+static void
alias_free (struct PangoAlias *alias)
{
int i;
@@ -1423,7 +1423,7 @@ read_alias_file (const char *filename)
fclose (file);
}
-void
+static void
pango_load_aliases (void)
{
char *filename;
diff --git a/pango/pango.def b/pango/pango.def
index 0dc1b6da..f0228572 100644
--- a/pango/pango.def
+++ b/pango/pango.def
@@ -39,8 +39,8 @@ EXPORTS
pango_break
pango_color_copy
pango_color_free
- pango_color_parse
pango_color_get_type
+ pango_color_parse
pango_config_key_get
pango_context_get_base_dir
pango_context_get_font_description
@@ -49,6 +49,7 @@ EXPORTS
pango_context_get_type
pango_context_list_families
pango_context_load_font
+ pango_context_load_fontset
pango_context_new
pango_context_set_base_dir
pango_context_set_font_description
@@ -85,6 +86,7 @@ EXPORTS
pango_font_description_get_weight
pango_font_description_hash
pango_font_description_merge
+ pango_font_description_merge_static
pango_font_description_new
pango_font_description_set_family
pango_font_description_set_family_static
@@ -111,10 +113,13 @@ EXPORTS
pango_font_map_get_type
pango_font_map_list_families
pango_font_map_load_font
+ pango_font_map_load_fontset
+ pango_font_mask_get_type
pango_font_metrics_get_approximate_char_width
pango_font_metrics_get_approximate_digit_width
pango_font_metrics_get_ascent
pango_font_metrics_get_descent
+ pango_font_metrics_get_type
pango_font_metrics_new
pango_font_metrics_ref
pango_font_metrics_unref
@@ -219,6 +224,7 @@ EXPORTS
pango_layout_set_wrap
pango_layout_xy_to_index
pango_log2vis_get_embedding_levels
+ pango_lookup_aliases
pango_map_get_engine
pango_map_get_entry
pango_module_register
@@ -253,4 +259,5 @@ EXPORTS
pango_underline_get_type
pango_variant_get_type
pango_weight_get_type
+ pango_wrap_mode_get_type
diff --git a/pango/pangowin32-fontcache.c b/pango/pangowin32-fontcache.c
index e09dd79d..613c3806 100644
--- a/pango/pangowin32-fontcache.c
+++ b/pango/pangowin32-fontcache.c
@@ -184,9 +184,10 @@ pango_win32_font_cache_load (PangoWin32FontCache *cache,
}
else
{
+ BOOL aa = TRUE; /* turn on anti-aliasing */
lf = *lfp;
- /* Always turn on anti-aliasing */
- lf.lfQuality = ANTIALIASED_QUALITY;
+ SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &aa, 0);
+ lf.lfQuality = (aa ? ANTIALIASED_QUALITY : DEFAULT_QUALITY);
for (tries = 0; ; tries++)
{
#if 0
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index a6d5052d..f9634011 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -794,7 +794,7 @@ struct type_4_table { /* Must be packed! */
guint16 arrays[1];
};
-guint
+static guint
get_unicode_mapping_offset (HDC hdc)
{
guint16 n_tables;
@@ -830,7 +830,7 @@ get_unicode_mapping_offset (HDC hdc)
return 0;
}
-struct type_4_table *
+static struct type_4_table *
get_unicode_mapping (HDC hdc)
{
guint32 offset;
@@ -886,28 +886,28 @@ get_unicode_mapping (HDC hdc)
return table;
}
-guint16 *
+static guint16 *
get_id_range_offset (struct type_4_table *table)
{
gint32 seg_count = table->seg_count_x_2/2;
return &table->arrays[seg_count*3];
}
-guint16 *
+static guint16 *
get_id_delta (struct type_4_table *table)
{
gint32 seg_count = table->seg_count_x_2/2;
return &table->arrays[seg_count*2];
}
-guint16 *
+static guint16 *
get_start_count (struct type_4_table *table)
{
gint32 seg_count = table->seg_count_x_2/2;
return &table->arrays[seg_count*1];
}
-guint16 *
+static guint16 *
get_end_count (struct type_4_table *table)
{
gint32 seg_count = table->seg_count_x_2/2;
@@ -917,7 +917,7 @@ get_end_count (struct type_4_table *table)
}
-gboolean
+static gboolean
find_segment (struct type_4_table *table,
guint16 wc,
guint16 *segment)
diff --git a/pango/querymodules.c b/pango/querymodules.c
index 5b86d53a..c8a8b4e9 100644
--- a/pango/querymodules.c
+++ b/pango/querymodules.c
@@ -22,9 +22,6 @@
#include "config.h"
#include <glib.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
#include <gmodule.h>
#include "pango-break.h"
#include "pango-context.h"
@@ -40,13 +37,6 @@
#ifdef G_OS_WIN32
#define SOEXT ".dll"
-#ifndef PATH_MAX
-#include <stdlib.h>
-#define PATH_MAX _MAX_PATH
-#endif /* PATH_MAX */
-#include <direct.h> /* for getcwd() with MSVC */
-#include <io.h> /* for getcwd() with mingw */
-#define getcwd _getcwd
#else
#define SOEXT ".so"
#endif
@@ -126,7 +116,7 @@ query_module (const char *dir, const char *name)
int main (int argc, char **argv)
{
- char cwd[PATH_MAX];
+ char *cwd;
int i;
char *path;
@@ -151,28 +141,30 @@ int main (int argc, char **argv)
for (i=0; dirs[i]; i++)
{
- DIR *dir = opendir (dirs[i]);
+ GDir *dir = g_dir_open (dirs[i], 0, NULL);
if (dir)
{
- struct dirent *dent;
+ char *dent;
- while ((dent = readdir (dir)))
+ while ((dent = g_dir_read_name (dir)))
{
- int len = strlen (dent->d_name);
- if (len > 3 && strcmp (dent->d_name + len - strlen (SOEXT), SOEXT) == 0)
- query_module (dirs[i], dent->d_name);
+ int len = strlen (dent);
+ if (len > 3 && strcmp (dent + len - strlen (SOEXT), SOEXT) == 0)
+ query_module (dirs[i], dent);
}
- closedir (dir);
+ g_dir_close (dir);
}
}
}
else
{
- getcwd (cwd, PATH_MAX);
+ cwd = g_get_current_dir ();
for (i=1; i<argc; i++)
query_module (cwd, argv[i]);
+
+ g_free (cwd);
}
return 0;
diff --git a/pango/shape.c b/pango/shape.c
index 8d242747..2c95f2e8 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -34,10 +34,11 @@
* convert the characters into glyphs. You may also pass
* in only a substring of the item from pango_itemize().
*/
-void pango_shape (const gchar *text,
- gint length,
- PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
+void
+pango_shape (const gchar *text,
+ gint length,
+ PangoAnalysis *analysis,
+ PangoGlyphString *glyphs)
{
if (analysis->shape_engine)
analysis->shape_engine->script_shape (analysis->font, text, length, analysis, glyphs);
diff --git a/pango/testfonts.c b/pango/testfonts.c
index b63e9695..d49e986f 100644
--- a/pango/testfonts.c
+++ b/pango/testfonts.c
@@ -24,9 +24,6 @@
#include <glib.h>
#include <stdlib.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
#include <gmodule.h>
#include "pango.h"
#include "pango-utils.h"
@@ -46,35 +43,41 @@
static HDC pre_render (int width, int height);
static void post_render (HDC hdc, const char* sFile);
-float
+static float
calc_duration (GTimeVal *tv1, GTimeVal *tv0)
{
return ( ((float)tv1->tv_sec - tv0->tv_sec)
+ (tv1->tv_usec - tv0->tv_usec) / 1000000.0);
}
+static int
+compare_font_family (PangoFontFamily** a,
+ PangoFontFamily** b)
+{
+ return strcmp (pango_font_family_get_name (*a), pango_font_family_get_name (*b));
+}
+
int main (int argc, char **argv)
{
PangoFontMap *fontmap = pango_win32_font_map_for_display();
PangoContext *context;
PangoCoverage * coverage = NULL;
PangoFont* font = NULL;
- PangoFontFamily** families;
- int nb;
- int i;
+ PangoFontFamily** families = NULL;
+ PangoFontFace** faces = NULL;
+ int nb, i;
const gchar* family_name = NULL;
PangoLanguage *lang = pango_language_from_string (g_win32_getlocale ());
HDC hdc = NULL;
int line = 0;
GTimeVal tv0, tv1;
- int my_font_size = 64;
+ int my_font_size = 12;
printf ("# Pango Font Test\n"
"# Language: %s\n"
"#\n", pango_language_to_string (lang));
- /* FIXME: this wasn't necessary with previous version
- * and isn't done with current gtk+ win32
+ /* this wasn't necessary with previous version
*
* force initialization of built-in engines, otherwise
* the rendering get's really fast - too fast to work :-(
@@ -83,9 +86,18 @@ int main (int argc, char **argv)
if (argc == 1) /* No arguments given */
{
- PangoFontDescription *desc = pango_font_description_from_string("Sans 12");
+ char *std_fonts[] = {"Sans 12", "Serif 12", "Monospace 12"};
- font = pango_font_map_load_font (fontmap, context, desc);
+ /* try to load some fonts often hardcoded */
+ for (i = 0; i < G_N_ELEMENTS (std_fonts); i++)
+ {
+ PangoFontDescription *desc = pango_font_description_from_string("Sans 12");
+
+ /* spits warnings if font cannot be loaded */
+ font = pango_font_map_load_font (fontmap, context, desc);
+
+ g_object_unref (font);
+ }
}
else
{
@@ -94,13 +106,13 @@ int main (int argc, char **argv)
s = g_string_new (argv[1]);
for (i = 2; i < argc; i++)
- {
- s = g_string_append_c (s, ' ');
- s = g_string_append (s, argv[i]);
+ {
+ s = g_string_append_c (s, ' ');
+ s = g_string_append (s, argv[i]);
- if (0 != atoi (argv[i]))
- my_font_size = atoi (argv[i]);
- }
+ if (0 != atoi (argv[i]))
+ my_font_size = atoi (argv[i]);
+ }
desc = pango_font_description_from_string(s->str);
family_name = pango_font_description_get_family (desc);
@@ -118,87 +130,123 @@ int main (int argc, char **argv)
pango_font_map_list_families (fontmap, &families, &nb);
- hdc = pre_render(my_font_size * 64, 3 * my_font_size * MIN (nb, 10) / 2);
-
- for (i = 0; i < MIN (nb, 10); i++)
- {
- PangoFontDescription *desc = pango_font_description_new ();
- const 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",
- family_name, style, weight);
-
- pango_font_description_set_family (desc, family_name);
-
- /* give it an arbitray size to load it */
- pango_font_description_set_size (desc, my_font_size * PANGO_SCALE);
+ if (!family_name)
+ {
+ qsort (families, nb, sizeof (PangoFontFamily*), compare_font_family);
+ }
+ else
+ {
+ /* Get on the family faces. No simple way ? */
+ for (i = 0; i < nb; i++)
+ {
+ if (0 == strcmp (pango_font_family_get_name (families[i]), family_name))
+ {
+ pango_font_family_list_faces (families[i], &faces, &nb);
+ /* now nb is the number of faces */
+ break;
+ }
+ }
+ g_free (families);
+ families = NULL;
+ }
- g_get_current_time (&tv0);
- font = pango_font_map_load_font (fontmap, context, desc);
- g_get_current_time (&tv1);
- g_print ("\tpango_font_map_load_font took %.3f sec\n", calc_duration (&tv1, &tv0));
+ hdc = pre_render(my_font_size * 64, 3 * my_font_size * nb / 2);
- if (font)
+ for (i = 0; i < nb; i++)
{
- PangoItem *item;
- PangoGlyphString * glyphs;
- char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz"
- "1234567890 -+*/!§$%&()[]{}<>|#=?@";
+ PangoFontDescription *desc;
+ const char *f_name;
+ PangoWeight weight;
+ PangoStyle style;
+
+ if (families)
+ {
+ desc = pango_font_description_new ();
+
+ f_name = pango_font_family_get_name (families[i]);
+ pango_font_description_set_family (desc, f_name);
+ }
+ else
+ {
+ desc = pango_font_face_describe (faces[i]);
+ /* this is _not_ the family name from above */
+ f_name = pango_font_description_get_family (desc);
+ }
+ weight = pango_font_description_get_weight (desc);
+ style = pango_font_description_get_style (desc);
+
+ g_print ("%s; Style: %d; Weight: %d\n",
+ f_name, style, weight);
+
+ /* give it an arbitray size to load it */
+ pango_font_description_set_size (desc, my_font_size * PANGO_SCALE);
g_get_current_time (&tv0);
- coverage = pango_font_get_coverage (font, lang);
+ font = pango_font_map_load_font (fontmap, context, desc);
g_get_current_time (&tv1);
- g_print ("\tpango_font_get_coverage took %.3f sec\n", calc_duration (&tv1, &tv0));
+ g_print ("\tpango_font_map_load_font took %.3f sec\n", calc_duration (&tv1, &tv0));
+
+ if (font)
+ {
+ PangoItem *item;
+ PangoGlyphString * glyphs;
+ char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "1234567890 -+*/!§$%&()[]{}<>|#=?@";
- /* ... */
- pango_context_set_language (context, lang);
- pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
- pango_context_set_font_description (context, desc);
-
- glyphs = pango_glyph_string_new ();
- item = pango_item_new ();
-
- item->analysis.shape_engine = pango_font_find_shaper (font, lang, s[0]);
- item->analysis.font = g_object_ref (G_OBJECT (font));
- pango_shape ( s, sizeof(s), &(item->analysis), glyphs);
-
- if (hdc)
- {
- /* the positioning isn't correct */
- char * name = g_strdup_printf ("%s (%s%s)",
- 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);
- pango_win32_render (hdc, font, glyphs, 200, line);
+ coverage = pango_font_get_coverage (font, lang);
g_get_current_time (&tv1);
- g_print ("\tpango_win32_render took %.3f sec\n", calc_duration (&tv1, &tv0));
- line += (3 * my_font_size / 2);
- g_free(name);
- }
-
- /* free glyphs, ... */
- pango_glyph_string_free (glyphs);
- pango_item_free (item);
-
- pango_coverage_unref (coverage);
- g_object_unref (G_OBJECT (font));
+ g_print ("\tpango_font_get_coverage took %.3f sec\n", calc_duration (&tv1, &tv0));
+
+ /* ... */
+ pango_context_set_language (context, lang);
+ pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
+ pango_context_set_font_description (context, desc);
+
+ glyphs = pango_glyph_string_new ();
+ item = pango_item_new ();
+
+ item->analysis.shape_engine = pango_font_find_shaper (font, lang, s[0]);
+ item->analysis.font = g_object_ref (G_OBJECT (font));
+ pango_shape ( s, sizeof(s), &(item->analysis), glyphs);
+
+ if (hdc)
+ {
+ /* the positioning isn't correct */
+ char* name = g_strdup_printf ("%s (%s%s)",
+ f_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);
+ pango_win32_render (hdc, font, glyphs, 200, line);
+ g_get_current_time (&tv1);
+ g_print ("\tpango_win32_render took %.3f sec\n",
+ calc_duration (&tv1, &tv0));
+ line += (3 * my_font_size / 2);
+ g_free(name);
+ }
+
+ /* free glyphs, ... */
+ pango_glyph_string_free (glyphs);
+ pango_item_free (item);
+
+ pango_coverage_unref (coverage);
+ g_object_unref (G_OBJECT (font));
+ }
+ pango_font_description_free (desc);
}
- pango_font_description_free (desc);
- }
if (hdc)
post_render (hdc, "pango-fonts.bmp");
- //pango_font_map_free_families (families, nb);
+ g_free (families);
+ g_free (faces);
return 0;
}
@@ -212,8 +260,7 @@ static HWND hwndRender = NULL;
static BOOL
SaveBitmap (HBITMAP hBmp, const char* pszFile);
-static
-HDC
+static HDC
pre_render (int width, int height)
{
HDC hmemdc;