summaryrefslogtreecommitdiff
path: root/pango/pangoft2.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-03-15 01:32:36 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-03-15 01:32:36 +0000
commitbb3e77cc890eb14c9a3973b0c856ef5dc30aa606 (patch)
tree1b4fd3424b626b90ce1ad5584d44e32482aa31b3 /pango/pangoft2.c
parentca30a4175066d693135eb035c4546e9a519054c4 (diff)
downloadpango-bb3e77cc890eb14c9a3973b0c856ef5dc30aa606.tar.gz
Check for FT_Get_First_Char from FreeType-2.0.9.
Thu Mar 14 20:28:59 2002 Owen Taylor <otaylor@redhat.com> * configure.in: Check for FT_Get_First_Char from FreeType-2.0.9. * pango/pangoft2.c pango/pangoxft-font.c: Use FT_Get_First_Char/Get_Next_Char to accelerate coverage calculation.
Diffstat (limited to 'pango/pangoft2.c')
-rw-r--r--pango/pangoft2.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index f13d0e44..5c2aa891 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -599,19 +599,40 @@ static PangoCoverage *
pango_ft2_calc_coverage (PangoFont *font,
PangoLanguage *language)
{
- PangoCoverage *result;
+ PangoCoverage *coverage;
FT_Face face;
- gunichar wc;
- result = pango_coverage_new ();
+ coverage = pango_coverage_new ();
face = pango_ft2_font_get_face (font);
- for (wc = 0; wc < 65536; wc++)
- {
- if (FT_Get_Char_Index (face, wc))
- pango_coverage_set (result, wc, PANGO_COVERAGE_EXACT);
- }
- return result;
+#ifdef HAVE_FT_GET_FIRST_CHAR
+ {
+ FT_UInt gindex;
+ FT_ULong charcode;
+
+ charcode = FT_Get_First_Char (face, &gindex);
+ while (gindex)
+ {
+ pango_coverage_set (coverage, charcode, PANGO_COVERAGE_EXACT);
+ charcode = FT_Get_Next_Char (face, charcode, &gindex);
+ }
+ }
+#else
+ /* Ugh, this is going to be SLOW */
+ {
+ gunichar wc;
+
+ for (wc = 0; wc < G_MAXUSHORT; wc++)
+ {
+ FT_UInt glyph = FT_Get_Char_Index (face, wc);
+
+ if (glyph && glyph < face->num_glyphs)
+ pango_coverage_set (coverage, wc, PANGO_COVERAGE_EXACT);
+ }
+ }
+#endif
+
+ return coverage;
}
static void