[gtk/pango2: 2/2] wip: Port to pango2 api




commit 54934eadfaa9b242807de1273734b56d9a31503b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jan 22 13:37:32 2022 -0500

    wip: Port to pango2 api
    
    Missing: replace shape attributes with user fonts

 .gitlab-ci/test-msys2.sh               |   2 +-
 demos/gtk-demo/combobox.c              |   3 +-
 demos/gtk-demo/css_basics.c            |   4 +-
 demos/gtk-demo/css_multiplebgs.c       |   4 +-
 demos/gtk-demo/css_pixbufs.c           |   4 +-
 demos/gtk-demo/css_shadows.c           |   4 +-
 demos/gtk-demo/dropdown.c              |   2 +-
 demos/gtk-demo/fontify.c               |  61 ++--
 demos/gtk-demo/fontrendering.c         |  20 +-
 demos/gtk-demo/hypertext.c             |   2 +-
 demos/gtk-demo/iconscroll.c            |   4 +-
 demos/gtk-demo/markup.txt              |   6 +-
 demos/gtk-demo/meson.build             |   2 +-
 demos/gtk-demo/pickers.c               |   2 +-
 demos/gtk-demo/printing.c              |  17 +-
 demos/gtk-demo/rotated_text.c          |   9 +-
 demos/gtk-demo/textview.c              |   4 +-
 demos/node-editor/node-editor-window.c |   2 +-
 demos/print-editor/print-editor.c      |  38 +--
 gdk/gdkpango.c                         | 117 +++-----
 gdk/gdkpango.h                         |  22 +-
 gdk/gdkrgba.c                          |   5 +-
 gdk/wayland/gdkkeys-wayland.c          |   2 -
 gdk/x11/gdkkeys-x11.c                  |   2 -
 gsk/gskrendernodeparser.c              |  24 +-
 gtk/a11y/gtkatspipango.c               | 221 +++++++-------
 gtk/a11y/gtkatspipangoprivate.h        |   2 +-
 gtk/a11y/gtkatspitextbuffer.c          |   6 +-
 gtk/gskpango.c                         |  79 +++--
 gtk/gskpango.h                         |   9 -
 gtk/gtkaboutdialog.c                   |   2 +-
 gtk/gtkcellrendererprogress.c          |   6 +-
 gtk/gtkcellrenderertext.c              | 127 ++++----
 gtk/gtkcolorbutton.c                   |   3 +-
 gtk/gtkcssenumvalue.c                  |  10 +-
 gtk/gtkcssstyle.c                      |  45 ++-
 gtk/gtkemojichooser.c                  |  10 +-
 gtk/gtkfontbutton.c                    |  51 ++--
 gtk/gtkfontchooser.c                   |   8 +-
 gtk/gtkfontchooserwidget.c             |  64 +---
 gtk/gtkglarea.c                        |   7 +-
 gtk/gtkimage.c                         |   2 +-
 gtk/gtkimcontextsimple.c               |   2 +-
 gtk/gtkimcontextwayland.c              |   2 +-
 gtk/gtkinscription.c                   |  25 +-
 gtk/gtklabel.c                         | 116 ++++----
 gtk/gtkmain.c                          |   3 -
 gtk/gtkpango.c                         |  80 +++--
 gtk/gtkprintcontext.c                  |  10 +-
 gtk/gtkprintunixdialog.c               |   8 +-
 gtk/gtksettings.c                      |  11 +-
 gtk/gtkstylecontext.c                  |   2 +-
 gtk/gtktext.c                          |  87 +++---
 gtk/gtktextattributes.c                |   4 +
 gtk/gtktextattributes.h                |   7 +-
 gtk/gtktextbuffer.c                    |  68 ++---
 gtk/gtktextlayout.c                    | 514 +++++++++++++++++----------------
 gtk/gtktextlayoutprivate.h             |   6 -
 gtk/gtktexttag.c                       |  38 ++-
 gtk/gtktexttagprivate.h                |   1 +
 gtk/gtktextutil.c                      |  77 +++--
 gtk/gtktextview.c                      |  20 +-
 gtk/gtkwidget.c                        |   6 +-
 gtk/inspector/css-editor.ui            |   5 +-
 gtk/inspector/fpsoverlay.c             |   9 +-
 gtk/inspector/general.c                |   8 +-
 gtk/meson.build                        |   6 +-
 meson.build                            |  33 +--
 subprojects/pango.wrap                 |   2 +-
 tests/rendernode-create-tests.c        |  31 +-
 tests/simple.c                         |  12 +-
 tests/testdropdown.c                   |   2 +-
 tests/testfontchooserdialog.c          |   8 +-
 tests/testgtk.c                        | 154 +++++-----
 tests/testprintfileoperation.c         |  36 +--
 testsuite/gtk/builder.c                |  12 +-
 testsuite/gtk/label.c                  |  68 +++--
 77 files changed, 1188 insertions(+), 1299 deletions(-)
---
diff --git a/.gitlab-ci/test-msys2.sh b/.gitlab-ci/test-msys2.sh
index 0929a6133c..318ac928d6 100644
--- a/.gitlab-ci/test-msys2.sh
+++ b/.gitlab-ci/test-msys2.sh
@@ -28,7 +28,7 @@ pacman --noconfirm -S --needed \
     mingw-w64-$MSYS2_ARCH-graphene \
     mingw-w64-$MSYS2_ARCH-json-glib \
     mingw-w64-$MSYS2_ARCH-libepoxy \
-    mingw-w64-$MSYS2_ARCH-pango \
+    mingw-w64-$MSYS2_ARCH-pango2 \
     mingw-w64-$MSYS2_ARCH-fribidi \
     mingw-w64-$MSYS2_ARCH-gst-plugins-bad-libs \
     mingw-w64-$MSYS2_ARCH-shared-mime-info \
