summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-context.c2
-rw-r--r--pango/pango-glyph-item.c11
-rw-r--r--pango/pango-markup.c50
-rw-r--r--pango/pangofc-fontmap.c24
-rw-r--r--pango/pangofc-shape.c4
5 files changed, 53 insertions, 38 deletions
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 1fcdf366..a3d7e6c4 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -1572,7 +1572,7 @@ pango_itemize_with_base_dir (PangoContext *context,
g_return_val_if_fail (length >= 0, NULL);
g_return_val_if_fail (length == 0 || text != NULL, NULL);
- if (length == 0 || g_utf8_strlen (text, length) == 0)
+ if (length == 0 || g_utf8_strlen (text + start_index, length) == 0)
return NULL;
itemize_state_init (&state, context, text, base_dir, start_index, length,
diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c
index 326ae37f..e38de730 100644
--- a/pango/pango-glyph-item.c
+++ b/pango/pango-glyph-item.c
@@ -753,7 +753,16 @@ pango_glyph_item_letter_space (PangoGlyphItem *glyph_item,
have_cluster = pango_glyph_item_iter_next_cluster (&iter))
{
if (!log_attrs[iter.start_char].is_cursor_position)
- continue;
+ {
+ if (glyphs[iter.start_glyph].geometry.width == 0)
+ {
+ if (iter.start_glyph < iter.end_glyph) /* LTR */
+ glyphs[iter.start_glyph].geometry.x_offset -= space_right;
+ else
+ glyphs[iter.start_glyph].geometry.x_offset += space_left;
+ }
+ continue;
+ }
if (iter.start_glyph < iter.end_glyph) /* LTR */
{
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index b74c1ad4..d0b47016 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -677,8 +677,21 @@ text_handler (GMarkupParseContext *context G_GNUC_UNUSED,
/* The underline should go underneath the char
* we're setting as the next range_start
*/
- uline_index = md->index;
- uline_len = g_utf8_next_char (p) - p;
+ if (md->attr_list != NULL)
+ {
+ /* Add the underline indicating the accelerator */
+ PangoAttribute *attr;
+
+ attr = pango_attr_underline_new (PANGO_UNDERLINE_LOW);
+
+ uline_index = md->index;
+ uline_len = g_utf8_next_char (p) - p;
+
+ attr->start_index = uline_index;
+ attr->end_index = uline_index + uline_len;
+
+ pango_attr_list_change (md->attr_list, attr);
+ }
/* set next range_start to include this char */
range_start = p;
@@ -693,35 +706,12 @@ text_handler (GMarkupParseContext *context G_GNUC_UNUSED,
}
p = g_utf8_next_char (p);
- }
-
- if (range_end)
- {
- g_string_append_len (md->text,
- range_start,
- range_end - range_start);
- md->index += range_end - range_start;
- }
- else
- {
- g_string_append_len (md->text,
- range_start,
- end - range_start);
- md->index += end - range_start;
- }
-
- if (md->attr_list != NULL && uline_index >= 0)
- {
- /* Add the underline indicating the accelerator */
- PangoAttribute *attr;
-
- attr = pango_attr_underline_new (PANGO_UNDERLINE_LOW);
-
- attr->start_index = uline_index;
- attr->end_index = uline_index + uline_len;
+ }
- pango_attr_list_change (md->attr_list, attr);
- }
+ g_string_append_len (md->text,
+ range_start,
+ end - range_start);
+ md->index += end - range_start;
}
}
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 341b2d6c..3c31409e 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -1614,7 +1614,6 @@ pango_fc_make_pattern (const PangoFontDescription *description,
int slant;
double weight;
PangoGravity gravity;
- FcBool vertical;
char **families;
int i;
int width;
@@ -1625,7 +1624,6 @@ pango_fc_make_pattern (const PangoFontDescription *description,
width = pango_fc_convert_width_to_fc (pango_font_description_get_stretch (description));
gravity = pango_font_description_get_gravity (description);
- vertical = PANGO_GRAVITY_IS_VERTICAL (gravity) ? FcTrue : FcFalse;
/* The reason for passing in FC_SIZE as well as FC_PIXEL_SIZE is
* to work around a bug in libgnomeprint where it doesn't look
@@ -1634,13 +1632,14 @@ pango_fc_make_pattern (const PangoFontDescription *description,
* Putting FC_SIZE in here slightly reduces the efficiency
* of caching of patterns and fonts when working with multiple different
* dpi values.
+ *
+ * Do not pass FC_VERTICAL_LAYOUT true as HarfBuzz shaping assumes false.
*/
pattern = FcPatternBuild (NULL,
PANGO_FC_VERSION, FcTypeInteger, pango_version(),
FC_WEIGHT, FcTypeDouble, weight,
FC_SLANT, FcTypeInteger, slant,
FC_WIDTH, FcTypeInteger, width,
- FC_VERTICAL_LAYOUT, FcTypeBool, vertical,
#ifdef FC_VARIABLE
FC_VARIABLE, FcTypeBool, FcDontCare,
#endif
@@ -2439,7 +2438,24 @@ pango_fc_font_description_from_pattern (FcPattern *pattern, gboolean include_siz
pango_font_description_set_variant (desc, PANGO_VARIANT_NORMAL);
if (include_size && FcPatternGetDouble (pattern, FC_SIZE, 0, &size) == FcResultMatch)
- pango_font_description_set_size (desc, size * PANGO_SCALE);
+ {
+ FcMatrix *fc_matrix;
+ double scale_factor = 1;
+
+ if (FcPatternGetMatrix (pattern, FC_MATRIX, 0, &fc_matrix) == FcResultMatch)
+ {
+ PangoMatrix mat = PANGO_MATRIX_INIT;
+
+ mat.xx = fc_matrix->xx;
+ mat.xy = fc_matrix->xy;
+ mat.yx = fc_matrix->yx;
+ mat.yy = fc_matrix->yy;
+
+ scale_factor = pango_matrix_get_font_scale_factor (&mat);
+ }
+
+ pango_font_description_set_size (desc, scale_factor * size * PANGO_SCALE);
+ }
/* gravity is a bit different. we don't want to set it if it was not set on
* the pattern */
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index b6f74ca1..5c716b24 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -409,8 +409,8 @@ pango_hb_shape (PangoFont *font,
for (i = 0; i < num_glyphs; i++)
{
/* 90 degrees rotation counter-clockwise. */
- infos[i].geometry.width = hb_position->y_advance;
- infos[i].geometry.x_offset = hb_position->y_offset;
+ infos[i].geometry.width = - hb_position->y_advance;
+ infos[i].geometry.x_offset = - hb_position->y_offset;
infos[i].geometry.y_offset = - hb_position->x_offset;
hb_position++;
}