diff options
author | Owen Taylor <otaylor@redhat.com> | 2002-03-15 01:32:36 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2002-03-15 01:32:36 +0000 |
commit | bb3e77cc890eb14c9a3973b0c856ef5dc30aa606 (patch) | |
tree | 1b4fd3424b626b90ce1ad5584d44e32482aa31b3 /pango | |
parent | ca30a4175066d693135eb035c4546e9a519054c4 (diff) | |
download | pango-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')
-rw-r--r-- | pango/pangoft2.c | 39 | ||||
-rw-r--r-- | pango/pangoxft-font.c | 14 |
2 files changed, 38 insertions, 15 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 diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c index 6600bd78..4ec646ac 100644 --- a/pango/pangoxft-font.c +++ b/pango/pangoxft-font.c @@ -19,6 +19,8 @@ * Boston, MA 02111-1307, USA. */ +#include "config.h" + #include <stdlib.h> #include "pangoxft-private.h" @@ -471,8 +473,8 @@ pango_xft_font_get_coverage (PangoFont *font, coverage = pango_coverage_new (); #ifdef HAVE_FT_GET_FIRST_CHAR { - FT_ULong gindex; - FT_Ulong charcode; + FT_UInt gindex; + FT_ULong charcode; charcode = FT_Get_First_Char (face, &gindex); while (gindex) @@ -484,14 +486,14 @@ pango_xft_font_get_coverage (PangoFont *font, #else /* Ugh, this is going to be SLOW */ { - int i; + gunichar wc; - for (i = 0; i < G_MAXUSHORT; i++) + for (wc = 0; wc < G_MAXUSHORT; wc++) { - FT_UInt glyph = FT_Get_Char_Index (face, i); + FT_UInt glyph = FT_Get_Char_Index (face, wc); if (glyph && glyph < face->num_glyphs) - pango_coverage_set (coverage, i, PANGO_COVERAGE_EXACT); + pango_coverage_set (coverage, wc, PANGO_COVERAGE_EXACT); } } #endif |