Updated Indic Patches
- From: Eric Mader <mader jtcsv com>
- To: gtk-i18n-list gnome org
- Subject: Updated Indic Patches
- Date: Wed, 20 Feb 2002 09:40:49 -0800
Here's a new version of the patch file generated with "diff -up"
Eric
cvs server: Diffing .
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/pango/ChangeLog,v
retrieving revision 1.447
diff -u -p -r1.447 ChangeLog
--- ChangeLog 2002/02/17 23:51:16 1.447
+++ ChangeLog 2002/02/19 21:46:03
@@ -1,3 +1,17 @@
+Tue Feb 19 10:07:52 2002 Eric Mader <mader jtcsv com>
+ * configure.in: Add module indic-xft
+
+ * modules/indic/Makefile.am: changes for indic-xft module
+
+ * modules/indic/indic-ot.h, modules/indic/indic-ot.c,
+ * modules/indic/indic-ot-class-tables.c, modules/indic/indic-xft.c: new files
+
+ * modules/arabic/arabic-xft.c (arabic-engine-shape): comment out num_glyphs == n_chars
+ assertion (need a real solution for this!)
+
+ * modules/arabic/arabic-ft2.c (arabic-engine-shape): added font argument to
+ pang_ot_ruleset_shape call. This makes it compile, but it's probably still broken...
+
Sun Feb 17 18:50:30 2002 Owen Taylor <otaylor redhat com>
* configure.in: Version 0.25
@@ -368,6 +382,13 @@ Mon Dec 10 09:18:09 2001 Owen Taylor <
[ Note, however, there are remaining problems - see, #66626 ]
Thu Dec 6 19:07:31 2001 Owen Taylor <otaylor redhat com>
+
+2001-12-01 Elliot Lee <sopwith redhat com>
+
+ * pango/opentype/pango-ot-ruleset.c, pango/pango-ot.h (pango_ot_ruleset_shape):
+ Function now attempts to do glyph positioning. Handle OpenType GPOS tables for layout,
+ or fall back to a basic routine if not.
+ * modules/arabic/arabic-xft.c: Use above API, and handle non-spacing marks.
* pango/pango-layout.c (get_items_log_attrs): Fix problem
where length passed in didn't get adjusted for paragraph
Index: configure.in
===================================================================
RCS file: /cvs/gnome/pango/configure.in,v
retrieving revision 1.95
diff -u -p -r1.95 configure.in
--- configure.in 2002/02/17 23:51:17 1.95
+++ configure.in 2002/02/19 21:46:03
@@ -274,7 +274,7 @@ arabic_modules="arabic-ft2,arabic-x,arab
basic_modules="basic-ft2,basic-win32,basic-x,basic-xft"
hangul_modules="hangul-x"
hebrew_modules="hebrew-ft2,hebrew-x,hebrew-xft"
-indic_modules="bengali-x,devanagari-x,gurmukhi-x,gujarati-x,myanmar-x"
+indic_modules="bengali-x,devanagari-x,gurmukhi-x,gujarati-x,myanmar-x,indic-xft"
tamil_modules="tamil-x,tamil-xft"
thai_modules="thai-x"
@@ -345,6 +345,7 @@ AM_CONDITIONAL(INCLUDE_DEVANAGARI_X,echo
AM_CONDITIONAL(INCLUDE_GUJARATI_X,echo $included_modules | grep '\(^\|,\)gujarati-x\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_GURMUKHI_X,echo $included_modules | grep '\(^\|,\)gurmukhi-x\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_MYANMAR_X,echo $included_modules | grep '\(^\|,\)myanmar-x\($\|,\)' > /dev/null)
+AM_CONDITIONAL(INCLUDE_INDIC_XFT,echo $included_modules | grep '\(^\|,\)indic-xft\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_TAMIL_X,echo $included_modules | grep '\(^\|,\)tamil-x\($\|,\)' > /dev/null)
AM_CONDITIONAL(INCLUDE_TAMIL_XFT,echo $included_modules | grep '\(^\|,\)tamil-xft\($\|,\)' > /dev/null)
cvs server: Diffing docs
cvs server: Diffing docs/TEXT
cvs server: Diffing docs/tmpl
Index: docs/tmpl/opentype.sgml
===================================================================
RCS file: /cvs/gnome/pango/docs/tmpl/opentype.sgml,v
retrieving revision 1.4
diff -u -p -r1.4 opentype.sgml
--- docs/tmpl/opentype.sgml 2001/11/11 23:36:28 1.4
+++ docs/tmpl/opentype.sgml 2002/02/19 21:46:03
@@ -150,6 +150,7 @@ OpenType Font Handling
</para>
@ruleset:
+ font:
@glyphs:
@properties:
cvs server: Diffing examples
cvs server: Diffing modules
cvs server: Diffing modules/arabic
Index: modules/arabic/arabic-ft2.c
===================================================================
RCS file: /cvs/gnome/pango/modules/arabic/arabic-ft2.c,v
retrieving revision 1.1
diff -u -p -r1.1 arabic-ft2.c
--- modules/arabic/arabic-ft2.c 2002/01/24 15:18:06 1.1
+++ modules/arabic/arabic-ft2.c 2002/02/19 21:46:03
@@ -297,7 +297,7 @@ arabic_engine_shape (PangoFont *f
if (ruleset)
{
- pango_ot_ruleset_shape (ruleset, glyphs, properties);
+ pango_ot_ruleset_shape (ruleset, font, glyphs, properties);
g_free (wcs);
g_free (properties);
Index: modules/arabic/arabic-xft.c
===================================================================
RCS file: /cvs/gnome/pango/modules/arabic/arabic-xft.c,v
retrieving revision 1.6
diff -u -p -r1.6 arabic-xft.c
--- modules/arabic/arabic-xft.c 2001/06/14 20:38:20 1.6
+++ modules/arabic/arabic-xft.c 2002/02/19 21:46:03
@@ -140,13 +140,13 @@ find_char (FT_Face face, PangoFont *font
static void
arabic_engine_shape (PangoFont *font,
- const char *text,
- gint length,
- PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
+ const char *text,
+ gint length,
+ PangoAnalysis *analysis,
+ PangoGlyphString *glyphs)
{
int n_chars;
- int i;
+ int i, prev_i;
const char *p;
gulong *properties = NULL;
gunichar *wcs = NULL;
@@ -165,9 +165,10 @@ arabic_engine_shape (PangoFont *f
pango_glyph_string_set_size (glyphs, n_chars);
ruleset = get_ruleset (font);
+
+ wcs = g_utf8_to_ucs4_fast (text, length, NULL);
if (ruleset)
{
- wcs = g_utf8_to_ucs4_fast (text, length, NULL);
properties = g_new0 (gulong, n_chars);
Assign_Arabic_Properties (wcs, properties, n_chars);
@@ -246,34 +247,35 @@ arabic_engine_shape (PangoFont *f
p = g_utf8_next_char (p);
}
-
- ruleset = get_ruleset (font);
-
- if (ruleset)
- {
- pango_ot_ruleset_shape (ruleset, glyphs, properties);
-
- g_free (wcs);
- g_free (properties);
-
- }
+ pango_ot_ruleset_shape (ruleset, font, glyphs, properties);
+ /* g_assert(glyphs->num_glyphs == n_chars);*/
+ prev_i = -1;
for (i = 0; i < glyphs->num_glyphs; i++)
{
+ int x = 0;
- if (glyphs->glyphs[i].glyph)
+ if (g_unichar_type(wcs[i]) != G_UNICODE_NON_SPACING_MARK)
{
- PangoRectangle logical_rect;
-
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
- glyphs->glyphs[i].geometry.width = logical_rect.width;
+ prev_i = i; /* Need to know what the last 'normal' character was, in case of multiple marks */
}
- else
- glyphs->glyphs[i].geometry.width = 0;
-
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
+ else if (glyphs->glyphs[i].geometry.width && prev_i >= 0)
+ {
+ glyphs->glyphs[i].geometry.x_offset -= glyphs->glyphs[prev_i].geometry.width; /* Position the mark over the tail of the
+ previous 'normal' character... */
+ x = glyphs->glyphs[prev_i].geometry.width - glyphs->glyphs[i].geometry.width;
+ if (x > 0)
+ /* ... then if it is shorter than the previous char, back
+ the mark up so it is centered over the last quarter of the
+ previous glyph. Or something. */
+ glyphs->glyphs[i].geometry.x_offset += x / 4;
+
+ glyphs->glyphs[i].geometry.width = 0;
+ }
}
+
+ g_free (wcs);
+ g_free (properties);
/* Simple bidi support */
cvs server: Diffing modules/basic
cvs server: Diffing modules/hangul
cvs server: Diffing modules/hebrew
cvs server: Diffing modules/indic
Index: modules/indic/Makefile.am
===================================================================
RCS file: /cvs/gnome/pango/modules/indic/Makefile.am,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile.am
--- modules/indic/Makefile.am 2001/12/13 17:43:00 1.9
+++ modules/indic/Makefile.am 2002/02/19 21:46:03
@@ -8,11 +8,34 @@ sources = \
devanagari-x.c \
pango-indic-script.h
+xft_sources = \
+ indic-xft.c \
+ indic-ot-class-tables.c \
+ indic-ot.c \
+ indic-ot.h
+
pangolibs = $(top_builddir)/pango/libpango.la $(FRIBIDI_LIBS) $(GLIB_LIBS)
pangoxlibs = $(top_builddir)/pango/libpangox.la $(X_LIBS) $(pangolibs)
pangoxftlibs = $(top_builddir)/pango/libpangoxft.la $(XFT_LIBS) $(pangolibs)
pangoft2libs = $(top_builddir)/pango/libpangoft2.la $(FREETYPE_LIBS) $(pangolibs)
+if HAVE_XFT
+if INCLUDE_INDIC_XFT
+XFT_MODULES=
+XFT_INCLUDED=libpango-indic-xft.la
+XFT_PREFIX=-DXFT_MODULE_PREFIX
+else
+XFT_MODULES=pango-indic-xft.la
+XFT_INCLUDED=
+XFT_PREFIX=
+indic_xft_libadd=$(pangoxftlibs)
+endif
+else
+XFT_MODULES=
+XFT_INCLUDED=
+XFT_PREFIX=
+endif
+
if HAVE_X
if INCLUDE_MYANMAR_X
@@ -55,14 +78,14 @@ gujarati_x_inst=pango-gujarati-x.la
gujarati_x_libadd=$(pangoxlibs)
endif
-noinst_LTLIBRARIES = $(myanmar_x_noinst) $(gurmukhi_x_noinst) $(bengali_x_noinst) $(devanagari_x_noinst) $(gujarati_x_noinst)
+noinst_LTLIBRARIES = $(myanmar_x_noinst) $(gurmukhi_x_noinst) $(bengali_x_noinst) $(devanagari_x_noinst) $(gujarati_x_noinst) $(XFT_INCLUDED)
moduledir = $(libdir)/pango/modules
-module_LTLIBRARIES = $(myanmar_x_inst) $(gurmukhi_x_inst) $(bengali_x_inst) $(devanagari_x_inst) $(gujarati_x_inst)
+module_LTLIBRARIES = $(myanmar_x_inst) $(gurmukhi_x_inst) $(bengali_x_inst) $(devanagari_x_inst) $(gujarati_x_inst) $(XFT_MODULES)
endif
-INCLUDES = -DPANGO_ENABLE_ENGINE -DG_DISABLE_DEPRECATED -I$(top_srcdir) -I$(top_srcdir)/pango/ $(X_CFLAGS) $(myanmar_x_cflags) $(gurmukhi_x_cflags) $(bengali_x_cflags) $(devanagari_x_cflags) $(gujarati_x_cflags)
+INCLUDES = -DPANGO_ENABLE_ENGINE -DG_DISABLE_DEPRECATED -I$(top_srcdir) -I$(top_srcdir)/pango/ $(X_CFLAGS) $(myanmar_x_cflags) $(gurmukhi_x_cflags) $(bengali_x_cflags) $(devanagari_x_cflags) $(gujarati_x_cflags) $(FREETYPE_CFLAGS)
EXTRA_DIST = \
pango-indic-script.h
@@ -106,6 +129,12 @@ libpango_gujarati_x_la_SOURCES = gujarat
else
pango_gujarati_x_la_SOURCES = gujarati-x.c
endif
+
+pango_indic_xft_la_LDFLAGS = -export-dynamic -avoid-version -module
+pango_indic_xft_la_LIBADD = $(indic_xft_libadd)
+pango_indic_xft_la_SOURCES = $(xft_sources)
+
+libpango_indic_xft_la_SOURCES = $(xft_sources)
included-modules: $(noinst_LTLIBRARIES)
cvs server: Diffing modules/tamil
cvs server: Diffing modules/thai
cvs server: Diffing pango
Index: pango/pango-ot.h
===================================================================
RCS file: /cvs/gnome/pango/pango/pango-ot.h,v
retrieving revision 1.3
diff -u -p -r1.3 pango-ot.h
--- pango/pango-ot.h 2001/10/30 22:09:19 1.3
+++ pango/pango-ot.h 2002/02/19 21:46:03
@@ -78,6 +78,7 @@ void pango_ot_ruleset_add_fea
guint feature_index,
gulong property_bit);
void pango_ot_ruleset_shape (PangoOTRuleset *ruleset,
+ PangoFont *font,
PangoGlyphString *glyphs,
gulong *properties);
cvs server: Diffing pango/mini-fribidi
cvs server: Diffing pango/mini-xft
cvs server: Diffing pango/opentype
Index: pango/opentype/ftxgpos.c
===================================================================
RCS file: /cvs/gnome/pango/pango/opentype/ftxgpos.c,v
retrieving revision 1.3
diff -u -p -r1.3 ftxgpos.c
--- pango/opentype/ftxgpos.c 2001/09/19 21:20:36 1.3
+++ pango/opentype/ftxgpos.c 2002/02/19 21:46:03
@@ -34,7 +34,9 @@
#include "ftxopen.h"
#include "ftxopenf.h"
+#include <stdio.h>
+
struct GPOS_Instance_
{
TTO_GPOSHeader* gpos;
@@ -803,6 +805,7 @@
break;
default:
+ printf("Load_Anchor: an->PosFormat = %d?\n", an->PosFormat);
return TTO_Err_Invalid_GPOS_SubTable_Format;
}
@@ -1082,6 +1085,7 @@
break;
default:
+ printf("Load_SinglePos: sp->PosFormat = %d?\n", sp->PosFormat);
return TTO_Err_Invalid_GPOS_SubTable_Format;
}
@@ -1560,6 +1564,7 @@
break;
default:
+ printf("Load_PairPos: pp->PosFormat = %d?\n", pp->PosFormat);
return TTO_Err_Invalid_GPOS_SubTable_Format;
}
@@ -1730,6 +1735,7 @@
break;
default:
+ printf("Lookup_PairPos: pp->PosFormat = %d?\n", pp->PosFormat);
return TTO_Err_Invalid_GPOS_SubTable_Format;
}
@@ -3856,6 +3862,7 @@
return Load_ContextPos3( &cp->cpf.cpf3, stream );
default:
+ printf("Load_ContextPos: cp->PosFormat = %d?\n", cp->PosFormat);
return TTO_Err_Invalid_GPOS_SubTable_Format;
}
@@ -4142,6 +4149,7 @@
flags, context_length, nesting_level );
default:
+ printf("Lookup_ContextPos: cp->PosFormat = %d?\n", cp->PosFormat);
return TTO_Err_Invalid_GPOS_SubTable_Format;
}
@@ -5113,6 +5121,7 @@
return Load_ChainContextPos3( &ccp->ccpf.ccpf3, stream );
default:
+ printf("Load_ChainContextPos: ccp->PosFormat = %d?\n", ccp->PosFormat);
return TTO_Err_Invalid_GPOS_SubTable_Format;
}
@@ -5648,6 +5657,7 @@
nesting_level );
default:
+ printf("Lookup_ChainContextPos: ccp->PosFormat = %d?\n", ccp->PosFormat);
return TTO_Err_Invalid_GPOS_SubTable_Format;
}
@@ -5783,7 +5793,10 @@
for ( n = 0; n < ls->FeatureCount; n++ )
{
if ( fi[n] >= fl->FeatureCount )
- return TTO_Err_Invalid_GPOS_SubTable_Format;
+ {
+ printf("TT_GPOS_Select_Feature: fi[n] = %d, FeatureCount = %d?\n", fi[n], fl->FeatureCount);
+ return TTO_Err_Invalid_GPOS_SubTable_Format;
+ }
if ( feature_tag == fr[fi[n]].FeatureTag )
{
@@ -5932,6 +5945,7 @@
if ( fi[n] >= fl->FeatureCount )
{
FREE( ftl );
+ printf("TT_GPOS_Query_Features: fi[n] = %d, FeatureCount = %d?\n", fi[n], fl->FeatureCount);
return TTO_Err_Invalid_GPOS_SubTable_Format;
}
ftl[n] = fr[fi[n]].FeatureTag;
Index: pango/opentype/ftxgsub.c
===================================================================
RCS file: /cvs/gnome/pango/pango/opentype/ftxgsub.c,v
retrieving revision 1.2
diff -u -p -r1.2 ftxgsub.c
--- pango/opentype/ftxgsub.c 2001/09/19 21:20:36 1.2
+++ pango/opentype/ftxgsub.c 2002/02/19 21:46:04
@@ -34,8 +34,10 @@
#include "ftxopen.h"
#include "ftxopenf.h"
+#include <stdio.h>
+
#define GSUB_ID Build_Extension_ID( 'G', 'S', 'U', 'B' )
@@ -271,6 +273,8 @@
FT_UShort i, num_lookups;
TTO_GSUBHeader* gsub;
TTO_Lookup* lo;
+
+ printf("TT_Load_GSUB_Table: Hello!\n");
if ( !retptr )
return TT_Err_Invalid_Argument;
Index: pango/opentype/ftxopen.c
===================================================================
RCS file: /cvs/gnome/pango/pango/opentype/ftxopen.c,v
retrieving revision 1.3
diff -u -p -r1.3 ftxopen.c
--- pango/opentype/ftxopen.c 2001/09/19 21:20:36 1.3
+++ pango/opentype/ftxopen.c 2002/02/19 21:46:04
@@ -24,7 +24,9 @@
#include "ftxopen.h"
#include "ftxopenf.h"
+#include <stdio.h>
+
/***************************
* Script related functions
***************************/
@@ -130,6 +132,7 @@
if ( s->LangSysCount == 0 && s->DefaultLangSys.FeatureCount == 0 )
{
+ printf("LangSysCount == 0 && DefaultLangSys.FeatureCount == 0!\n");
error = TTO_Err_Invalid_SubTable;
goto Fail2;
}
@@ -454,7 +457,7 @@
else
switch ( lookup_type )
{
-#if 0
+#if 1
case GPOS_LOOKUP_SINGLE:
return Load_SinglePos( &st->st.gpos.single, stream );
@@ -826,6 +829,7 @@
( rr[n].End - rr[n].Start + (long)rr[n].StartCoverageIndex ) >=
0x10000L )
{
+ printf("coverage format 2: start > end || range >= 0x10000L\n");
error = TTO_Err_Invalid_SubTable;
goto Fail;
}
@@ -869,6 +873,7 @@
return Load_Coverage2( &c->cf.cf2, stream );
default:
+ printf("coverage format %d?\n", c->CoverageFormat);
return TTO_Err_Invalid_SubTable_Format;
}
@@ -999,6 +1004,7 @@
return Coverage_Index2( &c->cf.cf2, glyphID, index );
default:
+ printf("Coverage_Index: coverage format %d?\n", c->CoverageFormat);
return TTO_Err_Invalid_SubTable_Format;
}
@@ -1042,7 +1048,10 @@
/* sanity check; we are limited to 16bit integers */
if ( cdf1->StartGlyph + (long)count >= 0x10000L )
- return TTO_Err_Invalid_SubTable;
+ {
+ printf("convrage format 1: count >= 0x10000L\n");
+ return TTO_Err_Invalid_SubTable;
+ }
cdf1->ClassValueArray = NULL;
@@ -1060,6 +1069,7 @@
cva[n] = GET_UShort();
if ( cva[n] >= limit )
{
+ printf("cva[n] >= limit\n");
error = TTO_Err_Invalid_SubTable;
goto Fail;
}
@@ -1132,8 +1142,18 @@
if ( crr[n].Start > crr[n].End ||
crr[n].Class >= limit )
{
+ printf("crr[n].Start >= crr[n].End || crr[n].Class >= limit\n");
+ printf("n = %d, Start = %4.4X, End = %4.4X, Class = %d, limit = %d, pos = %8.8X\n", n, crr[n].Start, crr[n].End, crr[n].Class, limit, stream->pos);
+#if 0
error = TTO_Err_Invalid_SubTable;
goto Fail;
+#else
+ if (crr[n].Start > crr[n].End)
+ crr[n].End = crr[n].Start;
+
+ if (crr[n].Class >= limit)
+ crr[n].Class = limit - 1;
+#endif
}
d[crr[n].Class] = TRUE;
}
@@ -1187,6 +1207,7 @@
break;
default:
+ printf("Class format %d?\n", cd->ClassFormat);
error = TTO_Err_Invalid_SubTable_Format;
break;
}
@@ -1327,6 +1348,7 @@
return Get_Class2( &cd->cd.cd2, glyphID, class, index );
default:
+ printf("Get_Class: class format %d?\n", cd->ClassFormat);
return TTO_Err_Invalid_SubTable_Format;
}
@@ -1362,7 +1384,10 @@
if ( d->StartSize > d->EndSize ||
d->DeltaFormat == 0 || d->DeltaFormat > 3 )
- return TTO_Err_Invalid_SubTable;
+ {
+ printf("StartSize > EndSize || DeltaFormat == 0 || DeltaFormat > 3\n");
+ return TTO_Err_Invalid_SubTable;
+ }
d->DeltaValue = NULL;
Index: pango/opentype/pango-ot-ruleset.c
===================================================================
RCS file: /cvs/gnome/pango/pango/opentype/pango-ot-ruleset.c,v
retrieving revision 1.3
diff -u -p -r1.3 pango-ot-ruleset.c
--- pango/opentype/pango-ot-ruleset.c 2001/10/30 22:09:20 1.3
+++ pango/opentype/pango-ot-ruleset.c 2002/02/19 21:46:04
@@ -21,9 +21,23 @@
#include <freetype/internal/ftmemory.h>
+#include <pango/pango-font.h>
+#include <pango/pango-utils.h>
+#include <pango/pangoft2.h>
#include <pango/pango-ot.h>
#include "pango-ot-private.h"
+#include <pango/pangoxft.h>
+
+#ifndef PANGO_UNITS_26_6
+#define PANGO_SCALE_26_6 (PANGO_SCALE / (1<<6))
+#define PANGO_PIXELS_26_6(d) \
+ (((d) >= 0) ? \
+ ((d) + PANGO_SCALE_26_6 / 2) / PANGO_SCALE_26_6 : \
+ ((d) - PANGO_SCALE_26_6 / 2) / PANGO_SCALE_26_6)
+#define PANGO_UNITS_26_6(d) (PANGO_SCALE_26_6 * (d))
+#endif
+
typedef struct _PangoOTRule PangoOTRule;
struct _PangoOTRule
@@ -136,20 +150,12 @@ pango_ot_ruleset_add_feature (PangoOTRul
g_array_append_val (ruleset->rules, tmp_rule);
}
-/**
- * pango_ot_ruleset_shape:
- * @ruleset: a #PangoOTRuleset.
- * @glyphs: a pointer to a #PangoGlyphString.
- * @properties: an array containing one #gulong bitfield for each glyph,
- * which gives the glyph's properties: If a certain bit is set for a glyph,
- * the feature which has the same bit set in its property value is applied.
- *
- * Shapes a string of glyphs with the given properties according to @ruleset.
- **/
-void
-pango_ot_ruleset_shape (PangoOTRuleset *ruleset,
- PangoGlyphString *glyphs,
- gulong *properties)
+/* Returns true if the GPOS table was found to allow positioning the glyphs */
+static gboolean
+pango_ot_ruleset_shape_internal(PangoOTRuleset *ruleset,
+ PangoFont *font,
+ PangoGlyphString *glyphs,
+ gulong *properties)
{
int i;
int last_cluster;
@@ -162,9 +168,9 @@ pango_ot_ruleset_shape (PangoOTRuleset
TTO_GSUB_String *result_string = NULL;
gboolean need_gsub = FALSE;
- gboolean need_gpos = FALSE;
+ gboolean need_gpos = FALSE, did_gpos = FALSE;
- g_return_if_fail (PANGO_OT_IS_RULESET (ruleset));
+ g_return_val_if_fail (PANGO_OT_IS_RULESET (ruleset), FALSE);
for (i = 0; i < ruleset->rules->len; i++)
{
@@ -209,7 +215,7 @@ pango_ot_ruleset_shape (PangoOTRuleset
}
if (!gsub && !gpos)
- return;
+ return FALSE;
g_assert (TT_GSUB_String_New (ruleset->info->face->memory,
&in_string) == FT_Err_Ok);
@@ -233,7 +239,38 @@ pango_ot_ruleset_shape (PangoOTRuleset
}
else
result_string = in_string;
-
+
+ if (gpos && font)
+ {
+ TTO_GPOS_Data *outgpos = NULL;
+
+ if (!TT_GPOS_Apply_String (pango_xft_font_get_face(font), gpos, 0, result_string, &outgpos,
+ FALSE /* enable device-dependant values */,
+ FALSE /* Even though this might be r2l text, RTL is handled elsewhere afaik */))
+ {
+
+ for (i = 0; i < result_string->length; i++)
+ {
+ int j;
+ glyphs->glyphs[i].geometry.x_offset = PANGO_UNITS_26_6(outgpos[i].x_pos);
+ glyphs->glyphs[i].geometry.y_offset = PANGO_UNITS_26_6(outgpos[i].y_pos);
+
+ for(j = 0; j < outgpos[i].back; j++)
+ glyphs->glyphs[i].geometry.x_offset -= glyphs->glyphs[i-j].geometry.width;
+
+ if (outgpos[i].new_advance)
+ /* Can't set new x offset for marks, so just make sure not to increase it.
+ Can do better than this by playing with ->x_offset. */
+ glyphs->glyphs[i].geometry.width = 0;
+ else
+ glyphs->glyphs[i].geometry.width = PANGO_UNITS_26_6(outgpos[i].x_advance);
+ }
+
+ FT_Free(gpos->memory, (void *)outgpos);
+ did_gpos = TRUE;
+ }
+ }
+
pango_glyph_string_set_size (glyphs, result_string->length);
last_cluster = -1;
@@ -255,4 +292,50 @@ pango_ot_ruleset_shape (PangoOTRuleset
TT_GSUB_String_Done (in_string);
if (out_string)
TT_GSUB_String_Done (out_string);
+
+ return did_gpos;
+}
+
+/**
+ * pango_ot_ruleset_shape:
+ * @ruleset: a #PangoOTRuleset.
+ * @glyphs: a pointer to a #PangoGlyphString.
+ * @properties: an array containing one #gulong bitfield for each glyph,
+ * which gives the glyph's properties: If a certain bit is set for a glyph,
+ * the feature which has the same bit set in its property value is applied.
+ *
+ * Shapes a string of glyphs with the given properties according to @ruleset.
+ **/
+void
+pango_ot_ruleset_shape (PangoOTRuleset *ruleset,
+ PangoFont *font,
+ PangoGlyphString *glyphs,
+ gulong *properties)
+{
+ int i;
+
+ if(pango_ot_ruleset_shape_internal(ruleset, font, glyphs, properties))
+ return;
+
+ if(!font)
+ return;
+
+ g_return_if_fail (PANGO_IS_FONT (font));
+
+ /* Fall back to some basic shaping */
+ for (i = 0; i < glyphs->num_glyphs; i++)
+ {
+ if (glyphs->glyphs[i].glyph)
+ {
+ PangoRectangle logical_rect;
+
+ pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
+ glyphs->glyphs[i].geometry.width = logical_rect.width;
+ }
+ else
+ glyphs->glyphs[i].geometry.width = 0;
+
+ glyphs->glyphs[i].geometry.x_offset = 0;
+ glyphs->glyphs[i].geometry.y_offset = 0;
+ }
}
cvs server: Diffing tests
cvs server: Diffing tools
cvs server: Diffing tools/maps
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]