diff --git a/demos/gtk-demo/combobox.c b/demos/gtk-demo/combobox.c
index d7a7320eb0..dd852ebcb5 100644
--- a/demos/gtk-demo/combobox.c
+++ b/demos/gtk-demo/combobox.c
@@ -261,9 +261,10 @@ mask_entry_set_background (MaskEntry *entry)
       if (!g_regex_match_simple (entry->mask, gtk_editable_get_text (GTK_EDITABLE (entry)), 0, 0))
         {
           PangoAttrList *attrs;
+          PangoColor color = { 65535, 32767, 32767, 65535 };
 
           attrs = pango_attr_list_new ();
-          pango_attr_list_insert (attrs, pango_attr_foreground_new (65535, 32767, 32767));
+          pango_attr_list_insert (attrs, pango_attr_foreground_new (&color));
           gtk_entry_set_attributes (GTK_ENTRY (entry), attrs);
           pango_attr_list_unref (attrs);
           return;
diff --git a/demos/gtk-demo/css_basics.c b/demos/gtk-demo/css_basics.c
index 1c9f309800..6c6081d774 100644
--- a/demos/gtk-demo/css_basics.c
+++ b/demos/gtk-demo/css_basics.c
@@ -84,11 +84,11 @@ do_css_basics (GtkWidget *do_widget)
       text = gtk_text_buffer_new (NULL);
       gtk_text_buffer_create_tag (text,
                                   "warning",
-                                  "underline", PANGO_UNDERLINE_SINGLE,
+                                  "underline", PANGO_LINE_STYLE_SOLID,
                                   NULL);
       gtk_text_buffer_create_tag (text,
                                   "error",
-                                  "underline", PANGO_UNDERLINE_ERROR,
+                                  "underline", PANGO_LINE_STYLE_DOTTED,
                                   NULL);
 
       provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
diff --git a/demos/gtk-demo/css_multiplebgs.c b/demos/gtk-demo/css_multiplebgs.c
index b3badee669..bc024ac1dc 100644
--- a/demos/gtk-demo/css_multiplebgs.c
+++ b/demos/gtk-demo/css_multiplebgs.c
@@ -122,11 +122,11 @@ do_css_multiplebgs (GtkWidget *do_widget)
       text = gtk_text_buffer_new (NULL);
       gtk_text_buffer_create_tag (text,
                                   "warning",
-                                  "underline", PANGO_UNDERLINE_SINGLE,
+                                  "underline", PANGO_LINE_STYLE_SOLID,
                                   NULL);
       gtk_text_buffer_create_tag (text,
                                   "error",
-                                  "underline", PANGO_UNDERLINE_ERROR,
+                                  "underline", PANGO_LINE_STYLE_DOTTED,
                                   NULL);
 
       provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
diff --git a/demos/gtk-demo/css_pixbufs.c b/demos/gtk-demo/css_pixbufs.c
index 9cf4b14549..4dbb201daf 100644
--- a/demos/gtk-demo/css_pixbufs.c
+++ b/demos/gtk-demo/css_pixbufs.c
@@ -93,11 +93,11 @@ do_css_pixbufs (GtkWidget *do_widget)
       text = gtk_text_buffer_new (NULL);
       gtk_text_buffer_create_tag (text,
                                   "warning",
-                                  "underline", PANGO_UNDERLINE_SINGLE,
+                                  "underline", PANGO_LINE_STYLE_SOLID,
                                   NULL);
       gtk_text_buffer_create_tag (text,
                                   "error",
-                                  "underline", PANGO_UNDERLINE_ERROR,
+                                  "underline", PANGO_LINE_STYLE_DOTTED,
                                   NULL);
 
       provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
diff --git a/demos/gtk-demo/css_shadows.c b/demos/gtk-demo/css_shadows.c
index cb534a451c..e9e9346218 100644
--- a/demos/gtk-demo/css_shadows.c
+++ b/demos/gtk-demo/css_shadows.c
@@ -111,11 +111,11 @@ do_css_shadows (GtkWidget *do_widget)
       text = gtk_text_buffer_new (NULL);
       gtk_text_buffer_create_tag (text,
                                   "warning",
-                                  "underline", PANGO_UNDERLINE_SINGLE,
+                                  "underline", PANGO_LINE_STYLE_SOLID,
                                   NULL);
       gtk_text_buffer_create_tag (text,
                                   "error",
-                                  "underline", PANGO_UNDERLINE_ERROR,
+                                  "underline", PANGO_LINE_STYLE_DOTTED,
                                   NULL);
 
       provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
diff --git a/demos/gtk-demo/dropdown.c b/demos/gtk-demo/dropdown.c
index aea35f7bcb..c517737a2a 100644
--- a/demos/gtk-demo/dropdown.c
+++ b/demos/gtk-demo/dropdown.c
@@ -434,7 +434,7 @@ do_dropdown (GtkWidget *do_widget)
 
       button = gtk_drop_down_new (NULL, NULL);
 
-      model = G_LIST_MODEL (pango_cairo_font_map_get_default ());
+      model = G_LIST_MODEL (pango_font_map_get_default ());
       gtk_drop_down_set_model (GTK_DROP_DOWN (button), model);
       gtk_drop_down_set_selected (GTK_DROP_DOWN (button), 0);
 
diff --git a/demos/gtk-demo/fontify.c b/demos/gtk-demo/fontify.c
index cdbdf654d3..18ffb8b936 100644
--- a/demos/gtk-demo/fontify.c
+++ b/demos/gtk-demo/fontify.c
@@ -27,13 +27,12 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
   GSList *attrs, *l;
   GtkTextTag *tag;
   char name[256];
-  float fg_alpha, bg_alpha;
 
   table = gtk_text_buffer_get_tag_table (buffer);
 
 #define LANGUAGE_ATTR(attr_name) \
     { \
-      const char *language = pango_language_to_string (((PangoAttrLanguage*)attr)->value); \
+      const char *language = pango_language_to_string (attr->lang_value); \
       g_snprintf (name, 256, "language=%s", language); \
       tag = gtk_text_tag_table_lookup (table, name); \
       if (!tag) \
@@ -48,7 +47,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
 
 #define STRING_ATTR(attr_name) \
     { \
-      const char *string = ((PangoAttrString*)attr)->value; \
+      const char *string = attr->str_value; \
       g_snprintf (name, 256, #attr_name "=%s", string); \
       tag = gtk_text_tag_table_lookup (table, name); \
       if (!tag) \
@@ -63,7 +62,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
 
 #define INT_ATTR(attr_name) \
     { \
-      int value = ((PangoAttrInt*)attr)->value; \
+      int value = attr->int_value; \
       g_snprintf (name, 256, #attr_name "=%d", value); \
       tag = gtk_text_tag_table_lookup (table, name); \
       if (!tag) \
@@ -78,7 +77,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
 
 #define FONT_ATTR(attr_name) \
     { \
-      PangoFontDescription *desc = ((PangoAttrFontDesc*)attr)->desc; \
+      PangoFontDescription *desc = attr->font_value; \
       char *str = pango_font_description_to_string (desc); \
       g_snprintf (name, 256, "font-desc=%s", str); \
       g_free (str); \
@@ -95,7 +94,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
 
 #define FLOAT_ATTR(attr_name) \
     { \
-      float value = ((PangoAttrFloat*)attr)->value; \
+      float value = attr->double_value; \
       g_snprintf (name, 256, #attr_name "=%g", value); \
       tag = gtk_text_tag_table_lookup (table, name); \
       if (!tag) \
@@ -108,15 +107,15 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
       gtk_text_buffer_apply_tag (buffer, tag, start, end); \
     }
 
-#define RGBA_ATTR(attr_name, alpha_value) \
+#define RGBA_ATTR(attr_name) \
     { \
       PangoColor *color; \
       GdkRGBA rgba; \
-      color = &((PangoAttrColor*)attr)->color; \
+      color = &attr->color_value; \
       rgba.red = color->red / 65535.; \
       rgba.green = color->green / 65535.; \
       rgba.blue = color->blue / 65535.; \
-      rgba.alpha = alpha_value; \
+      rgba.alpha = color->alpha / 65535.; \
       char *str = gdk_rgba_to_string (&rgba); \
       g_snprintf (name, 256, #attr_name "=%s", str); \
       g_free (str); \
@@ -144,33 +143,12 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
       gtk_text_buffer_apply_tag (buffer, tag, start, end); \
     }
 
-  fg_alpha = bg_alpha = 1.;
-
   attrs = pango_attr_iterator_get_attrs (iter);
   for (l = attrs; l; l = l->next)
     {
       PangoAttribute *attr = l->data;
 
-      switch ((int)attr->klass->type)
-        {
-        case PANGO_ATTR_FOREGROUND_ALPHA:
-          fg_alpha = ((PangoAttrInt*)attr)->value / 65535.;
-          break;
-
-        case PANGO_ATTR_BACKGROUND_ALPHA:
-          bg_alpha = ((PangoAttrInt*)attr)->value / 65535.;
-          break;
-
-        default:
-          break;
-        }
-    }
-
-  for (l = attrs; l; l = l->next)
-    {
-      PangoAttribute *attr = l->data;
-
-      switch (attr->klass->type)
+      switch (attr->type)
         {
         case PANGO_ATTR_LANGUAGE:
           LANGUAGE_ATTR (language);
@@ -205,11 +183,11 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           break;
 
         case PANGO_ATTR_FOREGROUND:
-          RGBA_ATTR (foreground_rgba, fg_alpha);
+          RGBA_ATTR (foreground_rgba);
           break;
 
         case PANGO_ATTR_BACKGROUND:
-          RGBA_ATTR (background_rgba, bg_alpha);
+          RGBA_ATTR (background_rgba);
           break;
 
         case PANGO_ATTR_UNDERLINE:
@@ -217,7 +195,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           break;
 
         case PANGO_ATTR_UNDERLINE_COLOR:
-          RGBA_ATTR (underline_rgba, fg_alpha);
+          RGBA_ATTR (underline_rgba);
           break;
 
         case PANGO_ATTR_OVERLINE:
@@ -225,7 +203,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           break;
 
         case PANGO_ATTR_OVERLINE_COLOR:
-          RGBA_ATTR (overline_rgba, fg_alpha);
+          RGBA_ATTR (overline_rgba);
           break;
 
         case PANGO_ATTR_STRIKETHROUGH:
@@ -233,7 +211,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           break;
 
         case PANGO_ATTR_STRIKETHROUGH_COLOR:
-          RGBA_ATTR (strikethrough_rgba, fg_alpha);
+          RGBA_ATTR (strikethrough_rgba);
           break;
 
         case PANGO_ATTR_RISE:
@@ -275,6 +253,10 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
         case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT:
           break;
 
+        case PANGO_ATTR_LINE_SPACING:
+          INT_ATTR (pixels_inside_wrap);
+          break;
+
         case PANGO_ATTR_WORD:
           VOID_ATTR (word);
           break;
@@ -283,6 +265,10 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           VOID_ATTR (sentence);
           break;
 
+        case PANGO_ATTR_PARAGRAPH:
+          VOID_ATTR (paragraph);
+          break;
+
         case PANGO_ATTR_BASELINE_SHIFT:
           INT_ATTR (baseline_shift);
           break;
@@ -291,12 +277,9 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           INT_ATTR (font_scale);
           break;
 
-        case PANGO_ATTR_SHAPE:
         case PANGO_ATTR_ABSOLUTE_SIZE:
         case PANGO_ATTR_GRAVITY:
         case PANGO_ATTR_GRAVITY_HINT:
-        case PANGO_ATTR_FOREGROUND_ALPHA:
-        case PANGO_ATTR_BACKGROUND_ALPHA:
           break;
 
         case PANGO_ATTR_TEXT_TRANSFORM:
diff --git a/demos/gtk-demo/fontrendering.c b/demos/gtk-demo/fontrendering.c
index 283523f481..3815b2f844 100644
--- a/demos/gtk-demo/fontrendering.c
+++ b/demos/gtk-demo/fontrendering.c
@@ -95,8 +95,8 @@ update_image (void)
       layout = pango_layout_new (context);
       pango_layout_set_font_description (layout, desc);
       pango_layout_set_text (layout, text, -1);
-      pango_layout_get_extents (layout, &ink, &logical);
-      baseline = pango_layout_get_baseline (layout);
+      pango_lines_get_extents (pango_layout_get_lines (layout), &ink, &logical);
+      baseline = pango_lines_get_baseline (pango_layout_get_lines (layout));
 
       pango_extents_to_pixels (&ink, NULL);
 
@@ -206,8 +206,9 @@ update_image (void)
     }
   else
     {
-      PangoLayoutIter *iter;
-      PangoLayoutRun *run;
+      PangoLineIter *iter;
+      PangoRun *run;
+      PangoGlyphString *glyphs;
       PangoGlyphInfo *g;
       int i, j;
       GString *str;
@@ -230,7 +231,7 @@ update_image (void)
       pango_layout_set_font_description (layout, desc);
       pango_layout_set_text (layout, str->str, -1);
       g_string_free (str, TRUE);
-      pango_layout_get_extents (layout, &ink, &logical);
+      pango_lines_get_extents (pango_layout_get_lines (layout), &ink, &logical);
       pango_extents_to_pixels (&logical, NULL);
 
       surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, logical.width * 3 / 2, 4*logical.height);
@@ -239,12 +240,13 @@ update_image (void)
       cairo_paint (cr);
 
       iter = pango_layout_get_iter (layout);
-      run = pango_layout_iter_get_run (iter);
+      run = pango_line_iter_get_run (iter);
+      glyphs = pango_run_get_glyphs (run);
 
       cairo_set_source_rgb (cr, 0, 0, 0);
       for (i = 0; i < 4; i++)
         {
-          g = &(run->glyphs->glyphs[2*i]);
+          g = &(glyphs->glyphs[2*i]);
           g->geometry.width = PANGO_UNITS_ROUND (g->geometry.width * 3 / 2);
         }
 
@@ -252,7 +254,7 @@ update_image (void)
         {
           for (i = 0; i < 4; i++)
             {
-              g = &(run->glyphs->glyphs[2*i]);
+              g = &(glyphs->glyphs[2*i]);
               g->geometry.x_offset = i * (PANGO_SCALE / 4);
               g->geometry.y_offset = j * (PANGO_SCALE / 4);
             }
@@ -262,7 +264,7 @@ update_image (void)
         }
 
       cairo_destroy (cr);
-      pango_layout_iter_free (iter);
+      pango_line_iter_free (iter);
       g_object_unref (layout);
 
       pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), 
cairo_image_surface_get_height (surface));
diff --git a/demos/gtk-demo/hypertext.c b/demos/gtk-demo/hypertext.c
index a704784815..27c8fa1e70 100644
--- a/demos/gtk-demo/hypertext.c
+++ b/demos/gtk-demo/hypertext.c
@@ -29,7 +29,7 @@ insert_link (GtkTextBuffer *buffer,
 
   tag = gtk_text_buffer_create_tag (buffer, NULL,
                                     "foreground", "blue",
-                                    "underline", PANGO_UNDERLINE_SINGLE,
+                                    "underline", PANGO_LINE_STYLE_SOLID,
                                     NULL);
   g_object_set_data (G_OBJECT (tag), "page", GINT_TO_POINTER (page));
   gtk_text_buffer_insert_with_tags (buffer, iter, text, -1, tag, NULL);
diff --git a/demos/gtk-demo/iconscroll.c b/demos/gtk-demo/iconscroll.c
index 8212818516..244f3f8987 100644
--- a/demos/gtk-demo/iconscroll.c
+++ b/demos/gtk-demo/iconscroll.c
@@ -123,11 +123,11 @@ populate_emoji_text (void)
   for (int i = 0; i < 500; i++)
     {
       if (i % 2)
-        g_string_append (s, "<span underline=\"single\" underline_color=\"red\">x</span>");
+        g_string_append (s, "<span underline=\"solid\" underline_color=\"red\">x</span>");
       for (int j = 0; j < 30; j++)
         {
           g_string_append (s, "💓");
-          g_string_append (s, "<span underline=\"single\" underline_color=\"red\">x</span>");
+          g_string_append (s, "<span underline=\"solid\" underline_color=\"red\">x</span>");
         }
       g_string_append (s, "\n");
     }
diff --git a/demos/gtk-demo/markup.txt b/demos/gtk-demo/markup.txt
index 96399b9d81..a3c47370a9 100644
--- a/demos/gtk-demo/markup.txt
+++ b/demos/gtk-demo/markup.txt
@@ -7,9 +7,9 @@ Text weights: <span weight="thin">thin</span> <span weight="light">light</span>
 
 Text <span color="gray">c<span color="green">o</span>l<span color="tomato">o</span>rs</span> and <span 
background="pink">backgrounds</span>
 
-Colorful <span underline="low" underline-color="blue"><span underline="double" 
underline-color="red">under</span>lines</span> and <span background="pink"><span 
underline="error">mo</span><span underline="error" underline-color="green">re</span></span>
+Colorful <span underline_position="under" underline-color="blue"><span underline="double" 
underline-color="red">under</span>lines</span> and <span background="pink"><span 
underline="wavy">mo</span><span underline="wavy" underline-color="green">re</span></span>
 
-Colorful <span strikethrough="true" strikethrough-color="magenta">strikethroughs</span> and <span 
overline="single" overline_color="green">overlines</span>
+Colorful <span strikethrough="solid" strikethrough-color="magenta">strikethroughs</span> and <span 
overline="solid" overline_color="green">overlines</span>
 
 Superscripts and subscripts: 𝜀<span rise="-6000" size="x-small" font_desc="italic">0</span> = 𝜔<span 
rise="8000" size="smaller">𝜔<span rise="14000" size="smaller">𝜔<span rise="20000">.<span rise="23000">.<span 
rise="26000">.</span></span></span></span></span>
 
@@ -19,7 +19,7 @@ OpenType font features: <span font_desc="sans regular" font_features="dlig=0">fe
 
 Shortcuts: <tt>Monospace</tt> – <b>Bold</b> – <i>Italic</i> – <big>Big</big> – <small>Small</small> – 
<u>Underlined</u> – <s>Strikethrough</s> – Super<sup>script</sup> – Sub<sub>script</sub>
 
-hy­phen­ation al­go­rithm is a <span allow_breaks="false" style="italic">set of rules</span>, espe­ci­ally 
one co­di­fied for im­ple­men­tation in a com­pu­ter pro­gram, that de­ci­des at which points a word can be 
bro­ken over two lines with a hy­phen. For ex­am­ple, a hy­phen­ation al­go­rithm might de­cide that 
im­peach­ment can be broken as impeach‧ment or im‧peachment but not impe‧achment.
+A hy­phen­ation al­go­rithm is a <span allow_breaks="false" style="italic">set of rules</span>, espe­ci­ally 
one co­di­fied for im­ple­men­tation in a com­pu­ter pro­gram, that de­ci­des at which points a word can be 
bro­ken over two lines with a hy­phen. For ex­am­ple, a hy­phen­ation al­go­rithm might de­cide that 
im­peach­ment can be broken as impeach‧ment or im‧peachment but not impe‧achment.
 
 <span insert_hyphens="false">one/two three/four five/six seven/eight nine/ten</span>
 
diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build
index ef89fbc7d2..c78c335049 100644
--- a/demos/gtk-demo/meson.build
+++ b/demos/gtk-demo/meson.build
@@ -75,7 +75,7 @@ demos = files([
   'printing.c',
   'read_more.c',
   'revealer.c',
-  'rotated_text.c',
+  #'rotated_text.c', FIXME
   'scale.c',
   'search_entry.c',
   'search_entry2.c',
diff --git a/demos/gtk-demo/pickers.c b/demos/gtk-demo/pickers.c
index 635a7f9149..866dbcb24a 100644
--- a/demos/gtk-demo/pickers.c
+++ b/demos/gtk-demo/pickers.c
@@ -26,7 +26,7 @@ filter_font_cb (const PangoFontFamily *family,
   };
   const char *family_name;
 
-  family_name = pango_font_family_get_name (PANGO_FONT_FAMILY (family));
+  family_name = pango_font_family_get_name ((PangoFontFamily *)family);
 
   return g_strv_contains (alias_families, family_name);
 }
diff --git a/demos/gtk-demo/printing.c b/demos/gtk-demo/printing.c
index beef569f25..2633f8a3aa 100644
--- a/demos/gtk-demo/printing.c
+++ b/demos/gtk-demo/printing.c
@@ -60,7 +60,7 @@ draw_page (GtkPrintOperation *operation,
   PrintData *data = (PrintData *)user_data;
   cairo_t *cr;
   PangoLayout *layout;
-  int text_width, text_height;
+  PangoRectangle ext;
   double width;
   int line, i;
   PangoFontDescription *desc;
@@ -85,16 +85,18 @@ draw_page (GtkPrintOperation *operation,
   pango_font_description_free (desc);
 
   pango_layout_set_text (layout, data->resourcename, -1);
-  pango_layout_get_pixel_size (layout, &text_width, &text_height);
+  pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+  pango_extents_to_pixels (&ext, NULL);
 
-  if (text_width > width)
+  if (ext.width > width)
     {
       pango_layout_set_width (layout, width);
       pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_START);
-      pango_layout_get_pixel_size (layout, &text_width, &text_height);
+      pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+      pango_extents_to_pixels (&ext, NULL);
     }
 
-  cairo_move_to (cr, (width - text_width) / 2,  (HEADER_HEIGHT - text_height) / 2);
+  cairo_move_to (cr, (width - ext.width) / 2,  (HEADER_HEIGHT - ext.height) / 2);
   pango_cairo_show_layout (cr, layout);
 
   page_str = g_strdup_printf ("%d/%d", page_nr + 1, data->num_pages);
@@ -102,8 +104,9 @@ draw_page (GtkPrintOperation *operation,
   g_free (page_str);
 
   pango_layout_set_width (layout, -1);
-  pango_layout_get_pixel_size (layout, &text_width, &text_height);
-  cairo_move_to (cr, width - text_width - 4, (HEADER_HEIGHT - text_height) / 2);
+  pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+  pango_extents_to_pixels (&ext, NULL);
+  cairo_move_to (cr, width - ext.width - 4, (HEADER_HEIGHT - ext.height) / 2);
   pango_cairo_show_layout (cr, layout);
 
   g_object_unref (layout);
diff --git a/demos/gtk-demo/rotated_text.c b/demos/gtk-demo/rotated_text.c
index 4f2c3f9513..bb97fb8baf 100644
--- a/demos/gtk-demo/rotated_text.c
+++ b/demos/gtk-demo/rotated_text.c
@@ -63,7 +63,7 @@ create_fancy_attr_list_for_layout (PangoLayout *layout)
   logical_rect.y = -ascent;
   logical_rect.height = ascent;
   ink_rect = logical_rect;
-  pango_font_metrics_unref (metrics);
+  pango_font_metrics_free (metrics);
 
   /* Set fancy shape attributes for all hearts */
   attrs = pango_attr_list_new ();
@@ -142,13 +142,14 @@ rotated_text_draw (GtkDrawingArea *da,
   /* Draw the layout N_WORDS times in a circle */
   for (i = 0; i < N_WORDS; i++)
     {
-      int layout_width, layout_height;
+      PangoRectangle ext;
 
       /* Inform Pango to re-layout the text with the new transformation matrix */
       pango_cairo_update_layout (cr, layout);
 
-      pango_layout_get_pixel_size (layout, &layout_width, &layout_height);
-      cairo_move_to (cr, - layout_width / 2, - RADIUS * .9);
+      pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+      pango_extents_to_pixels (&ext, NULL);
+      cairo_move_to (cr, - ext.width / 2, - RADIUS * .9);
       pango_cairo_show_layout (cr, layout);
 
       /* Rotate for the next turn */
diff --git a/demos/gtk-demo/textview.c b/demos/gtk-demo/textview.c
index 8d58099cff..c622a75b1f 100644
--- a/demos/gtk-demo/textview.c
+++ b/demos/gtk-demo/textview.c
@@ -100,10 +100,10 @@ create_tags (GtkTextBuffer *buffer)
                               "strikethrough", TRUE, NULL);
 
   gtk_text_buffer_create_tag (buffer, "underline",
-                              "underline", PANGO_UNDERLINE_SINGLE, NULL);
+                              "underline", PANGO_LINE_STYLE_SOLID, NULL);
 
   gtk_text_buffer_create_tag (buffer, "double_underline",
-                              "underline", PANGO_UNDERLINE_DOUBLE, NULL);
+                              "underline", PANGO_LINE_STYLE_DOUBLE, NULL);
 
   gtk_text_buffer_create_tag (buffer, "superscript",
                               "rise", 10 * PANGO_SCALE,   /* 10 pixels */
diff --git a/demos/node-editor/node-editor-window.c b/demos/node-editor/node-editor-window.c
index 68f261183a..c792b45d0d 100644
--- a/demos/node-editor/node-editor-window.c
+++ b/demos/node-editor/node-editor-window.c
@@ -1060,7 +1060,7 @@ node_editor_window_init (NodeEditorWindow *self)
   gtk_text_tag_table_add (self->tag_table,
                           g_object_new (GTK_TYPE_TEXT_TAG,
                                         "name", "error",
-                                        "underline", PANGO_UNDERLINE_ERROR,
+                                        "underline", PANGO_LINE_STYLE_DOTTED,
                                         NULL));
   gtk_text_tag_table_add (self->tag_table,
                           g_object_new (GTK_TYPE_TEXT_TAG,
diff --git a/demos/print-editor/print-editor.c b/demos/print-editor/print-editor.c
index ca5d143d06..344c06b018 100644
--- a/demos/print-editor/print-editor.c
+++ b/demos/print-editor/print-editor.c
@@ -212,12 +212,13 @@ begin_print (GtkPrintOperation *operation,
             PrintData *print_data)
 {
   PangoFontDescription *desc;
-  PangoLayoutLine *layout_line;
+  PangoLines *lines;
+  PangoLine *line;
   double width, height;
   double page_height;
   GList *page_breaks;
   int num_lines;
-  int line;
+  int i;
 
   width = gtk_print_context_get_width (context);
   height = gtk_print_context_get_height (context);
@@ -232,18 +233,19 @@ begin_print (GtkPrintOperation *operation,
 
   pango_layout_set_text (print_data->layout, print_data->text, -1);
 
-  num_lines = pango_layout_get_line_count (print_data->layout);
+  lines = pango_layout_get_lines (print_data->layout);
+  num_lines = pango_lines_get_line_count (lines);
 
   page_breaks = NULL;
   page_height = 0;
 
-  for (line = 0; line < num_lines; line++)
+  for (i = 0; i < num_lines; i++)
     {
-      PangoRectangle ink_rect, logical_rect;
+      PangoRectangle logical_rect;
       double line_height;
 
-      layout_line = pango_layout_get_line (print_data->layout, line);
-      pango_layout_line_get_extents (layout_line, &ink_rect, &logical_rect);
+      line = pango_lines_get_lines (lines)[i];
+      pango_line_get_extents (line, NULL, &logical_rect);
 
       line_height = logical_rect.height / 1024.0;
 
@@ -271,7 +273,7 @@ draw_page (GtkPrintOperation *operation,
   cairo_t *cr;
   GList *pagebreak;
   int start, end, i;
-  PangoLayoutIter *iter;
+  PangoLineIter *iter;
   double start_pos;
 
   if (page_nr == 0)
@@ -284,7 +286,7 @@ draw_page (GtkPrintOperation *operation,
 
   pagebreak = g_list_nth (print_data->page_breaks, page_nr);
   if (pagebreak == NULL)
-    end = pango_layout_get_line_count (print_data->layout);
+    end = pango_lines_get_line_count (pango_layout_get_lines (print_data->layout));
   else
     end = GPOINTER_TO_INT (pagebreak->data);
 
@@ -297,30 +299,30 @@ draw_page (GtkPrintOperation *operation,
   iter = pango_layout_get_iter (print_data->layout);
   do
     {
-      PangoRectangle   logical_rect;
-      PangoLayoutLine *line;
-      int              baseline;
+      PangoRectangle logical_rect;
+      PangoLine *line;
+      int baseline;
 
       if (i >= start)
        {
-         line = pango_layout_iter_get_line (iter);
+         line = pango_line_iter_get_line (iter);
 
-         pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
-         baseline = pango_layout_iter_get_baseline (iter);
+         pango_line_iter_get_line_extents (iter, NULL, &logical_rect);
+         baseline = pango_line_iter_get_line_baseline (iter);
 
          if (i == start)
            start_pos = logical_rect.y / 1024.0;
 
          cairo_move_to (cr, logical_rect.x / 1024.0, baseline / 1024.0 - start_pos);
 
-         pango_cairo_show_layout_line  (cr, line);
+         pango_cairo_show_line  (cr, line);
        }
       i++;
     }
   while (i < end &&
-        pango_layout_iter_next_line (iter));
+        pango_line_iter_next_line (iter));
 
-  pango_layout_iter_free (iter);
+  pango_line_iter_free (iter);
 }
 
 static void
diff --git a/gdk/gdkpango.c b/gdk/gdkpango.c
index 4da170baea..e6836e9aa0 100644
--- a/gdk/gdkpango.c
+++ b/gdk/gdkpango.c
@@ -30,25 +30,29 @@
  * region which contains the given ranges, i.e. if you draw with the
  * region as clip, only the given ranges are drawn.
  */
-static cairo_region_t*
-layout_iter_get_line_clip_region (PangoLayoutIter *iter,
-                                 int              x_origin,
-                                 int              y_origin,
-                                 const int       *index_ranges,
-                                 int              n_ranges)
+static cairo_region_t *
+layout_iter_get_line_clip_region (PangoLineIter *iter,
+                                  int              x_origin,
+                                  int              y_origin,
+                                  const int       *index_ranges,
+                                  int              n_ranges)
 {
-  PangoLayoutLine *line;
+  PangoLines *lines;
+  PangoLine *line;
   cairo_region_t *clip_region;
   PangoRectangle logical_rect;
   int baseline;
   int i;
+  int start_index, length;
 
-  line = pango_layout_iter_get_line_readonly (iter);
+  lines = pango_line_iter_get_lines (iter);
+  line = pango_line_iter_get_line (iter);
+  pango_line_get_text (line, &start_index, &length);
 
   clip_region = cairo_region_create ();
 
-  pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
-  baseline = pango_layout_iter_get_baseline (iter);
+  pango_line_iter_get_line_extents (iter, NULL, &logical_rect);
+  baseline = pango_line_iter_get_line_baseline (iter);
 
   i = 0;
   while (i < n_ranges)
@@ -57,22 +61,22 @@ layout_iter_get_line_clip_region (PangoLayoutIter *iter,
       int n_pixel_ranges = 0;
       int j;
 
-      /* Note that get_x_ranges returns layout coordinates
-       */
-      if (index_ranges[i*2+1] >= pango_layout_line_get_start_index (line) &&
-         index_ranges[i*2] < pango_layout_line_get_start_index (line) + pango_layout_line_get_length (line))
-       pango_layout_line_get_x_ranges (line,
-                                       index_ranges[i*2],
-                                       index_ranges[i*2+1],
-                                       &pixel_ranges, &n_pixel_ranges);
+      /* Note that get_x_ranges returns layout coordinates */
+      if (index_ranges[i*2+1] >= pango_line_get_start_index (line) &&
+         index_ranges[i*2] < pango_line_get_start_index (line) + pango_line_get_length (line))
+        pango_lines_get_x_ranges (lines,
+                                  line,
+                                  NULL, index_ranges[i*2],
+                                  NULL, index_ranges[i*2+1],
+                                  &pixel_ranges, &n_pixel_ranges);
 
       for (j = 0; j < n_pixel_ranges; j++)
         {
           GdkRectangle rect;
-         int x_off, y_off;
+          int x_off, y_off;
 
           x_off = PANGO_PIXELS (pixel_ranges[2*j] - logical_rect.x);
-         y_off = PANGO_PIXELS (baseline - logical_rect.y);
+          y_off = PANGO_PIXELS (baseline - logical_rect.y);
 
           rect.x = x_origin + x_off;
           rect.y = y_origin - y_off;
@@ -88,57 +92,6 @@ layout_iter_get_line_clip_region (PangoLayoutIter *iter,
   return clip_region;
 }
 
-/**
- * gdk_pango_layout_line_get_clip_region: (skip)
- * @line: a `PangoLayoutLine`
- * @x_origin: X pixel where you intend to draw the layout line with this clip
- * @y_origin: baseline pixel where you intend to draw the layout line with this clip
- * @index_ranges: (array): array of byte indexes into the layout, where even
- *   members of array are start indexes and odd elements are end indexes
- * @n_ranges: number of ranges in @index_ranges, i.e. half the size of @index_ranges
- *
- * Obtains a clip region which contains the areas where the given
- * ranges of text would be drawn.
- *
- * @x_origin and @y_origin are the top left position of the layout.
- * @index_ranges should contain ranges of bytes in the layout’s text.
- * The clip region will include space to the left or right of the line
- * (to the layout bounding box) if you have indexes above or below the
- * indexes contained inside the line. This is to draw the selection all
- * the way to the side of the layout. However, the clip region is in line
- * coordinates, not layout coordinates.
- *
- * Note that the regions returned correspond to logical extents of the text
- * ranges, not ink extents. So the drawn line may in fact touch areas out of
- * the clip region.  The clip region is mainly useful for highlightling parts
- * of text, such as when text is selected.
- *
- * Returns: a clip region containing the given ranges
- */
-cairo_region_t*
-gdk_pango_layout_line_get_clip_region (PangoLayoutLine *line,
-                                       int              x_origin,
-                                       int              y_origin,
-                                       const int       *index_ranges,
-                                       int              n_ranges)
-{
-  cairo_region_t *clip_region;
-  PangoLayoutIter *iter;
-
-  g_return_val_if_fail (line != NULL, NULL);
-  g_return_val_if_fail (index_ranges != NULL, NULL);
-
-  iter = pango_layout_get_iter (line->layout);
-  while (pango_layout_iter_get_line_readonly (iter) != line)
-    pango_layout_iter_next_line (iter);
-
-  clip_region = layout_iter_get_line_clip_region(iter, x_origin, y_origin, index_ranges, n_ranges);
-
-  pango_layout_iter_free (iter);
-
-  return clip_region;
-}
-
 /**
  * gdk_pango_layout_get_clip_region: (skip)
  * @layout: a `PangoLayout`
@@ -160,14 +113,14 @@ gdk_pango_layout_line_get_clip_region (PangoLayoutLine *line,
  *
  * Returns: a clip region containing the given ranges
  */
-cairo_region_t*
+cairo_region_t *
 gdk_pango_layout_get_clip_region (PangoLayout *layout,
                                   int          x_origin,
                                   int          y_origin,
                                   const int   *index_ranges,
                                   int          n_ranges)
 {
-  PangoLayoutIter *iter;
+  PangoLineIter *iter;
   cairo_region_t *clip_region;
 
   g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
@@ -183,21 +136,21 @@ gdk_pango_layout_get_clip_region (PangoLayout *layout,
       cairo_region_t *line_region;
       int baseline;
 
-      pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
-      baseline = pango_layout_iter_get_baseline (iter);
+      pango_line_iter_get_line_extents (iter, NULL, &logical_rect);
+      baseline = pango_line_iter_get_line_baseline (iter);
 
-      line_region = layout_iter_get_line_clip_region(iter,
-                                                    x_origin + PANGO_PIXELS (logical_rect.x),
-                                                    y_origin + PANGO_PIXELS (baseline),
-                                                    index_ranges,
-                                                    n_ranges);
+      line_region = layout_iter_get_line_clip_region (iter,
+                                                      x_origin + PANGO_PIXELS (logical_rect.x),
+                                                      y_origin + PANGO_PIXELS (baseline),
+                                                      index_ranges,
+                                                      n_ranges);
 
       cairo_region_union (clip_region, line_region);
       cairo_region_destroy (line_region);
     }
-  while (pango_layout_iter_next_line (iter));
+  while (pango_line_iter_next_line (iter));
 
-  pango_layout_iter_free (iter);
+  pango_line_iter_free (iter);
 
   return clip_region;
 }
diff --git a/gdk/gdkpango.h b/gdk/gdkpango.h
index 5a674bc3d8..610ed4712e 100644
--- a/gdk/gdkpango.h
+++ b/gdk/gdkpango.h
@@ -1,5 +1,5 @@
 /* GDK - The GIMP Drawing Kit
- * Copyright (C) 2000 Red Hat, Inc. 
+ * Copyright (C) 2000 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -27,24 +27,12 @@
 
 G_BEGIN_DECLS
 
-/* Get a clip region to draw only part of a layout or
- * line. index_ranges contains alternating range starts/stops. The
- * region is the region which contains the given ranges, i.e. if you
- * draw with the region as clip, only the given ranges are drawn.
- */
-
-GDK_AVAILABLE_IN_ALL
-cairo_region_t    *gdk_pango_layout_line_get_clip_region (PangoLayoutLine *line,
-                                                     int              x_origin,
-                                                     int              y_origin,
-                                                     const int       *index_ranges,
-                                                     int              n_ranges);
 GDK_AVAILABLE_IN_ALL
 cairo_region_t    *gdk_pango_layout_get_clip_region      (PangoLayout     *layout,
-                                                     int              x_origin,
-                                                     int              y_origin,
-                                                     const int       *index_ranges,
-                                                     int              n_ranges);
+                                                          int              x_origin,
+                                                          int              y_origin,
+                                                          const int       *index_ranges,
+                                                          int              n_ranges);
 
 G_END_DECLS
 
diff --git a/gdk/gdkrgba.c b/gdk/gdkrgba.c
index 7732e507c8..118e04bdcc 100644
--- a/gdk/gdkrgba.c
+++ b/gdk/gdkrgba.c
@@ -224,19 +224,18 @@ gdk_rgba_parse (GdkRGBA    *rgba,
   else
     {
       PangoColor pango_color;
-      guint16 alpha;
 
       /* Resort on PangoColor for rgb.txt color
        * map and '#' prefixed colors
        */
-      if (pango_color_parse_with_alpha (&pango_color, &alpha, str))
+      if (pango_color_parse (&pango_color, str))
         {
           if (rgba)
             {
               rgba->red = pango_color.red / 65535.;
               rgba->green = pango_color.green / 65535.;
               rgba->blue = pango_color.blue / 65535.;
-              rgba->alpha = alpha / 65535.;
+              rgba->alpha = pango_color.alpha / 65535.;
             }
 
           return TRUE;
diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c
index 35ac9e8262..fdd534dbd3 100644
--- a/gdk/wayland/gdkkeys-wayland.c
+++ b/gdk/wayland/gdkkeys-wayland.c
@@ -432,8 +432,6 @@ update_direction (GdkWaylandKeymap *keymap)
                  case PANGO_DIRECTION_LTR:
                    rtl[layout]--;
                    break;
-                 case PANGO_DIRECTION_TTB_LTR:
-                 case PANGO_DIRECTION_TTB_RTL:
                  case PANGO_DIRECTION_WEAK_LTR:
                  case PANGO_DIRECTION_WEAK_RTL:
                  case PANGO_DIRECTION_NEUTRAL:
diff --git a/gdk/x11/gdkkeys-x11.c b/gdk/x11/gdkkeys-x11.c
index 93bb4312b4..d513fccb89 100644
--- a/gdk/x11/gdkkeys-x11.c
+++ b/gdk/x11/gdkkeys-x11.c
@@ -492,8 +492,6 @@ get_direction (XkbDescRec *xkb,
         case PANGO_DIRECTION_LTR:
           rtl_minus_ltr--;
           break;
-        case PANGO_DIRECTION_TTB_LTR:
-        case PANGO_DIRECTION_TTB_RTL:
         case PANGO_DIRECTION_WEAK_LTR:
         case PANGO_DIRECTION_WEAK_RTL:
         case PANGO_DIRECTION_NEUTRAL:
diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c
index 7e5a74db0c..8c1d320257 100644
--- a/gsk/gskrendernodeparser.c
+++ b/gsk/gskrendernodeparser.c
@@ -645,15 +645,12 @@ static PangoFont *
 font_from_string (const char *string)
 {
   PangoFontDescription *desc;
-  PangoFontMap *font_map;
   PangoContext *context;
   PangoFont *font;
 
   desc = pango_font_description_from_string (string);
-  font_map = pango_cairo_font_map_get_default ();
-  context = pango_font_map_create_context (font_map);
-  font = pango_font_map_load_font (font_map, context, desc);
-
+  context = pango_context_new ();
+  font = pango_context_load_font (context, desc);
   pango_font_description_free (desc);
   g_object_unref (context);
 
@@ -667,8 +664,8 @@ font_from_string (const char *string)
 static PangoGlyphString *
 create_ascii_glyphs (PangoFont *font)
 {
+#if 0
   PangoLanguage *language = pango_language_from_string ("en_US"); /* just pick one */
-  PangoCoverage *coverage;
   PangoAnalysis not_a_hack = {
     .shape_engine = NULL, /* unused */
     .lang_engine = NULL, /* unused by pango_shape() */
@@ -680,16 +677,15 @@ create_ascii_glyphs (PangoFont *font)
     .language = language,
     .extra_attrs = NULL
   };
+#endif
   PangoGlyphString *result, *glyph_string;
   guint i;
 
-  coverage = pango_font_get_coverage (font, language);
   for (i = MIN_ASCII_GLYPH; i < MAX_ASCII_GLYPH; i++)
     {
-      if (!pango_coverage_get (coverage, i))
+      if (!pango_font_face_has_char (pango_font_get_face (font), i))
         break;
     }
-  pango_coverage_unref (coverage);
   if (i < MAX_ASCII_GLYPH)
     return NULL;
 
@@ -704,11 +700,11 @@ create_ascii_glyphs (PangoFont *font)
       if (cairo_version () < CAIRO_VERSION_ENCODE (1, 17, 4))
         flags = PANGO_SHAPE_ROUND_POSITIONS;
 
-      pango_shape_with_flags (text, 1,
-                              text, 1,
-                              &not_a_hack,
-                              glyph_string,
-                              flags);
+      pango_shape (text, 1,
+                   text, 1,
+                   NULL, // &not_a_hack,
+                   glyph_string,
+                   flags);
 
       if (glyph_string->num_glyphs != 1)
         {
diff --git a/gtk/a11y/gtkatspipango.c b/gtk/a11y/gtkatspipango.c
index b353027cc4..5e199fe17e 100644
--- a/gtk/a11y/gtkatspipango.c
+++ b/gtk/a11y/gtkatspipango.c
@@ -88,23 +88,22 @@ pango_stretch_to_string (PangoStretch stretch)
 }
 
 const char *
-pango_underline_to_string (PangoUnderline value)
+pango_line_style_to_string (PangoLineStyle value)
 {
   switch (value)
     {
-    case PANGO_UNDERLINE_NONE:
+    case PANGO_LINE_STYLE_NONE:
       return "none";
-    case PANGO_UNDERLINE_SINGLE:
-    case PANGO_UNDERLINE_SINGLE_LINE:
+    case PANGO_LINE_STYLE_SOLID:
       return "single";
-    case PANGO_UNDERLINE_DOUBLE:
-    case PANGO_UNDERLINE_DOUBLE_LINE:
+    case PANGO_LINE_STYLE_DOUBLE:
       return "double";
-    case PANGO_UNDERLINE_LOW:
-      return "low";
-    case PANGO_UNDERLINE_ERROR:
-    case PANGO_UNDERLINE_ERROR_LINE:
-      return "error";
+    case PANGO_LINE_STYLE_DASHED:
+      return "dashed";
+    case PANGO_LINE_STYLE_DOTTED:
+      return "dotted";
+    case PANGO_LINE_STYLE_WAVY:
+      return "wavy";
     default:
       g_assert_not_reached ();
     }
@@ -138,6 +137,10 @@ pango_align_to_string (PangoAlignment align)
       return "center";
     case PANGO_ALIGN_RIGHT:
       return "right";
+    case PANGO_ALIGN_NATURAL:
+      return "natural";
+    case PANGO_ALIGN_JUSTIFY:
+      return "fill";
     default:
       g_assert_not_reached ();
     }
@@ -250,12 +253,8 @@ gtk_pango_get_run_attributes (PangoLayout     *layout,
                               int             *end_offset)
 {
   PangoAttrIterator *iter;
-  PangoAttrList *attr;
-  PangoAttrString *pango_string;
-  PangoAttrInt *pango_int;
-  PangoAttrColor *pango_color;
-  PangoAttrLanguage *pango_lang;
-  PangoAttrFloat *pango_float;
+  PangoAttrList *attr_list;
+  PangoAttribute *attr;
   int index, start_index, end_index;
   gboolean is_next;
   glong len;
@@ -267,16 +266,16 @@ gtk_pango_get_run_attributes (PangoLayout     *layout,
   len = g_utf8_strlen (text, -1);
 
   /* Grab the attributes of the PangoLayout, if any */
-  attr = pango_layout_get_attributes (layout);
+  attr_list = pango_layout_get_attributes (layout);
 
-  if (attr == NULL)
+  if (attr_list == NULL)
     {
       *start_offset = 0;
       *end_offset = len;
       return;
     }
 
-  iter = pango_attr_list_get_iterator (attr);
+  iter = pango_attr_list_get_iterator (attr_list);
   /* Get invariant range offsets */
   /* If offset out of range, set offset in range */
   if (offset > len)
@@ -303,100 +302,98 @@ gtk_pango_get_run_attributes (PangoLayout     *layout,
     }
 
   /* Get attributes */
-  pango_string = (PangoAttrString *) pango_attr_iterator_get (iter, PANGO_ATTR_FAMILY);
-  if (pango_string != NULL)
-    {
-      value = g_strdup_printf ("%s", pango_string->value);
-      g_variant_builder_add (builder, "{ss}", "family-name", value);
-      g_free (value);
-    }
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_FAMILY);
+  if (attr != NULL)
+    g_variant_builder_add (builder, "{ss}", "family-name", attr->str_value);
 
-  pango_int = (PangoAttrInt *) pango_attr_iterator_get (iter, PANGO_ATTR_STYLE);
-  if (pango_int != NULL)
-    g_variant_builder_add (builder, "{ss}", "style", pango_style_to_string (pango_int->value));
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_STYLE);
+  if (attr != NULL)
+    g_variant_builder_add (builder, "{ss}", "style", pango_style_to_string (attr->int_value));
 
-  pango_int = (PangoAttrInt *) pango_attr_iterator_get (iter, PANGO_ATTR_WEIGHT);
-  if (pango_int != NULL)
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_WEIGHT);
+  if (attr != NULL)
     {
-      value = g_strdup_printf ("%i", pango_int->value);
+      value = g_strdup_printf ("%i", attr->int_value);
       g_variant_builder_add (builder, "{ss}", "weight", value);
       g_free (value);
     }
 
-  pango_int = (PangoAttrInt *) pango_attr_iterator_get (iter, PANGO_ATTR_VARIANT);
-  if (pango_int != NULL)
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_VARIANT);
+  if (attr != NULL)
     g_variant_builder_add (builder, "{ss}", "variant",
-                           pango_variant_to_string (pango_int->value));
+                           pango_variant_to_string (attr->int_value));
 
-  pango_int = (PangoAttrInt *) pango_attr_iterator_get (iter, PANGO_ATTR_STRETCH);
-  if (pango_int != NULL)
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_STRETCH);
+  if (attr != NULL)
     g_variant_builder_add (builder, "{ss}", "stretch",
-                           pango_stretch_to_string (pango_int->value));
+                           pango_stretch_to_string (attr->int_value));
 
-  pango_int = (PangoAttrInt *) pango_attr_iterator_get (iter, PANGO_ATTR_SIZE);
-  if (pango_int != NULL)
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_SIZE);
+  if (attr != NULL)
     {
-      value = g_strdup_printf ("%i", pango_int->value / PANGO_SCALE);
+      value = g_strdup_printf ("%i", attr->int_value / PANGO_SCALE);
       g_variant_builder_add (builder, "{ss}", "size", value);
       g_free (value);
     }
 
-  pango_int = (PangoAttrInt *) pango_attr_iterator_get (iter, PANGO_ATTR_UNDERLINE);
-  if (pango_int != NULL)
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_UNDERLINE);
+  if (attr != NULL)
     g_variant_builder_add (builder, "{ss}", "underline",
-                           pango_underline_to_string (pango_int->value));
+                           pango_line_style_to_string (attr->int_value));
 
-  pango_int = (PangoAttrInt *) pango_attr_iterator_get (iter, PANGO_ATTR_STRIKETHROUGH);
-  if (pango_int != NULL)
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_STRIKETHROUGH);
+  if (attr != NULL)
     {
-      if (pango_int->value)
+      if (attr->int_value)
         val = "true";
       else
         val = "false";
       g_variant_builder_add (builder, "{ss}", "strikethrough", val);
     }
 
-  pango_int = (PangoAttrInt *) pango_attr_iterator_get (iter, PANGO_ATTR_RISE);
-  if (pango_int != NULL)
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_RISE);
+  if (attr != NULL)
     {
-      value = g_strdup_printf ("%i", pango_int->value);
+      value = g_strdup_printf ("%i", attr->int_value);
       g_variant_builder_add (builder, "{ss}", "rise", value);
       g_free (value);
     }
 
-  pango_lang = (PangoAttrLanguage *) pango_attr_iterator_get (iter, PANGO_ATTR_LANGUAGE);
-  if (pango_lang != NULL)
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_LANGUAGE);
+  if (attr != NULL)
     {
       g_variant_builder_add (builder, "{ss}", "language",
-                             pango_language_to_string (pango_lang->value));
+                             pango_language_to_string (attr->lang_value));
     }
 
-  pango_float = (PangoAttrFloat *) pango_attr_iterator_get (iter, PANGO_ATTR_SCALE);
-  if (pango_float != NULL)
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_SCALE);
+  if (attr != NULL)
     {
-      value = g_strdup_printf ("%g", pango_float->value);
+      value = g_strdup_printf ("%g", attr->double_value);
       g_variant_builder_add (builder, "{ss}", "scale", value);
       g_free (value);
     }
 
-  pango_color = (PangoAttrColor *) pango_attr_iterator_get (iter, PANGO_ATTR_FOREGROUND);
-  if (pango_color != NULL)
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_FOREGROUND);
+  if (attr != NULL)
     {
-      value = g_strdup_printf ("%u,%u,%u",
-                               pango_color->color.red,
-                               pango_color->color.green,
-                               pango_color->color.blue);
+      value = g_strdup_printf ("%u,%u,%u,%u",
+                               attr->color_value.red,
+                               attr->color_value.green,
+                               attr->color_value.blue,
+                               attr->color_value.alpha);
       g_variant_builder_add (builder, "{ss}", "fg-color", value);
       g_free (value);
     }
 
-  pango_color = (PangoAttrColor *) pango_attr_iterator_get (iter, PANGO_ATTR_BACKGROUND);
-  if (pango_color != NULL)
+  attr = pango_attr_iterator_get (iter, PANGO_ATTR_BACKGROUND);
+  if (attr != NULL)
     {
-      value = g_strdup_printf ("%u,%u,%u",
-                               pango_color->color.red,
-                               pango_color->color.green,
-                               pango_color->color.blue);
+      value = g_strdup_printf ("%u,%u,%u,%u",
+                               attr->color_value.red,
+                               attr->color_value.green,
+                               attr->color_value.blue,
+                               attr->color_value.alpha);
       g_variant_builder_add (builder, "{ss}", "bg-color", value);
       g_free (value);
     }
@@ -425,7 +422,7 @@ gtk_pango_move_chars (PangoLayout *layout,
   const PangoLogAttr *attrs;
   int n_attrs;
 
-  attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+  attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
   while (count > 0 && offset < n_attrs - 1)
     {
@@ -471,7 +468,7 @@ gtk_pango_move_words (PangoLayout  *layout,
   const PangoLogAttr *attrs;
   int n_attrs;
 
-  attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+  attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
   while (count > 0 && offset < n_attrs - 1)
     {
@@ -517,7 +514,7 @@ gtk_pango_move_sentences (PangoLayout  *layout,
   const PangoLogAttr *attrs;
   int n_attrs;
 
-  attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+  attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
   while (count > 0 && offset < n_attrs - 1)
     {
@@ -561,7 +558,7 @@ gtk_pango_move_lines (PangoLayout *layout,
                       int          count)
 {
   GSList *lines, *l;
-  PangoLayoutLine *line;
+  PangoLine *line;
   int num;
   const char *text;
   int pos, line_pos;
@@ -628,7 +625,7 @@ gtk_pango_is_inside_word (PangoLayout  *layout,
   const PangoLogAttr *attrs;
   int n_attrs;
 
-  attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+  attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
   while (offset >= 0 &&
          !(attrs[offset].is_word_start || attrs[offset].is_word_end))
@@ -657,7 +654,7 @@ gtk_pango_is_inside_sentence (PangoLayout  *layout,
   const PangoLogAttr *attrs;
   int n_attrs;
 
-  attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+  attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
   while (offset >= 0 &&
          !(attrs[offset].is_sentence_start || attrs[offset].is_sentence_end))
@@ -676,8 +673,8 @@ pango_layout_get_line_before (PangoLayout           *layout,
                               int                   *start_offset,
                               int                   *end_offset)
 {
-  PangoLayoutIter *iter;
-  PangoLayoutLine *line, *prev_line = NULL, *prev_prev_line = NULL;
+  PangoLineIter *iter;
+  PangoLine *line, *prev_line = NULL, *prev_prev_line = NULL;
   int index, start_index, length, end_index;
   int prev_start_index, prev_length;
   int prev_prev_start_index, prev_prev_length;
@@ -689,9 +686,9 @@ pango_layout_get_line_before (PangoLayout           *layout,
   iter = pango_layout_get_iter (layout);
   do
     {
-      line = pango_layout_iter_get_line (iter);
-      start_index = pango_layout_line_get_start_index (line);
-      length = pango_layout_line_get_length (line);
+      line = pango_line_iter_get_line (iter);
+      start_index = pango_line_get_start_index (line);
+      length = pango_line_get_length (line);
       end_index = start_index + length;
 
       if (index >= start_index && index <= end_index)
@@ -735,14 +732,14 @@ pango_layout_get_line_before (PangoLayout           *layout,
       prev_start_index = start_index;
       prev_length = length;
     }
-  while (pango_layout_iter_next_line (iter));
+  while (pango_line_iter_next_line (iter));
 
   if (!found)
     {
       start_index = prev_start_index + prev_length;
       end_index = start_index;
     }
-  pango_layout_iter_free (iter);
+  pango_line_iter_free (iter);
 
   *start_offset = g_utf8_pointer_to_offset (text, text + start_index);
   *end_offset = g_utf8_pointer_to_offset (text, text + end_index);
@@ -755,8 +752,8 @@ pango_layout_get_line_at (PangoLayout           *layout,
                           int                   *start_offset,
                           int                   *end_offset)
 {
-  PangoLayoutIter *iter;
-  PangoLayoutLine *line, *prev_line = NULL;
+  PangoLineIter *iter;
+  PangoLine *line, *prev_line = NULL;
   int index, start_index, length, end_index;
   const char *text;
   gboolean found = FALSE;
@@ -766,9 +763,9 @@ pango_layout_get_line_at (PangoLayout           *layout,
   iter = pango_layout_get_iter (layout);
   do
     {
-      line = pango_layout_iter_get_line (iter);
-      start_index = pango_layout_line_get_start_index (line);
-      length = pango_layout_line_get_length (line);
+      line = pango_line_iter_get_line (iter);
+      start_index = pango_line_get_start_index (line);
+      length = pango_line_get_length (line);
       end_index = start_index + length;
 
       if (index >= start_index && index <= end_index)
@@ -777,12 +774,12 @@ pango_layout_get_line_at (PangoLayout           *layout,
           switch (boundary_type)
             {
             case ATSPI_TEXT_BOUNDARY_LINE_START:
-              if (pango_layout_iter_next_line (iter))
-                end_index = pango_layout_line_get_start_index (pango_layout_iter_get_line (iter));
+              if (pango_line_iter_next_line (iter))
+                end_index = pango_line_get_start_index (pango_line_iter_get_line (iter));
               break;
             case ATSPI_TEXT_BOUNDARY_LINE_END:
               if (prev_line)
-                start_index = pango_layout_line_get_start_index (prev_line) + pango_layout_line_get_length 
(prev_line);
+                start_index = pango_line_get_start_index (prev_line) + pango_line_get_length (prev_line);
               break;
             case ATSPI_TEXT_BOUNDARY_CHAR:
             case ATSPI_TEXT_BOUNDARY_WORD_START:
@@ -799,14 +796,14 @@ pango_layout_get_line_at (PangoLayout           *layout,
 
       prev_line = line;
     }
-  while (pango_layout_iter_next_line (iter));
+  while (pango_line_iter_next_line (iter));
 
   if (!found)
     {
-      start_index = pango_layout_line_get_start_index (prev_line) + pango_layout_line_get_length (prev_line);
+      start_index = pango_line_get_start_index (prev_line) + pango_line_get_length (prev_line);
       end_index = start_index;
     }
-  pango_layout_iter_free (iter);
+  pango_line_iter_free (iter);
 
   *start_offset = g_utf8_pointer_to_offset (text, text + start_index);
   *end_offset = g_utf8_pointer_to_offset (text, text + end_index);
@@ -819,8 +816,8 @@ pango_layout_get_line_after (PangoLayout           *layout,
                              int                   *start_offset,
                              int                   *end_offset)
 {
-  PangoLayoutIter *iter;
-  PangoLayoutLine *line, *prev_line = NULL;
+  PangoLineIter *iter;
+  PangoLine *line, *prev_line = NULL;
   int index, start_index, length, end_index;
   const char *text;
   gboolean found = FALSE;
@@ -830,29 +827,29 @@ pango_layout_get_line_after (PangoLayout           *layout,
   iter = pango_layout_get_iter (layout);
   do
     {
-      line = pango_layout_iter_get_line (iter);
-      start_index = pango_layout_line_get_start_index (line);
-      length = pango_layout_line_get_length (line);
+      line = pango_line_iter_get_line (iter);
+      start_index = pango_line_get_start_index (line);
+      length = pango_line_get_length (line);
       end_index = start_index + length;
 
       if (index >= start_index && index <= end_index)
         {
           /* Found line for offset */
-          if (pango_layout_iter_next_line (iter))
+          if (pango_line_iter_next_line (iter))
             {
-              line = pango_layout_iter_get_line (iter);
+              line = pango_line_iter_get_line (iter);
               switch (boundary_type)
                 {
                 case ATSPI_TEXT_BOUNDARY_LINE_START:
-                  start_index = pango_layout_line_get_start_index (line);
-                  if (pango_layout_iter_next_line (iter))
-                    end_index = pango_layout_line_get_start_index (pango_layout_iter_get_line (iter));
+                  start_index = pango_line_get_start_index (line);
+                  if (pango_line_iter_next_line (iter))
+                    end_index = pango_line_get_start_index (pango_line_iter_get_line (iter));
                   else
-                    end_index = start_index + pango_layout_line_get_length (line);
+                    end_index = start_index + pango_line_get_length (line);
                   break;
                 case ATSPI_TEXT_BOUNDARY_LINE_END:
                   start_index = end_index;
-                  end_index = pango_layout_line_get_start_index (line) + pango_layout_line_get_length (line);
+                  end_index = pango_line_get_start_index (line) + pango_line_get_length (line);
                   break;
                 case ATSPI_TEXT_BOUNDARY_CHAR:
                 case ATSPI_TEXT_BOUNDARY_WORD_START:
@@ -872,14 +869,14 @@ pango_layout_get_line_after (PangoLayout           *layout,
 
       prev_line = line;
     }
-  while (pango_layout_iter_next_line (iter));
+  while (pango_line_iter_next_line (iter));
 
   if (!found)
     {
-      start_index = pango_layout_line_get_start_index (prev_line) + pango_layout_line_get_length (prev_line);
+      start_index = pango_line_get_start_index (prev_line) + pango_line_get_length (prev_line);
       end_index = start_index;
     }
-  pango_layout_iter_free (iter);
+  pango_line_iter_free (iter);
 
   *start_offset = g_utf8_pointer_to_offset (text, text + start_index);
   *end_offset = g_utf8_pointer_to_offset (text, text + end_index);
@@ -923,7 +920,7 @@ gtk_pango_get_text_before (PangoLayout           *layout,
       return g_strdup ("");
     }
 
-  attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+  attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
   start = offset;
   end = start;
@@ -1028,7 +1025,7 @@ gtk_pango_get_text_after (PangoLayout           *layout,
       return g_strdup ("");
     }
 
-  attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+  attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
   start = offset;
   end = start;
@@ -1139,7 +1136,7 @@ gtk_pango_get_text_at (PangoLayout           *layout,
       return g_strdup ("");
     }
 
-  attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+  attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
   start = offset;
   end = start;
@@ -1224,7 +1221,7 @@ char *gtk_pango_get_string_at (PangoLayout           *layout,
       return g_strdup ("");
     }
 
-  attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+  attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
   start = offset;
   end = start;
diff --git a/gtk/a11y/gtkatspipangoprivate.h b/gtk/a11y/gtkatspipangoprivate.h
index e9e91d292f..14a20c9693 100644
--- a/gtk/a11y/gtkatspipangoprivate.h
+++ b/gtk/a11y/gtkatspipangoprivate.h
@@ -23,7 +23,7 @@
 G_BEGIN_DECLS
 
 const char *pango_wrap_mode_to_string (PangoWrapMode mode);
-const char *pango_underline_to_string (PangoUnderline underline);
+const char *pango_line_style_to_string (PangoLineStyle underline);
 const char *pango_stretch_to_string (PangoStretch stretch);
 const char *pango_style_to_string (PangoStyle style);
 const char *pango_variant_to_string (PangoVariant variant);
diff --git a/gtk/a11y/gtkatspitextbuffer.c b/gtk/a11y/gtkatspitextbuffer.c
index 40fd05fa1f..4a2f109907 100644
--- a/gtk/a11y/gtkatspitextbuffer.c
+++ b/gtk/a11y/gtkatspitextbuffer.c
@@ -106,7 +106,7 @@ gtk_text_view_add_default_attributes (GtkTextView     *view,
   g_variant_builder_add (builder, "{ss}", "strikethrough",
                          text_attrs->appearance.strikethrough ? "true" : "false");
   g_variant_builder_add (builder, "{ss}", "underline",
-                         pango_underline_to_string (text_attrs->appearance.underline));
+                         pango_line_style_to_string (text_attrs->appearance.underline));
 
   value = g_strdup_printf ("%u,%u,%u",
                            (guint)(text_attrs->appearance.bg_rgba->red * 65535),
@@ -455,7 +455,7 @@ gtk_text_buffer_get_run_attributes (GtkTextBuffer   *buffer,
   while (temp_tags && !val_set)
     {
       GtkTextTag *tag = GTK_TEXT_TAG (temp_tags->data);
-      PangoUnderline underline;
+      PangoLineStyle underline;
 
       g_object_get (tag,
                     "underline-set", &val_set,
@@ -463,7 +463,7 @@ gtk_text_buffer_get_run_attributes (GtkTextBuffer   *buffer,
                     NULL);
       if (val_set)
         g_variant_builder_add (builder, "{ss}", "underline",
-                               pango_underline_to_string (underline));
+                               pango_line_style_to_string (underline));
       temp_tags = temp_tags->next;
     }
   val_set = FALSE;
diff --git a/gtk/gskpango.c b/gtk/gskpango.c
index 6807ada46d..56b0ef561c 100644
--- a/gtk/gskpango.c
+++ b/gtk/gskpango.c
@@ -44,35 +44,23 @@ gsk_pango_renderer_set_state (GskPangoRenderer      *crenderer,
   crenderer->state = state;
 }
 
-void
-gsk_pango_renderer_set_shape_handler (GskPangoRenderer    *crenderer,
-                                      GskPangoShapeHandler handler)
-{
-  g_return_if_fail (GSK_IS_PANGO_RENDERER (crenderer));
-
-  crenderer->shape_handler = handler;
-}
-
 static void
 get_color (GskPangoRenderer *crenderer,
            PangoRenderPart   part,
            GdkRGBA          *rgba)
 {
   const PangoColor *color = pango_renderer_get_color ((PangoRenderer *) (crenderer), part);
-  const guint16 a = pango_renderer_get_alpha ((PangoRenderer *) (crenderer), part);
 
   if (color)
     {
       rgba->red = color->red / 65535.;
       rgba->green = color->green / 65535.;
       rgba->blue = color->blue / 65535.;
-      rgba->alpha = a ? a  / 65535. : crenderer->fg_color->alpha;
+      rgba->alpha = color->alpha / 65535.;
     }
   else
     {
       *rgba = *crenderer->fg_color;
-      if (a)
-        rgba->alpha = a / 65535.;
     }
 }
 
@@ -81,7 +69,7 @@ set_color (GskPangoRenderer *crenderer,
            PangoRenderPart   part,
            cairo_t          *cr)
 {
-  GdkRGBA rgba = { 0, 0, 0, 1 };
+  GdkRGBA rgba = { 1, 192./255., 203./255., 1 };
 
   get_color (crenderer, part, &rgba);
   gdk_cairo_set_source_rgba (cr, &rgba);
@@ -95,12 +83,12 @@ gsk_pango_renderer_draw_glyph_item (PangoRenderer  *renderer,
                                     int             y)
 {
   GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
-  GdkRGBA color;
+  GdkRGBA color = { 0, 0, 0, 1 };
 
   get_color (crenderer, PANGO_RENDER_PART_FOREGROUND, &color);
 
   gtk_snapshot_append_text (crenderer->snapshot,
-                            glyph_item->item->analysis.font,
+                            pango_analysis_get_font (pango_item_get_analysis (glyph_item->item)),
                             glyph_item->glyphs,
                             &color,
                             (float) x / PANGO_SCALE,
@@ -116,12 +104,12 @@ gsk_pango_renderer_draw_rectangle (PangoRenderer     *renderer,
                                    int                height)
 {
   GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
-  GdkRGBA rgba;
+  GdkRGBA color = { 0, 0, 0, 1 };
 
-  get_color (crenderer, part, &rgba);
+  get_color (crenderer, part, &color);
 
   gtk_snapshot_append_color (crenderer->snapshot,
-                             &rgba,
+                             &color,
                              &GRAPHENE_RECT_INIT ((double)x / PANGO_SCALE,
                                                   (double)y / PANGO_SCALE,
                                                   (double)width / PANGO_SCALE,
@@ -139,16 +127,17 @@ gsk_pango_renderer_draw_trapezoid (PangoRenderer   *renderer,
                                    double           x22)
 {
   GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
-  PangoLayout *layout;
+  PangoLines *lines;
   PangoRectangle ink_rect;
   cairo_t *cr;
   double x, y;
 
-  layout = pango_renderer_get_layout (renderer);
-  if (!layout)
+  lines = pango_renderer_get_lines (renderer);
+  if (!lines)
     return;
 
-  pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
+  pango_lines_get_extents (lines, &ink_rect, NULL);
+  pango_extents_to_pixels (&ink_rect, NULL);
   cr = gtk_snapshot_append_cairo (crenderer->snapshot,
                                   &GRAPHENE_RECT_INIT (ink_rect.x, ink_rect.y,
                                                        ink_rect.width, ink_rect.height));
@@ -207,6 +196,7 @@ gsk_pango_renderer_draw_error_underline (PangoRenderer *renderer,
   gtk_snapshot_pop (crenderer->snapshot);
 }
 
+#if 0
 static void
 gsk_pango_renderer_draw_shape (PangoRenderer  *renderer,
                                PangoAttrShape *attr,
@@ -214,7 +204,7 @@ gsk_pango_renderer_draw_shape (PangoRenderer  *renderer,
                                int             y)
 {
   GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
-  PangoLayout *layout;
+  PangoLines *lines;
   PangoCairoShapeRendererFunc shape_renderer;
   gpointer shape_renderer_data;
   double base_x = (double)x / PANGO_SCALE;
@@ -245,15 +235,16 @@ gsk_pango_renderer_draw_shape (PangoRenderer  *renderer,
       cairo_t *cr;
       PangoRectangle ink_rect;
 
-      layout = pango_renderer_get_layout (renderer);
-      if (!layout)
+      lines = pango_renderer_get_lines (renderer);
+      if (!lines)
         return;
 
-      pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
+      pango_lines_get_extents (lines, &ink_rect, NULL);
+      pango_extents_to_pixels (&ink_rect, NULL);
       cr = gtk_snapshot_append_cairo (crenderer->snapshot,
                                       &GRAPHENE_RECT_INIT (ink_rect.x, ink_rect.y,
                                                            ink_rect.width, ink_rect.height));
-      shape_renderer = pango_cairo_context_get_shape_renderer (pango_layout_get_context (layout),
+      shape_renderer = pango_cairo_context_get_shape_renderer (pango_renderer_get_context (renderer),
                                                                &shape_renderer_data);
 
       if (!shape_renderer)
@@ -271,6 +262,7 @@ gsk_pango_renderer_draw_shape (PangoRenderer  *renderer,
       cairo_destroy (cr);
     }
 }
+#endif
 
 static void
 text_renderer_set_rgba (GskPangoRenderer *crenderer,
@@ -279,35 +271,34 @@ text_renderer_set_rgba (GskPangoRenderer *crenderer,
 {
   PangoRenderer *renderer = PANGO_RENDERER (crenderer);
   PangoColor color = { 0, };
-  guint16 alpha;
 
   if (rgba)
     {
       color.red = (guint16)(rgba->red * 65535);
       color.green = (guint16)(rgba->green * 65535);
       color.blue = (guint16)(rgba->blue * 65535);
-      alpha = (guint16)(rgba->alpha * 65535);
+      color.alpha = (guint16)(rgba->alpha * 65535);
       pango_renderer_set_color (renderer, part, &color);
-      pango_renderer_set_alpha (renderer, part, alpha);
     }
   else
     {
       pango_renderer_set_color (renderer, part, NULL);
-      pango_renderer_set_alpha (renderer, part, 0);
     }
 }
 
 static GtkTextAppearance *
 get_item_appearance (PangoItem *item)
 {
-  GSList *tmp_list = item->analysis.extra_attrs;
+  GSList *tmp_list;
+
+  tmp_list = pango_analysis_get_extra_attributes (pango_item_get_analysis (item));
 
   while (tmp_list)
     {
       PangoAttribute *attr = tmp_list->data;
 
-      if (attr->klass->type == gtk_text_attr_appearance_type)
-        return &((GtkTextAttrAppearance *)attr)->appearance;
+      if (attr->type == gtk_text_attr_appearance_type)
+        return (GtkTextAppearance *)attr->pointer_value;
 
       tmp_list = tmp_list->next;
     }
@@ -316,8 +307,8 @@ get_item_appearance (PangoItem *item)
 }
 
 static void
-gsk_pango_renderer_prepare_run (PangoRenderer  *renderer,
-                                PangoLayoutRun *run)
+gsk_pango_renderer_prepare_run (PangoRenderer *renderer,
+                                PangoRun      *run)
 {
   GskPangoRenderer *crenderer = GSK_PANGO_RENDERER (renderer);
   const GdkRGBA *bg_rgba = NULL;
@@ -326,7 +317,7 @@ gsk_pango_renderer_prepare_run (PangoRenderer  *renderer,
 
   PANGO_RENDERER_CLASS (gsk_pango_renderer_parent_class)->prepare_run (renderer, run);
 
-  appearance = get_item_appearance (run->item);
+  appearance = get_item_appearance (pango_run_get_item (run));
 
   if (appearance == NULL)
     return;
@@ -369,7 +360,7 @@ gsk_pango_renderer_prepare_run (PangoRenderer  *renderer,
 
   if (appearance->underline_rgba)
     text_renderer_set_rgba (crenderer, PANGO_RENDER_PART_UNDERLINE, appearance->underline_rgba);
-  else if (appearance->underline == PANGO_UNDERLINE_ERROR)
+  else if (appearance->underline == PANGO_LINE_STYLE_DOTTED)
     {
       if (!crenderer->error_color)
         {
@@ -381,6 +372,12 @@ gsk_pango_renderer_prepare_run (PangoRenderer  *renderer,
     }
   else
     text_renderer_set_rgba (crenderer, PANGO_RENDER_PART_UNDERLINE, fg_rgba);
+
+  if (appearance->overline_rgba)
+    text_renderer_set_rgba (crenderer, PANGO_RENDER_PART_OVERLINE, appearance->overline_rgba);
+  else
+    text_renderer_set_rgba (crenderer, PANGO_RENDER_PART_OVERLINE, fg_rgba);
+
 }
 
 static void
@@ -397,7 +394,6 @@ gsk_pango_renderer_class_init (GskPangoRendererClass *klass)
   renderer_class->draw_rectangle = gsk_pango_renderer_draw_rectangle;
   renderer_class->draw_trapezoid = gsk_pango_renderer_draw_trapezoid;
   renderer_class->draw_error_underline = gsk_pango_renderer_draw_error_underline;
-  renderer_class->draw_shape = gsk_pango_renderer_draw_shape;
   renderer_class->prepare_run = gsk_pango_renderer_prepare_run;
 }
 
@@ -421,7 +417,6 @@ gsk_pango_renderer_acquire (void)
 
       /* Reset to standard state */
       renderer->state = GSK_PANGO_RENDERER_NORMAL;
-      renderer->shape_handler = NULL;
     }
   else
     {
@@ -476,7 +471,7 @@ gtk_snapshot_append_layout (GtkSnapshot   *snapshot,
   crenderer->snapshot = snapshot;
   crenderer->fg_color = color;
 
-  pango_renderer_draw_layout (PANGO_RENDERER (crenderer), layout, 0, 0);
+  pango_renderer_draw_lines (PANGO_RENDERER (crenderer), pango_layout_get_lines (layout), 0, 0);
 
   gsk_pango_renderer_release (crenderer);
 }
diff --git a/gtk/gskpango.h b/gtk/gskpango.h
index 672128d1c1..15f679440b 100644
--- a/gtk/gskpango.h
+++ b/gtk/gskpango.h
@@ -41,11 +41,6 @@ typedef enum
   GSK_PANGO_RENDERER_CURSOR
 } GskPangoRendererState;
 
-typedef gboolean (*GskPangoShapeHandler) (PangoAttrShape         *attr,
-                                          GdkSnapshot            *snapshot,
-                                          double                  width,
-                                          double                  height);
-
 /*
  * This is a PangoRenderer implementation that translates all the draw calls to
  * gsk render nodes, using the GtkSnapshot helper class. Glyphs are translated
@@ -66,8 +61,6 @@ struct _GskPangoRenderer
   GskPangoRendererState  state;
 
   guint                  is_cached_renderer : 1;
-
-  GskPangoShapeHandler   shape_handler;
 };
 
 struct _GskPangoRendererClass
@@ -78,8 +71,6 @@ struct _GskPangoRendererClass
 GType             gsk_pango_renderer_get_type  (void) G_GNUC_CONST;
 void              gsk_pango_renderer_set_state (GskPangoRenderer      *crenderer,
                                                 GskPangoRendererState  state);
-void              gsk_pango_renderer_set_shape_handler (GskPangoRenderer      *crenderer,
-                                                        GskPangoShapeHandler handler);
 GskPangoRenderer *gsk_pango_renderer_acquire   (void);
 void              gsk_pango_renderer_release   (GskPangoRenderer      *crenderer);
 
diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c
index a5a980402b..c373ccfea9 100644
--- a/gtk/gtkaboutdialog.c
+++ b/gtk/gtkaboutdialog.c
@@ -1892,7 +1892,7 @@ text_buffer_new (GtkAboutDialog  *about,
 
               tag = gtk_text_buffer_create_tag (buffer, NULL,
                                                 "foreground-rgba", &color,
-                                                "underline", PANGO_UNDERLINE_SINGLE,
+                                                "underline", PANGO_LINE_STYLE_SOLID,
                                                 NULL);
               if (strcmp (link_type, "email") == 0)
                 {
diff --git a/gtk/gtkcellrendererprogress.c b/gtk/gtkcellrendererprogress.c
index a836abe093..076607cc09 100644
--- a/gtk/gtkcellrendererprogress.c
+++ b/gtk/gtkcellrendererprogress.c
@@ -289,7 +289,8 @@ compute_dimensions (GtkCellRenderer *cell,
   int xpad, ypad;
 
   layout = gtk_widget_create_pango_layout (widget, text);
-  pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
+  pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &logical_rect);
+  pango_extents_to_pixels (&logical_rect, NULL);
 
   gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
 
@@ -506,7 +507,8 @@ gtk_cell_renderer_progress_snapshot (GtkCellRenderer      *cell,
       float text_xalign;
 
       layout = gtk_widget_create_pango_layout (widget, priv->label);
-      pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
+      pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &logical_rect);
+      pango_extents_to_pixels (&logical_rect, NULL);
 
       if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
        text_xalign = 1.0 - priv->text_xalign;
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index 2b673e963e..2e96100863 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -173,7 +173,7 @@ struct _GtkCellRendererTextPrivate
   PangoEllipsizeMode    ellipsize;
   PangoFontDescription *font;
   PangoLanguage        *language;
-  PangoUnderline        underline_style;
+  PangoLineStyle        underline_style;
   PangoWrapMode         wrap_mode;
 
   char *text;
@@ -237,7 +237,7 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
   GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
 
   object_class->finalize = gtk_cell_renderer_text_finalize;
-  
+
   object_class->get_property = gtk_cell_renderer_text_get_property;
   object_class->set_property = gtk_cell_renderer_text_set_property;
 
@@ -374,8 +374,8 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
 
   text_cell_renderer_props[PROP_UNDERLINE] =
       g_param_spec_enum ("underline", NULL, NULL,
-                         PANGO_TYPE_UNDERLINE,
-                         PANGO_UNDERLINE_NONE,
+                         PANGO_TYPE_LINE_STYLE,
+                         PANGO_LINE_STYLE_NONE,
                          GTK_PARAM_READWRITE);
 
   text_cell_renderer_props[PROP_LANGUAGE] =
@@ -622,7 +622,7 @@ gtk_cell_renderer_text_get_property (GObject        *object,
     case PROP_FONT:
         g_value_take_string (value, pango_font_description_to_string (priv->font));
       break;
-      
+
     case PROP_FONT_DESC:
       g_value_set_boxed (value, priv->font);
       break;
@@ -658,7 +658,7 @@ gtk_cell_renderer_text_get_property (GObject        *object,
     case PROP_SCALE:
       g_value_set_double (value, priv->font_scale);
       break;
-      
+
     case PROP_EDITABLE:
       g_value_set_boolean (value, priv->editable);
       break;
@@ -673,7 +673,7 @@ gtk_cell_renderer_text_get_property (GObject        *object,
 
     case PROP_RISE:
       g_value_set_int (value, priv->rise);
-      break;  
+      break;
 
     case PROP_LANGUAGE:
       g_value_set_static_string (value, pango_language_to_string (priv->language));
@@ -682,7 +682,7 @@ gtk_cell_renderer_text_get_property (GObject        *object,
     case PROP_ELLIPSIZE:
       g_value_set_enum (value, priv->ellipsize);
       break;
-      
+
     case PROP_WRAP_MODE:
       g_value_set_enum (value, priv->wrap_mode);
       break;
@@ -690,7 +690,7 @@ gtk_cell_renderer_text_get_property (GObject        *object,
     case PROP_WRAP_WIDTH:
       g_value_set_int (value, priv->wrap_width);
       break;
-      
+
     case PROP_ALIGN:
       g_value_set_enum (value, priv->align);
       break;
@@ -712,14 +712,14 @@ gtk_cell_renderer_text_get_property (GObject        *object,
       {
        PangoFontMask mask = get_property_font_set_mask (param_id);
        g_value_set_boolean (value, (pango_font_description_get_set_fields (priv->font) & mask) != 0);
-       
+
        break;
       }
 
     case PROP_SCALE_SET:
       g_value_set_boolean (value, priv->scale_set);
       break;
-      
+
     case PROP_EDITABLE_SET:
       g_value_set_boolean (value, priv->editable_set);
       break;
@@ -747,14 +747,14 @@ gtk_cell_renderer_text_get_property (GObject        *object,
     case PROP_ALIGN_SET:
       g_value_set_boolean (value, priv->align_set);
       break;
-      
+
     case PROP_WIDTH_CHARS:
       g_value_set_int (value, priv->width_chars);
-      break;  
+      break;
 
     case PROP_MAX_WIDTH_CHARS:
       g_value_set_int (value, priv->max_width_chars);
-      break;  
+      break;
 
     case PROP_PLACEHOLDER_TEXT:
       g_value_set_string (value, priv->placeholder_text);
@@ -827,7 +827,7 @@ set_font_desc_fields (PangoFontDescription *desc,
                      PangoFontMask         to_set)
 {
   PangoFontMask changed_mask = 0;
-  
+
   if (to_set & PANGO_FONT_MASK_FAMILY)
     {
       const char *family = pango_font_description_get_family (desc);
@@ -855,7 +855,7 @@ set_font_desc_fields (PangoFontDescription *desc,
          size = 10 * PANGO_SCALE;
          changed_mask |= PANGO_FONT_MASK_SIZE;
        }
-      
+
       pango_font_description_set_size (desc, size);
     }
 
@@ -1289,7 +1289,7 @@ gtk_cell_renderer_text_set_property (GObject      *object,
 
 /**
  * gtk_cell_renderer_text_new:
- * 
+ *
  * Creates a new `GtkCellRendererText`. Adjust how text is drawn using
  * object properties. Object properties can be
  * set globally (with g_object_set()). Also, with `GtkTreeViewColumn`,
@@ -1297,7 +1297,7 @@ gtk_cell_renderer_text_set_property (GObject      *object,
  * you can bind the “text” property on the cell renderer to a string
  * value in the model, thus rendering a different string in each row
  * of the `GtkTreeView`.
- * 
+ *
  * Returns: the new cell renderer
  **/
 GtkCellRenderer *
@@ -1321,7 +1321,7 @@ add_attr (PangoAttrList  *attr_list,
 {
   attr->start_index = 0;
   attr->end_index = G_MAXINT;
-  
+
   pango_attr_list_insert (attr_list, attr);
 }
 
@@ -1334,7 +1334,7 @@ get_layout (GtkCellRendererText *celltext,
   GtkCellRendererTextPrivate *priv = gtk_cell_renderer_text_get_instance_private (celltext);
   PangoAttrList *attr_list;
   PangoLayout *layout;
-  PangoUnderline uline;
+  PangoLineStyle uline;
   int xpad;
   gboolean placeholder_layout = show_placeholder_text (celltext);
 
@@ -1348,31 +1348,27 @@ get_layout (GtkCellRendererText *celltext,
   else
     attr_list = pango_attr_list_new ();
 
-  pango_layout_set_single_paragraph_mode (layout, priv->single_paragraph);
+  pango_layout_set_single_paragraph (layout, priv->single_paragraph);
 
   if (!placeholder_layout && cell_area)
     {
       /* Add options that affect appearance but not size */
-      
+
       /* note that background doesn't go here, since it affects
        * background_area not the PangoLayout area
        */
-      
+
       if (priv->foreground_set
          && (flags & GTK_CELL_RENDERER_SELECTED) == 0)
         {
           PangoColor color;
-          guint16 alpha;
 
           color.red = CLAMP (priv->foreground.red * 65535. + 0.5, 0, 65535);
           color.green = CLAMP (priv->foreground.green * 65535. + 0.5, 0, 65535);
           color.blue = CLAMP (priv->foreground.blue * 65535. + 0.5, 0, 65535);
-          alpha = CLAMP (priv->foreground.alpha * 65535. + 0.5, 0, 65535);
+          color.alpha = CLAMP (priv->foreground.alpha * 65535. + 0.5, 0, 65535);
 
-          add_attr (attr_list,
-                    pango_attr_foreground_new (color.red, color.green, color.blue));
-
-          add_attr (attr_list, pango_attr_foreground_alpha_new (alpha));
+          add_attr (attr_list, pango_attr_foreground_new (&color));
         }
 
       if (priv->strikethrough_set)
@@ -1381,7 +1377,6 @@ get_layout (GtkCellRendererText *celltext,
   else if (placeholder_layout)
     {
       PangoColor color;
-      guint16 alpha;
       GtkStyleContext *context;
       GdkRGBA fg = { 0.5, 0.5, 0.5, 1.0 };
 
@@ -1391,12 +1386,9 @@ get_layout (GtkCellRendererText *celltext,
       color.red = CLAMP (fg.red * 65535. + 0.5, 0, 65535);
       color.green = CLAMP (fg.green * 65535. + 0.5, 0, 65535);
       color.blue = CLAMP (fg.blue * 65535. + 0.5, 0, 65535);
-      alpha = CLAMP (fg.alpha * 65535. + 0.5, 0, 65535);
-
-      add_attr (attr_list,
-                pango_attr_foreground_new (color.red, color.green, color.blue));
+      color.alpha = CLAMP (fg.alpha * 65535. + 0.5, 0, 65535);
 
-      add_attr (attr_list, pango_attr_foreground_alpha_new (alpha));
+      add_attr (attr_list, pango_attr_foreground_new (&color));
     }
 
   add_attr (attr_list, pango_attr_font_desc_new (priv->font));
@@ -1408,7 +1400,7 @@ get_layout (GtkCellRendererText *celltext,
   if (priv->underline_set)
     uline = priv->underline_style;
   else
-    uline = PANGO_UNDERLINE_NONE;
+    uline = PANGO_LINE_STYLE_NONE;
 
   if (priv->language_set)
     add_attr (attr_list, pango_attr_language_new (priv->language));
@@ -1417,31 +1409,24 @@ get_layout (GtkCellRendererText *celltext,
     {
       switch (uline)
         {
-        case PANGO_UNDERLINE_NONE:
-          uline = PANGO_UNDERLINE_SINGLE;
-          break;
-
-        case PANGO_UNDERLINE_SINGLE:
-          uline = PANGO_UNDERLINE_DOUBLE;
-          break;
-
-        case PANGO_UNDERLINE_SINGLE_LINE:
-          uline = PANGO_UNDERLINE_DOUBLE_LINE;
+        case PANGO_LINE_STYLE_NONE:
+          uline = PANGO_LINE_STYLE_SOLID;
           break;
 
-        case PANGO_UNDERLINE_DOUBLE_LINE:
-        case PANGO_UNDERLINE_ERROR_LINE:
+        case PANGO_LINE_STYLE_SOLID:
+          uline = PANGO_LINE_STYLE_DOUBLE;
           break;
 
-        case PANGO_UNDERLINE_DOUBLE:
-        case PANGO_UNDERLINE_LOW:
-        case PANGO_UNDERLINE_ERROR:
+        case PANGO_LINE_STYLE_DOUBLE:
+        case PANGO_LINE_STYLE_DOTTED:
+        case PANGO_LINE_STYLE_DASHED:
+        case PANGO_LINE_STYLE_WAVY:
         default:
           break;
         }
     }
 
-  if (uline != PANGO_UNDERLINE_NONE)
+  if (uline != PANGO_LINE_STYLE_NONE)
     add_attr (attr_list, pango_attr_underline_new (priv->underline_style));
 
   if (priv->rise_set)
@@ -1462,7 +1447,7 @@ get_layout (GtkCellRendererText *celltext,
       PangoRectangle rect;
       int            width, text_width;
 
-      pango_layout_get_extents (layout, NULL, &rect);
+      pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &rect);
       text_width = rect.width;
 
       if (cell_area)
@@ -1494,7 +1479,7 @@ get_layout (GtkCellRendererText *celltext,
 
       pango_layout_set_alignment (layout, align);
     }
-  
+
   return layout;
 }
 
@@ -1542,7 +1527,7 @@ get_size (GtkCellRenderer    *cell,
                                           pango_context_get_language (context));
       row_height = (pango_font_metrics_get_ascent (metrics) +
                    pango_font_metrics_get_descent (metrics));
-      pango_font_metrics_unref (metrics);
+      pango_font_metrics_free (metrics);
 
       pango_font_description_free (font_desc);
 
@@ -1551,7 +1536,7 @@ get_size (GtkCellRenderer    *cell,
       gtk_cell_renderer_set_fixed_size (cell,
                                        cell_width, 2 * ypad +
                                        priv->fixed_height_rows * PANGO_PIXELS (row_height));
-      
+
       if (height)
        {
          *height = cell_height;
@@ -1562,7 +1547,8 @@ get_size (GtkCellRenderer    *cell,
        return;
     }
 
-  pango_layout_get_pixel_extents (layout, NULL, &rect);
+  pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &rect);
+  pango_extents_to_pixels (&rect, NULL);
 
   gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
 
@@ -1627,7 +1613,8 @@ gtk_cell_renderer_text_snapshot (GtkCellRenderer      *cell,
   else if (priv->wrap_width == -1)
     pango_layout_set_width (layout, -1);
 
-  pango_layout_get_pixel_extents (layout, NULL, &rect);
+  pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &rect);
+  pango_extents_to_pixels (&rect, NULL);
   x_offset = x_offset - rect.x;
 
   gtk_snapshot_push_clip (snapshot,
@@ -1728,7 +1715,7 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer      *cell,
   if (priv->text)
     gtk_editable_set_text (GTK_EDITABLE (priv->entry), priv->text);
   g_object_set_data_full (G_OBJECT (priv->entry), I_(GTK_CELL_RENDERER_TEXT_PATH), g_strdup (path), g_free);
-  
+
   gtk_editable_select_region (GTK_EDITABLE (priv->entry), 0, -1);
 
   priv->in_entry_menu = FALSE;
@@ -1751,7 +1738,7 @@ gtk_cell_renderer_text_start_editing (GtkCellRenderer      *cell,
  * gtk_cell_renderer_text_set_fixed_height_from_font:
  * @renderer: A `GtkCellRendererText`
  * @number_of_rows: Number of rows of text each cell renderer is allocated, or -1
- * 
+ *
  * Sets the height of a renderer to explicitly be determined by the “font” and
  * “y_pad” property set on it.  Further changes in these properties do not
  * affect the height, so they must be accompanied by a subsequent call to this
@@ -1813,7 +1800,7 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
 
   /* Fetch the length of the complete unwrapped text */
   pango_layout_set_width (layout, -1);
-  pango_layout_get_extents (layout, NULL, &rect);
+  pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &rect);
   text_width = rect.width;
 
   /* Fetch the average size of a character */
@@ -1824,7 +1811,7 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
 
   char_width = pango_font_metrics_get_approximate_char_width (metrics);
 
-  pango_font_metrics_unref (metrics);
+  pango_font_metrics_free (metrics);
   g_object_unref (layout);
 
   /* enforce minimum width for ellipsized labels at ~3 chars */
@@ -1854,7 +1841,7 @@ gtk_cell_renderer_text_get_preferred_width (GtkCellRenderer *cell,
   if (priv->max_width_chars > 0)
     {
       int max_width = xpad * 2 + PANGO_PIXELS (char_width) * priv->max_width_chars;
-      
+
       min_width = MIN (min_width, max_width);
       nat_width = MIN (nat_width, max_width);
     }
@@ -1874,21 +1861,23 @@ gtk_cell_renderer_text_get_preferred_height_for_width (GtkCellRenderer *cell,
                                                        int             *natural_height)
 {
   GtkCellRendererText *celltext = GTK_CELL_RENDERER_TEXT (cell);
-  PangoLayout         *layout;
-  int                  text_height, xpad, ypad;
+  PangoLayout *layout;
+  int xpad, ypad;
+  PangoRectangle ext;
 
   gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
 
   layout = get_layout (celltext, widget, NULL, 0);
 
   pango_layout_set_width (layout, (width - xpad * 2) * PANGO_SCALE);
-  pango_layout_get_pixel_size (layout, NULL, &text_height);
+  pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+  pango_extents_to_pixels (&ext, NULL);
 
   if (minimum_height)
-    *minimum_height = text_height + ypad * 2;
+    *minimum_height = ext.height + ypad * 2;
 
   if (natural_height)
-    *natural_height = text_height + ypad * 2;
+    *natural_height = ext.height + ypad * 2;
 
   g_object_unref (layout);
 }
@@ -1926,7 +1915,7 @@ gtk_cell_renderer_text_get_aligned_area (GtkCellRenderer       *cell,
   int y_offset = 0;
 
   layout = get_layout (celltext, widget, cell_area, flags);
-  get_size (cell, widget, cell_area, layout, &x_offset, &y_offset, 
+  get_size (cell, widget, cell_area, layout, &x_offset, &y_offset,
            &aligned_area->width, &aligned_area->height);
 
   aligned_area->x = cell_area->x + x_offset;
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index bb00ab50bb..3d33e8ccf0 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -297,7 +297,8 @@ gtk_color_button_init (GtkColorButton *button)
   gtk_widget_set_can_focus (button->swatch, FALSE);
   gtk_widget_remove_css_class (button->swatch, "activatable");
   layout = gtk_widget_create_pango_layout (GTK_WIDGET (button), "Black");
-  pango_layout_get_pixel_extents (layout, NULL, &rect);
+  pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &rect);
+  pango_extents_to_pixels (&rect, NULL);
   g_object_unref (layout);
 
   gtk_widget_set_size_request (button->swatch, rect.width, rect.height);
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index dfb7a0d394..1296493808 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -516,9 +516,15 @@ static GtkCssValue font_stretch_values[] = {
 GtkCssValue *
 _gtk_css_font_stretch_value_new (PangoStretch font_stretch)
 {
-  g_return_val_if_fail (font_stretch < G_N_ELEMENTS (font_stretch_values), NULL);
+  /* FIXME support 'normal' and percentages */
 
-  return _gtk_css_value_ref (&font_stretch_values[font_stretch]);
+  for (int i = 0; i < G_N_ELEMENTS (font_stretch_values); i++)
+    {
+      if (font_stretch == font_stretch_values[i].value)
+        return _gtk_css_value_ref (&font_stretch_values[i]);
+    }
+
+  return NULL;
 }
 
 GtkCssValue *
diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c
index f03d9b4f1a..fc1aa097d8 100644
--- a/gtk/gtkcssstyle.c
+++ b/gtk/gtkcssstyle.c
@@ -385,21 +385,21 @@ gtk_css_style_to_string (GtkCssStyle *style)
   return g_string_free (string, FALSE);
 }
 
-static PangoUnderline
-get_pango_underline_from_style (GtkTextDecorationStyle style)
+static PangoLineStyle
+get_pango_line_style_from_style (GtkTextDecorationStyle style)
 {
   switch (style)
     {
     case GTK_CSS_TEXT_DECORATION_STYLE_DOUBLE:
-      return PANGO_UNDERLINE_DOUBLE;
+      return PANGO_LINE_STYLE_DOUBLE;
     case GTK_CSS_TEXT_DECORATION_STYLE_WAVY:
-      return PANGO_UNDERLINE_ERROR;
+      return PANGO_LINE_STYLE_DOTTED;
     case GTK_CSS_TEXT_DECORATION_STYLE_SOLID:
     default:
-      return PANGO_UNDERLINE_SINGLE;
+      return PANGO_LINE_STYLE_SOLID;
     }
 
-  g_return_val_if_reached (PANGO_UNDERLINE_SINGLE);
+  g_return_val_if_reached (PANGO_LINE_STYLE_SOLID);
 }
 
 PangoTextTransform
@@ -420,12 +420,6 @@ gtk_css_style_get_pango_text_transform (GtkCssStyle *style)
     }
 }
 
-static PangoOverline
-get_pango_overline_from_style (GtkTextDecorationStyle style)
-{
-  return PANGO_OVERLINE_SINGLE;
-}
-
 static PangoAttrList *
 add_pango_attr (PangoAttrList  *attrs,
                 PangoAttribute *attr)
@@ -608,27 +602,30 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
 
   if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE)
     {
-      attrs = add_pango_attr (attrs, pango_attr_underline_new (get_pango_underline_from_style 
(decoration_style)));
+      attrs = add_pango_attr (attrs, pango_attr_underline_new (get_pango_line_style_from_style 
(decoration_style)));
       if (!gdk_rgba_equal (color, decoration_color))
-        attrs = add_pango_attr (attrs, pango_attr_underline_color_new (decoration_color->red * 65535. + 0.5,
-                                                                       decoration_color->green * 65535. + 
0.5,
-                                                                       decoration_color->blue * 65535. + 
0.5));
+        attrs = add_pango_attr (attrs, pango_attr_underline_color_new (&(PangoColor){decoration_color->red * 
65535. + 0.5,
+                                                                                     decoration_color->green 
* 65535. + 0.5,
+                                                                                     decoration_color->blue 
* 65535. + 0.5,
+                                                                                     decoration_color->alpha 
* 65535. + 0.5}));
     }
   if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_OVERLINE)
     {
-      attrs = add_pango_attr (attrs, pango_attr_overline_new (get_pango_overline_from_style 
(decoration_style)));
+      attrs = add_pango_attr (attrs, pango_attr_overline_new (get_pango_line_style_from_style 
(decoration_style)));
       if (!gdk_rgba_equal (color, decoration_color))
-        attrs = add_pango_attr (attrs, pango_attr_overline_color_new (decoration_color->red * 65535. + 0.5,
-                                                                      decoration_color->green * 65535. + 0.5,
-                                                                      decoration_color->blue * 65535. + 
0.5));
+        attrs = add_pango_attr (attrs, pango_attr_overline_color_new (&(PangoColor){decoration_color->red * 
65535. + 0.5,
+                                                                                    decoration_color->green 
* 65535. + 0.5,
+                                                                                    decoration_color->blue * 
65535. + 0.5,
+                                                                                    decoration_color->alpha 
* 65535. + 0.5}));
     }
   if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH)
     {
-      attrs = add_pango_attr (attrs, pango_attr_strikethrough_new (TRUE));
+      attrs = add_pango_attr (attrs, pango_attr_strikethrough_new (get_pango_line_style_from_style 
(decoration_style)));
       if (!gdk_rgba_equal (color, decoration_color))
-        attrs = add_pango_attr (attrs, pango_attr_strikethrough_color_new (decoration_color->red * 65535. + 
0.5,
-                                                                           decoration_color->green * 65535. 
+ 0.5,
-                                                                           decoration_color->blue * 65535. + 
0.5));
+        attrs = add_pango_attr (attrs, pango_attr_strikethrough_color_new 
(&(PangoColor){decoration_color->red * 65535. + 0.5,
+                                                                                         
decoration_color->green * 65535. + 0.5,
+                                                                                         
decoration_color->blue * 65535. + 0.5,
+                                                                                         
decoration_color->alpha * 65535. + 0.5}));
     }
 
   /* letter-spacing */
diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c
index 810072c146..c7f1edba3f 100644
--- a/gtk/gtkemojichooser.c
+++ b/gtk/gtkemojichooser.c
@@ -573,10 +573,10 @@ add_emoji (GtkWidget    *box,
   pango_attr_list_unref (attrs);
 
   layout = gtk_label_get_layout (GTK_LABEL (label));
-  pango_layout_get_extents (layout, &rect, NULL);
+  pango_lines_get_extents (pango_layout_get_lines (layout), &rect, NULL);
 
   /* Check for fallback rendering that generates too wide items */
-  if (pango_layout_get_unknown_glyphs_count (layout) > 0 ||
+  if (pango_lines_get_unknown_glyphs_count (pango_layout_get_lines (layout)) > 0 ||
       rect.width >= 1.5 * chooser->emoji_max_width)
     {
       g_object_ref_sink (label);
@@ -866,7 +866,7 @@ filter_func (GtkFlowBoxChild *child,
     goto out;
 
   term_tokens = g_str_tokenize_and_fold (text, "en", NULL);
-  
+
   g_variant_get_child (emoji_data, 1, "&s", &name);
   name_tokens = g_str_tokenize_and_fold (name, "en", NULL);
   g_variant_get_child (emoji_data, 2, "^a&s", &keywords);
@@ -993,7 +993,7 @@ gtk_emoji_chooser_init (GtkEmojiChooser *chooser)
     pango_layout_set_attributes (layout, attrs);
     pango_attr_list_unref (attrs);
 
-    pango_layout_get_extents (layout, &rect, NULL);
+    pango_lines_get_extents (pango_layout_get_lines (layout), &rect, NULL);
     chooser->emoji_max_width = rect.width;
 
     g_object_unref (layout);
@@ -1278,7 +1278,7 @@ gtk_emoji_chooser_class_init (GtkEmojiChooserClass *klass)
    * @direction: 1 to scroll forward, -1 to scroll back
    *
    * Scrolls to the next or previous section.
-   */ 
+   */
   gtk_widget_class_install_action (widget_class, "scroll.section", "i",
                                    gtk_emoji_chooser_scroll_section);
 
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index 9845c58682..d430826a4f 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -225,55 +225,48 @@ font_description_style_equal (const PangoFontDescription *a,
 static void
 gtk_font_button_update_font_data (GtkFontButton *font_button)
 {
-  PangoFontFamily **families;
-  PangoFontFace **faces;
-  int n_families, n_faces, i;
-  const char *family;
+  const char *name;
+  PangoFontMap *font_map;
 
   g_assert (font_button->font_desc != NULL);
 
   font_button->fontname = pango_font_description_to_string (font_button->font_desc);
 
-  family = pango_font_description_get_family (font_button->font_desc);
-  if (family == NULL)
+  name = pango_font_description_get_family (font_button->font_desc);
+  if (name == NULL)
     return;
 
-  n_families = 0;
-  families = NULL;
-  pango_context_list_families (gtk_widget_get_pango_context (GTK_WIDGET (font_button)),
-                               &families, &n_families);
-  n_faces = 0;
-  faces = NULL;
-  for (i = 0; i < n_families; i++)
+  font_map = pango_context_get_font_map (gtk_widget_get_pango_context (font_button->font_label));
+  for (int i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (font_map)); i++)
     {
-      const char *name = pango_font_family_get_name (families[i]);
+      PangoFontFamily *family = g_list_model_get_item (G_LIST_MODEL (font_map), i);
 
-      if (!g_ascii_strcasecmp (name, family))
+      if (!g_ascii_strcasecmp (name, pango_font_family_get_name (family)))
         {
-          font_button->font_family = g_object_ref (families[i]);
-
-          pango_font_family_list_faces (families[i], &faces, &n_faces);
+          g_set_object (&font_button->font_family, family);
+          g_object_unref (family);
           break;
         }
+
+      g_object_unref (family);
     }
-  g_free (families);
 
-  for (i = 0; i < n_faces; i++)
+  for (int i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (font_button->font_family)); i++)
     {
-      PangoFontDescription *tmp_desc = pango_font_face_describe (faces[i]);
+      PangoFontFace *face = g_list_model_get_item (G_LIST_MODEL (font_button->font_family), i);
+      PangoFontDescription *tmp_desc = pango_font_face_describe (face);
 
       if (font_description_style_equal (tmp_desc, font_button->font_desc))
         {
-          font_button->font_face = g_object_ref (faces[i]);
-
+          g_set_object (&font_button->font_face, face);
           pango_font_description_free (tmp_desc);
+          g_object_unref (face);
           break;
         }
-      else
-        pango_font_description_free (tmp_desc);
-    }
 
-  g_free (faces);
+      pango_font_description_free (tmp_desc);
+      g_object_unref (face);
+    }
 }
 
 static char *
@@ -429,7 +422,7 @@ gtk_font_button_font_chooser_set_font_map (GtkFontChooser *chooser,
       PangoContext *context;
 
       if (!font_map)
-        font_map = pango_cairo_font_map_get_default ();
+        font_map = pango_font_map_get_default ();
 
       context = gtk_widget_get_pango_context (font_button->font_label);
       pango_context_set_font_map (context, font_map);
@@ -1356,7 +1349,7 @@ gtk_font_button_update_font_info (GtkFontButton *font_button)
   else
     fam_name = C_("font", "None");
   if (font_button->font_face)
-    face_name = pango_font_face_get_face_name (font_button->font_face);
+    face_name = pango_font_face_get_name (font_button->font_face);
   else
     face_name = "";
 
diff --git a/gtk/gtkfontchooser.c b/gtk/gtkfontchooser.c
index fb87ed0ca4..f359bd7788 100644
--- a/gtk/gtkfontchooser.c
+++ b/gtk/gtkfontchooser.c
@@ -430,15 +430,15 @@ _gtk_font_chooser_font_activated (GtkFontChooser *chooser,
  *
  * ```c
  * FcConfig *config;
- * PangoFontMap *fontmap;
+ * PangoFcFontMap *fontmap;
  *
  * config = FcInitLoadConfigAndFonts ();
  * FcConfigAppFontAddFile (config, my_app_font_file);
  *
- * fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
- * pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
+ * fontmap = pango_fc_font_map_new ();
+ * pango_fc_font_map_set_config (fontmap, config);
  *
- * gtk_font_chooser_set_font_map (font_chooser, fontmap);
+ * gtk_font_chooser_set_font_map (font_chooser, PANGO_FONT_MAP (fontmap));
  * ```
  *
  * Note that other GTK widgets will only be able to use the
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index b998867e8a..f30706a120 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -357,7 +357,7 @@ user_filter_cb (gpointer item,
     }
 
   if (self->filter_by_monospace &&
-      !pango_font_family_is_monospace (family))
+      !pango_font_face_is_monospace (face))
     return FALSE;
 
   if (self->filter_by_language &&
@@ -377,7 +377,7 @@ user_filter_cb (gpointer item,
 
       ret = FALSE;
 
-      langs = pango_font_get_languages (font);
+      langs = pango_font_face_get_languages (pango_font_get_face (font));
       if (langs)
         {
           for (int i = 0; langs[i]; i++)
@@ -425,48 +425,12 @@ static void
 gtk_font_chooser_widget_update_marks (GtkFontChooserWidget *self)
 {
   GtkAdjustment *adj, *spin_adj;
-  const int *sizes;
-  int *font_sizes;
-  int i, n_sizes;
+  static const int sizes[] = {
+       6, 8, 9, 10, 11, 12, 13, 14, 16, 20, 24, 36, 48, 72
+  };
+  int n_sizes = G_N_ELEMENTS (sizes);
+  int i;
   double value, spin_value;
-  gpointer item;
-
-  item = gtk_single_selection_get_selected_item (self->selection);
-
-  if (item)
-    {
-      PangoFontFace *face;
-
-      if (PANGO_IS_FONT_FAMILY (item))
-        face = pango_font_family_get_face (item, NULL);
-      else
-        face = item;
-
-      pango_font_face_list_sizes (face, &font_sizes, &n_sizes);
-
-      /* It seems not many fonts actually have a sane set of sizes */
-      for (i = 0; i < n_sizes; i++)
-        font_sizes[i] = font_sizes[i] / PANGO_SCALE;
-    }
-  else
-    {
-      font_sizes = NULL;
-      n_sizes = 0;
-    }
-
-  if (n_sizes < 2)
-    {
-      static const int fallback_sizes[] = {
-        6, 8, 9, 10, 11, 12, 13, 14, 16, 20, 24, 36, 48, 72
-      };
-
-      sizes = fallback_sizes;
-      n_sizes = G_N_ELEMENTS (fallback_sizes);
-    }
-  else
-    {
-      sizes = font_sizes;
-    }
 
   gtk_scale_clear_marks (GTK_SCALE (self->size_slider));
   gtk_scale_clear_marks (GTK_SCALE (self->size_slider2));
@@ -502,8 +466,6 @@ gtk_font_chooser_widget_update_marks (GtkFontChooserWidget *self)
                           sizes[i],
                           GTK_POS_BOTTOM, NULL);
     }
-
-  g_free (font_sizes);
 }
 
 static void
@@ -588,7 +550,7 @@ maybe_update_preview_text (GtkFontChooserWidget *self,
       alt_default = pango_language_from_string (q);
     }
 
-  languages = pango_font_get_languages (font);
+  languages = pango_font_face_get_languages (pango_font_get_face (font));
 
   /* If the font supports the default language, just use it. */
   if (languages)
@@ -607,7 +569,7 @@ maybe_update_preview_text (GtkFontChooserWidget *self,
   if (languages)
     for (i = 0; languages[i]; i++)
       {
-        const PangoScript *scripts;
+        const GUnicodeScript *scripts;
         int num, j;
 
         scripts = pango_language_get_scripts (languages[i], &num);
@@ -701,7 +663,7 @@ get_font_name (GObject  *ignore,
     {
       return g_strconcat (pango_font_family_get_name (pango_font_face_get_family (item)),
                           " ",
-                          pango_font_face_get_face_name (item),
+                          pango_font_face_get_name (item),
                           NULL);
     }
   else
@@ -1050,7 +1012,7 @@ add_languages_from_font (GtkFontChooserWidget *self,
   context = gtk_widget_get_pango_context (GTK_WIDGET (self));
   font = pango_context_load_font (context, desc);
 
-  langs = pango_font_get_languages (font);
+  langs = pango_font_face_get_languages (pango_font_get_face (font));
   if (langs)
     {
       for (i = 0; langs[i]; i++)
@@ -1138,7 +1100,7 @@ update_fontlist (GtkFontChooserWidget *self)
 
   fontmap = self->font_map;
   if (!fontmap)
-    fontmap = pango_cairo_font_map_get_default ();
+    fontmap = pango_font_map_get_default ();
 
   if ((self->level & GTK_FONT_CHOOSER_LEVEL_STYLE) == 0)
     model = g_object_ref (G_LIST_MODEL (fontmap));
@@ -2476,7 +2438,7 @@ gtk_font_chooser_widget_set_font_map (GtkFontChooser *chooser,
       PangoContext *context;
 
       if (!fontmap)
-        fontmap = pango_cairo_font_map_get_default ();
+        fontmap = pango_font_map_get_default ();
 
       context = gtk_widget_get_pango_context (fontchooser->family_face_list);
       pango_context_set_font_map (context, fontmap);
diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
index c70de8b036..155a55ed80 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -652,17 +652,18 @@ gtk_gl_area_draw_error_screen (GtkGLArea   *area,
 {
   GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
   PangoLayout *layout;
-  int layout_height;
+  PangoRectangle ext;
 
   layout = gtk_widget_create_pango_layout (GTK_WIDGET (area),
                                            priv->error->message);
   pango_layout_set_width (layout, width * PANGO_SCALE);
   pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
-  pango_layout_get_pixel_size (layout, NULL, &layout_height);
+  pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+  pango_extents_to_pixels (&ext, NULL);
 
   gtk_snapshot_render_layout (snapshot,
                               gtk_widget_get_style_context (GTK_WIDGET (area)),
-                              0, (height - layout_height) / 2,
+                              0, (height - ext.height) / 2,
                               layout);
 
   g_object_unref (layout);
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 74d8a0b52f..3b9a28b9d9 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -974,7 +974,7 @@ gtk_image_get_baseline_align (GtkImage *image)
                 (float)pango_font_metrics_get_ascent (metrics) /
                 (pango_font_metrics_get_ascent (metrics) + pango_font_metrics_get_descent (metrics));
 
-      pango_font_metrics_unref (metrics);
+      pango_font_metrics_free (metrics);
     }
 
   return image->baseline_align;
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 85f307a343..404a76df17 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -1276,7 +1276,7 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext   *context,
         {
           PangoAttribute *attr;
 
-          attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
+          attr = pango_attr_underline_new (PANGO_LINE_STYLE_SOLID);
           attr->start_index = 0;
           attr->end_index = s->len;
           pango_attr_list_insert (*attrs, attr);
diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c
index 069070509a..720f38404f 100644
--- a/gtk/gtkimcontextwayland.c
+++ b/gtk/gtkimcontextwayland.c
@@ -642,7 +642,7 @@ gtk_im_context_wayland_get_preedit_string (GtkIMContext   *context,
       if (!*attrs)
         *attrs = pango_attr_list_new ();
 
-      attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
+      attr = pango_attr_underline_new (PANGO_LINE_STYLE_SOLID);
       attr->start_index = 0;
       attr->end_index = len;
       pango_attr_list_insert (*attrs, attr);
diff --git a/gtk/gtkinscription.c b/gtk/gtkinscription.c
index f44937fa69..fe7fd51a1e 100644
--- a/gtk/gtkinscription.c
+++ b/gtk/gtkinscription.c
@@ -315,7 +315,7 @@ get_char_pixels (GtkInscription *self)
   metrics = gtk_inscription_get_font_metrics (self);
   char_width = pango_font_metrics_get_approximate_char_width (metrics);
   digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
-  pango_font_metrics_unref (metrics);
+  pango_font_metrics_free (metrics);
 
   return MAX (char_width, digit_width);
 }
@@ -415,15 +415,20 @@ gtk_inscription_get_layout_location (GtkInscription *self,
   float xalign;
   int baseline;
   float x, y;
+  PangoLines *lines;
 
   g_assert (x_out);
   g_assert (y_out);
 
+  lines = pango_layout_get_lines (self->layout);
+
   xalign = self->xalign;
   if (_gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
     xalign = 1.0 - xalign;
 
-  pango_layout_get_pixel_extents (self->layout, NULL, &logical);
+  pango_lines_get_extents (lines, NULL, &logical);
+  pango_extents_to_pixels (&logical, NULL);
+
   if (pango_layout_get_width (self->layout) > 0)
     x = 0.f;
   else
@@ -432,11 +437,11 @@ gtk_inscription_get_layout_location (GtkInscription *self,
   baseline = gtk_widget_get_allocated_baseline (widget);
   if (baseline != -1)
     {
-      int layout_baseline = pango_layout_get_baseline (self->layout) / PANGO_SCALE;
+      int layout_baseline = pango_lines_get_baseline (lines) / PANGO_SCALE;
       /* yalign is 0 because we can't support yalign while baseline aligning */
       y = baseline - layout_baseline;
     }
-  else if (pango_layout_is_ellipsized (self->layout))
+  else if (pango_lines_is_ellipsized (lines))
     {
       y = 0.f;
     }
@@ -470,19 +475,19 @@ gtk_inscription_allocate (GtkWidget *widget,
        * If we can't fit 2 rows, we're single line.
        */
       {
-        PangoLayoutIter *iter = pango_layout_get_iter (self->layout);
-        if (pango_layout_iter_next_line (iter))
+        PangoLineIter *iter = pango_layout_get_iter (self->layout);
+        if (pango_line_iter_next_line (iter))
           {
             PangoRectangle rect;
-            pango_layout_iter_get_line_extents (iter, NULL, &rect);
+            pango_line_iter_get_line_extents (iter, NULL, &rect);
             if (rect.y + rect.height > height * PANGO_SCALE)
               {
-                while (!pango_layout_line_is_paragraph_start (pango_layout_iter_get_line_readonly (iter)))
+                while (!pango_line_is_paragraph_start (pango_line_iter_get_line (iter)))
                   {
-                    if (!pango_layout_iter_next_line (iter))
+                    if (!pango_line_iter_next_line (iter))
                       break;
                   }
-                if (!pango_layout_line_is_paragraph_start (pango_layout_iter_get_line_readonly (iter)))
+                if (!pango_line_is_paragraph_start (pango_line_iter_get_line (iter)))
                   {
                     pango_layout_set_width (self->layout, -1);
                   }
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 94d2856455..5e6c72cd3c 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -820,9 +820,10 @@ gtk_label_update_layout_attributes (GtkLabel      *self,
             }
 
           link_color = gtk_css_color_value_get_rgba (style->core->color);
-          attr = pango_attr_foreground_new (link_color->red * 65535,
-                                            link_color->green * 65535,
-                                            link_color->blue * 65535);
+          attr = pango_attr_foreground_new (&(PangoColor){link_color->red * 65535,
+                                                          link_color->green * 65535,
+                                                          link_color->blue * 65535,
+                                                          link_color->alpha * 65535});
           attr->start_index = link->start;
           attr->end_index = link->end;
           pango_attr_list_insert (attrs, attr);
@@ -882,15 +883,16 @@ gtk_label_css_changed (GtkWidget         *widget,
 static PangoDirection
 get_cursor_direction (GtkLabel *self)
 {
-  GSList *l;
+  PangoLines *lines;
 
   g_assert (self->select_info);
 
   gtk_label_ensure_layout (self);
 
-  for (l = pango_layout_get_lines_readonly (self->layout); l; l = l->next)
+  lines = pango_layout_get_lines (self->layout);
+  for (int i = 0; i < pango_lines_get_line_count (lines); i++)
     {
-      PangoLayoutLine *line = l->data;
+      PangoLine *line = pango_lines_get_lines (lines)[i];
 
       /* If self->select_info->selection_end is at the very end of
        * the line, we don't know if the cursor is on this line or
@@ -899,8 +901,8 @@ get_cursor_direction (GtkLabel *self)
        * definitely in this paragraph, which is good enough
        * to figure out the resolved direction.
        */
-       if (pango_layout_line_get_start_index (line) + pango_layout_line_get_length (line) >= 
self->select_info->selection_end)
-        return pango_layout_line_get_resolved_direction (line);
+       if (pango_line_get_start_index (line) + pango_line_get_length (line) >= 
self->select_info->selection_end)
+        return pango_line_get_resolved_direction (line);
     }
 
   return PANGO_DIRECTION_LTR;
@@ -972,6 +974,7 @@ gtk_label_get_measuring_layout (GtkLabel    *self,
                                 PangoLayout *existing_layout,
                                 int          width)
 {
+  PangoLines *lines;
   PangoLayout *copy;
 
   if (existing_layout != NULL)
@@ -1009,15 +1012,15 @@ gtk_label_get_measuring_layout (GtkLabel    *self,
    * can just return the current layout, because for measuring purposes, it will be
    * identical.
    */
-  if (!pango_layout_is_wrapped (self->layout) &&
-      !pango_layout_is_ellipsized (self->layout))
+  lines = pango_layout_get_lines (self->layout);
+  if (!pango_lines_is_wrapped (lines) && !pango_lines_is_ellipsized (lines))
     {
       PangoRectangle rect;
 
       if (width == -1)
         return g_object_ref (self->layout);
 
-      pango_layout_get_extents (self->layout, NULL, &rect);
+      pango_lines_get_extents (lines, NULL, &rect);
       if (rect.width <= width)
         return g_object_ref (self->layout);
     }
@@ -1038,7 +1041,7 @@ get_char_pixels (PangoLayout *layout)
   metrics = pango_context_get_metrics (context, NULL, NULL);
   char_width = pango_font_metrics_get_approximate_char_width (metrics);
   digit_width = pango_font_metrics_get_approximate_digit_width (metrics);
-  pango_font_metrics_unref (metrics);
+  pango_font_metrics_free (metrics);
 
   return MAX (char_width, digit_width);
 }
@@ -1096,11 +1099,11 @@ get_static_size (GtkLabel       *self,
 
   if (orientation == GTK_ORIENTATION_HORIZONTAL)
     {
-      pango_layout_get_size (layout, natural, NULL);
+      pango_lines_get_size (pango_layout_get_lines (layout), natural, NULL);
       if (self->ellipsize)
         {
           layout = gtk_label_get_measuring_layout (self, layout, 0);
-          pango_layout_get_size (layout, minimum, NULL);
+          pango_lines_get_size (pango_layout_get_lines (layout), minimum, NULL);
           /* yes, Pango ellipsizes even when that needs more space */
           *minimum = MIN (*minimum, *natural);
         }
@@ -1113,8 +1116,8 @@ get_static_size (GtkLabel       *self,
     }
   else
     {
-      pango_layout_get_size (layout, NULL, minimum);
-      *minimum_baseline = pango_layout_get_baseline (layout);
+      pango_lines_get_size (pango_layout_get_lines (layout), NULL, minimum);
+      *minimum_baseline = pango_lines_get_baseline (pango_layout_get_lines (layout));
 
       *natural = *minimum;
       *natural_baseline = *minimum_baseline;
@@ -1138,16 +1141,16 @@ get_height_for_width (GtkLabel *self,
     {
       /* Minimum height is assuming infinite width */
       layout = gtk_label_get_measuring_layout (self, NULL, -1);
-      pango_layout_get_size (layout, NULL, minimum_height);
-      baseline = pango_layout_get_baseline (layout);
+      pango_lines_get_size (pango_layout_get_lines (layout), NULL, minimum_height);
+      baseline = pango_lines_get_baseline (pango_layout_get_lines (layout));
       *minimum_baseline = baseline;
 
       /* Natural height is assuming natural width */
       get_default_widths (self, NULL, &natural_width);
 
       layout = gtk_label_get_measuring_layout (self, layout, natural_width);
-      pango_layout_get_size (layout, NULL, natural_height);
-      baseline = pango_layout_get_baseline (layout);
+      pango_lines_get_size (pango_layout_get_lines (layout), NULL, natural_height);
+      baseline = pango_lines_get_baseline (pango_layout_get_lines (layout));
       *natural_baseline = baseline;
     }
   else
@@ -1155,12 +1158,12 @@ get_height_for_width (GtkLabel *self,
       /* minimum = natural for any given width */
       layout = gtk_label_get_measuring_layout (self, NULL, width);
 
-      pango_layout_get_size (layout, NULL, &text_height);
+      pango_lines_get_size (pango_layout_get_lines (layout), NULL, &text_height);
 
       *minimum_height = text_height;
       *natural_height = text_height;
 
-      baseline = pango_layout_get_baseline (layout);
+      baseline = pango_lines_get_baseline (pango_layout_get_lines (layout));
       *minimum_baseline = baseline;
       *natural_baseline = baseline;
     }
@@ -1183,7 +1186,7 @@ my_pango_layout_get_width_for_height (PangoLayout *layout,
     {
       mid = (min + max) / 2;
       pango_layout_set_width (layout, mid * PANGO_SCALE);
-      pango_layout_get_size (layout, &text_width, &text_height);
+      pango_lines_get_size (pango_layout_get_lines (layout), &text_width, &text_height);
       text_width = PANGO_PIXELS_CEIL (text_width);
       if (text_width > mid)
         min = text_width;
@@ -1211,12 +1214,12 @@ get_width_for_height (GtkLabel *self,
     {
       /* Minimum width is as many line breaks as possible */
       layout = gtk_label_get_measuring_layout (self, NULL, MAX (minimum_default, 0));
-      pango_layout_get_size (layout, minimum_width, NULL);
+      pango_lines_get_size (pango_layout_get_lines (layout), minimum_width, NULL);
       *minimum_width = MAX (*minimum_width, minimum_default);
 
       /* Natural width is natural width - or as wide as possible */
       layout = gtk_label_get_measuring_layout (self, layout, natural_default);
-      pango_layout_get_size (layout, natural_width, NULL);
+      pango_lines_get_size (pango_layout_get_lines (layout), natural_width, NULL);
       *natural_width = MAX (*natural_width, *minimum_width);
     }
   else
@@ -1234,7 +1237,7 @@ get_width_for_height (GtkLabel *self,
       min = MAX (minimum_default, 0);
 
       pango_layout_set_width (layout, -1);
-      pango_layout_get_size (layout, &max, NULL);
+      pango_lines_get_size (pango_layout_get_lines (layout), &max, NULL);
 
       /* first, do natural width */
       if (self->natural_wrap_mode == GTK_NATURAL_WRAP_NONE)
@@ -1253,7 +1256,7 @@ get_width_for_height (GtkLabel *self,
         {
           g_object_unref (layout);
           layout = gtk_label_get_measuring_layout (self, NULL, MAX (minimum_default, 0));
-          pango_layout_get_size (layout, minimum_width, NULL);
+          pango_lines_get_size (pango_layout_get_lines (layout), minimum_width, NULL);
           *minimum_width = MAX (*minimum_width, minimum_default);
         }
       else if (self->natural_wrap_mode == GTK_NATURAL_WRAP_INHERIT)
@@ -1320,13 +1323,15 @@ get_layout_location (GtkLabel  *self,
   if (_gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
     xalign = 1.0 - xalign;
 
-  pango_layout_get_pixel_extents (self->layout, NULL, &logical);
+  pango_lines_get_extents (pango_layout_get_lines (self->layout), NULL, &logical);
+  pango_extents_to_pixels (&logical, NULL);
+
   x = floor ((xalign * (widget_width - logical.width)) - logical.x);
 
   baseline = gtk_widget_get_allocated_baseline (widget);
   if (baseline != -1)
     {
-      int layout_baseline = pango_layout_get_baseline (self->layout) / PANGO_SCALE;
+      int layout_baseline = pango_lines_get_baseline (pango_layout_get_lines (self->layout)) / PANGO_SCALE;
       /* yalign is 0 because we can't support yalign while baseline aligning */
       y = baseline - layout_baseline;
     }
@@ -1576,7 +1581,7 @@ range_is_in_ellipsis_full (GtkLabel *self,
                            int      *ellipsis_start,
                            int      *ellipsis_end)
 {
-  PangoLayoutIter *iter;
+  PangoLineIter *iter;
   gboolean in_ellipsis;
 
   if (!self->ellipsize)
@@ -1584,7 +1589,7 @@ range_is_in_ellipsis_full (GtkLabel *self,
 
   gtk_label_ensure_layout (self);
 
-  if (!pango_layout_is_ellipsized (self->layout))
+  if (!pango_lines_is_ellipsized (pango_layout_get_lines (self->layout)))
     return FALSE;
 
   iter = pango_layout_get_iter (self->layout);
@@ -1592,33 +1597,33 @@ range_is_in_ellipsis_full (GtkLabel *self,
   in_ellipsis = FALSE;
 
   do {
-    PangoLayoutRun *run;
+    PangoRun *run;
 
-    run = pango_layout_iter_get_run_readonly (iter);
+    run = pango_line_iter_get_run (iter);
     if (run)
       {
         PangoItem *item;
 
-        item = ((PangoGlyphItem*)run)->item;
+        item = pango_run_get_item (run);
 
-        if (item->offset <= range_start && range_end <= item->offset + item->length)
+        if (pango_item_get_byte_offset (item) <= range_start && range_end <= pango_item_get_byte_offset 
(item) + pango_item_get_byte_length (item))
           {
-            if (item->analysis.flags & PANGO_ANALYSIS_FLAG_IS_ELLIPSIS)
+            if (pango_analysis_get_flags (pango_item_get_analysis (item)) & PANGO_ANALYSIS_FLAG_IS_ELLIPSIS)
               {
                 if (ellipsis_start)
-                  *ellipsis_start = item->offset;
+                  *ellipsis_start = pango_item_get_byte_offset (item);
                 if (ellipsis_end)
-                  *ellipsis_end = item->offset + item->length;
+                  *ellipsis_end = pango_item_get_byte_offset (item) + pango_item_get_byte_length (item);
                 in_ellipsis = TRUE;
               }
             break;
           }
-        else if (item->offset + item->length >= range_end)
+        else if (pango_item_get_byte_offset (item) + pango_item_get_byte_length (item) >= range_end)
           break;
       }
-  } while (pango_layout_iter_next_run (iter));
+  } while (pango_line_iter_next_run (iter));
 
-  pango_layout_iter_free (iter);
+  pango_line_iter_free (iter);
 
   return in_ellipsis;
 }
@@ -1690,7 +1695,7 @@ get_layout_index (GtkLabel *self,
   int trailing = 0;
   const char *cluster;
   const char *cluster_end;
-  gboolean inside;
+  PangoLine *line;
   int lx, ly;
 
   *index = 0;
@@ -1705,9 +1710,9 @@ get_layout_index (GtkLabel *self,
   x *= PANGO_SCALE;
   y *= PANGO_SCALE;
 
-  inside = pango_layout_xy_to_index (self->layout,
-                                     x, y,
-                                     index, &trailing);
+  line = pango_lines_pos_to_index (pango_layout_get_lines (self->layout),
+                                   x, y,
+                                   index, &trailing);
 
   cluster = self->text + *index;
   cluster_end = cluster;
@@ -1719,7 +1724,7 @@ get_layout_index (GtkLabel *self,
 
   *index += (cluster_end - cluster);
 
-  return inside;
+  return line != NULL;
 }
 
 static gboolean
@@ -4139,8 +4144,7 @@ gtk_label_ensure_layout (GtkLabel *self)
       align = PANGO_ALIGN_CENTER;
       break;
     case GTK_JUSTIFY_FILL:
-      align = rtl ? PANGO_ALIGN_RIGHT : PANGO_ALIGN_LEFT;
-      pango_layout_set_justify (self->layout, TRUE);
+      align = PANGO_ALIGN_JUSTIFY;
       break;
     default:
       g_assert_not_reached();
@@ -4149,7 +4153,7 @@ gtk_label_ensure_layout (GtkLabel *self)
   pango_layout_set_alignment (self->layout, align);
   pango_layout_set_ellipsize (self->layout, self->ellipsize);
   pango_layout_set_wrap (self->layout, self->wrap_mode);
-  pango_layout_set_single_paragraph_mode (self->layout, self->single_line_mode);
+  pango_layout_set_single_paragraph (self->layout, self->single_line_mode);
   if (self->lines > 0)
     pango_layout_set_height (self->layout, - self->lines);
 
@@ -4205,7 +4209,7 @@ gtk_label_move_forward_word (GtkLabel *self,
 
       gtk_label_ensure_layout (self);
 
-      log_attrs = pango_layout_get_log_attrs_readonly (self->layout, &n_attrs);
+      log_attrs = pango_layout_get_log_attrs (self->layout, &n_attrs);
 
       /* Find the next word end */
       new_pos++;
@@ -4229,7 +4233,7 @@ gtk_label_move_backward_word (GtkLabel *self,
 
       gtk_label_ensure_layout (self);
 
-      log_attrs = pango_layout_get_log_attrs_readonly (self->layout, &n_attrs);
+      log_attrs = pango_layout_get_log_attrs (self->layout, &n_attrs);
 
       new_pos -= 1;
 
@@ -5353,7 +5357,7 @@ get_better_cursor (GtkLabel *self,
 
   gtk_label_ensure_layout (self);
 
-  pango_layout_get_cursor_pos (self->layout, index,
+  pango_lines_get_cursor_pos (pango_layout_get_lines (self->layout), NULL, index,
                                &strong_pos, &weak_pos);
 
   if (split_cursor)
@@ -5394,7 +5398,7 @@ gtk_label_move_logically (GtkLabel *self,
 
       length = g_utf8_strlen (self->text, -1);
 
-      log_attrs = pango_layout_get_log_attrs_readonly (self->layout, &n_attrs);
+      log_attrs = pango_layout_get_log_attrs (self->layout, &n_attrs);
 
       while (count > 0 && offset < length)
         {
@@ -5461,12 +5465,14 @@ gtk_label_move_visually (GtkLabel *self,
 
       if (count > 0)
         {
-          pango_layout_move_cursor_visually (self->layout, strong, index, 0, 1, &new_index, &new_trailing);
+          pango_lines_move_cursor (pango_layout_get_lines (self->layout), strong,
+                                   NULL, index, 0, 1, NULL, &new_index, &new_trailing);
           count--;
         }
       else
         {
-          pango_layout_move_cursor_visually (self->layout, strong, index, 0, -1, &new_index, &new_trailing);
+          pango_lines_move_cursor (pango_layout_get_lines (self->layout), strong,
+                                   NULL, index, 0, -1, NULL, &new_index, &new_trailing);
           count++;
         }
 
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 80c7542b03..f76f384bb2 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -496,9 +496,6 @@ do_pre_parse_initialization (void)
       slowdown = g_ascii_strtod (env_string, NULL);
       _gtk_set_slowdown (slowdown);
     }
-
-  /* Trigger fontconfig initialization early */
-  pango_cairo_font_map_get_default ();
 }
 
 static void
diff --git a/gtk/gtkpango.c b/gtk/gtkpango.c
index 58ee7a3bf2..2e8a2b096d 100644
--- a/gtk/gtkpango.c
+++ b/gtk/gtkpango.c
@@ -81,7 +81,6 @@ attribute_from_text (GtkBuilder  *builder,
 
   switch (type)
     {
-      /* PangoAttrLanguage */
     case PANGO_ATTR_LANGUAGE:
       if ((language = pango_language_from_string (value)))
         {
@@ -89,7 +88,6 @@ attribute_from_text (GtkBuilder  *builder,
           g_value_init (&val, G_TYPE_INT);
         }
       break;
-      /* PangoAttrInt */
     case PANGO_ATTR_STYLE:
       if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_STYLE, value, &val, error))
         attribute = pango_attr_style_new (g_value_get_enum (&val));
@@ -107,20 +105,16 @@ attribute_from_text (GtkBuilder  *builder,
         attribute = pango_attr_stretch_new (g_value_get_enum (&val));
       break;
     case PANGO_ATTR_UNDERLINE:
-      if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_UNDERLINE, value, &val, NULL))
+      if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_LINE_STYLE, value, &val, NULL))
         attribute = pango_attr_underline_new (g_value_get_enum (&val));
-      else
-        {
-          /* XXX: allow boolean for backwards compat, so ignore error */
-          /* Deprecate this somehow */
-          g_value_unset (&val);
-          if (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, value, &val, error))
-            attribute = pango_attr_underline_new (g_value_get_boolean (&val));
-        }
+      break;
+    case PANGO_ATTR_UNDERLINE_POSITION:
+      if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_UNDERLINE_POSITION, value, &val, NULL))
+        attribute = pango_attr_underline_position_new (g_value_get_enum (&val));
       break;
     case PANGO_ATTR_STRIKETHROUGH:
-      if (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, value, &val, error))
-        attribute = pango_attr_strikethrough_new (g_value_get_boolean (&val));
+      if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_LINE_STYLE, value, &val, NULL))
+        attribute = pango_attr_strikethrough_new (g_value_get_enum (&val));
       break;
     case PANGO_ATTR_GRAVITY:
       if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_GRAVITY, value, &val, error))
@@ -130,13 +124,11 @@ attribute_from_text (GtkBuilder  *builder,
       if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_GRAVITY_HINT, value, &val, error))
         attribute = pango_attr_gravity_hint_new (g_value_get_enum (&val));
       break;
-      /* PangoAttrString */
     case PANGO_ATTR_FAMILY:
       attribute = pango_attr_family_new (value);
       g_value_init (&val, G_TYPE_INT);
       break;
 
-      /* PangoAttrSize */
     case PANGO_ATTR_SIZE:
       if (gtk_builder_value_from_string_type (builder, G_TYPE_INT, value, &val, error))
         attribute = pango_attr_size_new (g_value_get_int (&val));
@@ -146,7 +138,6 @@ attribute_from_text (GtkBuilder  *builder,
         attribute = pango_attr_size_new_absolute (g_value_get_int (&val));
       break;
 
-      /* PangoAttrFontDesc */
     case PANGO_ATTR_FONT_DESC:
       if ((font_desc = pango_font_description_from_string (value)))
         {
@@ -155,47 +146,46 @@ attribute_from_text (GtkBuilder  *builder,
           g_value_init (&val, G_TYPE_INT);
         }
       break;
-      /* PangoAttrColor */
     case PANGO_ATTR_FOREGROUND:
       if (gtk_builder_value_from_string_type (builder, GDK_TYPE_RGBA, value, &val, error))
         {
           color = g_value_get_boxed (&val);
-          attribute = pango_attr_foreground_new (color->red * 65535,
-                                                 color->green * 65535,
-                                                 color->blue * 65535);
+          attribute = pango_attr_foreground_new (&(PangoColor){color->red * 65535,
+                                                               color->green * 65535,
+                                                               color->blue * 65535,
+                                                               color->alpha * 65535});
         }
       break;
     case PANGO_ATTR_BACKGROUND:
       if (gtk_builder_value_from_string_type (builder, GDK_TYPE_RGBA, value, &val, error))
         {
           color = g_value_get_boxed (&val);
-          attribute = pango_attr_background_new (color->red * 65535,
-                                                 color->green * 65535,
-                                                 color->blue * 65535);
+          attribute = pango_attr_background_new (&(PangoColor){color->red * 65535,
+                                                               color->green * 65535,
+                                                               color->blue * 65535,
+                                                               color->alpha * 65535});
         }
       break;
     case PANGO_ATTR_UNDERLINE_COLOR:
       if (gtk_builder_value_from_string_type (builder, GDK_TYPE_RGBA, value, &val, error))
         {
           color = g_value_get_boxed (&val);
-          attribute = pango_attr_underline_color_new (color->red * 65535,
-                                                      color->green * 65535,
-                                                      color->blue * 65535);
+          attribute = pango_attr_underline_color_new (&(PangoColor){color->red * 65535,
+                                                                    color->green * 65535,
+                                                                    color->blue * 65535,
+                                                                    color->alpha * 65535});
         }
       break;
     case PANGO_ATTR_STRIKETHROUGH_COLOR:
       if (gtk_builder_value_from_string_type (builder, GDK_TYPE_RGBA, value, &val, error))
         {
           color = g_value_get_boxed (&val);
-          attribute = pango_attr_strikethrough_color_new (color->red * 65535,
-                                                          color->green * 65535,
-                                                          color->blue * 65535);
+          attribute = pango_attr_strikethrough_color_new (&(PangoColor){color->red * 65535,
+                                                                        color->green * 65535,
+                                                                        color->blue * 65535,
+                                                                        color->alpha * 65535});
         }
       break;
-      /* PangoAttrShape */
-    case PANGO_ATTR_SHAPE:
-      /* Unsupported for now */
-      break;
       /* PangoAttrFloat */
     case PANGO_ATTR_SCALE:
       if (gtk_builder_value_from_string_type (builder, G_TYPE_DOUBLE, value, &val, error))
@@ -216,14 +206,6 @@ attribute_from_text (GtkBuilder  *builder,
     case PANGO_ATTR_FONT_FEATURES:
       attribute = pango_attr_font_features_new (value);
       break;
-    case PANGO_ATTR_FOREGROUND_ALPHA:
-      if (gtk_builder_value_from_string_type (builder, G_TYPE_INT, value, &val, error))
-        attribute = pango_attr_foreground_alpha_new ((guint16)g_value_get_int (&val));
-      break;
-    case PANGO_ATTR_BACKGROUND_ALPHA:
-      if (gtk_builder_value_from_string_type (builder, G_TYPE_INT, value, &val, error))
-        attribute = pango_attr_background_alpha_new ((guint16)g_value_get_int (&val));
-      break;
     case PANGO_ATTR_ALLOW_BREAKS:
       if (gtk_builder_value_from_string_type (builder, G_TYPE_BOOLEAN, value, &val, error))
         attribute = pango_attr_allow_breaks_new (g_value_get_boolean (&val));
@@ -237,16 +219,17 @@ attribute_from_text (GtkBuilder  *builder,
         attribute = pango_attr_insert_hyphens_new (g_value_get_boolean (&val));
       break;
     case PANGO_ATTR_OVERLINE:
-      if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_OVERLINE, value, &val, NULL))
+      if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_LINE_STYLE, value, &val, NULL))
         attribute = pango_attr_overline_new (g_value_get_enum (&val));
       break;
     case PANGO_ATTR_OVERLINE_COLOR:
       if (gtk_builder_value_from_string_type (builder, GDK_TYPE_RGBA, value, &val, error))
         {
           color = g_value_get_boxed (&val);
-          attribute = pango_attr_overline_color_new (color->red * 65535,
-                                                     color->green * 65535,
-                                                     color->blue * 65535);
+          attribute = pango_attr_overline_color_new (&(PangoColor){color->red * 65535,
+                                                                   color->green * 65535,
+                                                                   color->blue * 65535,
+                                                                   color->alpha * 65535});
         }
       break;
     case PANGO_ATTR_LINE_HEIGHT:
@@ -257,6 +240,10 @@ attribute_from_text (GtkBuilder  *builder,
       if (gtk_builder_value_from_string_type (builder, G_TYPE_INT, value, &val, error))
         attribute = pango_attr_line_height_new_absolute (g_value_get_int (&val) * PANGO_SCALE);
       break;
+    case PANGO_ATTR_LINE_SPACING:
+      if (gtk_builder_value_from_string_type (builder, G_TYPE_INT, value, &val, error))
+        attribute = pango_attr_line_spacing_new (g_value_get_int (&val) * PANGO_SCALE);
+      break;
     case PANGO_ATTR_TEXT_TRANSFORM:
       if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_TEXT_TRANSFORM, value, &val, error))
         attribute = pango_attr_text_transform_new (g_value_get_enum (&val));
@@ -267,6 +254,9 @@ attribute_from_text (GtkBuilder  *builder,
     case PANGO_ATTR_SENTENCE:
       attribute = pango_attr_sentence_new ();
       break;
+    case PANGO_ATTR_PARAGRAPH:
+      attribute = pango_attr_paragraph_new ();
+      break;
     case PANGO_ATTR_BASELINE_SHIFT:
       if (gtk_builder_value_from_string_type (builder, PANGO_TYPE_BASELINE_SHIFT, value, &val, NULL))
         attribute = pango_attr_baseline_shift_new (g_value_get_enum (&val));
diff --git a/gtk/gtkprintcontext.c b/gtk/gtkprintcontext.c
index 1141062d31..12a39db911 100644
--- a/gtk/gtkprintcontext.c
+++ b/gtk/gtkprintcontext.c
@@ -178,7 +178,7 @@ _gtk_print_context_new (GtkPrintOperation *op)
 static PangoFontMap *
 _gtk_print_context_get_fontmap (GtkPrintContext *context)
 {
-  return pango_cairo_font_map_get_default ();
+  return pango_font_map_get_default ();
 }
 
 /**
@@ -573,8 +573,8 @@ gtk_print_context_create_pango_context (GtkPrintContext *context)
   cairo_font_options_t *options;
 
   g_return_val_if_fail (GTK_IS_PRINT_CONTEXT (context), NULL);
-  
-  pango_context = pango_font_map_create_context (_gtk_print_context_get_fontmap (context));
+
+  pango_context = pango_context_new_with_font_map (_gtk_print_context_get_fontmap (context));
 
   options = cairo_font_options_create ();
   cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_OFF);
@@ -584,8 +584,8 @@ gtk_print_context_create_pango_context (GtkPrintContext *context)
   /* We use the unit-scaled resolution, as we still want 
    * fonts given in points to work 
    */
-  pango_cairo_context_set_resolution (pango_context,
-                                     context->surface_dpi_y / context->pixels_per_unit_y);
+  pango_font_map_set_resolution (pango_context_get_font_map (pango_context),
+                                 context->surface_dpi_y / context->pixels_per_unit_y);
   return pango_context;
 }
 
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 14c15264ad..cf13d9ebe9 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -2595,7 +2595,7 @@ draw_page (GtkDrawingArea *da,
             text = g_strdup_printf ("%d", i++);
             pango_layout_set_text (layout, text, -1);
             g_free (text);
-            pango_layout_get_size (layout, &layout_w, &layout_h);
+            pango_lines_get_size (pango_layout_get_lines (layout), &layout_w, &layout_h);
             cairo_save (cr);
             cairo_translate (cr,
                              x * page_width,
@@ -2613,7 +2613,7 @@ draw_page (GtkDrawingArea *da,
             text = g_strdup_printf ("%d", i++);
             pango_layout_set_text (layout, text, -1);
             g_free (text);
-            pango_layout_get_size (layout, &layout_w, &layout_h);
+            pango_lines_get_size (pango_layout_get_lines (layout), &layout_w, &layout_h);
             cairo_save (cr);
             cairo_translate (cr,
                              x * page_width,
@@ -2680,7 +2680,7 @@ draw_page (GtkDrawingArea *da,
 
       pango_layout_set_text (layout, text, -1);
       g_free (text);
-      pango_layout_get_size (layout, &layout_w, &layout_h);
+      pango_lines_get_size (pango_layout_get_lines (layout), &layout_w, &layout_h);
 
       ltr = gtk_widget_get_direction (GTK_WIDGET (dialog)) == GTK_TEXT_DIR_LTR;
 
@@ -2704,7 +2704,7 @@ draw_page (GtkDrawingArea *da,
 
       pango_layout_set_text (layout, text, -1);
       g_free (text);
-      pango_layout_get_size (layout, &layout_w, &layout_h);
+      pango_lines_get_size (pango_layout_get_lines (layout), &layout_w, &layout_h);
 
       cairo_translate (cr, (width - layout_w / PANGO_SCALE) / 2,
                            pos_y + h + 2 * RULER_DISTANCE);
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index aeeba2ac6f..814dbe5a4e 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -1688,15 +1688,16 @@ settings_update_fontconfig (GtkSettings *settings)
 
   if (timestamp != last_update_timestamp)
     {
-      PangoFontMap *fontmap = pango_cairo_font_map_get_default ();
+      PangoFontMap *fontmap = pango_font_map_get_default ();
       gboolean update_needed = FALSE;
 
       /* bug 547680 */
-      if (PANGO_IS_FC_FONT_MAP (fontmap) && !FcConfigUptoDate (NULL))
+      if (PANGO_IS_FC_FONT_MAP (fontmap))
         {
-          pango_fc_font_map_config_changed (PANGO_FC_FONT_MAP (fontmap));
-          if (FcInitReinitialize ())
-            update_needed = TRUE;
+          FcConfig *config;
+
+          config = pango_fc_font_map_get_config (PANGO_FC_FONT_MAP (fontmap));
+          pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
         }
 
       last_update_timestamp = timestamp;
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 5fca489632..bb96e16fb6 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -1165,7 +1165,7 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot     *snapshot,
         keyboard_direction = gdk_device_get_direction (keyboard);
     }
 
-  pango_layout_get_caret_pos (layout, index, &strong_pos, &weak_pos);
+  pango_lines_get_caret_pos (pango_layout_get_lines (layout), NULL, index, &strong_pos, &weak_pos);
 
   direction2 = PANGO_DIRECTION_NEUTRAL;
 
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 92903949fe..f58b1e0250 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -2293,7 +2293,7 @@ gtk_text_get_selection_bound_location (GtkText *self)
   layout = gtk_text_ensure_layout (self, FALSE);
   text = pango_layout_get_text (layout);
   index = g_utf8_offset_to_pointer (text, priv->selection_bound) - text;
-  pango_layout_index_to_pos (layout, index, &pos);
+  pango_lines_index_to_pos (pango_layout_get_lines (layout), NULL, index, &pos);
 
   if (gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL)
     x = (pos.x + pos.width) / PANGO_SCALE;
@@ -2406,12 +2406,13 @@ gtk_text_measure (GtkWidget      *widget,
       if (priv->propagate_text_width)
         {
           PangoLayout *layout;
-          int act;
+          PangoRectangle ext;
 
           layout = gtk_text_ensure_layout (self, TRUE);
-          pango_layout_get_pixel_size (layout, &act, NULL);
+          pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+          pango_extents_to_pixels (&ext, NULL);
 
-          nat = MIN (act, nat);
+          nat = MIN (ext.width, nat);
         }
 
       nat = MAX (min, nat);
@@ -2433,17 +2434,19 @@ gtk_text_measure (GtkWidget      *widget,
     {
       int height, baseline;
       PangoLayout *layout;
+      PangoRectangle ext;
 
       layout = gtk_text_ensure_layout (self, TRUE);
 
       priv->ascent = pango_font_metrics_get_ascent (metrics);
       priv->descent = pango_font_metrics_get_descent (metrics);
 
-      pango_layout_get_pixel_size (layout, NULL, &height);
+      pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+      pango_extents_to_pixels (&ext, NULL);
 
-      height = MAX (height, PANGO_PIXELS (priv->ascent + priv->descent));
+      height = MAX (ext.height, PANGO_PIXELS (priv->ascent + priv->descent));
 
-      baseline = pango_layout_get_baseline (layout) / PANGO_SCALE;
+      baseline = pango_lines_get_baseline (pango_layout_get_lines (layout)) / PANGO_SCALE;
 
       *minimum = *natural = height;
 
@@ -2463,7 +2466,7 @@ gtk_text_measure (GtkWidget      *widget,
         *natural_baseline = baseline;
     }
 
-  pango_font_metrics_unref (metrics);
+  pango_font_metrics_free (metrics);
 }
 
 static void
@@ -2584,17 +2587,18 @@ gtk_text_get_pixel_ranges (GtkText  *self,
   if (priv->selection_bound != priv->current_pos)
     {
       PangoLayout *layout = gtk_text_ensure_layout (self, TRUE);
-      PangoLayoutLine *line = pango_layout_get_lines_readonly (layout)->data;
+      PangoLines *lines = pango_layout_get_lines (layout);
+      PangoLine *line = pango_lines_get_lines (lines)[0];
       const char *text = pango_layout_get_text (layout);
       int start_index = g_utf8_offset_to_pointer (text, priv->selection_bound) - text;
       int end_index = g_utf8_offset_to_pointer (text, priv->current_pos) - text;
       int real_n_ranges, i;
 
-      pango_layout_line_get_x_ranges (line,
-                                      MIN (start_index, end_index),
-                                      MAX (start_index, end_index),
-                                      ranges,
-                                      &real_n_ranges);
+      pango_lines_get_x_ranges (lines, line,
+                                NULL, MIN (start_index, end_index),
+                                NULL, MAX (start_index, end_index),
+                                ranges,
+                                &real_n_ranges);
 
       if (ranges)
         {
@@ -3479,7 +3483,7 @@ find_invisible_char (GtkWidget *widget)
       len = g_unichar_to_utf8 (invisible_chars[i], text);
       pango_layout_set_text (layout, text, len);
 
-      count = pango_layout_get_unknown_glyphs_count (layout);
+      count = pango_lines_get_unknown_glyphs_count (pango_layout_get_lines (layout));
 
       if (count == 0)
         {
@@ -3755,7 +3759,7 @@ get_better_cursor_x (GtkText *self,
                 "gtk-split-cursor", &split_cursor,
                 NULL);
 
-  pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
+  pango_lines_get_cursor_pos (pango_layout_get_lines (layout), NULL, index, &strong_pos, &weak_pos);
 
   if (split_cursor)
     return strong_pos.x / PANGO_SCALE;
@@ -4034,7 +4038,7 @@ gtk_text_backspace (GtkText *self)
       const PangoLogAttr *log_attrs;
       int n_attrs;
 
-      log_attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+      log_attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
       /* Deleting parts of characters */
       if (log_attrs[priv->current_pos].backspace_deletes_character)
@@ -4433,7 +4437,7 @@ gtk_text_create_layout (GtkText  *self,
   guint n_bytes;
 
   layout = gtk_widget_create_pango_layout (widget, NULL);
-  pango_layout_set_single_paragraph_mode (layout, TRUE);
+  pango_layout_set_single_paragraph (layout, TRUE);
 
   tmp_attrs = gtk_css_style_get_pango_attributes (gtk_css_node_get_style (gtk_widget_get_css_node (widget)));
   if (!tmp_attrs)
@@ -4549,23 +4553,25 @@ get_layout_position (GtkText *self,
   GtkTextPrivate *priv = gtk_text_get_instance_private (self);
   const int text_height = gtk_widget_get_height (GTK_WIDGET (self));
   PangoLayout *layout;
+  PangoLines *lines;
   PangoRectangle logical_rect;
   int y_pos, area_height;
-  PangoLayoutLine *line;
+  PangoLine *line;
 
   layout = gtk_text_ensure_layout (self, TRUE);
+  lines = pango_layout_get_lines (layout);
 
   area_height = PANGO_SCALE * text_height;
 
-  line = pango_layout_get_lines_readonly (layout)->data;
-  pango_layout_line_get_extents (line, NULL, &logical_rect);
+  line = pango_lines_get_lines (lines)[0];
+  pango_line_get_extents (line, NULL, &logical_rect);
 
   /* Align primarily for locale's ascent/descent */
   if (priv->text_baseline < 0)
     y_pos = ((area_height - priv->ascent - priv->descent) / 2 +
              priv->ascent + logical_rect.y);
   else
-    y_pos = PANGO_SCALE * priv->text_baseline - pango_layout_get_baseline (layout);
+    y_pos = PANGO_SCALE * priv->text_baseline - pango_lines_get_baseline (lines);
 
   /* Now see if we need to adjust to fit in actual drawn string */
   if (logical_rect.height > area_height)
@@ -4826,7 +4832,7 @@ gtk_text_find_position (GtkText *self,
 {
   GtkTextPrivate *priv = gtk_text_get_instance_private (self);
   PangoLayout *layout;
-  PangoLayoutLine *line;
+  PangoLine *line;
   int index;
   int pos;
   int trailing;
@@ -4837,8 +4843,8 @@ gtk_text_find_position (GtkText *self,
   text = pango_layout_get_text (layout);
   cursor_index = g_utf8_offset_to_pointer (text, priv->current_pos) - text;
 
-  line = pango_layout_get_lines_readonly (layout)->data;
-  pango_layout_line_x_to_index (line, x * PANGO_SCALE, &index, &trailing);
+  line = pango_lines_get_lines (pango_layout_get_lines (layout))[0];
+  pango_line_x_to_index (line, x * PANGO_SCALE, &index, &trailing);
 
   if (index >= cursor_index && priv->preedit_length)
     {
@@ -4883,7 +4889,7 @@ gtk_text_get_cursor_locations (GtkText   *self,
 
       index = g_utf8_offset_to_pointer (text, priv->current_pos + priv->preedit_cursor) - text;
 
-      pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
+      pango_lines_get_cursor_pos (pango_layout_get_lines (layout), NULL, index, &strong_pos, &weak_pos);
 
       if (strong_x)
         *strong_x = strong_pos.x / PANGO_SCALE;
@@ -4915,14 +4921,14 @@ gtk_text_get_scroll_limits (GtkText *self,
   GtkTextPrivate *priv = gtk_text_get_instance_private (self);
   float xalign;
   PangoLayout *layout;
-  PangoLayoutLine *line;
+  PangoLine *line;
   PangoRectangle logical_rect;
   int text_width, width;
 
   layout = gtk_text_ensure_layout (self, TRUE);
-  line = pango_layout_get_lines_readonly (layout)->data;
+  line = pango_lines_get_lines (pango_layout_get_lines (layout))[0];
 
-  pango_layout_line_get_extents (line, NULL, &logical_rect);
+  pango_line_get_extents (line, NULL, &logical_rect);
 
   /* Display as much text as we can */
 
@@ -5065,12 +5071,16 @@ gtk_text_move_visually (GtkText *self,
 
       if (count > 0)
         {
-          pango_layout_move_cursor_visually (layout, strong, index, 0, 1, &new_index, &new_trailing);
+          pango_lines_move_cursor (pango_layout_get_lines (layout), strong,
+                                   NULL, index, 0, 1,
+                                   NULL, &new_index, &new_trailing);
           count--;
         }
       else
         {
-          pango_layout_move_cursor_visually (layout, strong, index, 0, -1, &new_index, &new_trailing);
+          pango_lines_move_cursor (pango_layout_get_lines (layout), strong,
+                                   NULL, index, 0, -1,
+                                   NULL, &new_index, &new_trailing);
           count++;
         }
 
@@ -5107,7 +5117,7 @@ gtk_text_move_logically (GtkText *self,
       const PangoLogAttr *log_attrs;
       int n_attrs;
 
-      log_attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+      log_attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
       while (count > 0 && new_pos < length)
         {
@@ -5151,7 +5161,7 @@ gtk_text_move_forward_word (GtkText  *self,
       const PangoLogAttr *log_attrs;
       int n_attrs;
 
-      log_attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+      log_attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
       /* Find the next word boundary */
       new_pos++;
@@ -5182,7 +5192,7 @@ gtk_text_move_backward_word (GtkText  *self,
       const PangoLogAttr *log_attrs;
       int n_attrs;
 
-      log_attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+      log_attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
       new_pos = start - 1;
 
@@ -5204,7 +5214,7 @@ gtk_text_delete_whitespace (GtkText *self)
   int n_attrs;
   int start, end;
 
-  log_attrs = pango_layout_get_log_attrs_readonly (layout, &n_attrs);
+  log_attrs = pango_layout_get_log_attrs (layout, &n_attrs);
 
   start = end = priv->current_pos;
 
@@ -7150,9 +7160,10 @@ gtk_text_compute_cursor_extents (GtkText         *self,
   position = CLAMP (position, 0, g_utf8_strlen (text, -1));
   index = g_utf8_offset_to_pointer (text, position) - text;
 
-  pango_layout_get_cursor_pos (layout, index,
-                               strong ? &pango_strong_pos : NULL,
-                               weak ? &pango_weak_pos : NULL);
+  pango_lines_get_cursor_pos (pango_layout_get_lines (layout),
+                              NULL, index,
+                              strong ? &pango_strong_pos : NULL,
+                              weak ? &pango_weak_pos : NULL);
   gtk_text_get_layout_offsets (self, &offset_x, &offset_y);
 
   if (strong)
diff --git a/gtk/gtktextattributes.c b/gtk/gtktextattributes.c
index 856b4f3310..6c4adb4de9 100644
--- a/gtk/gtktextattributes.c
+++ b/gtk/gtktextattributes.c
@@ -403,6 +403,9 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest,
       if (tag->priv->underline_set)
         dest->appearance.underline = vals->appearance.underline;
 
+      if (tag->priv->underline_position_set)
+        dest->appearance.underline_position = vals->appearance.underline_position;
+
       if (tag->priv->overline_set)
         dest->appearance.overline = vals->appearance.overline;
 
@@ -472,6 +475,7 @@ _gtk_text_tag_affects_size (GtkTextTag *tag)
     priv->line_height_set ||
     priv->tabs_set ||
     priv->underline_set ||
+    priv->underline_position_set ||
     priv->overline_set ||
     priv->wrap_mode_set ||
     priv->invisible_set ||
diff --git a/gtk/gtktextattributes.h b/gtk/gtktextattributes.h
index 3aa01c8690..c8c1af3e87 100644
--- a/gtk/gtktextattributes.h
+++ b/gtk/gtktextattributes.h
@@ -71,9 +71,10 @@ struct _GtkTextAppearance
   /* super/subscript rise, can be negative */
   int rise;
 
-  guint underline : 4;          /* PangoUnderline */
-  guint overline  : 2;          /* PangoOverline */
-  guint strikethrough : 1;
+  guint underline          : 4; /* PangoLineStyle */
+  guint overline           : 4; /* PangoLineStyle */
+  guint strikethrough      : 4; /* PangoLineStyle */
+  guint underline_position : 4; /* PangoUnderlinePosition */
 
   /* Whether to use background-related values; this is irrelevant for
    * the values struct when in a tag, but is used for the composite
diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c
index b3fa50ab5c..5cda519c0a 100644
--- a/gtk/gtktextbuffer.c
+++ b/gtk/gtktextbuffer.c
@@ -4361,7 +4361,7 @@ compute_log_attrs (const GtkTextIter *iter,
   /* FIXME we need to follow PangoLayout and allow different language
    * tags within the paragraph
    */
-  pango_get_log_attrs (paragraph, byte_len, -1,
+  pango_get_log_attrs (paragraph, byte_len, NULL, -1,
                       gtk_text_iter_get_language (&start),
                        attrs,
                        char_len + 1);
@@ -4468,13 +4468,12 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
   GSList *attrs, *l;
   GtkTextTag *tag;
   char name[256];
-  float fg_alpha, bg_alpha;
 
   table = gtk_text_buffer_get_tag_table (buffer);
 
 #define LANGUAGE_ATTR(attr_name) \
     { \
-      const char *language = pango_language_to_string (((PangoAttrLanguage*)attr)->value); \
+      const char *language = pango_language_to_string (attr->lang_value); \
       g_snprintf (name, 256, "language=%s", language); \
       tag = gtk_text_tag_table_lookup (table, name); \
       if (!tag) \
@@ -4489,7 +4488,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
 
 #define STRING_ATTR(attr_name) \
     { \
-      const char *string = ((PangoAttrString*)attr)->value; \
+      const char *string = attr->str_value; \
       g_snprintf (name, 256, #attr_name "=%s", string); \
       tag = gtk_text_tag_table_lookup (table, name); \
       if (!tag) \
@@ -4504,7 +4503,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
 
 #define INT_ATTR(attr_name) \
     { \
-      int value = ((PangoAttrInt*)attr)->value; \
+      int value = attr->int_value; \
       g_snprintf (name, 256, #attr_name "=%d", value); \
       tag = gtk_text_tag_table_lookup (table, name); \
       if (!tag) \
@@ -4519,7 +4518,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
 
 #define FONT_ATTR(attr_name) \
     { \
-      PangoFontDescription *desc = ((PangoAttrFontDesc*)attr)->desc; \
+      PangoFontDescription *desc = attr->font_value; \
       char *str = pango_font_description_to_string (desc); \
       g_snprintf (name, 256, "font-desc=%s", str); \
       g_free (str); \
@@ -4536,7 +4535,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
 
 #define FLOAT_ATTR(attr_name) \
     { \
-      float value = ((PangoAttrFloat*)attr)->value; \
+      float value = attr->double_value; \
       g_snprintf (name, 256, #attr_name "=%g", value); \
       tag = gtk_text_tag_table_lookup (table, name); \
       if (!tag) \
@@ -4549,15 +4548,14 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
       gtk_text_buffer_apply_tag (buffer, tag, start, end); \
     }
 
-#define RGBA_ATTR(attr_name, alpha_value) \
+#define RGBA_ATTR(attr_name) \
     { \
-      PangoColor *color; \
+      PangoColor *color = &attr->color_value; \
       GdkRGBA rgba; \
-      color = &((PangoAttrColor*)attr)->color; \
       rgba.red = color->red / 65535.; \
       rgba.green = color->green / 65535.; \
       rgba.blue = color->blue / 65535.; \
-      rgba.alpha = alpha_value; \
+      rgba.alpha = color->alpha / 65535.; \
       char *str = gdk_rgba_to_string (&rgba); \
       g_snprintf (name, 256, #attr_name "=%s", str); \
       g_free (str); \
@@ -4585,32 +4583,12 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
       gtk_text_buffer_apply_tag (buffer, tag, start, end); \
     }
 
-  fg_alpha = bg_alpha = 1.;
   attrs = pango_attr_iterator_get_attrs (iter);
   for (l = attrs; l; l = l->next)
     {
       PangoAttribute *attr = l->data;
 
-      switch ((int)attr->klass->type)
-        {
-        case PANGO_ATTR_FOREGROUND_ALPHA:
-          fg_alpha = ((PangoAttrInt*)attr)->value / 65535.;
-          break;
-
-        case PANGO_ATTR_BACKGROUND_ALPHA:
-          bg_alpha = ((PangoAttrInt*)attr)->value / 65535.;
-          break;
-
-        default:
-          break;
-        }
-    }
-
-  for (l = attrs; l; l = l->next)
-    {
-      PangoAttribute *attr = l->data;
-
-      switch (attr->klass->type)
+      switch (attr->type)
         {
         case PANGO_ATTR_LANGUAGE:
           LANGUAGE_ATTR (language);
@@ -4645,19 +4623,24 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           break;
 
         case PANGO_ATTR_FOREGROUND:
-          RGBA_ATTR (foreground_rgba, fg_alpha);
+          RGBA_ATTR (foreground_rgba);
           break;
 
         case PANGO_ATTR_BACKGROUND:
-          RGBA_ATTR (background_rgba, bg_alpha);
+          RGBA_ATTR (background_rgba);
           break;
 
         case PANGO_ATTR_UNDERLINE:
           INT_ATTR (underline);
           break;
 
+        case PANGO_ATTR_UNDERLINE_POSITION:
+          g_print ("insert underline-position\n");
+          INT_ATTR (underline_position);
+          break;
+
         case PANGO_ATTR_UNDERLINE_COLOR:
-          RGBA_ATTR (underline_rgba, fg_alpha);
+          RGBA_ATTR (underline_rgba);
           break;
 
         case PANGO_ATTR_OVERLINE:
@@ -4665,7 +4648,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           break;
 
         case PANGO_ATTR_OVERLINE_COLOR:
-          RGBA_ATTR (overline_rgba, fg_alpha);
+          RGBA_ATTR (overline_rgba);
           break;
 
         case PANGO_ATTR_STRIKETHROUGH:
@@ -4673,7 +4656,7 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           break;
 
         case PANGO_ATTR_STRIKETHROUGH_COLOR:
-          RGBA_ATTR (strikethrough_rgba, fg_alpha);
+          RGBA_ATTR (strikethrough_rgba);
           break;
 
         case PANGO_ATTR_RISE:
@@ -4696,6 +4679,10 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           FLOAT_ATTR (line_height);
           break;
 
+        case PANGO_ATTR_LINE_SPACING:
+          INT_ATTR (pixels_inside_wrap);
+          break;
+
         case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT:
           break;
 
@@ -4727,6 +4714,10 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           VOID_ATTR (sentence);
           break;
 
+        case PANGO_ATTR_PARAGRAPH:
+          VOID_ATTR (paragraph);
+          break;
+
         case PANGO_ATTR_BASELINE_SHIFT:
           INT_ATTR (baseline_shift);
           break;
@@ -4735,12 +4726,9 @@ insert_tags_for_attributes (GtkTextBuffer     *buffer,
           INT_ATTR (font_scale);
           break;
 
-        case PANGO_ATTR_SHAPE:
         case PANGO_ATTR_ABSOLUTE_SIZE:
         case PANGO_ATTR_GRAVITY:
         case PANGO_ATTR_GRAVITY_HINT:
-        case PANGO_ATTR_FOREGROUND_ALPHA:
-        case PANGO_ATTR_BACKGROUND_ALPHA:
           break;
 
         case PANGO_ATTR_INVALID:
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index ad0570b6b1..06e97fac10 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -1073,7 +1073,9 @@ gtk_text_layout_wrap (GtkTextLayout   *layout,
   line_data->width = display->width;
   line_data->height = display->height;
   line_data->valid = TRUE;
-  pango_layout_get_pixel_extents (display->layout, &ink_rect, &logical_rect);
+  pango_lines_get_extents (pango_layout_get_lines (display->layout), &ink_rect, &logical_rect);
+  pango_extents_to_pixels (&ink_rect, NULL);
+  pango_extents_to_pixels (&logical_rect, NULL);
   line_data->top_ink = MAX (0, logical_rect.x - ink_rect.x);
   line_data->bottom_ink = MAX (0, logical_rect.x + logical_rect.width - ink_rect.x - ink_rect.width);
   gtk_text_line_display_unref (display);
@@ -1228,8 +1230,6 @@ set_para_values (GtkTextLayout      *layout,
       display->direction = GTK_TEXT_DIR_RTL;
       break;
     case PANGO_DIRECTION_LTR:
-    case PANGO_DIRECTION_TTB_LTR:
-    case PANGO_DIRECTION_TTB_RTL:
     case PANGO_DIRECTION_WEAK_LTR:
     case PANGO_DIRECTION_WEAK_RTL:
     default:
@@ -1245,17 +1245,14 @@ set_para_values (GtkTextLayout      *layout,
   switch (style->justification)
     {
     case GTK_JUSTIFY_LEFT:
-      pango_align = (base_dir == PANGO_DIRECTION_LTR) ? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT;
-      break;
     case GTK_JUSTIFY_RIGHT:
-      pango_align = (base_dir == PANGO_DIRECTION_LTR) ? PANGO_ALIGN_RIGHT : PANGO_ALIGN_LEFT;
+      pango_align = PANGO_ALIGN_NATURAL;
       break;
     case GTK_JUSTIFY_CENTER:
       pango_align = PANGO_ALIGN_CENTER;
       break;
     case GTK_JUSTIFY_FILL:
-      pango_align = (base_dir == PANGO_DIRECTION_LTR) ? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT;
-      pango_layout_set_justify (display->layout, TRUE);
+      pango_align = GTK_JUSTIFY_FILL;
       break;
     default:
       g_assert_not_reached ();
@@ -1263,8 +1260,7 @@ set_para_values (GtkTextLayout      *layout,
     }
 
   pango_layout_set_alignment (display->layout, pango_align);
-  pango_layout_set_spacing (display->layout,
-                            style->pixels_inside_wrap * PANGO_SCALE);
+  pango_layout_set_spacing (display->layout, style->pixels_inside_wrap * PANGO_SCALE);
 
   if (style->tabs)
     pango_layout_set_tabs (display->layout, style->tabs);
@@ -1320,35 +1316,54 @@ set_para_values (GtkTextLayout      *layout,
     }
 }
 
-static PangoAttribute *
-gtk_text_attr_appearance_copy (const PangoAttribute *attr)
+static gpointer
+gtk_text_attr_appearance_copy (gconstpointer data)
 {
-  const GtkTextAttrAppearance *appearance_attr = (const GtkTextAttrAppearance *)attr;
+  const GtkTextAppearance *appearance = data;
+  GtkTextAppearance *copy;
+
+  copy = g_new (GtkTextAppearance, 1);
+  memcpy (copy, appearance, sizeof (GtkTextAppearance));
+
+  if (copy->fg_rgba)
+    copy->fg_rgba = gdk_rgba_copy (copy->fg_rgba);
+
+  if (copy->bg_rgba)
+    copy->bg_rgba = gdk_rgba_copy (copy->bg_rgba);
 
-  return gtk_text_attr_appearance_new (&appearance_attr->appearance);
+  if (copy->underline_rgba)
+    copy->underline_rgba = gdk_rgba_copy (copy->underline_rgba);
+
+  if (copy->overline_rgba)
+    copy->overline_rgba = gdk_rgba_copy (copy->overline_rgba);
+
+  if (copy->strikethrough_rgba)
+    copy->strikethrough_rgba = gdk_rgba_copy (copy->strikethrough_rgba);
+
+  return copy;
 }
 
 static void
-gtk_text_attr_appearance_destroy (PangoAttribute *attr)
+gtk_text_attr_appearance_destroy (gpointer data)
 {
-  GtkTextAttrAppearance *appearance_attr = (GtkTextAttrAppearance *)attr;
+  GtkTextAppearance *appearance = data;
 
-  if (appearance_attr->appearance.fg_rgba)
-    gdk_rgba_free (appearance_attr->appearance.fg_rgba);
+  if (appearance->fg_rgba)
+    gdk_rgba_free (appearance->fg_rgba);
 
-  if (appearance_attr->appearance.bg_rgba)
-    gdk_rgba_free (appearance_attr->appearance.bg_rgba);
+  if (appearance->bg_rgba)
+    gdk_rgba_free (appearance->bg_rgba);
 
-  if (appearance_attr->appearance.underline_rgba)
-    gdk_rgba_free (appearance_attr->appearance.underline_rgba);
+  if (appearance->underline_rgba)
+    gdk_rgba_free (appearance->underline_rgba);
 
-  if (appearance_attr->appearance.overline_rgba)
-    gdk_rgba_free (appearance_attr->appearance.overline_rgba);
+  if (appearance->overline_rgba)
+    gdk_rgba_free (appearance->overline_rgba);
 
-  if (appearance_attr->appearance.strikethrough_rgba)
-    gdk_rgba_free (appearance_attr->appearance.strikethrough_rgba);
+  if (appearance->strikethrough_rgba)
+    gdk_rgba_free (appearance->strikethrough_rgba);
 
-  g_slice_free (GtkTextAttrAppearance, appearance_attr);
+  g_free (appearance);
 }
 
 static gboolean
@@ -1391,11 +1406,11 @@ strikethrough_equal (const GtkTextAppearance *appearance1,
 }
 
 static gboolean
-gtk_text_attr_appearance_compare (const PangoAttribute *attr1,
-                                  const PangoAttribute *attr2)
+gtk_text_attr_appearance_compare (gconstpointer data1,
+                                  gconstpointer data2)
 {
-  const GtkTextAppearance *appearance1 = &((const GtkTextAttrAppearance *)attr1)->appearance;
-  const GtkTextAppearance *appearance2 = &((const GtkTextAttrAppearance *)attr2)->appearance;
+  const GtkTextAppearance *appearance1 = data1;
+  const GtkTextAppearance *appearance2 = data2;
 
   return rgba_equal (appearance1->fg_rgba, appearance2->fg_rgba) &&
          rgba_equal (appearance1->bg_rgba, appearance2->bg_rgba) &&
@@ -1405,53 +1420,37 @@ gtk_text_attr_appearance_compare (const PangoAttribute *attr1,
          overline_equal (appearance1, appearance2);
 }
 
-/*
- * gtk_text_attr_appearance_new:
- * @desc:
- *
- * Create a new font description attribute. (This attribute
- * allows setting family, style, weight, variant, stretch,
- * and size simultaneously.)
- *
- * Returns:
- */
 static PangoAttribute *
 gtk_text_attr_appearance_new (const GtkTextAppearance *appearance)
 {
-  static PangoAttrClass klass = {
-    0,
-    gtk_text_attr_appearance_copy,
-    gtk_text_attr_appearance_destroy,
-    gtk_text_attr_appearance_compare
-  };
-
-  GtkTextAttrAppearance *result;
-
-  if (!klass.type)
-    klass.type = gtk_text_attr_appearance_type =
-      pango_attr_type_register (I_("GtkTextAttrAppearance"));
+  PangoAttribute *attr;
 
-  result = g_slice_new (GtkTextAttrAppearance);
-  result->attr.klass = &klass;
+  if (gtk_text_attr_appearance_type == 0)
+   gtk_text_attr_appearance_type =
+       pango_attr_type_register ("appearance",
+                                 PANGO_ATTR_VALUE_POINTER,
+                                 PANGO_ATTR_AFFECTS_RENDERING,
+                                 PANGO_ATTR_MERGE_OVERRIDES,
+                                 gtk_text_attr_appearance_copy,
+                                 gtk_text_attr_appearance_destroy,
+                                 gtk_text_attr_appearance_compare,
+                                 NULL);
 
-  result->appearance = *appearance;
+  attr = pango_attribute_new (gtk_text_attr_appearance_type);
 
-  if (appearance->fg_rgba)
-    result->appearance.fg_rgba = gdk_rgba_copy (appearance->fg_rgba);
+  attr->pointer_value = gtk_text_attr_appearance_copy (appearance);
 
-  if (appearance->bg_rgba)
-    result->appearance.bg_rgba = gdk_rgba_copy (appearance->bg_rgba);
-
-  if (appearance->underline_rgba)
-    result->appearance.underline_rgba = gdk_rgba_copy (appearance->underline_rgba);
-
-  if (appearance->overline_rgba)
-    result->appearance.overline_rgba = gdk_rgba_copy (appearance->overline_rgba);
-
-  if (appearance->strikethrough_rgba)
-    result->appearance.strikethrough_rgba = gdk_rgba_copy (appearance->strikethrough_rgba);
+  return attr;
+}
 
-  return (PangoAttribute *)result;
+static void
+convert_pango_color (PangoColor    *result,
+                     const GdkRGBA *rgba)
+{
+  result->red = rgba->red * 65535.;
+  result->green = rgba->green * 65535.;
+  result->blue = rgba->blue * 65535.;
+  result->alpha = rgba->alpha * 65535.;
 }
 
 static void
@@ -1464,8 +1463,9 @@ add_generic_attrs (GtkTextLayout      *layout,
                    gboolean            is_text)
 {
   PangoAttribute *attr;
+  PangoColor color;
 
-  if (appearance->underline != PANGO_UNDERLINE_NONE)
+  if (appearance->underline != PANGO_LINE_STYLE_NONE)
     {
       attr = pango_attr_underline_new (appearance->underline);
 
@@ -1475,11 +1475,21 @@ add_generic_attrs (GtkTextLayout      *layout,
       pango_attr_list_insert (attrs, attr);
     }
 
+  if (appearance->underline_position != PANGO_UNDERLINE_POSITION_NORMAL)
+    {
+      attr = pango_attr_underline_position_new (appearance->underline_position);
+
+      g_print ("add underline-position\n");
+      attr->start_index = start;
+      attr->end_index = start + byte_count;
+
+      pango_attr_list_insert (attrs, attr);
+    }
+
   if (appearance->underline_rgba)
     {
-      attr = pango_attr_underline_color_new (appearance->underline_rgba->red * 65535,
-                                             appearance->underline_rgba->green * 65535,
-                                             appearance->underline_rgba->blue * 65535);
+      convert_pango_color (&color, appearance->underline_rgba);
+      attr = pango_attr_underline_color_new (&color);
 
       attr->start_index = start;
       attr->end_index = start + byte_count;
@@ -1487,7 +1497,7 @@ add_generic_attrs (GtkTextLayout      *layout,
       pango_attr_list_insert (attrs, attr);
     }
 
-  if (appearance->overline != PANGO_OVERLINE_NONE)
+  if (appearance->overline != PANGO_LINE_STYLE_NONE)
     {
       attr = pango_attr_overline_new (appearance->overline);
 
@@ -1499,9 +1509,8 @@ add_generic_attrs (GtkTextLayout      *layout,
 
   if (appearance->overline_rgba)
     {
-      attr = pango_attr_overline_color_new (appearance->overline_rgba->red * 65535,
-                                            appearance->overline_rgba->green * 65535,
-                                            appearance->overline_rgba->blue * 65535);
+      convert_pango_color (&color, appearance->overline_rgba);
+      attr = pango_attr_overline_color_new (&color);
 
       attr->start_index = start;
       attr->end_index = start + byte_count;
@@ -1521,9 +1530,8 @@ add_generic_attrs (GtkTextLayout      *layout,
 
   if (appearance->strikethrough_rgba)
     {
-      attr = pango_attr_strikethrough_color_new (appearance->strikethrough_rgba->red * 65535,
-                                                 appearance->strikethrough_rgba->green * 65535,
-                                                 appearance->strikethrough_rgba->blue * 65535);
+      convert_pango_color (&color, appearance->strikethrough_rgba);
+      attr = pango_attr_strikethrough_color_new (&color);
 
       attr->start_index = start;
       attr->end_index = start + byte_count;
@@ -1547,8 +1555,7 @@ add_generic_attrs (GtkTextLayout      *layout,
 
       attr->start_index = start;
       attr->end_index = start + byte_count;
-
-      ((GtkTextAttrAppearance *)attr)->appearance.is_text = is_text;
+      ((GtkTextAppearance *) attr->pointer_value)->is_text = is_text;
 
       pango_attr_list_insert (attrs, attr);
     }
@@ -1568,7 +1575,7 @@ add_text_attrs (GtkTextLayout      *layout,
   PangoAttribute *attr;
 
   if (*last_font_attr &&
-      pango_font_description_equal (style->font, ((PangoAttrFontDesc*)*last_font_attr)->desc) &&
+      pango_font_description_equal (style->font, (*last_font_attr)->font_value) &&
       (*last_font_attr)->end_index >= start)
     {
       (*last_font_attr)->start_index = MIN ((*last_font_attr)->start_index, start);
@@ -1585,7 +1592,7 @@ add_text_attrs (GtkTextLayout      *layout,
     }
 
   if (*last_scale_attr &&
-      style->font_scale == ((PangoAttrFloat*)*last_scale_attr)->value &&
+      style->font_scale == (*last_scale_attr)->double_value &&
       (*last_scale_attr)->end_index >= start)
     {
       (*last_scale_attr)->start_index = MIN ((*last_scale_attr)->start_index, start);
@@ -1602,7 +1609,7 @@ add_text_attrs (GtkTextLayout      *layout,
     }
 
   if (*last_fallback_attr &&
-      (!style->no_fallback) == ((PangoAttrInt*)*last_fallback_attr)->value &&
+      (!style->no_fallback) == (*last_fallback_attr)->int_value &&
       (*last_fallback_attr)->end_index >= start)
     {
       (*last_fallback_attr)->start_index = MIN ((*last_fallback_attr)->start_index, start);
@@ -1735,11 +1742,13 @@ add_paintable_attrs (GtkTextLayout      *layout,
   logical_rect.width = width * PANGO_SCALE;
   logical_rect.height = height * PANGO_SCALE;
 
+#if 0
   attr = pango_attr_shape_new_with_data (&logical_rect, &logical_rect,
                                         paintable->paintable, NULL, NULL);
   attr->start_index = start;
   attr->end_index = start + seg->byte_count;
   pango_attr_list_insert (attrs, attr);
+#endif
 }
 
 static void
@@ -1803,11 +1812,13 @@ add_child_attrs (GtkTextLayout      *layout,
   logical_rect.width = width * PANGO_SCALE;
   logical_rect.height = height * PANGO_SCALE;
 
+#if 0
   attr = pango_attr_shape_new_with_data (&logical_rect, &logical_rect,
                                         widget, NULL, NULL);
   attr->start_index = start;
   attr->end_index = start + seg->byte_count;
   pango_attr_list_insert (attrs, attr);
+#endif
 }
 
 /*
@@ -1902,18 +1913,18 @@ add_cursor (GtkTextLayout      *layout,
 }
 
 static gboolean
-is_shape (PangoLayoutRun *run)
+is_shape (PangoRun *run)
 {
-  GSList *tmp_list = run->item->analysis.extra_attrs;
+  PangoItem *item = pango_run_get_item (run);
 
-  while (tmp_list)
+  for (GSList *l = pango_analysis_get_extra_attributes (pango_item_get_analysis (item)); l; l = l->next)
     {
-      PangoAttribute *attr = tmp_list->data;
+      PangoAttribute *attr = l->data;
 
+#if 0
       if (attr->klass->type == PANGO_ATTR_SHAPE)
         return TRUE;
-
-      tmp_list = tmp_list->next;
+#endif
     }
 
   return FALSE;
@@ -1924,12 +1935,12 @@ allocate_child_widgets (GtkTextLayout      *text_layout,
                         GtkTextLineDisplay *display)
 {
   PangoLayout *layout = display->layout;
-  PangoLayoutIter *run_iter;
+  PangoLineIter *run_iter;
 
   run_iter = pango_layout_get_iter (layout);
   do
     {
-      PangoLayoutRun *run = pango_layout_iter_get_run_readonly (run_iter);
+      PangoRun *run = pango_line_iter_get_run (run_iter);
 
       if (run && is_shape (run))
         {
@@ -1943,7 +1954,7 @@ allocate_child_widgets (GtkTextLayout      *text_layout,
           /* The pango iterator iterates in visual order.
            * We use the byte index to find the child widget.
            */
-          byte_index = pango_layout_iter_get_index (run_iter);
+          byte_index = pango_line_iter_get_index (run_iter);
           line_display_index_to_iter (text_layout, display, &text_iter, byte_index, 0);
           anchor = gtk_text_iter_get_child_anchor (&text_iter);
           if (anchor)
@@ -1961,7 +1972,7 @@ allocate_child_widgets (GtkTextLayout      *text_layout,
                    * the widget with respect to the top of the line
                    * and the left side of the buffer
                    */
-                  pango_layout_iter_get_run_extents (run_iter,
+                  pango_line_iter_get_run_extents (run_iter,
                                                      NULL,
                                                      &extents);
 
@@ -1977,9 +1988,9 @@ allocate_child_widgets (GtkTextLayout      *text_layout,
           g_free (widgets);
         }
     }
-  while (pango_layout_iter_next_run (run_iter));
+  while (pango_line_iter_next_run (run_iter));
 
-  pango_layout_iter_free (run_iter);
+  pango_line_iter_free (run_iter);
 }
 
 void
@@ -1991,12 +2002,12 @@ gtk_text_layout_update_children (GtkTextLayout      *text_layout,
 
 static void
 convert_color (GdkRGBA        *result,
-              PangoAttrColor *attr)
+              PangoAttribute *attr)
 {
-  result->red = attr->color.red / 65535.;
-  result->blue = attr->color.blue / 65535.;
-  result->green = attr->color.green / 65535.;
-  result->alpha = 1;
+  result->red = attr->color_value.red / 65535.;
+  result->green = attr->color_value.green / 65535.;
+  result->blue = attr->color_value.blue / 65535.;
+  result->alpha = attr->color_value.alpha / 65535.;
 }
 
 /* This function is used to convert the preedit string attributes, which are
@@ -2049,50 +2060,50 @@ add_preedit_attrs (GtkTextLayout     *layout,
          PangoAttribute *attr = tmp_list->data;
          GdkRGBA rgba;
 
-         switch ((guint) attr->klass->type)
+         switch ((guint) attr->type)
            {
            case PANGO_ATTR_FOREGROUND:
-             convert_color (&rgba, (PangoAttrColor *)attr);
+             convert_color (&rgba, attr);
              if (appearance.fg_rgba)
                gdk_rgba_free (appearance.fg_rgba);
              appearance.fg_rgba = gdk_rgba_copy (&rgba);
              break;
            case PANGO_ATTR_BACKGROUND:
-             convert_color (&rgba, (PangoAttrColor *)attr);
+             convert_color (&rgba, attr);
              if (appearance.bg_rgba)
                gdk_rgba_free (appearance.bg_rgba);
              appearance.bg_rgba = gdk_rgba_copy (&rgba);
              appearance.draw_bg = TRUE;
              break;
            case PANGO_ATTR_UNDERLINE:
-             appearance.underline = ((PangoAttrInt *)attr)->value;
+             appearance.underline = attr->int_value;
              break;
             case PANGO_ATTR_UNDERLINE_COLOR:
-              convert_color (&rgba, (PangoAttrColor*)attr);
+              convert_color (&rgba, attr);
              if (appearance.underline_rgba)
                gdk_rgba_free (appearance.underline_rgba);
              appearance.underline_rgba = gdk_rgba_copy (&rgba);
              break;
            case PANGO_ATTR_OVERLINE:
-             appearance.overline = ((PangoAttrInt *)attr)->value;
+             appearance.overline = attr->int_value;
              break;
             case PANGO_ATTR_OVERLINE_COLOR:
-              convert_color (&rgba, (PangoAttrColor*)attr);
+              convert_color (&rgba, attr);
              if (appearance.overline_rgba)
                gdk_rgba_free (appearance.overline_rgba);
              appearance.overline_rgba = gdk_rgba_copy (&rgba);
              break;
            case PANGO_ATTR_STRIKETHROUGH:
-             appearance.strikethrough = ((PangoAttrInt *)attr)->value;
+             appearance.strikethrough = attr->int_value;
              break;
             case PANGO_ATTR_STRIKETHROUGH_COLOR:
-              convert_color (&rgba, (PangoAttrColor*)attr);
+              convert_color (&rgba, attr);
              if (appearance.strikethrough_rgba)
                gdk_rgba_free (appearance.strikethrough_rgba);
              appearance.strikethrough_rgba = gdk_rgba_copy (&rgba);
              break;
             case PANGO_ATTR_RISE:
-              appearance.rise = ((PangoAttrInt *)attr)->value;
+              appearance.rise = attr->int_value;
               break;
            default:
              break;
@@ -2578,7 +2589,7 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
   g_slist_free (cursor_byte_offsets);
   g_slist_free (cursor_segs);
 
-  pango_layout_get_extents (display->layout, NULL, &extents);
+  pango_lines_get_extents (pango_layout_get_lines (display->layout), NULL, &extents);
 
   text_pixel_width = PIXEL_BOUND (extents.width);
 
@@ -2606,6 +2617,17 @@ gtk_text_layout_create_display (GtkTextLayout *layout,
         case PANGO_ALIGN_RIGHT:
           display->x_offset += excess;
           break;
+        case PANGO_ALIGN_NATURAL:
+          {
+            PangoLine *first_line;
+
+            first_line = pango_lines_get_lines (pango_layout_get_lines (display->layout))[0];
+            if (first_line && pango_line_get_resolved_direction (first_line) == PANGO_DIRECTION_RTL)
+              display->x_offset += excess;
+          }
+          break;
+        case PANGO_ALIGN_JUSTIFY:
+          break;
         }
     }
 
@@ -2824,12 +2846,13 @@ gtk_text_layout_get_iter_at_position (GtkTextLayout *layout,
     }
   else
     {
-       /* Ignore the "outside" return value from pango. Pango is doing
+       /* Ignore the return value from pango. Pango is doing
         * the right thing even if we are outside the layout in the
         * x-direction.
         */
-      inside = pango_layout_xy_to_index (display->layout, x * PANGO_SCALE, y * PANGO_SCALE,
-                                         &byte_index, trailing);
+      pango_lines_pos_to_index (pango_layout_get_lines (display->layout),
+                                x * PANGO_SCALE, y * PANGO_SCALE,
+                                &byte_index, trailing);
     }
 
   line_display_index_to_iter (layout, display, target_iter, byte_index, 0);
@@ -2887,9 +2910,9 @@ gtk_text_layout_get_cursor_locations (GtkTextLayout  *layout,
   if (gtk_text_iter_equal (iter, &insert_iter))
     index += layout->preedit_cursor - layout->preedit_len;
 
-  pango_layout_get_cursor_pos (display->layout, index,
-                              strong_pos ? &pango_strong_pos : NULL,
-                              weak_pos ? &pango_weak_pos : NULL);
+  pango_lines_get_cursor_pos (pango_layout_get_lines (display->layout), NULL, index,
+                              strong_pos ? &pango_strong_pos : NULL,
+                              weak_pos ? &pango_weak_pos : NULL);
 
   if (strong_pos)
     {
@@ -3034,7 +3057,7 @@ gtk_text_layout_get_iter_location (GtkTextLayout     *layout,
 
   byte_index = gtk_text_iter_get_line_index (iter);
 
-  pango_layout_index_to_pos (display->layout, byte_index, &pango_rect);
+  pango_lines_index_to_pos (pango_layout_get_lines (display->layout), NULL, byte_index, &pango_rect);
 
   rect->x = PANGO_PIXELS (x_offset + pango_rect.x);
   rect->y += PANGO_PIXELS (pango_rect.y) + display->top_margin;
@@ -3074,18 +3097,18 @@ find_display_line_below (GtkTextLayout *layout,
   while (line && !found_line)
     {
       GtkTextLineDisplay *display = gtk_text_layout_get_line_display (layout, line, FALSE);
-      PangoLayoutIter *layout_iter;
+      PangoLineIter *line_iter;
 
-      layout_iter = pango_layout_get_iter (display->layout);
+      line_iter = pango_layout_get_iter (display->layout);
 
       line_top += display->top_margin;
 
       do
         {
-          int first_y, last_y;
-          PangoLayoutLine *layout_line = pango_layout_iter_get_line_readonly (layout_iter);
+          PangoRectangle ext;
+          PangoLine *pango_line = pango_line_iter_get_line (line_iter);
 
-          found_byte = pango_layout_line_get_start_index (layout_line);
+          found_byte = pango_line_get_start_index (pango_line);
 
           if (line_top >= y)
             {
@@ -3093,12 +3116,13 @@ find_display_line_below (GtkTextLayout *layout,
               break;
             }
 
-          pango_layout_iter_get_line_yrange (layout_iter, &first_y, &last_y);
-          line_top += (last_y - first_y) / PANGO_SCALE;
+          pango_line_iter_get_line_extents (line_iter, NULL, &ext);
+          pango_extents_to_pixels (&ext, NULL);
+          line_top += ext.height;
         }
-      while (pango_layout_iter_next_line (layout_iter));
+      while (pango_line_iter_next_line (line_iter));
 
-      pango_layout_iter_free (layout_iter);
+      pango_line_iter_free (line_iter);
 
       line_top += display->bottom_margin;
       gtk_text_line_display_unref (display);
@@ -3141,38 +3165,40 @@ find_display_line_above (GtkTextLayout *layout,
     {
       GtkTextLineDisplay *display = gtk_text_layout_get_line_display (layout, line, FALSE);
       PangoRectangle logical_rect;
-      PangoLayoutIter *layout_iter;
+      PangoLineIter *line_iter;
       int tmp_top;
 
-      layout_iter = pango_layout_get_iter (display->layout);
+      line_iter = pango_layout_get_iter (display->layout);
 
       line_top -= display->top_margin + display->bottom_margin;
-      pango_layout_iter_get_layout_extents (layout_iter, NULL, &logical_rect);
+      pango_line_iter_get_layout_extents (line_iter, NULL, &logical_rect);
       line_top -= logical_rect.height / PANGO_SCALE;
 
       tmp_top = line_top + display->top_margin;
 
       do
         {
-          int first_y, last_y;
-          PangoLayoutLine *layout_line = pango_layout_iter_get_line_readonly (layout_iter);
+          PangoRectangle ext;
+
+          PangoLine *pango_line = pango_line_iter_get_line (line_iter);
 
-          found_byte = pango_layout_line_get_start_index (layout_line);
+          found_byte = pango_line_get_start_index (pango_line);
 
-          pango_layout_iter_get_line_yrange (layout_iter, &first_y, &last_y);
+          pango_line_iter_get_line_extents (line_iter, NULL, &ext);
+          pango_extents_to_pixels (&ext, NULL);
 
-          tmp_top -= (last_y - first_y) / PANGO_SCALE;
+          tmp_top -= ext.height;
 
           if (tmp_top < y)
             {
               found_line = line;
-             pango_layout_iter_free (layout_iter);
+              pango_line_iter_free (line_iter);
               goto done;
             }
         }
-      while (pango_layout_iter_next_line (layout_iter));
+      while (pango_line_iter_next_line (line_iter));
 
-      pango_layout_iter_free (layout_iter);
+      pango_line_iter_free (line_iter);
 
       gtk_text_line_display_unref (display);
 
@@ -3248,10 +3274,10 @@ gtk_text_layout_move_iter_to_previous_line (GtkTextLayout *layout,
   GtkTextLine *line;
   GtkTextLineDisplay *display;
   int line_byte;
-  GSList *tmp_list;
-  PangoLayoutLine *layout_line;
+  PangoLine *pango_line;
   GtkTextIter orig;
   gboolean update_byte = FALSE;
+  int line_no;
 
   g_return_val_if_fail (GTK_IS_TEXT_LAYOUT (layout), FALSE);
   g_return_val_if_fail (iter != NULL, FALSE);
@@ -3285,15 +3311,15 @@ gtk_text_layout_move_iter_to_previous_line (GtkTextLayout *layout,
       update_byte = TRUE;
     }
 
-  tmp_list = pango_layout_get_lines_readonly (display->layout);
-  layout_line = tmp_list->data;
+  line_no = 0;
+  pango_line = pango_lines_get_lines (pango_layout_get_lines (display->layout))[line_no];
 
   if (update_byte)
     {
-      line_byte = pango_layout_line_get_start_index (layout_line) + pango_layout_line_get_length 
(layout_line);
+      line_byte = pango_line_get_start_index (pango_line) + pango_line_get_length (pango_line);
     }
 
-  if (line_byte < pango_layout_line_get_length (layout_line) || !tmp_list->next) /* first line of paragraph 
*/
+  if (line_byte < pango_line_get_length (pango_line) || line_no + 1 == pango_lines_get_line_count 
(pango_layout_get_lines (display->layout))) /* first line of paragraph */
     {
       GtkTextLine *prev_line;
 
@@ -3311,11 +3337,11 @@ gtk_text_layout_move_iter_to_previous_line (GtkTextLayout *layout,
 
           if (display->height > 0)
             {
-              tmp_list = g_slist_last (pango_layout_get_lines_readonly (display->layout));
-              layout_line = tmp_list->data;
+              PangoLines *lines = pango_layout_get_lines (display->layout);
+              pango_line = pango_lines_get_lines (lines)[pango_lines_get_line_count (lines) - 1];
 
               line_display_index_to_iter (layout, display, iter,
-                                          pango_layout_line_get_start_index (layout_line) + 
pango_layout_line_get_length (layout_line), 0);
+                                          pango_line_get_start_index (pango_line) + pango_line_get_length 
(pango_line), 0);
               break;
             }
 
@@ -3324,22 +3350,22 @@ gtk_text_layout_move_iter_to_previous_line (GtkTextLayout *layout,
     }
   else
     {
-      int prev_offset = pango_layout_line_get_start_index (layout_line);
+      int prev_offset = pango_line_get_start_index (pango_line);
 
-      tmp_list = tmp_list->next;
-      while (tmp_list)
+      line_no++;
+      while (line_no < pango_lines_get_line_count (pango_layout_get_lines (display->layout)))
         {
-          layout_line = tmp_list->data;
+          pango_line = pango_lines_get_lines (pango_layout_get_lines (display->layout))[line_no];
 
-          if (line_byte < pango_layout_line_get_start_index (layout_line) + pango_layout_line_get_length 
(layout_line) ||
-              !tmp_list->next)
+          if (line_byte < pango_line_get_start_index (pango_line) + pango_line_get_length (pango_line) ||
+              line_no + 1 == pango_lines_get_line_count (pango_layout_get_lines (display->layout)))
             {
              line_display_index_to_iter (layout, display, iter, prev_offset, 0);
               break;
             }
 
-          prev_offset = pango_layout_line_get_start_index (layout_line);
-          tmp_list = tmp_list->next;
+          prev_offset = pango_line_get_start_index (pango_line);
+          line_no++;
         }
     }
 
@@ -3372,6 +3398,8 @@ gtk_text_layout_move_iter_to_next_line (GtkTextLayout *layout,
   gboolean found = FALSE;
   gboolean found_after = FALSE;
   gboolean first = TRUE;
+  PangoLines *lines;
+  int line_no;
 
   g_return_val_if_fail (GTK_IS_TEXT_LAYOUT (layout), FALSE);
   g_return_val_if_fail (iter != NULL, FALSE);
@@ -3382,8 +3410,6 @@ gtk_text_layout_move_iter_to_next_line (GtkTextLayout *layout,
 
   while (line && !found_after)
     {
-      GSList *tmp_list;
-
       display = gtk_text_layout_get_line_display (layout, line, FALSE);
 
       if (display->height == 0)
@@ -3397,21 +3423,22 @@ gtk_text_layout_move_iter_to_next_line (GtkTextLayout *layout,
       else
        line_byte = 0;
 
-      tmp_list = pango_layout_get_lines_readonly (display->layout);
-      while (tmp_list && !found_after)
+      lines = pango_layout_get_lines (display->layout);
+      line_no = 0;
+      while (line_no < pango_lines_get_line_count (lines) && !found_after)
         {
-          PangoLayoutLine *layout_line = tmp_list->data;
+          PangoLine *pango_line = pango_lines_get_lines (lines)[line_no];
 
           if (found)
             {
              line_display_index_to_iter (layout, display, iter,
-                                          pango_layout_line_get_start_index (layout_line), 0);
+                                          pango_line_get_start_index (pango_line), 0);
               found_after = TRUE;
             }
-          else if (line_byte < pango_layout_line_get_start_index (layout_line) + 
pango_layout_line_get_length (layout_line) || !tmp_list->next)
+          else if (line_byte < pango_line_get_start_index (pango_line) + pango_line_get_length (pango_line) 
|| line_no + 1 == pango_lines_get_line_count (lines))
             found = TRUE;
 
-          tmp_list = tmp_list->next;
+          line_no++;
         }
 
     next:
@@ -3445,8 +3472,9 @@ gtk_text_layout_move_iter_to_line_end (GtkTextLayout *layout,
   GtkTextLine *line;
   GtkTextLineDisplay *display;
   int line_byte;
-  GSList *tmp_list;
   GtkTextIter orig;
+  PangoLines *lines;
+  int line_no;
 
   g_return_val_if_fail (GTK_IS_TEXT_LAYOUT (layout), FALSE);
   g_return_val_if_fail (iter != NULL, FALSE);
@@ -3457,29 +3485,31 @@ gtk_text_layout_move_iter_to_line_end (GtkTextLayout *layout,
   display = gtk_text_layout_get_line_display (layout, line, FALSE);
   line_byte = line_display_iter_to_index (layout, display, iter);
 
-  tmp_list = pango_layout_get_lines_readonly (display->layout);
-  while (tmp_list)
+  lines = pango_layout_get_lines (display->layout);
+  line_no = 0;
+
+  while (line_no < pango_lines_get_line_count (lines))
     {
-      PangoLayoutLine *layout_line = tmp_list->data;
+      PangoLine *pango_line = pango_lines_get_lines (lines)[line_no];
 
-      if (line_byte < pango_layout_line_get_start_index (layout_line) + pango_layout_line_get_length 
(layout_line) || !tmp_list->next)
+      if (line_byte < pango_line_get_start_index (pango_line) + pango_line_get_length (pango_line) || 
line_no + 1 == pango_lines_get_line_count (lines))
         {
          line_display_index_to_iter (layout, display, iter,
-                                     direction < 0 ? pango_layout_line_get_start_index (layout_line) : 
pango_layout_line_get_start_index (layout_line) + pango_layout_line_get_length (layout_line),
+                                     direction < 0 ? pango_line_get_start_index (pango_line) : 
pango_line_get_start_index (pango_line) + pango_line_get_length (pango_line),
                                      0);
 
           /* FIXME: As a bad hack, we move back one position when we
           * are inside a paragraph to avoid going to next line on a
           * forced break not at whitespace. Real fix is to keep track
           * of whether marks are at leading or trailing edge?  */
-          if (direction > 0 && pango_layout_line_get_length (layout_line) > 0 &&
+          if (direction > 0 && pango_line_get_length (pango_line) > 0 &&
              !gtk_text_iter_ends_line (iter) &&
              !_gtk_text_btree_char_is_invisible (iter))
             gtk_text_iter_backward_char (iter);
           break;
         }
 
-      tmp_list = tmp_list->next;
+      line_no++;
     }
 
   gtk_text_line_display_unref (display);
@@ -3504,7 +3534,8 @@ gtk_text_layout_iter_starts_line (GtkTextLayout       *layout,
   GtkTextLine *line;
   GtkTextLineDisplay *display;
   int line_byte;
-  GSList *tmp_list;
+  PangoLines *lines;
+  int line_no;
 
   g_return_val_if_fail (GTK_IS_TEXT_LAYOUT (layout), FALSE);
   g_return_val_if_fail (iter != NULL, FALSE);
@@ -3513,26 +3544,27 @@ gtk_text_layout_iter_starts_line (GtkTextLayout       *layout,
   display = gtk_text_layout_get_line_display (layout, line, FALSE);
   line_byte = line_display_iter_to_index (layout, display, iter);
 
-  tmp_list = pango_layout_get_lines_readonly (display->layout);
-  while (tmp_list)
+  lines = pango_layout_get_lines (display->layout);
+  line_no = 0;
+  while (line_no < pango_lines_get_line_count (lines))
     {
-      PangoLayoutLine *layout_line = tmp_list->data;
+      PangoLine *pango_line = pango_lines_get_lines (lines)[line_no];
 
-      if (line_byte < pango_layout_line_get_start_index (layout_line) + pango_layout_line_get_length 
(layout_line) ||
-          !tmp_list->next)
+      if (line_byte < pango_line_get_start_index (pango_line) + pango_line_get_length (pango_line) ||
+          line_no + 1 == pango_lines_get_line_count (lines))
         {
           /* We're located on this line or the para delimiters before
            * it
            */
           gtk_text_line_display_unref (display);
 
-          if (line_byte == pango_layout_line_get_start_index (layout_line))
+          if (line_byte == pango_line_get_start_index (pango_line))
             return TRUE;
           else
             return FALSE;
         }
 
-      tmp_list = tmp_list->next;
+      line_no++;
     }
 
   g_assert_not_reached ();
@@ -3567,7 +3599,7 @@ gtk_text_layout_move_iter_to_x (GtkTextLayout *layout,
   GtkTextLine *line;
   GtkTextLineDisplay *display;
   int line_byte;
-  PangoLayoutIter *layout_iter;
+  PangoLineIter *line_iter;
 
   g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
   g_return_if_fail (iter != NULL);
@@ -3577,33 +3609,33 @@ gtk_text_layout_move_iter_to_x (GtkTextLayout *layout,
   display = gtk_text_layout_get_line_display (layout, line, FALSE);
   line_byte = line_display_iter_to_index (layout, display, iter);
 
-  layout_iter = pango_layout_get_iter (display->layout);
+  line_iter = pango_layout_get_iter (display->layout);
 
   do
     {
-      PangoLayoutLine *layout_line = pango_layout_iter_get_line_readonly (layout_iter);
+      PangoLine *pango_line = pango_line_iter_get_line (line_iter);
 
-      if (line_byte < pango_layout_line_get_start_index (layout_line) + pango_layout_line_get_length 
(layout_line) ||
-          pango_layout_iter_at_last_line (layout_iter))
+      if (line_byte < pango_line_get_start_index (pango_line) + pango_line_get_length (pango_line) ||
+          pango_line_iter_at_last_line (line_iter))
         {
           PangoRectangle logical_rect;
           int byte_index, trailing;
           int x_offset = display->x_offset * PANGO_SCALE;
 
-          pango_layout_iter_get_line_extents (layout_iter, NULL, &logical_rect);
+          pango_line_iter_get_line_extents (line_iter, NULL, &logical_rect);
 
-          pango_layout_line_x_to_index (layout_line,
-                                        x * PANGO_SCALE - x_offset - logical_rect.x,
-                                        &byte_index, &trailing);
+          pango_line_x_to_index (pango_line,
+                                 x * PANGO_SCALE - x_offset - logical_rect.x,
+                                 &byte_index, &trailing);
 
          line_display_index_to_iter (layout, display, iter, byte_index, trailing);
 
           break;
         }
     }
-  while (pango_layout_iter_next_line (layout_iter));
+  while (pango_line_iter_next_line (line_iter));
 
-  pango_layout_iter_free (layout_iter);
+  pango_line_iter_free (line_iter);
 
   gtk_text_line_display_unref (display);
 }
@@ -3665,12 +3697,16 @@ gtk_text_layout_move_iter_visually (GtkTextLayout *layout,
 
       if (count > 0)
         {
-          pango_layout_move_cursor_visually (display->layout, strong, line_byte, 0, 1, &new_index, 
&new_trailing);
+          pango_lines_move_cursor (pango_layout_get_lines (display->layout), strong,
+                                   NULL, line_byte, 0, 1,
+                                   NULL, &new_index, &new_trailing);
           count--;
         }
       else
         {
-          pango_layout_move_cursor_visually (display->layout, strong, line_byte, 0, -1, &new_index, 
&new_trailing);
+          pango_lines_move_cursor (pango_layout_get_lines (display->layout), strong,
+                                   NULL, line_byte, 0, -1,
+                                   NULL, &new_index, &new_trailing);
           count++;
         }
 
@@ -3861,7 +3897,7 @@ render_para (GskPangoRenderer   *crenderer,
 {
   PangoLayout *layout = line_display->layout;
   int byte_offset = 0;
-  PangoLayoutIter *iter;
+  PangoLineIter *iter;
   int screen_width;
   gboolean first = TRUE;
 
@@ -3870,16 +3906,19 @@ render_para (GskPangoRenderer   *crenderer,
 
   do
     {
-      PangoLayoutLine *line = pango_layout_iter_get_line_readonly (iter);
+      PangoLine *line = pango_line_iter_get_line (iter);
       int selection_y, selection_height;
+      PangoRectangle ext;
       int first_y, last_y;
       PangoRectangle line_rect;
       int baseline;
       gboolean at_last_line;
 
-      pango_layout_iter_get_line_extents (iter, NULL, &line_rect);
-      baseline = pango_layout_iter_get_baseline (iter);
-      pango_layout_iter_get_line_yrange (iter, &first_y, &last_y);
+      pango_line_iter_get_line_extents (iter, NULL, &line_rect);
+      baseline = pango_line_iter_get_line_baseline (iter);
+      pango_line_iter_get_line_extents (iter, NULL, &ext);
+      first_y = ext.y;
+      last_y = ext.y + ext.height;
 
       /* Adjust for margins */
 
@@ -3900,7 +3939,7 @@ render_para (GskPangoRenderer   *crenderer,
           first = FALSE;
         }
 
-      at_last_line = pango_layout_iter_at_last_line (iter);
+      at_last_line = pango_line_iter_at_last_line (iter);
       if (at_last_line)
         selection_height += line_display->bottom_margin;
 
@@ -3908,7 +3947,7 @@ render_para (GskPangoRenderer   *crenderer,
        * only do it if the selection is opaque.
        */
       if (selection_start_index < byte_offset &&
-          selection_end_index > pango_layout_line_get_length (line) + byte_offset &&
+          selection_end_index > pango_line_get_length (line) + byte_offset &&
           selection->alpha >= 1)
         {
           gtk_snapshot_append_color (crenderer->snapshot,
@@ -3921,10 +3960,10 @@ render_para (GskPangoRenderer   *crenderer,
           if (draw_selection_text)
             {
               gsk_pango_renderer_set_state (crenderer, GSK_PANGO_RENDERER_SELECTED);
-              pango_renderer_draw_layout_line (PANGO_RENDERER (crenderer),
-                                               line,
-                                               line_rect.x,
-                                               baseline);
+              pango_renderer_draw_line (PANGO_RENDERER (crenderer),
+                                        line,
+                                        line_rect.x,
+                                        baseline);
             }
         }
       else
@@ -3938,23 +3977,23 @@ render_para (GskPangoRenderer   *crenderer,
                                                             selection_height));
 
           gsk_pango_renderer_set_state (crenderer, GSK_PANGO_RENDERER_NORMAL);
-          pango_renderer_draw_layout_line (PANGO_RENDERER (crenderer),
-                                           line,
-                                           line_rect.x,
-                                           baseline);
+          pango_renderer_draw_line (PANGO_RENDERER (crenderer),
+                                    line,
+                                    line_rect.x,
+                                    baseline);
 
           /* Check if some part of the line is selected; the newline
-           * that is after pango_layout_line_get_length (line) for the last line of the
+           * that is after pango_line_get_length (line) for the last line of the
            * paragraph counts as part of the line for this
            */
-          if ((selection_start_index < byte_offset + pango_layout_line_get_length (line) ||
-               (selection_start_index == byte_offset + pango_layout_line_get_length (line) && 
pango_layout_iter_at_last_line (iter))) &&
+          if ((selection_start_index < byte_offset + pango_line_get_length (line) ||
+               (selection_start_index == byte_offset + pango_line_get_length (line) && 
pango_line_iter_at_last_line (iter))) &&
               selection_end_index > byte_offset)
             {
               int *ranges = NULL;
               int n_ranges, i;
 
-              pango_layout_line_get_x_ranges (line, selection_start_index, selection_end_index, &ranges, 
&n_ranges);
+              pango_lines_get_x_ranges (pango_line_iter_get_lines (iter), line, NULL, selection_start_index, 
NULL, selection_end_index, &ranges, &n_ranges);
 
               gsk_pango_renderer_set_state (crenderer, GSK_PANGO_RENDERER_SELECTED);
 
@@ -3983,10 +4022,10 @@ render_para (GskPangoRenderer   *crenderer,
                   if (draw_selection_text)
                     {
                       gtk_snapshot_push_clip (crenderer->snapshot, &bounds);
-                      pango_renderer_draw_layout_line (PANGO_RENDERER (crenderer),
-                                                       line,
-                                                       line_rect.x,
-                                                       baseline);
+                      pango_renderer_draw_line (PANGO_RENDERER (crenderer),
+                                                line,
+                                                line_rect.x,
+                                                baseline);
                       gtk_snapshot_pop (crenderer->snapshot);
                     }
                 }
@@ -3996,7 +4035,7 @@ render_para (GskPangoRenderer   *crenderer,
               /* Paint in the ends of the line */
               if (line_rect.x > line_display->left_margin * PANGO_SCALE &&
                   ((line_display->direction == GTK_TEXT_DIR_LTR && selection_start_index < byte_offset) ||
-                   (line_display->direction == GTK_TEXT_DIR_RTL && selection_end_index > byte_offset + 
pango_layout_line_get_length (line))))
+                   (line_display->direction == GTK_TEXT_DIR_RTL && selection_end_index > byte_offset + 
pango_line_get_length (line))))
                 gtk_snapshot_append_color (crenderer->snapshot,
                                            selection,
                                            &GRAPHENE_RECT_INIT (line_display->left_margin,
@@ -4006,7 +4045,7 @@ render_para (GskPangoRenderer   *crenderer,
 
               if (line_rect.x + line_rect.width <
                   (screen_width + line_display->left_margin) * PANGO_SCALE &&
-                  ((line_display->direction == GTK_TEXT_DIR_LTR && selection_end_index > byte_offset + 
pango_layout_line_get_length (line)) ||
+                  ((line_display->direction == GTK_TEXT_DIR_LTR && selection_end_index > byte_offset + 
pango_line_get_length (line)) ||
                    (line_display->direction == GTK_TEXT_DIR_RTL && selection_start_index < byte_offset)))
                 {
                   int nonlayout_width = line_display->left_margin
@@ -4025,8 +4064,8 @@ render_para (GskPangoRenderer   *crenderer,
                    gtk_widget_has_focus (crenderer->widget) &&
                    cursor_alpha > 0 &&
                    byte_offset <= line_display->insert_index &&
-                   (line_display->insert_index < byte_offset + pango_layout_line_get_length (line) ||
-                    (at_last_line && line_display->insert_index == byte_offset + 
pango_layout_line_get_length (line))))
+                   (line_display->insert_index < byte_offset + pango_line_get_length (line) ||
+                    (at_last_line && line_display->insert_index == byte_offset + pango_line_get_length 
(line))))
             {
               GtkStyleContext *context;
               GdkRGBA cursor_color;
@@ -4051,36 +4090,21 @@ render_para (GskPangoRenderer   *crenderer,
                 {
                   gsk_pango_renderer_set_state (crenderer, GSK_PANGO_RENDERER_CURSOR);
                   gtk_snapshot_push_clip (crenderer->snapshot, &bounds);
-                  pango_renderer_draw_layout_line (PANGO_RENDERER (crenderer),
-                                                   line,
-                                                   line_rect.x,
-                                                   baseline);
+                  pango_renderer_draw_line (PANGO_RENDERER (crenderer),
+                                            line,
+                                            line_rect.x,
+                                            baseline);
                   gtk_snapshot_pop (crenderer->snapshot);
                 }
               gtk_snapshot_pop (crenderer->snapshot);
             }
         }
 
-      byte_offset += pango_layout_line_get_length (line);
-    }
-  while (pango_layout_iter_next_line (iter));
-
-  pango_layout_iter_free (iter);
-}
-
-static gboolean
-snapshot_shape (PangoAttrShape         *attr,
-                GdkSnapshot            *snapshot,
-                double                  width,
-                double                  height)
-{
-  if (GDK_IS_PAINTABLE (attr->data))
-    {
-      gdk_paintable_snapshot (GDK_PAINTABLE (attr->data), snapshot, width, height);
-      return TRUE;
+      byte_offset += pango_line_get_length (line);
     }
+  while (pango_line_iter_next_line (iter));
 
-  return FALSE;
+  pango_line_iter_free (iter);
 }
 
 void
@@ -4136,8 +4160,6 @@ gtk_text_layout_snapshot (GtkTextLayout      *layout,
 
   crenderer = gsk_pango_renderer_acquire ();
 
-  gsk_pango_renderer_set_shape_handler (crenderer, snapshot_shape);
-
   crenderer->widget = widget;
   crenderer->snapshot = snapshot;
   crenderer->fg_color = &color;
diff --git a/gtk/gtktextlayoutprivate.h b/gtk/gtktextlayoutprivate.h
index 480d1ada62..703f7457b1 100644
--- a/gtk/gtktextlayoutprivate.h
+++ b/gtk/gtktextlayoutprivate.h
@@ -161,12 +161,6 @@ struct _GtkTextLayoutClass
   GObjectClass parent_class;
 };
 
-struct _GtkTextAttrAppearance
-{
-  PangoAttribute attr;
-  GtkTextAppearance appearance;
-};
-
 typedef struct _CursorPosition CursorPosition;
 struct _CursorPosition {
   int pos;
diff --git a/gtk/gtktexttag.c b/gtk/gtktexttag.c
index b1f670753f..2f31ba995d 100644
--- a/gtk/gtktexttag.c
+++ b/gtk/gtktexttag.c
@@ -118,6 +118,7 @@ enum {
   PROP_STRIKETHROUGH_RGBA,
   PROP_RIGHT_MARGIN,
   PROP_UNDERLINE,
+  PROP_UNDERLINE_POSITION,
   PROP_UNDERLINE_RGBA,
   PROP_OVERLINE,
   PROP_OVERLINE_RGBA,
@@ -164,6 +165,7 @@ enum {
   PROP_STRIKETHROUGH_RGBA_SET,
   PROP_RIGHT_MARGIN_SET,
   PROP_UNDERLINE_SET,
+  PROP_UNDERLINE_POSITION_SET,
   PROP_UNDERLINE_RGBA_SET,
   PROP_OVERLINE_SET,
   PROP_OVERLINE_RGBA_SET,
@@ -582,8 +584,15 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
   g_object_class_install_property (object_class,
                                    PROP_UNDERLINE,
                                    g_param_spec_enum ("underline", NULL, NULL,
-                                                      PANGO_TYPE_UNDERLINE,
-                                                      PANGO_UNDERLINE_NONE,
+                                                      PANGO_TYPE_LINE_STYLE,
+                                                      PANGO_LINE_STYLE_NONE,
+                                                      GTK_PARAM_READWRITE));
+
+  g_object_class_install_property (object_class,
+                                   PROP_UNDERLINE_POSITION,
+                                   g_param_spec_enum ("underline-position", NULL, NULL,
+                                                      PANGO_TYPE_UNDERLINE_POSITION,
+                                                      PANGO_UNDERLINE_POSITION_NORMAL,
                                                       GTK_PARAM_READWRITE));
 
   /**
@@ -611,8 +620,8 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
   g_object_class_install_property (object_class,
                                    PROP_OVERLINE,
                                    g_param_spec_enum ("overline", NULL, NULL,
-                                                      PANGO_TYPE_OVERLINE,
-                                                      PANGO_OVERLINE_NONE,
+                                                      PANGO_TYPE_LINE_STYLE,
+                                                      PANGO_LINE_STYLE_NONE,
                                                       GTK_PARAM_READWRITE));
 
   /**
@@ -881,6 +890,8 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
 
   ADD_SET_PROP ("underline-set", PROP_UNDERLINE_SET, NULL, NULL);
 
+  ADD_SET_PROP ("underline-position-set", PROP_UNDERLINE_SET, NULL, NULL);
+
   /**
    * GtkTextTag:underline-rgba-set:
    *
@@ -1555,6 +1566,13 @@ gtk_text_tag_set_property (GObject      *object,
       g_object_notify (object, "underline-set");
       break;
 
+    case PROP_UNDERLINE_POSITION:
+      priv->underline_position_set = TRUE;
+      g_print ("set underline position tag\n");
+      priv->values->appearance.underline_position = g_value_get_enum (value);
+      g_object_notify (object, "underline-position-set");
+      break;
+
     case PROP_UNDERLINE_RGBA:
       {
         GdkRGBA *color = g_value_get_boxed (value);
@@ -1791,6 +1809,10 @@ gtk_text_tag_set_property (GObject      *object,
       priv->underline_set = g_value_get_boolean (value);
       break;
 
+    case PROP_UNDERLINE_POSITION_SET:
+      priv->underline_position_set = g_value_get_boolean (value);
+      break;
+
     case PROP_UNDERLINE_RGBA_SET:
       priv->underline_rgba_set = g_value_get_boolean (value);
       break;
@@ -2015,6 +2037,10 @@ gtk_text_tag_get_property (GObject      *object,
       g_value_set_enum (value, priv->values->appearance.underline);
       break;
 
+    case PROP_UNDERLINE_POSITION:
+      g_value_set_enum (value, priv->values->appearance.underline_position);
+      break;
+
     case PROP_UNDERLINE_RGBA:
       if (priv->underline_rgba_set)
         g_value_set_boxed (value, priv->values->appearance.underline_rgba);
@@ -2173,6 +2199,10 @@ gtk_text_tag_get_property (GObject      *object,
       g_value_set_boolean (value, priv->underline_set);
       break;
 
+    case PROP_UNDERLINE_POSITION_SET:
+      g_value_set_boolean (value, priv->underline_position_set);
+      break;
+
     case PROP_UNDERLINE_RGBA_SET:
       g_value_set_boolean (value, priv->underline_rgba_set);
       break;
diff --git a/gtk/gtktexttagprivate.h b/gtk/gtktexttagprivate.h
index 57ce42c2c6..5a674054bf 100644
--- a/gtk/gtktexttagprivate.h
+++ b/gtk/gtktexttagprivate.h
@@ -74,6 +74,7 @@ struct _GtkTextTagPrivate
   guint line_height_set : 1;
   guint tabs_set : 1;
   guint underline_set : 1;
+  guint underline_position_set : 1;
   guint overline_set : 1;
   guint wrap_mode_set : 1;
   guint bg_full_height_set : 1;
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index 75f081732a..433767d52f 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -42,18 +42,21 @@
 #define ELLIPSIS_CHARACTER "\xe2\x80\xa6"
 
 static void
-append_n_lines (GString *str, const char *text, GSList *lines, int n_lines)
+append_n_lines (GString    *str,
+                const char *text,
+                PangoLines *lines,
+                int         first,
+                int         n_lines)
 {
-  PangoLayoutLine *line;
+  PangoLine *line;
   int i;
 
-  for (i = 0; i < n_lines; i++)
+  for (i = first; i < first + n_lines; i++)
     {
-      line = lines->data;
+      line = pango_lines_get_lines (lines)[i];
       g_string_append_len (str,
-                           &text[pango_layout_line_get_start_index (line)],
-                           pango_layout_line_get_length (line));
-      lines = lines->next;
+                           &text[pango_line_get_start_index (line)],
+                           pango_line_get_length (line));
     }
 }
 
@@ -61,29 +64,25 @@ static void
 limit_layout_lines (PangoLayout *layout)
 {
   const char *text;
-  GString     *str;
-  GSList      *lines, *elem;
-  int          n_lines;
+  GString *str;
+  PangoLines *lines;
+  int n_lines;
 
-  n_lines = pango_layout_get_line_count (layout);
+  lines = pango_layout_get_lines (layout);
+  n_lines = pango_lines_get_line_count (lines);
 
   if (n_lines >= DRAG_ICON_MAX_LINES)
     {
-      text  = pango_layout_get_text (layout);
-      str   = g_string_new (NULL);
-      lines = pango_layout_get_lines_readonly (layout);
+      text = pango_layout_get_text (layout);
+      str = g_string_new (NULL);
 
       /* get first lines */
-      elem = lines;
-      append_n_lines (str, text, elem,
-                      DRAG_ICON_MAX_LINES / 2);
+      append_n_lines (str, text, lines, 0, DRAG_ICON_MAX_LINES / 2);
 
       g_string_append (str, "\n" ELLIPSIS_CHARACTER "\n");
 
       /* get last lines */
-      elem = g_slist_nth (lines, n_lines - DRAG_ICON_MAX_LINES / 2);
-      append_n_lines (str, text, elem,
-                      DRAG_ICON_MAX_LINES / 2);
+      append_n_lines (str, text, lines, n_lines - DRAG_ICON_MAX_LINES / 2, DRAG_ICON_MAX_LINES / 2);
 
       pango_layout_set_text (layout, str->str, -1);
       g_string_free (str, TRUE);
@@ -123,7 +122,7 @@ gtk_text_util_create_drag_icon (GtkWidget *widget,
 
   pango_layout_set_text (layout, text, len);
   pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
-  pango_layout_get_size (layout, &layout_width, NULL);
+  pango_lines_get_size (pango_layout_get_lines (layout), &layout_width, NULL);
 
   layout_width = MIN (layout_width, DRAG_ICON_MAX_WIDTH * PANGO_SCALE);
   pango_layout_set_width (layout, layout_width);
@@ -146,7 +145,7 @@ gtk_text_util_create_drag_icon (GtkWidget *widget,
         bg_widget = gtk_widget_get_parent (widget);
       else
         bg_widget = widget;
-      pango_layout_get_size (layout, &layout_width, &layout_height);
+      pango_lines_get_size (pango_layout_get_lines (layout), &layout_width, &layout_height);
       gtk_snapshot_render_background (snapshot,
                                       gtk_widget_get_style_context (bg_widget),
                                       0, 0, layout_width / PANGO_SCALE,
@@ -304,7 +303,7 @@ layout_get_char_width (PangoLayout *layout)
 
   metrics = pango_context_get_metrics (context, font_desc, NULL);
   width = pango_font_metrics_get_approximate_char_width (metrics);
-  pango_font_metrics_unref (metrics);
+  pango_font_metrics_free (metrics);
 
   return width;
 }
@@ -327,7 +326,7 @@ _gtk_text_util_get_block_cursor_location (PangoLayout    *layout,
                                          gboolean       *at_line_end)
 {
   PangoRectangle strong_pos, weak_pos;
-  PangoLayoutLine *layout_line;
+  PangoLine *line;
   gboolean rtl;
   int line_no;
   const char *text;
@@ -336,7 +335,7 @@ _gtk_text_util_get_block_cursor_location (PangoLayout    *layout,
   g_return_val_if_fail (index >= 0, FALSE);
   g_return_val_if_fail (pos != NULL, FALSE);
 
-  pango_layout_index_to_pos (layout, index, pos);
+  pango_lines_index_to_pos (pango_layout_get_lines (layout), NULL, index, pos);
 
   if (pos->width != 0)
     {
@@ -351,19 +350,19 @@ _gtk_text_util_get_block_cursor_location (PangoLayout    *layout,
       return TRUE;
     }
 
-  pango_layout_index_to_line_x (layout, index, FALSE, &line_no, NULL);
-  layout_line = pango_layout_get_line_readonly (layout, line_no);
-  g_return_val_if_fail (layout_line != NULL, FALSE);
+  line = NULL;
+  pango_lines_index_to_line (pango_layout_get_lines (layout), index, &line, &line_no, NULL, NULL);
+  g_return_val_if_fail (line != NULL, FALSE);
 
   text = pango_layout_get_text (layout);
 
-  if (index < pango_layout_line_get_start_index (layout_line) + pango_layout_line_get_length (layout_line))
+  if (index < pango_line_get_start_index (line) + pango_line_get_length (line))
     {
       /* this may be a zero-width character in the middle of the line,
        * or it could be a character where line is wrapped, we do want
        * block cursor in latter case */
       if (g_utf8_next_char (text + index) - text !=
-         pango_layout_line_get_start_index (layout_line) + pango_layout_line_get_length (layout_line))
+         pango_line_get_start_index (line) + pango_line_get_length (line))
        {
          /* zero-width character in the middle of the line, do not
           * bother with block cursor */
@@ -375,7 +374,7 @@ _gtk_text_util_get_block_cursor_location (PangoLayout    *layout,
    * be on the left or on the right depending on text direction, or it
    * even could be in the middle of visual layout in bidi text. */
 
-  pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
+  pango_lines_get_cursor_pos (pango_layout_get_lines (layout), NULL, index, &strong_pos, &weak_pos);
 
   if (strong_pos.x != weak_pos.x)
     {
@@ -386,11 +385,11 @@ _gtk_text_util_get_block_cursor_location (PangoLayout    *layout,
 
   /* In case when index points to the end of line, pos->x is always most right
    * pixel of the layout line, so we need to correct it for RTL text. */
-  if (pango_layout_line_get_length (layout_line))
+  if (pango_line_get_length (line))
     {
-      if (pango_layout_line_get_resolved_direction (layout_line) == PANGO_DIRECTION_RTL)
+      if (pango_line_get_resolved_direction (line) == PANGO_DIRECTION_RTL)
        {
-         PangoLayoutIter *iter;
+         PangoLineIter *iter;
          PangoRectangle line_rect;
          int i;
          int left, right;
@@ -398,15 +397,15 @@ _gtk_text_util_get_block_cursor_location (PangoLayout    *layout,
 
          p = g_utf8_prev_char (text + index);
 
-         pango_layout_line_index_to_x (layout_line, p - text, FALSE, &left);
-         pango_layout_line_index_to_x (layout_line, p - text, TRUE, &right);
+         pango_line_index_to_x (line, p - text, FALSE, &left);
+         pango_line_index_to_x (line, p - text, TRUE, &right);
          pos->x = MIN (left, right);
 
          iter = pango_layout_get_iter (layout);
          for (i = 0; i < line_no; i++)
-           pango_layout_iter_next_line (iter);
-         pango_layout_iter_get_line_extents (iter, NULL, &line_rect);
-         pango_layout_iter_free (iter);
+           pango_line_iter_next_line (iter);
+         pango_line_iter_get_line_extents (iter, NULL, &line_rect);
+         pango_line_iter_free (iter);
 
           rtl = TRUE;
          pos->x += line_rect.x;
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 6df6b6e50f..9cbf82d608 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -4524,6 +4524,7 @@ gtk_text_view_size_allocate (GtkWidget *widget,
 {
   GtkTextView *text_view;
   GtkTextViewPrivate *priv;
+  PangoRectangle ext;
   int width, height;
   GdkRectangle text_rect;
   GdkRectangle left_rect;
@@ -4619,10 +4620,11 @@ gtk_text_view_size_allocate (GtkWidget *widget,
 
   /* Optimize display cache size */
   layout = gtk_widget_create_pango_layout (widget, "X");
-  pango_layout_get_pixel_size (layout, &width, &height);
-  if (height > 0)
+  pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+  pango_extents_to_pixels (&ext, NULL);
+  if (ext.height > 0)
     {
-      mru_size = SCREEN_HEIGHT (widget) / height * 3;
+      mru_size = SCREEN_HEIGHT (widget) / ext.height * 3;
       gtk_text_layout_set_mru_size (priv->layout, mru_size);
     }
   g_object_unref (layout);
@@ -7685,14 +7687,14 @@ gtk_text_view_set_attributes_from_style (GtkTextView        *text_view,
       switch (decoration_style)
         {
         case GTK_CSS_TEXT_DECORATION_STYLE_DOUBLE:
-          values->appearance.underline = PANGO_UNDERLINE_DOUBLE;
+          values->appearance.underline = PANGO_LINE_STYLE_DOUBLE;
           break;
         case GTK_CSS_TEXT_DECORATION_STYLE_WAVY:
-          values->appearance.underline = PANGO_UNDERLINE_ERROR;
+          values->appearance.underline = PANGO_LINE_STYLE_DOTTED;
           break;
         case GTK_CSS_TEXT_DECORATION_STYLE_SOLID:
         default:
-          values->appearance.underline = PANGO_UNDERLINE_SINGLE;
+          values->appearance.underline = PANGO_LINE_STYLE_SOLID;
           break;
         }
 
@@ -7703,14 +7705,14 @@ gtk_text_view_set_attributes_from_style (GtkTextView        *text_view,
     }
   else
     {
-      values->appearance.underline = PANGO_UNDERLINE_NONE;
+      values->appearance.underline = PANGO_LINE_STYLE_NONE;
       gdk_rgba_free (values->appearance.underline_rgba);
       values->appearance.underline_rgba = NULL;
     }
 
   if (decoration_line & GTK_CSS_TEXT_DECORATION_LINE_OVERLINE)
     {
-      values->appearance.overline = PANGO_OVERLINE_SINGLE;
+      values->appearance.overline = PANGO_LINE_STYLE_SOLID;
       if (values->appearance.overline_rgba)
         *values->appearance.overline_rgba = *decoration_color;
       else
@@ -7718,7 +7720,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView        *text_view,
     }
   else
     {
-      values->appearance.overline = PANGO_OVERLINE_NONE;
+      values->appearance.overline = PANGO_LINE_STYLE_NONE;
       gdk_rgba_free (values->appearance.overline_rgba);
       values->appearance.overline_rgba = NULL;
     }
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 3d1a46897d..8433bc3ec9 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6362,7 +6362,7 @@ gtk_widget_get_effective_font_map (GtkWidget *widget)
   else if (priv->parent)
     return gtk_widget_get_effective_font_map (priv->parent);
   else
-    return pango_cairo_font_map_get_default ();
+    return pango_font_map_get_default ();
 }
 
 gboolean
@@ -6399,7 +6399,7 @@ gtk_widget_update_pango_context (GtkWidget        *widget,
                                          ? PANGO_DIRECTION_LTR
                                          : PANGO_DIRECTION_RTL);
 
-  pango_cairo_context_set_resolution (context, _gtk_css_number_value_get (style->core->dpi, 100));
+  pango_font_map_set_resolution (pango_context_get_font_map (context), _gtk_css_number_value_get 
(style->core->dpi, 100));
 
   font_options = (cairo_font_options_t*)g_object_get_qdata (G_OBJECT (widget), quark_font_options);
   if (settings && font_options)
@@ -6570,7 +6570,7 @@ gtk_widget_create_pango_context (GtkWidget *widget)
 
   g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
 
-  context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+  context = pango_context_new_with_font_map (pango_font_map_get_default ());
   gtk_widget_update_pango_context (widget, context, _gtk_widget_get_direction (widget));
   pango_context_set_language (context, gtk_get_default_language ());
 
diff --git a/gtk/inspector/css-editor.ui b/gtk/inspector/css-editor.ui
index 7663af860b..f48f5c9a7e 100644
--- a/gtk/inspector/css-editor.ui
+++ b/gtk/inspector/css-editor.ui
@@ -3,14 +3,15 @@
     <child type="tag">
       <object class="GtkTextTag">
         <property name="name">warning</property>
-        <property name="underline">single</property>
+        <property name="underline">solid</property>
         <property name="underline-rgba">darkorange</property>
       </object>
     </child>
     <child type="tag">
       <object class="GtkTextTag">
         <property name="name">error</property>
-        <property name="underline">error</property>
+        <property name="underline">wavy</property>
+        <property name="underline-rgba">red</property>
       </object>
     </child>
   </object>
diff --git a/gtk/inspector/fpsoverlay.c b/gtk/inspector/fpsoverlay.c
index 1329738a0d..859ebdf5b9 100644
--- a/gtk/inspector/fpsoverlay.c
+++ b/gtk/inspector/fpsoverlay.c
@@ -97,8 +97,8 @@ gtk_fps_overlay_snapshot (GtkInspectorOverlay *overlay,
   char *fps_string;
   graphene_rect_t bounds;
   gboolean has_bounds;
-  int width, height;
   double overlay_opacity;
+  PangoRectangle ext;
 
   now = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
   info = g_hash_table_lookup (self->infos, widget);
@@ -157,16 +157,17 @@ gtk_fps_overlay_snapshot (GtkInspectorOverlay *overlay,
   pango_attr_list_insert (attrs, pango_attr_font_features_new ("tnum=1"));
   pango_layout_set_attributes (layout, attrs);
   pango_attr_list_unref (attrs);
-  pango_layout_get_pixel_size (layout, &width, &height);
+  pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+  pango_extents_to_pixels (&ext, NULL);
 
   gtk_snapshot_save (snapshot);
   if (has_bounds)
-    gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (bounds.origin.x + bounds.size.width - width, 
bounds.origin.y));
+    gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (bounds.origin.x + bounds.size.width - ext.width, 
bounds.origin.y));
   if (overlay_opacity < 1.0)
     gtk_snapshot_push_opacity (snapshot, overlay_opacity);
   gtk_snapshot_append_color (snapshot,
                              &(GdkRGBA) { 0, 0, 0, 0.5 },
-                             &GRAPHENE_RECT_INIT (-1, -1, width + 2, height + 2));
+                             &GRAPHENE_RECT_INIT (-1, -1, ext.width + 2, ext.height + 2));
   gtk_snapshot_append_layout (snapshot,
                               layout,
                               &(GdkRGBA) { 1, 1, 1, 1 });
diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
index f456ea0da4..9beea5b5e6 100644
--- a/gtk/inspector/general.c
+++ b/gtk/inspector/general.c
@@ -741,13 +741,13 @@ init_pango (GtkInspectorGeneral *gen)
   const char *type;
   const char *name;
 
-  fontmap = pango_cairo_font_map_get_default ();
+  fontmap = pango_font_map_get_default ();
   type = G_OBJECT_TYPE_NAME (fontmap);
-  if (strcmp (type, "PangoCairoFcFontMap") == 0)
+  if (strcmp (type, "PangoFcFontMap") == 0)
     name = "fontconfig";
-  else if (strcmp (type, "PangoCairoCoreTextFontMap") == 0)
+  else if (strcmp (type, "PangoCoreTextFontMap") == 0)
     name = "coretext";
-  else if (strcmp (type, "PangoCairoWin32FontMap") == 0)
+  else if (strcmp (type, "PangoDirectWriteFontMap") == 0)
     name = "win32";
   else
     name = type;
diff --git a/gtk/meson.build b/gtk/meson.build
index 2e404f2ac4..9d7abc5ce9 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -1172,10 +1172,6 @@ if x11_enabled or wayland_enabled
   gtk_sources += gtk_use_wayland_or_x11_c_sources
 endif
 
-if pangoft_dep.found()
-  gtk_deps += pangoft_dep
-endif
-
 if macos_enabled
   gtk_macos_frameworks = [
     'AppKit',
@@ -1255,7 +1251,7 @@ if build_gir
     '--quiet',
   ]
 
-  gdk_gir_inc = [ 'cairo-1.0', 'Gio-2.0', 'GdkPixbuf-2.0', 'Pango-1.0', 'PangoCairo-1.0' ]
+  gdk_gir_inc = [ 'cairo-1.0', 'Gio-2.0', 'GdkPixbuf-2.0', 'Pango-2.0' ]
 
   gdk_gir = gnome.generate_gir(libgtk,
     sources: gdk_public_headers + gdk_public_sources + [ gdkenum_h ],
diff --git a/meson.build b/meson.build
index b7a6cb742f..49fec7b338 100644
--- a/meson.build
+++ b/meson.build
@@ -11,8 +11,8 @@ project('gtk', 'c',
         license: 'LGPL-2.1-or-later')
 
 glib_req           = '>= 2.66.0'
-pango_req          = '>= 1.50.0' # keep this in sync with .gitlab-ci/test-msys.sh
-harfbuzz_req      = '>= 2.6.0'
+pango_req          = '>= 1.90.0' # keep this in sync with .gitlab-ci/test-msys.sh
+harfbuzz_req       = '>= 2.6.0'
 fribidi_req        = '>= 0.19.7'
 cairo_req          = '>= 1.14.0'
 gdk_pixbuf_req     = '>= 2.30.0'
@@ -390,7 +390,7 @@ cairo_dep      = dependency('cairo', version: cairo_req,
                             default_options: ['zlib=enabled', 'tests=disabled'])
 cairogobj_dep  = dependency('cairo-gobject', version: cairo_req,
                             fallback : ['cairo', 'libcairogobject_dep'])
-pango_dep      = dependency('pango', version: pango_req,
+pango_dep      = dependency('pango2', version: pango_req,
                             fallback : ['pango', 'libpango_dep'])
 fribidi_dep    = dependency('fribidi', version: fribidi_req,
                             fallback : ['fribidi', 'libfribidi_dep'])
@@ -398,35 +398,19 @@ harfbuzz_dep   = dependency('harfbuzz', version: harfbuzz_req,
                             fallback: ['harfbuzz', 'libharfbuzz_dep'],
                             default_options: ['coretext=enabled'])
 
-# Require PangoFT2 if on X11 or wayland
-require_pangoft2 = wayland_enabled or x11_enabled
+pangocairo_dep = pango_dep
 
-if require_pangoft2
-  pangoft_dep    = dependency('pangoft2', version: pango_req,
-                              fallback : ['pango', 'libpangoft2_dep'])
-else
-  pangoft_dep    = dependency('pangoft2', required: false)
-endif
-
-if win32_enabled
-  # for GTK_IM_CONTEXT_IME
-  pangowin32_dep = dependency('pangowin32')
-endif
-
-is_msvc_like = cc.get_argument_syntax() == 'msvc'
-
-pangocairo_dep = dependency('pangocairo', version: pango_req,
-                            fallback : ['pango', 'libpangocairo_dep'])
 pixbuf_dep     = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
                             fallback : ['gdk-pixbuf', 'gdkpixbuf_dep'],
                             default_options: ['png=enabled', 'jpeg=enabled', 'builtin_loaders=png,jpeg', 
'man=false'])
-png_dep        = dependency(is_msvc_like ? 'png' : 'libpng',
+
+png_dep        = dependency('libpng',
                             fallback: ['libpng', 'libpng_dep'],
                             required: true)
-tiff_dep       = dependency(is_msvc_like ? 'tiff' : 'libtiff-4',
+tiff_dep       = dependency('libtiff-4',
                             fallback: ['libtiff', 'libtiff4_dep'],
                             required: true)
-jpeg_dep       = dependency(is_msvc_like ? 'jpeg' : 'libjpeg',
+jpeg_dep       = dependency('libjpeg',
                             fallback: ['libjpeg-turbo', 'jpeg_dep'],
                             required: true)
 
@@ -511,7 +495,6 @@ if have_egl
   cdata.set('HAVE_EGL', 1)
 endif
 cdata.set('HAVE_HARFBUZZ', harfbuzz_dep.found())
-cdata.set('HAVE_PANGOFT', pangoft_dep.found())
 
 wayland_pkgs = []
 if wayland_enabled
diff --git a/subprojects/pango.wrap b/subprojects/pango.wrap
index 64317f97fe..9267f2734f 100644
--- a/subprojects/pango.wrap
+++ b/subprojects/pango.wrap
@@ -2,5 +2,5 @@
 directory=pango
 url=https://gitlab.gnome.org/GNOME/pango.git
 push-url=ssh://git gitlab gnome org:GNOME/pango.git
-revision=main
+revision=pango2
 depth=1
diff --git a/tests/rendernode-create-tests.c b/tests/rendernode-create-tests.c
index 2bd7a3876b..b12ea7ddd0 100644
--- a/tests/rendernode-create-tests.c
+++ b/tests/rendernode-create-tests.c
@@ -381,13 +381,13 @@ text (guint n)
     }
   n_words = g_strv_length (words);
 
-  context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+  context = pango_context_new ();
   nodes = g_ptr_array_new_with_free_func ((GDestroyNotify) gsk_render_node_unref);
 
   settings = gtk_settings_get_default ();
   g_object_get (settings, "gtk-xft-dpi", &dpi_int, NULL);
   if (dpi_int > 0)
-    pango_cairo_context_set_resolution (context, dpi_int / 1024.);
+    pango_font_map_set_resolution (pango_font_map_get_default (), dpi_int / 1024.);
 
   desc = pango_font_description_new ();
   pango_font_description_set_family (desc, "Cantarell");
@@ -396,10 +396,11 @@ text (guint n)
   for (i = 0; i < n; i++)
     {
       PangoFont *font;
-      PangoLayoutIter *iter;
-      PangoLayoutRun *run;
+      PangoLineIter *iter;
+      PangoRun *run;
       GdkRGBA color;
-      int x, y, width, height;
+      PangoRectangle ext;
+      int x, y;
 
       pango_layout_set_text (layout, words[g_random_int_range (0, n_words)], -1);
       if (g_random_boolean ())
@@ -413,26 +414,30 @@ text (guint n)
       font = pango_context_load_font (context, desc);
       pango_layout_set_font_description (layout, desc);
 
-      pango_layout_get_pixel_size (layout, &width, &height);
-      x = width >= 1000 ? 0 : g_random_int_range (0, 1000 - width);
-      y = height >= 1000 ? 0 : g_random_int_range (0, 1000 - height);
+      pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+      pango_extents_to_pixels (&ext, NULL);
+
+      x = ext.width >= 1000 ? 0 : g_random_int_range (0, 1000 - ext.width);
+      y = ext.height >= 1000 ? 0 : g_random_int_range (0, 1000 - ext.height);
       hsv_to_rgb (&color, g_random_double (), g_random_double_range (0.5, 1.0), g_random_double_range (0.15, 
0.75));
 
       iter = pango_layout_get_iter (layout);
       do
         {
-          run = pango_layout_iter_get_run (iter);
+          run = pango_line_iter_get_run (iter);
           if (run != NULL)
             {
+              PangoGlyphString *glyphs;
               GskRenderNode *node;
-              
-              node = gsk_text_node_new (font, run->glyphs, &color, &GRAPHENE_POINT_INIT (x, y));
+
+              glyphs = pango_run_get_glyphs (run);
+              node = gsk_text_node_new (font, glyphs, &color, &GRAPHENE_POINT_INIT (x, y));
               if (node)
                 g_ptr_array_add (nodes, node);
             }
         }
-      while (pango_layout_iter_next_run (iter));
-      pango_layout_iter_free (iter);
+      while (pango_line_iter_next_run (iter));
+      pango_line_iter_free (iter);
 
       g_object_unref (font);
     }
diff --git a/tests/simple.c b/tests/simple.c
index 062afdc9fa..8eccffce40 100644
--- a/tests/simple.c
+++ b/tests/simple.c
@@ -45,18 +45,8 @@ main (int argc, char *argv[])
   gtk_init ();
 
   window = gtk_window_new ();
-  gtk_window_set_title (GTK_WINDOW (window), "hello world");
-  gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
-  g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
-
-  button = gtk_button_new ();
-  gtk_button_set_label (GTK_BUTTON (button), "hello world");
-  gtk_widget_set_margin_top (button, 10);
-  gtk_widget_set_margin_bottom (button, 10);
-  gtk_widget_set_margin_start (button, 10);
-  gtk_widget_set_margin_end (button, 10);
-  g_signal_connect (button, "clicked", G_CALLBACK (hello), NULL);
 
+  button = gtk_label_new ("test");
   gtk_window_set_child (GTK_WINDOW (window), button);
 
   gtk_widget_show (window);
diff --git a/tests/testdropdown.c b/tests/testdropdown.c
index 5dcd7fcae7..357759defa 100644
--- a/tests/testdropdown.c
+++ b/tests/testdropdown.c
@@ -471,7 +471,7 @@ main (int argc, char *argv[])
 
   button = gtk_drop_down_new (NULL, NULL);
 
-  model = G_LIST_MODEL (pango_cairo_font_map_get_default ());
+  model = G_LIST_MODEL (pango_font_map_get_default ());
   gtk_drop_down_set_model (GTK_DROP_DOWN (button), model);
   gtk_drop_down_set_selected (GTK_DROP_DOWN (button), 0);
 
diff --git a/tests/testfontchooserdialog.c b/tests/testfontchooserdialog.c
index 110e3fff52..97226090cf 100644
--- a/tests/testfontchooserdialog.c
+++ b/tests/testfontchooserdialog.c
@@ -29,7 +29,7 @@ monospace_filter (const PangoFontFamily *family,
                   const PangoFontFace   *face,
                   gpointer               data)
 {
-  return pango_font_family_is_monospace ((PangoFontFamily *) family);
+  return pango_font_face_is_monospace ((PangoFontFace *) face);
 }
 
 static void
@@ -46,13 +46,13 @@ notify_font_cb (GtkFontChooser *fontchooser, GParamSpec *pspec, gpointer data)
     {
        g_debug ("  Family: %s is-monospace:%s",
                 pango_font_family_get_name (family),
-                pango_font_family_is_monospace (family) ? "true" : "false");
+                pango_font_face_is_monospace (face) ? "true" : "false");
     }
   else
     g_debug ("  No font family!");
 
   if (face)
-    g_debug ("  Face description: %s", pango_font_face_get_face_name (face));
+    g_debug ("  Face description: %s", pango_font_face_get_name (face));
   else
     g_debug ("  No font face!");
 }
@@ -105,7 +105,7 @@ main (int argc, char *argv[])
       for (i = 0; i < argc; i++)
         FcConfigAppFontAddFile (config, (const FcChar8 *)argv[i]);
 
-      fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT);
+      fontmap = PANGO_FONT_MAP (pango_fc_font_map_new ());
       pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config);
       gtk_font_chooser_set_font_map (GTK_FONT_CHOOSER (font_button), fontmap);
     }
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 1b8cbf4cbe..bc5b2f63ea 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -19,7 +19,7 @@
  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
  * file for a list of people on the GTK+ Team.  See the ChangeLog
  * files for a list of changes.  These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  */
 
 
@@ -103,12 +103,12 @@ build_option_menu (const char           *items[],
   omenu = gtk_combo_box_text_new ();
   g_signal_connect (omenu, "changed",
                    G_CALLBACK (func), data);
-      
+
   for (i = 0; i < num_items; i++)
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), items[i]);
 
   gtk_combo_box_set_active (GTK_COMBO_BOX (omenu), history);
-  
+
   return omenu;
 }
 
@@ -198,7 +198,7 @@ create_alpha_window (GtkWidget *widget)
       GtkWidget *label;
       GdkDisplay *display;
       GtkCssProvider *provider;
-      
+
       window = gtk_dialog_new_with_buttons ("Alpha Window",
                                            GTK_WINDOW (gtk_widget_get_root (widget)), 0,
                                            "_Close", 0,
@@ -401,16 +401,16 @@ create_widget_grid (gboolean group)
   GtkWidget *grid;
   GtkWidget *group_widget = NULL;
   int i, j;
-  
+
   grid = gtk_grid_new ();
-  
+
   for (i = 0; i < 5; i++)
     {
       for (j = 0; j < 5; j++)
        {
          GtkWidget *widget;
          char *tmp;
-         
+
          if (i == 0 && j == 0)
            {
              widget = NULL;
@@ -438,7 +438,7 @@ create_widget_grid (gboolean group)
                     gtk_check_button_set_group (GTK_CHECK_BUTTON (widget), GTK_CHECK_BUTTON (group_widget));
                }
            }
-         
+
          if (widget)
            gtk_grid_attach (GTK_GRID (grid), widget, i, j, 1, 1);
        }
@@ -460,7 +460,7 @@ create_check_buttons (GtkWidget *widget)
   GtkWidget *button;
   GtkWidget *separator;
   GtkWidget *table;
-  
+
   if (!window)
     {
       window = gtk_dialog_new_with_buttons ("Check Buttons",
@@ -469,7 +469,7 @@ create_check_buttons (GtkWidget *widget)
                                             GTK_RESPONSE_NONE,
                                             NULL);
 
-      gtk_window_set_display (GTK_WINDOW (window), 
+      gtk_window_set_display (GTK_WINDOW (window),
                               gtk_widget_get_display (widget));
       g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
       g_signal_connect (window, "response",
@@ -612,7 +612,7 @@ new_pixbuf (const char *filename,
 
   if (pixbuf == NULL)
     pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile);
-  
+
   widget = gtk_image_new_from_pixbuf (pixbuf);
 
   g_object_unref (pixbuf);
@@ -680,12 +680,12 @@ statusbar_contexts (GtkStatusbar *statusbar)
   g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
           string,
           gtk_statusbar_get_context_id (statusbar, string));
-  
+
   string = "idle messages";
   g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
           string,
           gtk_statusbar_get_context_id (statusbar, string));
-  
+
   string = "some text";
   g_print ("GtkStatusBar: context=\"%s\", context_id=%d\n",
           string,
@@ -790,7 +790,7 @@ create_statusbar (GtkWidget *widget)
     gtk_window_destroy (GTK_WINDOW (window));
 }
 
-/* 
+/*
  * Label Demo
  */
 static void
@@ -806,11 +806,11 @@ create_sensitivity_control (GtkWidget *widget)
 {
   GtkWidget *button;
 
-  button = gtk_toggle_button_new_with_label ("Sensitive");  
+  button = gtk_toggle_button_new_with_label ("Sensitive");
 
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
                                 gtk_widget_is_sensitive (widget));
-  
+
   g_signal_connect (button,
                     "toggled",
                     G_CALLBACK (sensitivity_toggled),
@@ -849,11 +849,11 @@ create_selectable_control (GtkWidget *widget)
 {
   GtkWidget *button;
 
-  button = gtk_toggle_button_new_with_label ("Selectable");  
+  button = gtk_toggle_button_new_with_label ("Selectable");
 
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
                                 FALSE);
-  
+
   g_signal_connect (button,
                     "toggled",
                     G_CALLBACK (selectable_toggled),
@@ -1109,7 +1109,7 @@ on_rotated_text_draw (GtkDrawingArea *drawing_area,
   desc = pango_font_description_from_string ("Sans Bold 30");
   pango_layout_set_font_description (layout, desc);
   pango_font_description_free (desc);
-    
+
   n_words = G_N_ELEMENTS (words);
   for (i = 0; i < n_words; i++)
     {
@@ -1121,14 +1121,14 @@ on_rotated_text_draw (GtkDrawingArea *drawing_area,
       pango_cairo_update_layout (cr, layout);
 
       pango_layout_set_text (layout, words[i], -1);
-      pango_layout_get_size (layout, &layout_width, &layout_height);
+      pango_lines_get_size (pango_layout_get_lines (layout), &layout_width, &layout_height);
 
       cairo_move_to (cr, - layout_width / 2 / PANGO_SCALE, - DEFAULT_TEXT_RADIUS);
       pango_cairo_show_layout (cr, layout);
 
       cairo_restore (cr);
     }
-  
+
   g_object_unref (layout);
 }
 
@@ -1379,9 +1379,9 @@ create_image (GtkWidget *widget)
     {
       GtkWidget *vbox;
       GdkPixbuf *pixbuf;
-        
+
       window = gtk_window_new ();
-      
+
       gtk_window_set_display (GTK_WINDOW (window),
                              gtk_widget_get_display (widget));
 
@@ -1399,7 +1399,7 @@ create_image (GtkWidget *widget)
       pack_image (vbox, "Stock Warning Dialog", gtk_image_new_from_icon_name ("dialog-warning"));
 
       pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) openfile);
-      
+
       pack_image (vbox, "Pixbuf",
                   gtk_image_new_from_pixbuf (pixbuf));
 
@@ -1601,9 +1601,9 @@ cmw_color (GtkWidget *widget, GtkWidget *parent)
                      G_CALLBACK (cmw_destroy_cb), NULL);
     g_signal_connect (csd, "response",
                       G_CALLBACK (gtk_window_destroy), NULL);
-    
+
     /* wait until destroy calls gtk_main_quit */
-    gtk_widget_show (csd);    
+    gtk_widget_show (csd);
     while (!done)
       g_main_context_iteration (NULL, TRUE);
 }
@@ -1717,7 +1717,7 @@ make_message_dialog (GdkDisplay     *display,
                            "response",
                            G_CALLBACK (gtk_window_destroy),
                            *dialog);
-  
+
   g_object_add_weak_pointer (G_OBJECT (*dialog), (gpointer)dialog);
 
   gtk_dialog_set_default_response (GTK_DIALOG (*dialog), default_response);
@@ -1805,9 +1805,9 @@ scrolled_windows_remove (GtkWidget *dialog, int response, GtkWidget *scrollwin)
       sw_float_parent = gtk_window_new ();
       gtk_window_set_display (GTK_WINDOW (sw_float_parent),
                              gtk_widget_get_display (dialog));
-      
+
       gtk_window_set_default_size (GTK_WINDOW (sw_float_parent), 200, 200);
-      
+
       g_object_ref (scrollwin);
       gtk_box_remove (GTK_BOX (gtk_widget_get_parent (scrollwin)), scrollwin);
       gtk_window_set_child (GTK_WINDOW (sw_float_parent), scrollwin);
@@ -2192,7 +2192,7 @@ create_size_group_window (GdkDisplay   *display,
   gtk_widget_set_halign (main_button, GTK_ALIGN_CENTER);
   gtk_widget_set_valign (main_button, GTK_ALIGN_CENTER);
   gtk_grid_attach (GTK_GRID (grid), main_button, 0, 0, 1, 1);
-  
+
   gtk_size_group_add_widget (master_size_group, main_button);
   gtk_size_group_add_widget (hgroup1, main_button);
   gtk_size_group_add_widget (vgroup1, main_button);
@@ -3017,7 +3017,7 @@ create_color_selection (GtkWidget *widget)
       gtk_widget_set_margin_start (hbox, 5);
       gtk_widget_set_margin_end (hbox, 5);
       gtk_window_set_child (GTK_WINDOW (window), hbox);
-      
+
       label = gtk_label_new ("Pick a color");
       gtk_box_append (GTK_BOX (hbox), label);
 
@@ -3173,7 +3173,7 @@ create_font_selection (GtkWidget *widget)
       GtkWidget *picker;
       GtkWidget *hbox;
       GtkWidget *label;
-      
+
       window = gtk_window_new ();
       gtk_window_set_display (GTK_WINDOW (window),
                               gtk_widget_get_display (widget));
@@ -3187,7 +3187,7 @@ create_font_selection (GtkWidget *widget)
       gtk_widget_set_margin_start (hbox, 8);
       gtk_widget_set_margin_end (hbox, 8);
       gtk_window_set_child (GTK_WINDOW (window), hbox);
-      
+
       label = gtk_label_new ("Pick a font");
       gtk_box_append (GTK_BOX (hbox), label);
 
@@ -3195,7 +3195,7 @@ create_font_selection (GtkWidget *widget)
       gtk_font_button_set_use_font (GTK_FONT_BUTTON (picker), TRUE);
       gtk_box_append (GTK_BOX (hbox), picker);
     }
-  
+
   if (!gtk_widget_get_visible (window))
     gtk_widget_show (window);
   else
@@ -3253,7 +3253,7 @@ create_dialog (GtkWidget *widget)
        * dialogs than this. Don't use testgtk for example code,
        * use gtk-demo ;-)
        */
-      
+
       dialog_window = gtk_dialog_new ();
       gtk_window_set_display (GTK_WINDOW (dialog_window),
                               gtk_widget_get_display (widget));
@@ -3268,7 +3268,7 @@ create_dialog (GtkWidget *widget)
       gtk_dialog_add_button (GTK_DIALOG (dialog_window),
                              "Toggle",
                              GTK_RESPONSE_APPLY);
-      
+
       g_signal_connect (dialog_window, "response",
                        G_CALLBACK (dialog_response_cb),
                        NULL);
@@ -3280,7 +3280,7 @@ create_dialog (GtkWidget *widget)
     gtk_window_destroy (GTK_WINDOW (dialog_window));
 }
 
-/* Display & Screen test 
+/* Display & Screen test
  */
 
 typedef struct
@@ -3299,10 +3299,10 @@ screen_display_check (GtkWidget *widget, ScreenDisplaySelection *data)
   GtkWidget *dialog;
   GdkDisplay *new_display = NULL;
   GdkDisplay *current_display = gtk_widget_get_display (widget);
-  
+
   display_name = gtk_editable_get_text (GTK_EDITABLE (data->entry));
   display = gdk_display_open (display_name);
-      
+
   if (!display)
     {
       dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (widget)),
@@ -3361,15 +3361,15 @@ create_display_screen (GtkWidget *widget)
                         "display", display,
                         "title", "Screen or Display selection",
                          NULL);
-  g_signal_connect (window, "destroy", 
+  g_signal_connect (window, "destroy",
                    G_CALLBACK (gtk_window_destroy), NULL);
 
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
   gtk_window_set_child (GTK_WINDOW (window), vbox);
-  
+
   frame = gtk_frame_new ("Select display");
   gtk_box_append (GTK_BOX (vbox), frame);
-  
+
   grid = gtk_grid_new ();
   gtk_grid_set_row_spacing (GTK_GRID (grid), 3);
   gtk_grid_set_column_spacing (GTK_GRID (grid), 3);
@@ -3402,9 +3402,9 @@ create_display_screen (GtkWidget *widget)
   scr_dpy_data->toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
   scr_dpy_data->dialog_window = window;
 
-  g_signal_connect (cancelb, "clicked", 
+  g_signal_connect (cancelb, "clicked",
                    G_CALLBACK (screen_display_destroy_diag), window);
-  g_signal_connect (applyb, "clicked", 
+  g_signal_connect (applyb, "clicked",
                    G_CALLBACK (screen_display_check), scr_dpy_data);
   gtk_widget_show (window);
 }
@@ -3584,7 +3584,7 @@ set_page_image (GtkNotebook *notebook, int page_num, GdkPixbuf *pixbuf)
 
   pixwid = g_object_get_data (G_OBJECT (page_widget), "tab_pixmap");
   gtk_image_set_from_pixbuf (GTK_IMAGE (pixwid), pixbuf);
-  
+
   pixwid = g_object_get_data (G_OBJECT (page_widget), "menu_pixmap");
   gtk_image_set_from_pixbuf (GTK_IMAGE (pixwid), pixbuf);
 }
@@ -3594,7 +3594,7 @@ page_switch (GtkWidget *widget, gpointer *page, int page_num)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
   int old_page_num = gtk_notebook_get_current_page (notebook);
- 
+
   if (page_num == old_page_num)
     return;
 
@@ -3707,7 +3707,7 @@ show_all_pages (GtkButton   *button,
   int i;
 
   for (i = 0; i < gtk_notebook_get_n_pages (notebook); i++)
-    gtk_widget_show (gtk_notebook_get_nth_page (notebook, i)); 
+    gtk_widget_show (gtk_notebook_get_nth_page (notebook, i));
 }
 
 static void
@@ -3749,7 +3749,7 @@ notebook_type_changed (GtkWidget *optionmenu,
       gtk_notebook_set_show_border (notebook, FALSE);
       break;
 
-    case SCROLLABLE:  
+    case SCROLLABLE:
       /* scrollable */
       gtk_notebook_set_show_tabs (notebook, TRUE);
       gtk_notebook_set_show_border (notebook, TRUE);
@@ -3796,7 +3796,7 @@ create_notebook (GtkWidget *widget)
     "Borderless",
     "Scrollable"
   };
-  
+
   if (!window)
     {
       window = gtk_window_new ();
@@ -3934,13 +3934,13 @@ create_pane_options (GtkPaned    *paned,
   child2 = gtk_paned_get_end_child (paned);
 
   frame = gtk_frame_new (frame_label);
-  
+
   grid = gtk_grid_new ();
   gtk_frame_set_child (GTK_FRAME (frame), grid);
-  
+
   label = gtk_label_new (label1);
   gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
-  
+
   check_button = gtk_check_button_new_with_label ("Resize");
   gtk_grid_attach (GTK_GRID (grid), check_button, 0, 1, 1, 1);
   g_signal_connect (check_button, "toggled",
@@ -3957,7 +3957,7 @@ create_pane_options (GtkPaned    *paned,
 
   label = gtk_label_new (label2);
   gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1);
-  
+
   check_button = gtk_check_button_new_with_label ("Resize");
   gtk_grid_attach (GTK_GRID (grid), check_button, 1, 1, 1, 1);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
@@ -4009,7 +4009,7 @@ create_panes (GtkWidget *widget)
       frame = gtk_frame_new (NULL);
       gtk_widget_set_size_request (frame, 60, 60);
       gtk_paned_set_start_child (GTK_PANED (hpaned), frame);
-      
+
       button = gtk_button_new_with_label ("Hi there");
       gtk_frame_set_child (GTK_FRAME (frame), button);
 
@@ -4072,7 +4072,7 @@ paned_keyboard_window1 (GtkWidget *widget)
 
   window1 = gtk_window_new ();
   gtk_window_set_title (GTK_WINDOW (window1), "Basic paned navigation");
-  gtk_window_set_display (GTK_WINDOW (window1), 
+  gtk_window_set_display (GTK_WINDOW (window1),
                          gtk_widget_get_display (widget));
 
   hpaned1 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
@@ -4161,7 +4161,7 @@ paned_keyboard_window2 (GtkWidget *widget)
   window2 = gtk_window_new ();
   gtk_window_set_title (GTK_WINDOW (window2), "\"button 10\" is not inside the horizontal pane");
 
-  gtk_window_set_display (GTK_WINDOW (window2), 
+  gtk_window_set_display (GTK_WINDOW (window2),
                          gtk_widget_get_display (widget));
 
   hpaned2 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
@@ -4393,7 +4393,7 @@ create_paned_keyboard_navigation (GtkWidget *widget)
   static GtkWidget *window3 = NULL;
   static GtkWidget *window4 = NULL;
 
-  if (window1 && 
+  if (window1 &&
      (gtk_widget_get_display (window1) != gtk_widget_get_display (widget)))
     {
       gtk_window_destroy (GTK_WINDOW (window1));
@@ -4401,7 +4401,7 @@ create_paned_keyboard_navigation (GtkWidget *widget)
       gtk_window_destroy (GTK_WINDOW (window3));
       gtk_window_destroy (GTK_WINDOW (window4));
     }
-  
+
   if (!window1)
     {
       window1 = paned_keyboard_window1 (widget);
@@ -4703,7 +4703,7 @@ create_surface_states (GtkWidget *widget)
       g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
 
       gtk_window_set_title (GTK_WINDOW (window), "Surface states");
-      
+
       box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
       gtk_window_set_child (GTK_WINDOW (window), box1);
 
@@ -4711,7 +4711,7 @@ create_surface_states (GtkWidget *widget)
 
       gtk_window_set_display (GTK_WINDOW (iconified),
                              gtk_widget_get_display (widget));
-      
+
       g_signal_connect_object (iconified, "destroy",
                               G_CALLBACK (gtk_window_destroy),
                               window,
@@ -4720,21 +4720,21 @@ create_surface_states (GtkWidget *widget)
       gtk_window_set_title (GTK_WINDOW (iconified), "Minimized initially");
       controls = get_state_controls (iconified);
       gtk_window_set_child (GTK_WINDOW (iconified), controls);
-      
+
       normal = gtk_window_new ();
 
       gtk_window_set_display (GTK_WINDOW (normal),
                              gtk_widget_get_display (widget));
-      
+
       g_signal_connect_object (normal, "destroy",
                               G_CALLBACK (gtk_window_destroy),
                               window,
                               G_CONNECT_SWAPPED);
-      
+
       gtk_window_set_title (GTK_WINDOW (normal), "Unminimized initially");
       controls = get_state_controls (normal);
       gtk_window_set_child (GTK_WINDOW (normal), controls);
-      
+
       gtk_widget_realize (iconified);
       gtk_widget_realize (normal);
 
@@ -4786,7 +4786,7 @@ set_default_size_callback (GtkWidget *widget,
                            gpointer   data)
 {
   int w, h;
-  
+
   get_ints (data, &w, &h);
 
   gtk_window_set_default_size (g_object_get_data (data, "target"),
@@ -4806,7 +4806,7 @@ set_size_request_callback (GtkWidget *widget,
                           gpointer   data)
 {
   int w, h;
-  
+
   get_ints (data, &w, &h);
 
   gtk_widget_set_size_request (g_object_get_data (data, "target"),
@@ -4831,18 +4831,18 @@ window_controls (GtkWidget *window)
   GtkWidget *button;
   GtkWidget *spin;
   GtkAdjustment *adjustment;
-  
+
   control_window = gtk_window_new ();
 
   gtk_window_set_display (GTK_WINDOW (control_window),
                          gtk_widget_get_display (window));
 
   gtk_window_set_title (GTK_WINDOW (control_window), "Size controls");
-  
+
   g_object_set_data (G_OBJECT (control_window),
                      "target",
                      window);
-  
+
   g_signal_connect_object (control_window,
                           "destroy",
                           G_CALLBACK (gtk_window_destroy),
@@ -4942,7 +4942,7 @@ create_window_sizing (GtkWidget *widget)
   if (!target_window)
     {
       GtkWidget *label;
-      
+
       target_window = gtk_window_new ();
       gtk_window_set_display (GTK_WINDOW (target_window),
                              gtk_widget_get_display (widget));
@@ -4962,7 +4962,7 @@ create_window_sizing (GtkWidget *widget)
   /* don't show target window by default, we want to allow testing
    * of behavior on first show.
    */
-  
+
   if (!gtk_widget_get_visible (window))
     gtk_widget_show (window);
   else
@@ -5050,7 +5050,7 @@ progressbar_toggle_orientation (GtkWidget *widget, gpointer data)
     gtk_orientable_set_orientation (GTK_ORIENTABLE (pdata->pbar), GTK_ORIENTATION_HORIZONTAL);
   else
     gtk_orientable_set_orientation (GTK_ORIENTABLE (pdata->pbar), GTK_ORIENTATION_VERTICAL);
- 
+
   if (i == 1 || i == 2)
     gtk_progress_bar_set_inverted (GTK_PROGRESS_BAR (pdata->pbar), TRUE);
   else
@@ -5136,7 +5136,7 @@ create_progress_bar (GtkWidget *widget)
     "Middle",   // PANGO_ELLIPSIZE_MIDDLE,
     "End",      // PANGO_ELLIPSIZE_END
   };
-  
+
   if (!pdata)
     pdata = g_new0 (ProgressData, 1);
 
@@ -5203,7 +5203,7 @@ create_progress_bar (GtkWidget *widget)
                                         progressbar_toggle_orientation,
                                         pdata);
       gtk_grid_attach (GTK_GRID (grid), pdata->omenu1, 1, 0, 1, 1);
-      
+
       check = gtk_check_button_new_with_label ("Running");
       g_signal_connect (check, "toggled",
                        G_CALLBACK (toggle_running),
@@ -5833,7 +5833,7 @@ create_main_window (void)
   gtk_widget_set_margin_end (scrolled_window, 10);
   gtk_widget_set_vexpand (scrolled_window, TRUE);
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
-                                 GTK_POLICY_NEVER, 
+                                 GTK_POLICY_NEVER,
                                   GTK_POLICY_AUTOMATIC);
   gtk_box_append (GTK_BOX (box1), scrolled_window);
 
@@ -5967,7 +5967,7 @@ do_bench (char* what, int num)
              break;
            }
        }
-      
+
       if (!fn)
        g_print ("Can't bench: \"%s\" not found.\n", what);
       else
@@ -6028,7 +6028,7 @@ main (int argc, char *argv[])
          char *nextarg;
          char *what;
          char *count;
-         
+
          nextarg = strchr (argv[i], '=');
          if (nextarg)
            nextarg++;
diff --git a/tests/testprintfileoperation.c b/tests/testprintfileoperation.c
index bbd27c40bc..af636d38e0 100644
--- a/tests/testprintfileoperation.c
+++ b/tests/testprintfileoperation.c
@@ -13,9 +13,9 @@ static void
 test_print_file_operation_finalize (GObject *object)
 {
   TestPrintFileOperation *op = TEST_PRINT_FILE_OPERATION (object);
-  
+
   g_free (op->filename);
-  
+
   G_OBJECT_CLASS (test_print_file_operation_parent_class)->finalize (object);
 }
 
@@ -34,10 +34,10 @@ test_print_file_operation_new (const char *filename)
   op = g_object_new (TEST_TYPE_PRINT_FILE_OPERATION, NULL);
 
   op->filename = g_strdup (filename);
-  
+
   return op;
-}  
-  
+}
+
 void
 test_print_file_operation_set_font_size (TestPrintFileOperation *op,
                                         double points)
@@ -54,9 +54,9 @@ test_print_file_operation_begin_print (GtkPrintOperation *operation, GtkPrintCon
   double height;
 
   height = gtk_print_context_get_height (context) - HEADER_HEIGHT - HEADER_GAP;
-  
+
   op->lines_per_page = floor (height / op->font_size);
-  
+
   g_file_get_contents (op->filename,
                       &contents,
                       NULL, NULL);
@@ -67,7 +67,7 @@ test_print_file_operation_begin_print (GtkPrintOperation *operation, GtkPrintCon
   i = 0;
   while (op->lines[i] != NULL)
     i++;
-  
+
   op->num_lines = i;
   op->num_pages = (op->num_lines - 1) / op->lines_per_page + 1;
   gtk_print_operation_set_n_pages (operation, op->num_pages);
@@ -90,10 +90,10 @@ test_print_file_operation_draw_page (GtkPrintOperation *operation,
   width = gtk_print_context_get_width (context);
 
   cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT);
-  
+
   cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
   cairo_fill_preserve (cr);
-  
+
   cairo_set_source_rgb (cr, 0, 0, 0);
   cairo_set_line_width (cr, 1);
   cairo_stroke (cr);
@@ -107,8 +107,8 @@ test_print_file_operation_draw_page (GtkPrintOperation *operation,
   pango_layout_set_text (layout, op->filename, -1);
   pango_layout_set_width (layout, width);
   pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
-                             
-  pango_layout_get_size (layout, NULL, &layout_height);
+
+  pango_lines_get_size (pango_layout_get_lines (layout), NULL, &layout_height);
   text_height = (double)layout_height / PANGO_SCALE;
 
   cairo_move_to (cr, width / 2,  (HEADER_HEIGHT - text_height) / 2);
@@ -118,19 +118,19 @@ test_print_file_operation_draw_page (GtkPrintOperation *operation,
   pango_layout_set_text (layout, page_str, -1);
   g_free (page_str);
   pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT);
-                             
+
   cairo_move_to (cr, width - 2, (HEADER_HEIGHT - text_height) / 2);
   pango_cairo_show_layout (cr, layout);
-  
+
   g_object_unref (layout);
-  
+
   layout = gtk_print_context_create_pango_layout (context);
-  
+
   desc = pango_font_description_from_string ("mono");
   pango_font_description_set_size (desc, op->font_size * PANGO_SCALE);
   pango_layout_set_font_description (layout, desc);
   pango_font_description_free (desc);
-  
+
   cairo_move_to (cr, 0, HEADER_HEIGHT + HEADER_GAP);
   line = page_nr * op->lines_per_page;
   for (i = 0; i < op->lines_per_page && line < op->num_lines; i++, line++) {
@@ -159,5 +159,5 @@ test_print_file_operation_class_init (TestPrintFileOperationClass *class)
   print_class->begin_print = test_print_file_operation_begin_print;
   print_class->draw_page = test_print_file_operation_draw_page;
   print_class->end_print = test_print_file_operation_end_print;
-  
+
 }
diff --git a/testsuite/gtk/builder.c b/testsuite/gtk/builder.c
index 88dc7c853a..3c07afc111 100644
--- a/testsuite/gtk/builder.c
+++ b/testsuite/gtk/builder.c
@@ -1906,20 +1906,20 @@ filter_pango_attrs (PangoAttribute *attr,
 {
   FoundAttrs *found = (FoundAttrs *)data;
 
-  if (attr->klass->type == PANGO_ATTR_WEIGHT)
+  if (attr->type == PANGO_ATTR_WEIGHT)
     found->weight = TRUE;
-  else if (attr->klass->type == PANGO_ATTR_FOREGROUND)
+  else if (attr->type == PANGO_ATTR_FOREGROUND)
     found->foreground = TRUE;
-  else if (attr->klass->type == PANGO_ATTR_UNDERLINE)
+  else if (attr->type == PANGO_ATTR_UNDERLINE)
     found->underline = TRUE;
   /* Make sure optional start/end properties are working */
-  else if (attr->klass->type == PANGO_ATTR_SIZE &&
+  else if (attr->type == PANGO_ATTR_SIZE &&
           attr->start_index == 5 &&
           attr->end_index   == 10)
     found->size = TRUE;
-  else if (attr->klass->type == PANGO_ATTR_FONT_DESC)
+  else if (attr->type == PANGO_ATTR_FONT_DESC)
     found->font_desc = TRUE;
-  else if (attr->klass->type == PANGO_ATTR_LANGUAGE)
+  else if (attr->type == PANGO_ATTR_LANGUAGE)
     found->language = TRUE;
 
   return TRUE;
diff --git a/testsuite/gtk/label.c b/testsuite/gtk/label.c
index fa0687cf49..0814258ca8 100644
--- a/testsuite/gtk/label.c
+++ b/testsuite/gtk/label.c
@@ -5,50 +5,54 @@ print_attribute (PangoAttribute *attr, GString *string)
 {
   GEnumClass *class;
   GEnumValue *value;
-  PangoAttrString *str;
-  PangoAttrLanguage *lang;
-  PangoAttrInt *integer;
-  PangoAttrFloat *flt;
-  PangoAttrFontDesc *font;
-  PangoAttrColor *color;
-  PangoAttrShape *shape;
 
   g_string_append_printf (string, "[%d,%d]", attr->start_index, attr->end_index);
 
   class = g_type_class_ref (pango_attr_type_get_type ());
-  value = g_enum_get_value (class, attr->klass->type);
+  value = g_enum_get_value (class, attr->type);
   g_string_append_printf (string, "%s=", value->value_nick);
   g_type_class_unref (class);
 
-  if ((str = pango_attribute_as_string (attr)) != NULL)
-    g_string_append (string, str->value);
-  else if ((lang = pango_attribute_as_language (attr)) != NULL)
-    g_string_append (string, pango_language_to_string (lang->value));
-  else if ((integer = pango_attribute_as_int (attr)) != NULL)
-    g_string_append_printf (string, "%d", integer->value);
-  else if ((flt = pango_attribute_as_float (attr)) != NULL)
+  switch (PANGO_ATTR_TYPE_VALUE_TYPE (attr->type))
     {
+    case PANGO_ATTR_VALUE_STRING:
+      g_string_append (string, attr->str_value);
+      break;
+    case PANGO_ATTR_VALUE_BOOLEAN:
+      g_string_append_printf (string, "%s", attr->boolean_value ? "true" : "false");
+      break;
+    case PANGO_ATTR_VALUE_LANGUAGE:
+      g_string_append (string, pango_language_to_string (attr->lang_value));
+      break;
+    case PANGO_ATTR_VALUE_INT:
+      g_string_append_printf (string, "%d", attr->int_value);
+      break;
+    case PANGO_ATTR_VALUE_FLOAT:
+      {
         char val[20];
 
-        g_ascii_formatd (val, 20, "%f", flt->value);
+        g_ascii_formatd (val, 20, "%f", attr->double_value);
         g_string_append (string, val);
-     }
-  else if ((font = pango_attribute_as_font_desc (attr)) != NULL)
-    {
-      char *text = pango_font_description_to_string (font->desc);
-      g_string_append (string, text);
-      g_free (text);
-    }
-  else if ((color = pango_attribute_as_color (attr)) != NULL)
-    {
-      char *text = pango_color_to_string (&color->color);
-      g_string_append (string, text);
-      g_free (text);
+      }
+      break;
+    case PANGO_ATTR_VALUE_FONT_DESC:
+      {
+        char *text = pango_font_description_to_string (attr->font_value);
+        g_string_append (string, text);
+        g_free (text);
+      }
+      break;
+    case PANGO_ATTR_VALUE_COLOR:
+      {
+        char *text = pango_color_to_string (&attr->color_value);
+        g_string_append (string, text);
+        g_free (text);
+      }
+      break;
+    case PANGO_ATTR_VALUE_POINTER:
+    default:
+      g_assert_not_reached ();
     }
-  else if ((shape = pango_attribute_as_shape (attr)) != NULL)
-    g_string_append_printf (string, "shape");
-  else
-    g_assert_not_reached ();
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]