From 99848cfafee8e598ef533f254cdb99fbae4c9364 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 23 Jun 2004 20:33:35 +0000 Subject: [PATCH] #143693, Sayamindu Dasgupta Wed Jun 23 16:13:53 2004 Owen Taylor #143693, Sayamindu Dasgupta * pango/opentype/pango-ot-buffer.c (pango_ot_buffer_set_zero_width_marks) pango/opentype/pango-ot-private.h: Allow setting for whether marks should be given zero width, defaulting to FALSE. * modules/arabic/arabic-fc.c (arabic_engine_shape): Turn on zero-width-marks setting. --- src/pango-ot-buffer.c | 22 +++++++++++++++++++++- src/pango-ot-private.h | 5 +++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/pango-ot-buffer.c b/src/pango-ot-buffer.c index 35371ae85..a7b23e65a 100644 --- a/src/pango-ot-buffer.c +++ b/src/pango-ot-buffer.c @@ -42,6 +42,7 @@ pango_ot_buffer_new (PangoFcFont *font) buffer->font = g_object_ref (font); buffer->applied_gpos = FALSE; buffer->rtl = FALSE; + buffer->zero_width_marks = FALSE; pango_fc_font_unlock_face (font); @@ -82,6 +83,24 @@ pango_ot_buffer_set_rtl (PangoOTBuffer *buffer, buffer->rtl = rtl; } +/** + * pango_ot_buffer_set_zero_width_marks: + * @buffer: a #PangoOTBuffer + * @zero_width_marks: %TRUE if characters with a mark class should + * be forced to zero width. + * + * Sets whether characters with a mark class should be forced to zero width. + * This setting is needed for proper positioning of Arabic accents, + * but will produce incorrect results with standard OpenType indic + * fonts. + **/ +void +pango_ot_buffer_set_zero_width_marks (PangoOTBuffer *buffer, + gboolean zero_width_marks) +{ + buffer->zero_width_marks = zero_width_marks != FALSE; +} + void pango_ot_buffer_get_glyphs (PangoOTBuffer *buffer, PangoOTGlyph **glyphs, @@ -228,7 +247,8 @@ pango_ot_buffer_output (PangoOTBuffer *buffer, FT_UShort property; - if (gdef && + if (buffer->zero_width_marks && + gdef && TT_GDEF_Get_Glyph_Property (gdef, glyphs->glyphs[i].glyph, &property) == FT_Err_Ok && (property == TTO_MARK || (property & IGNORE_SPECIAL_MARKS) != 0)) { diff --git a/src/pango-ot-private.h b/src/pango-ot-private.h index 9d8f5d0ed..2871cce8a 100644 --- a/src/pango-ot-private.h +++ b/src/pango-ot-private.h @@ -84,8 +84,9 @@ struct _PangoOTBuffer { OTL_Buffer buffer; PangoFcFont *font; - gboolean rtl; - gboolean applied_gpos; + guint rtl : 1; + guint zero_width_marks : 1; + guint applied_gpos : 1; }; GType pango_ot_info_get_type (void);