summaryrefslogtreecommitdiff
path: root/pango/pangoft2-fontmap.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2000-12-21 09:54:01 +0000
committerAlexander Larsson <alexl@src.gnome.org>2000-12-21 09:54:01 +0000
commite763eba74d05d9b8948cd5bfa05ab7056f4c52e8 (patch)
treeea783760274470968a6be3d27e3ef740c635bc44 /pango/pangoft2-fontmap.c
parentb00ec4cbd9b6f08884d5ae01099be5f4dc854693 (diff)
downloadpango-e763eba74d05d9b8948cd5bfa05ab7056f4c52e8.tar.gz
Change usage to say pango-config instead of glib-config. Add support for
2000-12-21 Alexander Larsson <alexl@redhat.com> * pango-config.in: Change usage to say pango-config instead of glib-config. Add support for pangoft2. * modules/basic/Makefile.am: Compile and install pango-basic-ft2 if freetype was found. * modules/basic/basic-ft2.c: Remove lang engine. Make the glyph from the glyph index instead of the unicode index. The id is really BasicScriptEngineFT2. * pango/Makefile.am: Compile and install pangoft2 if freetype was found. * pango/pangoft2-fontcache.c (pango_ft2_font_cache_load): Init face->generic.data to 0, since this field will be used to cache the current size of the face. * pango/pangoft2-fontmap.c (pango_ft2_font_map_for_display): Use g_object_new instead of g_type_create_instance. (pango_ft2_font_entry_get_coverage): Use G_DIR_SEPARATOR_S instead of \\. (pango_ft2_font_entry_get_coverage): Init result to NULL. Don't write to file if open failed. * pango/pangoft2-private.h: Add PangoFT2GlyphInfo. * pango/pangoft2.c (pango_ft2_get_face): Export function, and make sure it sets the correct face size. (pango_ft2_load_font, pango_ft2_get_per_char, pango_ft2_font_get_kerning): PANGO_FT2_GLYPH_INDEX stores the glyph index, not the unicode value. (pango_ft2_font_get_glyph_extents): Cache glyph extents. (pango_ft2_has_glyph): Remove function. (pango_ft2_font_finalize): Free glyph info cache. * pango/pangoft2.h: Export pango_ft2_get_face, remove pango_ft2_has_glyph.
Diffstat (limited to 'pango/pangoft2-fontmap.c')
-rw-r--r--pango/pangoft2-fontmap.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c
index 92a051a5..6728361c 100644
--- a/pango/pangoft2-fontmap.c
+++ b/pango/pangoft2-fontmap.c
@@ -311,7 +311,7 @@ pango_ft2_font_map_for_display (void)
if (pango_ft2_global_fontmap != NULL)
return PANGO_FONT_MAP (pango_ft2_global_fontmap);
- pango_ft2_global_fontmap = (PangoFT2FontMap *)g_type_create_instance (PANGO_TYPE_FT2_FONT_MAP);
+ pango_ft2_global_fontmap = (PangoFT2FontMap *)g_object_new (PANGO_TYPE_FT2_FONT_MAP, NULL);
error = FT_Init_FreeType (&pango_ft2_global_fontmap->library);
if (error != FT_Err_Ok)
@@ -953,7 +953,7 @@ pango_ft2_font_entry_get_coverage (PangoFT2FontEntry *entry,
description = pango_font_describe (font);
cache_file_name = g_strconcat (pango_get_sysconf_subdirectory (),
- "\\cache.ft2\\",
+ G_DIR_SEPARATOR_S "cache.ft2" G_DIR_SEPARATOR_S,
pango_font_description_to_filename (description),
".",
lang ? lang : "",
@@ -961,6 +961,7 @@ pango_ft2_font_entry_get_coverage (PangoFT2FontEntry *entry,
pango_font_description_free (description);
PING (("trying to load %s", cache_file_name));
+ result = NULL;
if (g_file_get_contents (cache_file_name, &buf, &buflen, NULL))
{
result = pango_coverage_from_bytes (buf, buflen);
@@ -1001,12 +1002,15 @@ pango_ft2_font_entry_get_coverage (PangoFT2FontEntry *entry,
g_hash_table_destroy (coverage_hash);
cache_file = fopen (cache_file_name, "wb");
- pango_coverage_to_bytes (result, &buf, &buflen);
- PING (("saving %d bytes to %s", buflen, cache_file_name));
- fwrite (buf, buflen, 1, cache_file);
- fclose (cache_file);
- g_free (cache_file_name);
- g_free (buf);
+ if (cache_file)
+ {
+ pango_coverage_to_bytes (result, &buf, &buflen);
+ PING (("saving %d bytes to %s", buflen, cache_file_name));
+ fwrite (buf, buflen, 1, cache_file);
+ fclose (cache_file);
+ g_free (cache_file_name);
+ g_free (buf);
+ }
}
if (entry)