summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-08-02 03:06:59 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-08-02 03:06:59 +0000
commit5bd13c75423d2cea1fc09b333cfd7fb49437dca6 (patch)
treeabe5c2b12776841705513c4646a1ee152af6a63b
parent1311cfec2e3211049fe1a21073c2a6d36d40cfed (diff)
parent5590b99fb6369cd16110bce2a3e8ac6371c3c487 (diff)
downloadpango-5bd13c75423d2cea1fc09b333cfd7fb49437dca6.tar.gz
Merge branch 'compiler-warnings' into 'master'
Compiler warnings See merge request GNOME/pango!116
-rw-r--r--meson.build2
-rw-r--r--pango/break.c1
-rw-r--r--pango/emoji_presentation_scanner.c5
-rw-r--r--pango/pangofc-shape.c74
-rw-r--r--pango/pangoft2-render.c1
5 files changed, 79 insertions, 4 deletions
diff --git a/meson.build b/meson.build
index 1d0b7d2c..619e6f33 100644
--- a/meson.build
+++ b/meson.build
@@ -87,6 +87,7 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
'-Wno-uninitialized',
'-Wno-shadow',
'-Werror=implicit',
+ '-Werror=implicit-fallthrough',
'-Werror=nonnull',
'-Werror=init-self',
'-Werror=main',
@@ -101,6 +102,7 @@ elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
'-Werror=pointer-to-int-cast',
'-Werror=empty-body',
'-Werror=write-strings',
+ '-Werror=unused-but-set-variable',
'-Wundef', # FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=792481
]
diff --git a/pango/break.c b/pango/break.c
index abaf7d9b..14986c78 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -421,6 +421,7 @@ pango_default_break (const gchar *text,
GB_type = GB_ControlCRLF;
break;
}
+ /* fall through */
case G_UNICODE_OTHER_LETTER:
if (makes_hangul_syllable)
diff --git a/pango/emoji_presentation_scanner.c b/pango/emoji_presentation_scanner.c
index 97a52927..87e55aa7 100644
--- a/pango/emoji_presentation_scanner.c
+++ b/pango/emoji_presentation_scanner.c
@@ -96,7 +96,7 @@ scan_emoji_presentation (emoji_text_iter_t p,
const emoji_text_iter_t pe,
bool* is_emoji)
{
- emoji_text_iter_t ts, te;
+ emoji_text_iter_t te;
const emoji_text_iter_t eof = pe;
unsigned act;
@@ -106,7 +106,6 @@ scan_emoji_presentation (emoji_text_iter_t p,
#line 107 "emoji_presentation_scanner.c"
{
cs = emoji_presentation_start;
- ts = 0;
te = 0;
act = 0;
}
@@ -128,7 +127,6 @@ _resume:
switch ( *_acts++ ) {
case 1:
#line 1 "NONE"
- {ts = p;}
break;
#line 134 "emoji_presentation_scanner.c"
}
@@ -255,7 +253,6 @@ _again:
switch ( *_acts++ ) {
case 0:
#line 1 "NONE"
- {ts = 0;}
break;
#line 261 "emoji_presentation_scanner.c"
}
diff --git a/pango/pangofc-shape.c b/pango/pangofc-shape.c
index 2e9806b8..c2ef2b8f 100644
--- a/pango/pangofc-shape.c
+++ b/pango/pangofc-shape.c
@@ -203,6 +203,37 @@ pango_hb_font_get_nominal_glyph (hb_font_t *font,
return FALSE;
}
+static hb_bool_t
+pango_hb_font_get_variation_glyph (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t unicode,
+ hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph,
+ void *user_data G_GNUC_UNUSED)
+{
+ PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+
+ if (hb_font_get_glyph (context->parent,
+ unicode, variation_selector, glyph))
+ return TRUE;
+
+ return FALSE;
+}
+
+static hb_bool_t
+pango_hb_font_get_glyph_contour_point (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t glyph,
+ unsigned int point_index,
+ hb_position_t *x,
+ hb_position_t *y,
+ void *user_data G_GNUC_UNUSED)
+{
+ PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+
+ return hb_font_get_glyph_contour_point (context->parent, glyph, point_index, x, y);
+}
+
static hb_position_t
pango_hb_font_get_glyph_advance (hb_font_t *font,
void *font_data,
@@ -248,6 +279,44 @@ pango_hb_font_get_glyph_extents (hb_font_t *font,
return hb_font_get_glyph_extents (context->parent, glyph, extents);
}
+static hb_bool_t
+pango_hb_font_get_glyph_h_origin (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t glyph,
+ hb_position_t *x,
+ hb_position_t *y,
+ void *user_data G_GNUC_UNUSED)
+{
+ PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+
+ return hb_font_get_glyph_h_origin (context->parent, glyph, x, y);
+}
+
+static hb_bool_t
+pango_hb_font_get_glyph_v_origin (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t glyph,
+ hb_position_t *x,
+ hb_position_t *y,
+void *user_data G_GNUC_UNUSED)
+{
+ PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+
+ return hb_font_get_glyph_v_origin (context->parent, glyph, x, y);
+}
+
+static hb_position_t
+pango_hb_font_get_h_kerning (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t left_glyph,
+ hb_codepoint_t right_glyph,
+ void *user_data G_GNUC_UNUSED)
+{
+ PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+
+ return hb_font_get_glyph_h_kerning (context->parent, left_glyph, right_glyph);
+}
+
static hb_font_t *
pango_font_get_hb_font_for_context (PangoFont *font,
PangoHbShapeContext *context)
@@ -262,9 +331,14 @@ pango_font_get_hb_font_for_context (PangoFont *font,
funcs = hb_font_funcs_create ();
hb_font_funcs_set_nominal_glyph_func (funcs, pango_hb_font_get_nominal_glyph, NULL, NULL);
+ hb_font_funcs_set_variation_glyph_func (funcs, pango_hb_font_get_variation_glyph, NULL, NULL);
hb_font_funcs_set_glyph_h_advance_func (funcs, pango_hb_font_get_glyph_advance, NULL, NULL);
hb_font_funcs_set_glyph_v_advance_func (funcs, pango_hb_font_get_glyph_advance, NULL, NULL);
+ hb_font_funcs_set_glyph_h_origin_func (funcs, pango_hb_font_get_glyph_h_origin, NULL, NULL);
+ hb_font_funcs_set_glyph_v_origin_func (funcs, pango_hb_font_get_glyph_v_origin, NULL, NULL);
+ hb_font_funcs_set_glyph_h_kerning_func (funcs, pango_hb_font_get_h_kerning, NULL, NULL);
hb_font_funcs_set_glyph_extents_func (funcs, pango_hb_font_get_glyph_extents, NULL, NULL);
+ hb_font_funcs_set_glyph_contour_point_func (funcs, pango_hb_font_get_glyph_contour_point, NULL, NULL);
hb_font_funcs_make_immutable (funcs);
}
diff --git a/pango/pangoft2-render.c b/pango/pangoft2-render.c
index 3c573bce..6d299392 100644
--- a/pango/pangoft2-render.c
+++ b/pango/pangoft2-render.c
@@ -335,6 +335,7 @@ pango_ft2_renderer_draw_glyph (PangoRenderer *renderer,
break;
case 0xff:
*d = 0xff;
+ break;
default:
*d = MIN ((gushort) *d + (gushort) *s, 0xff);
break;