summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-06-24 23:00:58 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-07-04 11:17:21 -0400
commit778df432eb9bba4441d4c47cdbfbcd385b1e9d42 (patch)
tree39b66234cc325aafdddcebd76ec888d0cc099aaa
parent249ce63ebb3d5666d5559184dd7c2c65e32695c2 (diff)
downloadpango-778df432eb9bba4441d4c47cdbfbcd385b1e9d42.tar.gz
Convert to the pango2 prefix
This makes pango 2 not just parallel-installable with pango 1.x, but parallel-usable in the same process.
-rw-r--r--docs/migrating.md116
-rw-r--r--docs/pango.toml.in4
-rw-r--r--docs/pango_bidi.md24
-rw-r--r--docs/pango_cairo.md10
-rw-r--r--docs/pango_fonts.md26
-rw-r--r--docs/pango_markup.md14
-rw-r--r--docs/pango_rendering.md20
-rw-r--r--docs/pango_user.md4
-rw-r--r--examples/cairoshape.c90
-rw-r--r--examples/cairosimple.c30
-rw-r--r--examples/cairotwisted.c24
-rw-r--r--examples/columns.c64
-rw-r--r--examples/first-steps.c18
-rw-r--r--examples/pangowin32tobmp.c120
-rw-r--r--examples/parshape.c72
-rw-r--r--examples/userfont.c90
-rw-r--r--meson.build16
-rw-r--r--pango/break-arabic.c12
-rw-r--r--pango/break-indic.c180
-rw-r--r--pango/break-latin.c14
-rw-r--r--pango/break-thai.c18
-rw-r--r--pango/break.c2404
-rw-r--r--pango/ellipsize.c218
-rw-r--r--pango/emoji_presentation_scanner.c360
-rw-r--r--pango/glyphstring.c485
-rw-r--r--pango/itemize.c582
-rw-r--r--pango/meson.build20
-rw-r--r--pango/pango-attr-iterator-private.h8
-rw-r--r--pango/pango-attr-iterator.c242
-rw-r--r--pango/pango-attr-iterator.h54
-rw-r--r--pango/pango-attr-list-private.h12
-rw-r--r--pango/pango-attr-list.c508
-rw-r--r--pango/pango-attr-list.h112
-rw-r--r--pango/pango-attr-private.h10
-rw-r--r--pango/pango-attr.c420
-rw-r--r--pango/pango-attr.h280
-rw-r--r--pango/pango-attributes-private.h14
-rw-r--r--pango/pango-attributes.c612
-rw-r--r--pango/pango-attributes.h452
-rw-r--r--pango/pango-bidi-private.h10
-rw-r--r--pango/pango-bidi.c44
-rw-r--r--pango/pango-break-table.h18
-rw-r--r--pango/pango-break.h60
-rw-r--r--pango/pango-color.c64
-rw-r--r--pango/pango-color.h40
-rw-r--r--pango/pango-context-private.h22
-rw-r--r--pango/pango-context.c598
-rw-r--r--pango/pango-context.h128
-rw-r--r--pango/pango-direction.h38
-rw-r--r--pango/pango-emoji-private.h20
-rw-r--r--pango/pango-emoji-table.h16
-rw-r--r--pango/pango-emoji.c68
-rw-r--r--pango/pango-enum-types.h.template6
-rw-r--r--pango/pango-features.h.meson10
-rw-r--r--pango/pango-font-description-private.h32
-rw-r--r--pango/pango-font-description.c769
-rw-r--r--pango/pango-font-description.h408
-rw-r--r--pango/pango-font-face-private.h64
-rw-r--r--pango/pango-font-face.c278
-rw-r--r--pango/pango-font-face.h60
-rw-r--r--pango/pango-font-family-private.h22
-rw-r--r--pango/pango-font-family.c124
-rw-r--r--pango/pango-font-family.h20
-rw-r--r--pango/pango-font-metrics-private.h4
-rw-r--r--pango/pango-font-metrics.c114
-rw-r--r--pango/pango-font-metrics.h60
-rw-r--r--pango/pango-font-private.h94
-rw-r--r--pango/pango-font.c260
-rw-r--r--pango/pango-font.h80
-rw-r--r--pango/pango-fontmap-private.h40
-rw-r--r--pango/pango-fontmap.c734
-rw-r--r--pango/pango-fontmap.h126
-rw-r--r--pango/pango-fontset-cached-private.h40
-rw-r--r--pango/pango-fontset-cached.c226
-rw-r--r--pango/pango-fontset-private.h26
-rw-r--r--pango/pango-fontset.c112
-rw-r--r--pango/pango-fontset.h38
-rw-r--r--pango/pango-generic-family-private.h12
-rw-r--r--pango/pango-generic-family.c114
-rw-r--r--pango/pango-generic-family.h16
-rw-r--r--pango/pango-glyph-item-private.h72
-rw-r--r--pango/pango-glyph-item.c286
-rw-r--r--pango/pango-glyph-iter-private.h70
-rw-r--r--pango/pango-glyph.h258
-rw-r--r--pango/pango-gravity.c500
-rw-r--r--pango/pango-gravity.h110
-rw-r--r--pango/pango-hbface-private.h18
-rw-r--r--pango/pango-hbface.c476
-rw-r--r--pango/pango-hbface.h108
-rw-r--r--pango/pango-hbfamily-private.h26
-rw-r--r--pango/pango-hbfamily.c176
-rw-r--r--pango/pango-hbfont-private.h8
-rw-r--r--pango/pango-hbfont.c464
-rw-r--r--pango/pango-hbfont.h58
-rw-r--r--pango/pango-impl-utils.h32
-rw-r--r--pango/pango-item-private.h102
-rw-r--r--pango/pango-item.c326
-rw-r--r--pango/pango-item.h94
-rw-r--r--pango/pango-language-sample-table.h2
-rw-r--r--pango/pango-language-set-private.h20
-rw-r--r--pango/pango-language-set-simple-private.h10
-rw-r--r--pango/pango-language-set-simple.c58
-rw-r--r--pango/pango-language-set.c42
-rw-r--r--pango/pango-language.c332
-rw-r--r--pango/pango-language.h46
-rw-r--r--pango/pango-layout.c860
-rw-r--r--pango/pango-layout.h274
-rw-r--r--pango/pango-line-breaker.c1054
-rw-r--r--pango/pango-line-breaker.h70
-rw-r--r--pango/pango-line-iter-private.h2
-rw-r--r--pango/pango-line-iter.c336
-rw-r--r--pango/pango-line-iter.h104
-rw-r--r--pango/pango-line-private.h44
-rw-r--r--pango/pango-line.c560
-rw-r--r--pango/pango-line.h144
-rw-r--r--pango/pango-lines-private.h2
-rw-r--r--pango/pango-lines.c571
-rw-r--r--pango/pango-lines.h248
-rw-r--r--pango/pango-markup.c642
-rw-r--r--pango/pango-markup.h36
-rw-r--r--pango/pango-matrix.c229
-rw-r--r--pango/pango-matrix.h117
-rw-r--r--pango/pango-renderer.c1321
-rw-r--r--pango/pango-renderer.h344
-rw-r--r--pango/pango-run-private.h8
-rw-r--r--pango/pango-run.c140
-rw-r--r--pango/pango-run.h18
-rw-r--r--pango/pango-script-lang-table.h6
-rw-r--r--pango/pango-script-private.h12
-rw-r--r--pango/pango-script.c80
-rw-r--r--pango/pango-script.h49
-rw-r--r--pango/pango-tabs.c266
-rw-r--r--pango/pango-tabs.h133
-rw-r--r--pango/pango-trace-private.h16
-rw-r--r--pango/pango-trace.c14
-rw-r--r--pango/pango-types.h246
-rw-r--r--pango/pango-userface-private.h14
-rw-r--r--pango/pango-userface.c248
-rw-r--r--pango/pango-userface.h88
-rw-r--r--pango/pango-userfont-private.h4
-rw-r--r--pango/pango-userfont.c240
-rw-r--r--pango/pango-userfont.h34
-rw-r--r--pango/pango-utils.c150
-rw-r--r--pango/pango-utils.h93
-rw-r--r--pango/pango-version-macros.h120
-rw-r--r--pango/pangocairo-context.c128
-rw-r--r--pango/pangocairo-context.h30
-rw-r--r--pango/pangocairo-font.c276
-rw-r--r--pango/pangocairo-font.h10
-rw-r--r--pango/pangocairo-private.h42
-rw-r--r--pango/pangocairo-render.c617
-rw-r--r--pango/pangocairo-render.h68
-rw-r--r--pango/pangocoretext-fontmap.c136
-rw-r--r--pango/pangocoretext-fontmap.h10
-rw-r--r--pango/pangodwrite-fontmap.h18
-rw-r--r--pango/pangofc-fontmap.c222
-rw-r--r--pango/pangofc-fontmap.h20
-rw-r--r--pango/pangofc-language-set-private.h20
-rw-r--r--pango/pangofc-language-set.c58
-rw-r--r--pango/serializer.c606
-rw-r--r--pango/shape.c278
-rw-r--r--tests/dump-boundaries.c10
-rw-r--r--tests/markup-parse.c64
-rw-r--r--tests/test-bidi.c114
-rw-r--r--tests/test-break.c34
-rw-r--r--tests/test-common.c122
-rw-r--r--tests/test-common.h4
-rw-r--r--tests/test-ellipsize.c72
-rw-r--r--tests/test-font.c524
-rw-r--r--tests/test-fontsets.c28
-rw-r--r--tests/test-harfbuzz.c22
-rw-r--r--tests/test-itemize.c130
-rw-r--r--tests/test-layout.c28
-rw-r--r--tests/test-pangocairo-threads.c26
-rw-r--r--tests/test-shape.c116
-rw-r--r--tests/testattributes.c900
-rw-r--r--tests/testboundaries.c34
-rw-r--r--tests/testboundaries_ucd.c22
-rw-r--r--tests/testcolor.c20
-rw-r--r--tests/testcontext.c68
-rw-r--r--tests/testhbfont.c532
-rw-r--r--tests/testiter.c104
-rw-r--r--tests/testlanguage.c22
-rw-r--r--tests/testmatrix.c148
-rw-r--r--tests/testmisc.c686
-rw-r--r--tests/testrandom.c92
-rw-r--r--tests/testscript.c30
-rw-r--r--tests/testserialize.c136
-rw-r--r--tests/testtabs.c78
-rw-r--r--tests/validate-log-attrs.c76
-rw-r--r--tests/validate-log-attrs.h24
-rw-r--r--tools/gen-script-for-lang.c16
-rw-r--r--utils/pango-list.c80
-rw-r--r--utils/pango-segmentation.c30
-rw-r--r--utils/pango-view.c6
-rw-r--r--utils/userfont.c24
-rw-r--r--utils/userfont.h2
-rw-r--r--utils/viewer-cairo.c8
-rw-r--r--utils/viewer-cairo.h2
-rw-r--r--utils/viewer-main.c4
-rw-r--r--utils/viewer-pangocairo.c354
-rw-r--r--utils/viewer-pangoxft.c24
-rw-r--r--utils/viewer-render.c224
-rw-r--r--utils/viewer-render.h16
-rw-r--r--utils/viewer-x.c6
-rw-r--r--utils/viewer-x.h6
-rw-r--r--utils/viewer.h16
207 files changed, 16515 insertions, 16513 deletions
diff --git a/docs/migrating.md b/docs/migrating.md
index c7b897d0..1977ad2b 100644
--- a/docs/migrating.md
+++ b/docs/migrating.md
@@ -51,102 +51,102 @@ the `pangocairo.h` header, and use the APIs that are declared in it.
There is still a `pangocairo2.pc` file, if you want to be explicit in your
build configuration about requiring cairo support. If you want to handle
the possible absence of cairo support at runtime, you can check the
-[const@Pango.RENDERING_CAIRO] macro before including `pangocairo.h`.
+[const@Pango2.RENDERING_CAIRO] macro before including `pangocairo.h`.
### PangoFontMap changes
-The [class@Pango.FontMap] class has seen some significant changes. It is now possible
+The [class@Pango2.FontMap] class has seen some significant changes. It is now possible
to instantiate a `PangoFontMap`, and populate it manually with `PangoFontFamily`
and `PangoFontFace` objects. If you simply want to obtain the default fontmap
that is populated with the native font enumeration APIs, use
-[func@Pango.FontMap.get_default]. It is no longer necessary to use cairo-specific
+[func@Pango2.FontMap.get_default]. It is no longer necessary to use cairo-specific
APIs to obtain a suitable fontmap, or set the resolution.
| Old API | New API |
|---------|---------|
-|pango_cairo_font_map_get_default() | [func@Pango.FontMap.get_default] |
-|pango_cairo_font_map_set_resolution() | [method@Pango.FontMap.set_resolution] |
-|pango_font_map_create_context() | [ctor@Pango.Context.new_with_font_map] |
+|pango_cairo_font_map_get_default() | [func@Pango2.FontMap.get_default] |
+|pango_cairo_font_map_set_resolution() | [method@Pango2.FontMap.set_resolution] |
+|pango_font_map_create_context() | [ctor@Pango2.Context.new_with_font_map] |
### Font-related API changes
-Some APIs have been moved between [class@Pango.Font], [class@Pango.FontFace]
-and [class@Pango.FontFamily] or renamed.
+Some APIs have been moved between [class@Pango2.Font], [class@Pango2.FontFace]
+and [class@Pango2.FontFamily] or renamed.
| Old API | New API |
|---------|---------|
-| pango_font_face_get_face_name() | [method@Pango.FontFace.get_name] |
-| pango_font_family_is_monospace() | [method@Pango.FontFace.is_monospace] |
-| pango_font_family_is_variable() | [method@Pango.FontFace.is_variable] |
-| pango_font_get_languages() | [method@Pango.FontFace.get_languages] |
-| pango_font_has_char() | [method@Pango.FontFace.has_char] |
+| pango_font_face_get_face_name() | [method@Pango2.FontFace.get_name] |
+| pango_font_family_is_monospace() | [method@Pango2.FontFace.is_monospace] |
+| pango_font_family_is_variable() | [method@Pango2.FontFace.is_variable] |
+| pango_font_get_languages() | [method@Pango2.FontFace.get_languages] |
+| pango_font_has_char() | [method@Pango2.FontFace.has_char] |
The `PangoCoverage` object has been dropped, in favor of
-[method@Pango.FontFace.has_char].
+[method@Pango2.FontFace.has_char].
-The [struct@Pango.FontMetrics] struct has been made opaque and given
+The [struct@Pango2.FontMetrics] struct has been made opaque and given
copy/free semantics instead of ref/unref.
### PangoContext changes
-[ctor@Pango.Context.new] creates a `PangoContext` that uses the default
+[ctor@Pango2.Context.new] creates a `PangoContext` that uses the default
font map. To create a context with a custom font map, use
-[ctor@Pango.Context.new_with_font_map].
+[ctor@Pango2.Context.new_with_font_map].
### Itemization-related API changes
-[struct@Pango.Item] and [struct@Pango.Analysis] are now opaque structs
+[struct@Pango2.Item] and [struct@Pango2.Analysis] are now opaque structs
and have getters. APIs for creating items have been dropped.
### PangoLayout changes
Most APIs that provide information about the formatted output have been
-moved from [class@Pango.Layout] to the new objects [class@Pango.Lines] and
-[struct@Pango.LineIter]. To obtain these from a `PangoLayout`, use
-[method@Pango.Layout.get_lines] and [method@Pango.Layout.get_iter].
+moved from [class@Pango2.Layout] to the new objects [class@Pango2.Lines] and
+[struct@Pango2.LineIter]. To obtain these from a `PangoLayout`, use
+[method@Pango2.Layout.get_lines] and [method@Pango2.Layout.get_iter].
-The `PangoLayoutLine` struct has been replaced by [struct@Pango.Line],
-and the role of `PangoLayoutIter` has been taken over by [struct@Pango.LineIter].
+The `PangoLayoutLine` struct has been replaced by [struct@Pango2.Line],
+and the role of `PangoLayoutIter` has been taken over by [struct@Pango2.LineIter].
The `PangoGlyphItem/PangoLayoutRun` struct has been replaced by a new
-[struct@Pango.Run].
+[struct@Pango2.Run].
| Old API | New API |
|---------|---------|
-| pango_layout_get_extents() | [method@Pango.Lines.get_extents] |
-| pango_layout_get_size() | [method@Pango.Lines.get_size] |
-| pango_layout_get_pixel_extents() | use [func@Pango.extents_to_pixels] |
-| pango_layout_get_pixel_size() | use [func@Pango.extents_to_pixels] |
-| pango_layout_get_baseline() | [method@Pango.Lines.get_baseline] |
-| pango_layout_get_line_count() | [method@Pango.Lines.get_line_count] |
-| pango_layout_get_log_attrs_readonly() | [method@Pango.Layout.get_log_attrs] |
-| pango_layout_set_single_paragraph_mode() | [method@Pango.Layout.set_single_paragraph] |
-| pango_layout_is_wrapped() | [method@Pango.Lines.is_wrapped] |
-| pango_layout_is_ellipsized() | [method@Pango.Lines.is_ellipsized] |
-| pango_layout_xy_to_index() | [method@Pango.Lines.pos_to_index] |
-| pango_layout_get_cursor_pos() | [method@Pango.Lines.get_cursor_pos] |
-| pango_layout_get_caret_pos() | [method@Pango.Lines.get_caret_pos] |
-| pango_layout_move_cursor_visually() | [method@Pango.Lines.move_cursor] |
-| pango_layout_line_get_extents() | [method@Pango.Line.get_extents] |
-| pango_layout_line_get_x_ranges() | [method@Pango.Lines.get_x_ranges] |
-| pango_layout_line_x_to_index() | [method@Pango.Line.x_to_index] |
-| pango_layout_iter_get_layout_extents() | [method@Pango.LineIter.get_layout_extents] |
-| pango_layout_iter_get_line_yrange() | [method@Pango.LineIter.get_line_extents] |
+| pango_layout_get_extents() | [method@Pango2.Lines.get_extents] |
+| pango_layout_get_size() | [method@Pango2.Lines.get_size] |
+| pango_layout_get_pixel_extents() | use [func@Pango2.extents_to_pixels] |
+| pango_layout_get_pixel_size() | use [func@Pango2.extents_to_pixels] |
+| pango_layout_get_baseline() | [method@Pango2.Lines.get_baseline] |
+| pango_layout_get_line_count() | [method@Pango2.Lines.get_line_count] |
+| pango_layout_get_log_attrs_readonly() | [method@Pango2.Layout.get_log_attrs] |
+| pango_layout_set_single_paragraph_mode() | [method@Pango2.Layout.set_single_paragraph] |
+| pango_layout_is_wrapped() | [method@Pango2.Lines.is_wrapped] |
+| pango_layout_is_ellipsized() | [method@Pango2.Lines.is_ellipsized] |
+| pango_layout_xy_to_index() | [method@Pango2.Lines.pos_to_index] |
+| pango_layout_get_cursor_pos() | [method@Pango2.Lines.get_cursor_pos] |
+| pango_layout_get_caret_pos() | [method@Pango2.Lines.get_caret_pos] |
+| pango_layout_move_cursor_visually() | [method@Pango2.Lines.move_cursor] |
+| pango_layout_line_get_extents() | [method@Pango2.Line.get_extents] |
+| pango_layout_line_get_x_ranges() | [method@Pango2.Lines.get_x_ranges] |
+| pango_layout_line_x_to_index() | [method@Pango2.Line.x_to_index] |
+| pango_layout_iter_get_layout_extents() | [method@Pango2.LineIter.get_layout_extents] |
+| pango_layout_iter_get_line_yrange() | [method@Pango2.LineIter.get_line_extents] |
### PangoAttribute changes
-[struct@Pango.Attribute] is no longer defined with different structs,
+[struct@Pango2.Attribute] is no longer defined with different structs,
but is an opaque type with getters for the different types of value.
-To set the range of an attribute use [method@Pango.Attribute.set_range].
-To define your own attribute types, use [func@Pango.AttrType.register].
+To set the range of an attribute use [method@Pango2.Attribute.set_range].
+To define your own attribute types, use [func@Pango2.AttrType.register].
Some of the existing attribute types have seen changes as well. All the
-color-related attributes now take a [struct@Pango.Color] argument in their
-constructor. Alpha attributes have been removed, since [struct@Pango.Color]
+color-related attributes now take a [struct@Pango2.Color] argument in their
+constructor. Alpha attributes have been removed, since [struct@Pango2.Color]
now contains an alpha field.
The line-related attributes have been reorganized. There is now a
-[enum@Pango.LineStyle] enumeration that can be applied to underlines,
-overlines and strikethroughs, and a separate [enum@Pango.UnderlinePosition]
+[enum@Pango2.LineStyle] enumeration that can be applied to underlines,
+overlines and strikethroughs, and a separate [enum@Pango2.UnderlinePosition]
enumeration.
### Markup changes
@@ -155,30 +155,30 @@ The attributes 'alpha', 'fgalpha', 'background_alpha' and 'bgalpha' have
been removed. Alpha values can now be specified as part of color attributes.
The 'underline', 'overline' and 'strikethrough' attributes now all take values
-from the [enum@Pango.LineStyle] enumeration. The `PANGO_UNDERLINE_LOW` value
+from the [enum@Pango2.LineStyle] enumeration. The `PANGO_UNDERLINE_LOW` value
has been replaced by the separate 'underline-position' attribute.
## New functionality to explore
### Complex line breaking with PangoLineBreaker
-[class@Pango.LineBreaker] is the core of pango's line-breaking algorithm,
+[class@Pango2.LineBreaker] is the core of pango's line-breaking algorithm,
broken out from `PangoLayout`. It gives applications more direct access to
influence the operation of the line-breaking algorithm, and facilitates
complex line breaking tasks such as shaped paragraphs or multi-column layout.
-To create a `PangoLineBreaker`, use [ctor@Pango.LineBreaker.new]. To add text
-to it, use [method@Pango.LineBreaker.add_text], and to obtain formatted lines,
-use [method@Pango.LineBreaker.next_line].
+To create a `PangoLineBreaker`, use [ctor@Pango2.LineBreaker.new]. To add text
+to it, use [method@Pango2.LineBreaker.add_text], and to obtain formatted lines,
+use [method@Pango2.LineBreaker.next_line].
### Application-specific fonts
-[class@Pango.HbFace] makes it easily possible to create fonts from font files
+[class@Pango2.HbFace] makes it easily possible to create fonts from font files
that are shipped with an application or even from font data in memory. These
-custom faces can then be added to any fontmap with [method@Pango.FontMap.add_face],
+custom faces can then be added to any fontmap with [method@Pango2.FontMap.add_face],
to make them available like any other font.
### Custom fonts
-[class@Pango.UserFace] is a callback-based implementation of fonts that allows
+[class@Pango2.UserFace] is a callback-based implementation of fonts that allows
for entirely appication-defined font handling, including glyph drawing.
diff --git a/docs/pango.toml.in b/docs/pango.toml.in
index 7503e1ec..70d8b37d 100644
--- a/docs/pango.toml.in
+++ b/docs/pango.toml.in
@@ -1,6 +1,6 @@
[library]
-namespace = "Pango"
-version = "@PANGO_VERSION@"
+namespace = "Pango2"
+version = "@PANGO2_VERSION@"
browse_url = "https://gitlab.gnome.org/GNOME/pango2/"
repository_url = "https://gitlab.gnome.org/GNOME/pango.git"
website_url = "https://www.pango.org"
diff --git a/docs/pango_bidi.md b/docs/pango_bidi.md
index 1f2f0547..fe55263d 100644
--- a/docs/pango_bidi.md
+++ b/docs/pango_bidi.md
@@ -7,7 +7,7 @@ Title: Bidirectional and Vertical Text
Pango supports bidirectional text (like Arabic and Hebrew) automatically.
Some applications however, need some help to correctly handle bidirectional text.
-The [enum@Pango.Direction] type can be used with [method@Pango.Context.set_base_dir]
+The [enum@Pango2.Direction] type can be used with [method@Pango2.Context.set_base_dir]
to instruct Pango about direction of text, though in most cases Pango detects
text direction correctly and automatically.
@@ -43,36 +43,36 @@ tells glyphs which way is down, so the gravity of normal Latin text is south.
A gravity value of east means that glyphs will be rotated ninety degrees
counterclockwise. So, to render vertical text one needs to set the gravity
and rotate the layout using the matrix machinery already in place. This has
-the huge advantage that most algorithms working on a [class@Pango.Layout] do
+the huge advantage that most algorithms working on a [class@Pango2.Layout] do
not need any change as the assumption that lines run in the X direction and
stack in the Y direction holds even for vertical text layouts.
Here is an example for some English text rendered with gravity west,
rotated 90 degrees:
-Applications should only need to set base gravity on [class@Pango.Context] in use,
+Applications should only need to set base gravity on [class@Pango2.Context] in use,
and let Pango decide the gravity assigned to each run of text. This automatically
handles text with mixed scripts. A very common use is to set the context base
-gravity to auto using [method@Pango.Context.set_base_gravity] and rotate the layout
+gravity to auto using [method@Pango2.Context.set_base_gravity] and rotate the layout
normally. Pango will make sure that Asian languages take the right form, while
other scripts are rotated normally.
The correct way to set gravity on a layout is to set it on the context associated
-with it using [method@Pango.Context.set_base_gravity]. The context of a layout can
-be accessed using [method@Pango.Layout.get_context]. The currently set base gravity
-of the context can be accessed using [method@Pango.Context.get_base_gravity] and
-the *resolved* gravity of it using [method@Pango.Context.get_gravity]. The resolved
+with it using [method@Pango2.Context.set_base_gravity]. The context of a layout can
+be accessed using [method@Pango2.Layout.get_context]. The currently set base gravity
+of the context can be accessed using [method@Pango2.Context.get_base_gravity] and
+the *resolved* gravity of it using [method@Pango2.Context.get_gravity]. The resolved
gravity is the same as the base gravity for the most part, except that if the base
gravity is set to `PANGO_GRAVITY_AUTO`, the resolved gravity will depend on the
-current matrix set on context, and is derived using [func@Pango.Gravity.get_for_matrix].
+current matrix set on context, and is derived using [func@Pango2.Gravity.get_for_matrix].
The next thing an application may want to set on the context is the *gravity hint*.
-A [enum@Pango.GravityHint] instructs how different scripts should react to the set
+A [enum@Pango2.GravityHint] instructs how different scripts should react to the set
base gravity.
Font descriptions have a gravity property too, that can be set using
-[method@Pango.FontDescription.set_gravity] and accessed using
-[method@Pango.FontDescription.get_gravity]. However, those are rarely useful
+[method@Pango2.FontDescription.set_gravity] and accessed using
+[method@Pango2.FontDescription.get_gravity]. However, those are rarely useful
from application code and are mainly used by `PangoLayout` internally.
Last but not least, one can create `PangoAttributes` for gravity and gravity
diff --git a/docs/pango_cairo.md b/docs/pango_cairo.md
index f4d699f6..309b7d02 100644
--- a/docs/pango_cairo.md
+++ b/docs/pango_cairo.md
@@ -11,15 +11,15 @@ files, and to the screen on X and on other windowing systems. The functions in
this section allow using Pango to render to Cairo surfaces.
Using Pango with Cairo is straightforward. A `PangoContext` created with
-[func@Pango.cairo_create_context] can be used on any Cairo context (`cairo_t`),
+[func@Pango2.cairo_create_context] can be used on any Cairo context (`cairo_t`),
but needs to be updated to match the current transformation matrix and target
-surface of the Cairo context using [func@Pango.cairo_update_context].
-The convenience functions [func@Pango.cairo_create_layout] and
-[func@Pango.cairo_update_layout] handle the common case where the program
+surface of the Cairo context using [func@Pango2.cairo_update_context].
+The convenience functions [func@Pango2.cairo_create_layout] and
+[func@Pango2.cairo_update_layout] handle the common case where the program
doesn't need to manipulate the properties of the `PangoContext`.
When you get the metrics of a layout or of a piece of a layout using functions
-such as [method@Pango.Lines.get_extents], the reported metrics are in user-space
+such as [method@Pango2.Lines.get_extents], the reported metrics are in user-space
coordinates. If a piece of text is 10 units long, and you call
`cairo_scale (cr, 2.0)`, it still is more-or-less 10 units long. However, the
results will be affected by hinting (that is, the process of adjusting the text
diff --git a/docs/pango_fonts.md b/docs/pango_fonts.md
index 1cae8c68..77595359 100644
--- a/docs/pango_fonts.md
+++ b/docs/pango_fonts.md
@@ -19,11 +19,11 @@ family, and "Helvetica Bold 12pt" is a concrete font of this face.
# Font Enumeration
The central object for dealing with the available fonts on a system and caching
-loaded fonts is a [class@Pango.FontMap]. An application typically uses a single
+loaded fonts is a [class@Pango2.FontMap]. An application typically uses a single
font map.
Since the font map depends on the platform in use, you'll need to use the backend
-function [func@Pango.FontMap.get_default] to obtain the default fontmap. Depending
+function [func@Pango2.FontMap.get_default] to obtain the default fontmap. Depending
on the platform, it will return a `PangoFcFontMap`, a `PangoDirectWriterFontMap`
or a `PangoCoreTextFontMap`.
@@ -36,44 +36,44 @@ of a font family, use the [iface@Gio.ListModel] implementation of the font famil
The default font map used by Pango will contain the fonts that are available
via the font enumeration APIs of the system (for Linux, that is fontconfig).
For special situations (such as writing Pango tests), it can appropriate
-to create an empty font map with [ctor@Pango.FontMap.new] and populate it
-only with the fonts you need, using [method@Pango.FontMap.add_file].
+to create an empty font map with [ctor@Pango2.FontMap.new] and populate it
+only with the fonts you need, using [method@Pango2.FontMap.add_file].
It is also possible to add custom fonts to the default font map if you
just want to make some custom font available in addition to the normal
system fonts. While loading a font from a .ttf or .otf file with
-[method@Pango.FontMap.add_file] is often the most convenient way to add
+[method@Pango2.FontMap.add_file] is often the most convenient way to add
a custom font, it is also possible to load a font from memory by combining
-[ctor@Pango.HbFace.new_from_hb_face] and `hb_face_create()`.
+[ctor@Pango2.HbFace.new_from_hb_face] and `hb_face_create()`.
Another approach to custom fonts is to draw the glyphs yourself. This
-is possible with [class@Pango.UserFace]. Such font faces can also be
+is possible with [class@Pango2.UserFace]. Such font faces can also be
added to font maps and used like regular font faces.
# Font Descriptions
Since loading fonts uses system resources, Pango provides a way to describe
-a font without loading it. A [struct@Pango.FontDescription] is a struct that
+a font without loading it. A [struct@Pango2.FontDescription] is a struct that
contains enough information to load a concrete font with
-[method@Pango.FontMap.load_font] or [method@Pango.Context.load_font]. You can
-obtain a font description from a font face using [method@Pango.FontFace.describe],
+[method@Pango2.FontMap.load_font] or [method@Pango2.Context.load_font]. You can
+obtain a font description from a font face using [method@Pango2.FontFace.describe],
or by parsing a string such as
Helvetica Bold 12pt
-with [func@Pango.FontDescription.from_string].
+with [func@Pango2.FontDescription.from_string].
# Glyphs
A font provides information about glyphs and how to position and render them.
The Pango rendering pipeline uses this information to create a
-[struct@Pango.GlyphString], which contains the glyphs corresponding to the
+[struct@Pango2.GlyphString], which contains the glyphs corresponding to the
characters in the text and related information such as glyph positions and sizes,
and clustering information (i.e. which glyphs correspond to which characters).
![A glyph string](rects3.png)
-A glyph is identified by a [alias@Pango.Glyph], which is a numeric ID. Note that
+A glyph is identified by a [alias@Pango2.Glyph], which is a numeric ID. Note that
glyph IDs are font-specific: the same character can be represented by different
glyph IDs in different fonts.
diff --git a/docs/pango_markup.md b/docs/pango_markup.md
index 4a4e8bd7..587c4352 100644
--- a/docs/pango_markup.md
+++ b/docs/pango_markup.md
@@ -5,7 +5,7 @@ Title: Text Attributes and Markup
# Text Attributes
Attributed text is used in a number of places in Pango. It is used as the
-input to the itemization process and also when creating a [class@Pango.Layout].
+input to the itemization process and also when creating a [class@Pango2.Layout].
Attributes can influence the various stages of the rendering pipeline. For example,
font or size attributes will influence the font selection that is happening during
@@ -14,17 +14,17 @@ color or underline attributes will be used for rendering.
Pango uses a simple structs for individual attributes. Each attribute has a type,
and a start and end index that determine the range of characters that the attribute
-applies to. See the [enum@Pango.AttrType] enumeration for all the possible
+applies to. See the [enum@Pango2.AttrType] enumeration for all the possible
attribute types.
-Attributes rarely come alone. Pango uses the [struct@Pango.AttrList] structure
+Attributes rarely come alone. Pango uses the [struct@Pango2.AttrList] structure
to hold all attributes that apply to a piece of text.
# Pango Markup
Frequently, you want to display some text to the user with attributes applied to
part of the text (for example, you might want bold or italicized words). With the
-base Pango interfaces, you could create a [struct@Pango.AttrList] and apply it to
+base Pango interfaces, you could create a [struct@Pango2.AttrList] and apply it to
the text; the problem is that you'd need to apply attributes to some numeric range
of characters, for example "characters 12-17." This is broken from an
internationalization standpoint; once the text is translated, the word you wanted
@@ -32,7 +32,7 @@ to italicize could be in a different position.
The solution is to include the text attributes in the string to be translated.
Pango provides this feature with a small markup language. You can parse a marked-up
-string into the string text plus a [struct@Pango.AttrList] using either of
+string into the string text plus a [struct@Pango2.AttrList] using either of
[func@parse_markup] or [func@markup_parser_new].
A simple example of a marked-up string might be:
@@ -55,7 +55,7 @@ Arabic text:
Pango uses GMarkup to parse this language, which means that XML features
such as numeric character entities such as `&#169;` for © can be used too.
-The root tag of a marked-up document is `<markup>`, but [func@Pango.parse_markup]
+The root tag of a marked-up document is `<markup>`, but [func@Pango2.parse_markup]
allows you to omit this tag, so you will most likely never need to use it.
The most general markup tag is `<span>`, then there are some convenience
tags.
@@ -65,7 +65,7 @@ tags.
font
font_desc
: A font description string, such as "Sans Italic 12". See
- [func@Pango.FontDescription.from_string] for a description of the format of
+ [func@Pango2.FontDescription.from_string] for a description of the format of
the string representation. Note that any other span attributes will override
this description. So if you have "Sans Italic" and also a style="normal"
attribute, you will get Sans normal, not italic.
diff --git a/docs/pango_rendering.md b/docs/pango_rendering.md
index 029a81b7..a84599c6 100644
--- a/docs/pango_rendering.md
+++ b/docs/pango_rendering.md
@@ -16,24 +16,24 @@ various stages of this pipeline and the APIs that implement them.
Itemization
: breaks a piece of text into segments with consistent direction and shaping
properties. Among other things, this determines which font to use for each
- character. Use [func@Pango.itemize] to itemize text.
+ character. Use [func@Pango2.itemize] to itemize text.
Shaping
-: converts characters into glyphs. Use [func@Pango.shape] or
- [func@Pango.shape_item] to shape text.
+: converts characters into glyphs. Use [func@Pango2.shape] or
+ [func@Pango2.shape_item] to shape text.
Line Breaking
: determines where line breaks should be inserted into a sequence of glyphs.
- The functions [func@Pango.default_break], [func@Pango.tailor_break] and
- [func@Pango.attr_break] determine possible line breaks. The actual line
- breaking is done by [class@Pango.LineBreaker].
+ The functions [func@Pango2.default_break], [func@Pango2.tailor_break] and
+ [func@Pango2.attr_break] determine possible line breaks. The actual line
+ breaking is done by [class@Pango2.LineBreaker].
Justification
: adjusts inter-word spacing to form lines of even length. This is done by
- [struct@Pango.Line].
+ [struct@Pango2.Line].
Rendering
: takes a string of positioned glyphs, and renders them onto a surface.
- This is accomplished by a [class@Pango.Renderer] object. The functions
- [func@Pango.cairo_show_glyph_string] and [func@Pango.cairo_show_layout]
- use a [class@Pango.Renderer] to draw text onto a cairo surface.
+ This is accomplished by a [class@Pango2.Renderer] object. The functions
+ [func@Pango2.cairo_show_glyph_string] and [func@Pango2.cairo_show_layout]
+ use a [class@Pango2.Renderer] to draw text onto a cairo surface.
diff --git a/docs/pango_user.md b/docs/pango_user.md
index 0938042f..c1e0f985 100644
--- a/docs/pango_user.md
+++ b/docs/pango_user.md
@@ -6,11 +6,11 @@ Title: Rendering with user fonts
Most of the time, text is rendered using fonts that are ready-made and provided
in formats such as TrueType or OpenType. Pango supports such fonts with
-[class@PangoHbFace]. But there are fonts in custom formats that HarfBuzz might
+[class@Pango2.HbFace]. But there are fonts in custom formats that HarfBuzz might
not support. And sometimes, it is more convenient to use a drawing API to render
glyphs on-the-spot, maybe with fancy effects.
-For these cases, Pango provides the [class@PangoUserFace] implementation of
+For these cases, Pango provides the [class@Pango2.UserFace] implementation of
`PangoFontFace` that uses callbacks for its functionality. This lets you embed
custom drawing into your text, fully integrated with Pango's text layout
capabilities.
diff --git a/examples/cairoshape.c b/examples/cairoshape.c
index 07f19b8c..ea38e95d 100644
--- a/examples/cairoshape.c
+++ b/examples/cairoshape.c
@@ -1,12 +1,12 @@
/* Example code to show how to use user fonts to render arbitrary content
- * inside a text layout, positioned by Pango.
+ * inside a text layout, positioned by Pango2.
*
* This examples uses a small parser to convert shapes in the format of
* SVG paths to cairo instructions. You can typically extract these from
* the SVG file's <path> elements directly.
*
* The code then searches for the Unicode bullet character in the layout
- * text and automatically adds PangoAttribtues to the layout to replace
+ * text and automatically adds Pango2Attribtues to the layout to replace
* each of the with a rendering of the GNOME Foot logo.
*
* Written by Behdad Esfahbod, 2007
@@ -86,48 +86,48 @@ mini_svg_render (MiniSvg *shape, cairo_t *cr)
cairo_fill (cr);
}
-static PangoLayout *
+static Pango2Layout *
get_layout (cairo_t *cr)
{
- PangoLayout *layout;
- PangoAttrList *attrs;
- PangoFontDescription *font_desc;
+ Pango2Layout *layout;
+ Pango2AttrList *attrs;
+ Pango2FontDescription *font_desc;
const char *p;
- /* Create a PangoLayout, set the font and text */
- layout = pango_cairo_create_layout (cr);
- pango_layout_set_text (layout, text, -1);
+ /* Create a Pango2Layout, set the font and text */
+ layout = pango2_cairo_create_layout (cr);
+ pango2_layout_set_text (layout, text, -1);
- font_desc = pango_font_description_from_string ("Cantarell 12");
- pango_layout_set_font_description (layout, font_desc);
- pango_font_description_free (font_desc);
+ font_desc = pango2_font_description_from_string ("Cantarell 12");
+ pango2_layout_set_font_description (layout, font_desc);
+ pango2_font_description_free (font_desc);
- attrs = pango_attr_list_new ();
+ attrs = pango2_attr_list_new ();
- font_desc = pango_font_description_from_string ("Bullets 12");
+ font_desc = pango2_font_description_from_string ("Bullets 12");
for (p = text; (p = strstr (p, BULLET)); p += strlen (BULLET))
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- attr = pango_attr_font_desc_new (font_desc);
- pango_attribute_set_range (attr, p - text, p - text + strlen (BULLET));
- pango_attr_list_insert (attrs, attr);
+ attr = pango2_attr_font_desc_new (font_desc);
+ pango2_attribute_set_range (attr, p - text, p - text + strlen (BULLET));
+ pango2_attr_list_insert (attrs, attr);
}
for (p = text; (p = strstr (p, HEART)); p += strlen (HEART))
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- attr = pango_attr_font_desc_new (font_desc);
- pango_attribute_set_range (attr, p - text, p - text + strlen (HEART));
- pango_attr_list_insert (attrs, attr);
+ attr = pango2_attr_font_desc_new (font_desc);
+ pango2_attribute_set_range (attr, p - text, p - text + strlen (HEART));
+ pango2_attr_list_insert (attrs, attr);
}
- pango_font_description_free (font_desc);
+ pango2_font_description_free (font_desc);
- pango_layout_set_attributes (layout, attrs);
- pango_attr_list_unref (attrs);
+ pango2_layout_set_attributes (layout, attrs);
+ pango2_attr_list_unref (attrs);
return layout;
}
@@ -135,12 +135,12 @@ get_layout (cairo_t *cr)
static void
measure_text (cairo_t *cr, int *width, int *height)
{
- PangoLayout *layout = get_layout (cr);
- PangoLines *lines = pango_layout_get_lines (layout);
- PangoRectangle ext;
+ Pango2Layout *layout = get_layout (cr);
+ Pango2Lines *lines = pango2_layout_get_lines (layout);
+ Pango2Rectangle ext;
- pango_lines_get_extents (lines, NULL, &ext);
- pango_extents_to_pixels (&ext, NULL);
+ pango2_lines_get_extents (lines, NULL, &ext);
+ pango2_extents_to_pixels (&ext, NULL);
*width = ext.width + 20;
*height = ext.height + 20;
@@ -149,17 +149,17 @@ measure_text (cairo_t *cr, int *width, int *height)
static void
draw_text (cairo_t *cr)
{
- PangoLayout *layout = get_layout (cr);
- PangoLines *lines = pango_layout_get_lines (layout);
+ Pango2Layout *layout = get_layout (cr);
+ Pango2Lines *lines = pango2_layout_get_lines (layout);
cairo_move_to (cr, 10, 10);
- pango_cairo_show_lines (cr, lines);
+ pango2_cairo_show_lines (cr, lines);
g_object_unref (layout);
}
static gboolean
-glyph_cb (PangoUserFace *face,
+glyph_cb (Pango2UserFace *face,
hb_codepoint_t unicode,
hb_codepoint_t *glyph,
gpointer data)
@@ -174,7 +174,7 @@ glyph_cb (PangoUserFace *face,
}
static gboolean
-glyph_info_cb (PangoUserFace *face,
+glyph_info_cb (Pango2UserFace *face,
int size,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents,
@@ -201,7 +201,7 @@ glyph_info_cb (PangoUserFace *face,
}
static gboolean
-font_info_cb (PangoUserFace *face,
+font_info_cb (Pango2UserFace *face,
int size,
hb_font_extents_t *extents,
gpointer user_data)
@@ -214,7 +214,7 @@ font_info_cb (PangoUserFace *face,
}
static gboolean
-render_cb (PangoUserFace *face,
+render_cb (Pango2UserFace *face,
int size,
hb_codepoint_t glyph,
gpointer user_data,
@@ -257,15 +257,15 @@ render_cb (PangoUserFace *face,
static void
setup_fontmap (void)
{
- PangoFontMap *fontmap = pango_font_map_get_default ();
- PangoFontDescription *desc;
- PangoUserFace *face;
+ Pango2FontMap *fontmap = pango2_font_map_get_default ();
+ Pango2FontDescription *desc;
+ Pango2UserFace *face;
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, "Bullets");
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, "Bullets");
/* Create our fancy user font, "Bullets Black" */
- face = pango_user_face_new (font_info_cb,
+ face = pango2_user_face_new (font_info_cb,
glyph_cb,
glyph_info_cb,
NULL,
@@ -273,9 +273,9 @@ setup_fontmap (void)
NULL, NULL, "Black", desc);
/* And add it to the default fontmap */
- pango_font_map_add_face (fontmap, PANGO_FONT_FACE (face));
+ pango2_font_map_add_face (fontmap, PANGO2_FONT_FACE (face));
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
}
int
diff --git a/examples/cairosimple.c b/examples/cairosimple.c
index c97e7118..26c72a3f 100644
--- a/examples/cairosimple.c
+++ b/examples/cairosimple.c
@@ -8,21 +8,21 @@
static void
draw_text (cairo_t *cr)
{
- PangoLayout *layout;
- PangoLines *lines;
- PangoFontDescription *desc;
+ Pango2Layout *layout;
+ Pango2Lines *lines;
+ Pango2FontDescription *desc;
int i;
/* Center coordinates on the middle of the region we are drawing */
cairo_translate (cr, RADIUS, RADIUS);
- /* Create a PangoLayout, set the font and text */
- layout = pango_cairo_create_layout (cr);
+ /* Create a Pango2Layout, set the font and text */
+ layout = pango2_cairo_create_layout (cr);
- pango_layout_set_text (layout, "Text", -1);
- desc = pango_font_description_from_string (FONT);
- pango_layout_set_font_description (layout, desc);
- pango_font_description_free (desc);
+ pango2_layout_set_text (layout, "Text", -1);
+ desc = pango2_font_description_from_string (FONT);
+ pango2_layout_set_font_description (layout, desc);
+ pango2_font_description_free (desc);
/* Draw the layout N_WORDS times in a circle */
for (i = 0; i < N_WORDS; i++)
@@ -39,14 +39,14 @@ draw_text (cairo_t *cr)
cairo_rotate (cr, angle * G_PI / 180.);
- /* Inform Pango to re-layout the text with the new transformation */
- pango_cairo_update_layout (cr, layout);
+ /* Inform Pango2 to re-layout the text with the new transformation */
+ pango2_cairo_update_layout (cr, layout);
- lines = pango_layout_get_lines (layout);
+ lines = pango2_layout_get_lines (layout);
- pango_lines_get_size (lines, &width, &height);
- cairo_move_to (cr, - ((double) width / PANGO_SCALE) / 2, - RADIUS);
- pango_cairo_show_layout (cr, layout);
+ pango2_lines_get_size (lines, &width, &height);
+ cairo_move_to (cr, - ((double) width / PANGO2_SCALE) / 2, - RADIUS);
+ pango2_cairo_show_layout (cr, layout);
cairo_restore (cr);
}
diff --git a/examples/cairotwisted.c b/examples/cairotwisted.c
index 98735ecc..ee9a6119 100644
--- a/examples/cairotwisted.c
+++ b/examples/cairotwisted.c
@@ -472,10 +472,10 @@ draw_text (cairo_t *cr,
const char *font,
const char *text)
{
- PangoContext *context;
- PangoLayout *layout;
- PangoLine *line;
- PangoFontDescription *desc;
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2Line *line;
+ Pango2FontDescription *desc;
cairo_font_options_t *font_options;
font_options = cairo_font_options_create ();
@@ -486,20 +486,20 @@ draw_text (cairo_t *cr,
cairo_set_font_options (cr, font_options);
cairo_font_options_destroy (font_options);
- context = pango_cairo_create_context (cr);
- layout = pango_layout_new (context);
+ context = pango2_cairo_create_context (cr);
+ layout = pango2_layout_new (context);
g_object_unref (context);
- desc = pango_font_description_from_string (font);
- pango_layout_set_font_description (layout, desc);
- pango_font_description_free (desc);
+ desc = pango2_font_description_from_string (font);
+ pango2_layout_set_font_description (layout, desc);
+ pango2_font_description_free (desc);
- pango_layout_set_text (layout, text, -1);
+ pango2_layout_set_text (layout, text, -1);
- line = pango_lines_get_lines (pango_layout_get_lines (layout))[0];
+ line = pango2_lines_get_lines (pango2_layout_get_lines (layout))[0];
cairo_move_to (cr, x, y);
- pango_cairo_line_path (cr, line);
+ pango2_cairo_line_path (cr, line);
g_object_unref (layout);
}
diff --git a/examples/columns.c b/examples/columns.c
index 4884c0dc..5288e754 100644
--- a/examples/columns.c
+++ b/examples/columns.c
@@ -5,18 +5,18 @@ int
main (int argc, char *argv[])
{
const char *filename;
- PangoContext *context;
- PangoLineBreaker *breaker;
+ Pango2Context *context;
+ Pango2LineBreaker *breaker;
int margin;
int x, y, width, height;
int x0, y0;
int col;
- PangoLines *lines;
+ Pango2Lines *lines;
cairo_surface_t *surface;
cairo_t *cr;
char *text;
gsize length;
- PangoAttrList *attrs;
+ Pango2AttrList *attrs;
GError *error = NULL;
if (argc != 3)
@@ -33,7 +33,7 @@ main (int argc, char *argv[])
filename = argv[2];
- context = pango_context_new ();
+ context = pango2_context_new ();
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 600, 600);
cr = cairo_create (surface);
@@ -41,61 +41,61 @@ main (int argc, char *argv[])
cairo_paint (cr);
cairo_set_source_rgb (cr, 0, 0, 0);
- breaker = pango_line_breaker_new (context);
+ breaker = pango2_line_breaker_new (context);
g_print ("Using %s\n", G_OBJECT_TYPE_NAME (breaker));
- attrs = pango_attr_list_new ();
+ attrs = pango2_attr_list_new ();
- pango_line_breaker_add_text (breaker, text, -1, attrs);
+ pango2_line_breaker_add_text (breaker, text, -1, attrs);
- pango_attr_list_unref (attrs);
+ pango2_attr_list_unref (attrs);
- lines = pango_lines_new ();
+ lines = pango2_lines_new ();
/* We do 2 columns, followed by 3 columns, to demonstrate changing
* line width.
*/
margin = 20;
- x = x0 = margin * PANGO_SCALE;
- y = y0 = margin * PANGO_SCALE;
- width = (300 - 2 * margin) * PANGO_SCALE;
- height = (300 - margin) * PANGO_SCALE;
+ x = x0 = margin * PANGO2_SCALE;
+ y = y0 = margin * PANGO2_SCALE;
+ width = (300 - 2 * margin) * PANGO2_SCALE;
+ height = (300 - margin) * PANGO2_SCALE;
col = 0;
- while (pango_line_breaker_has_line (breaker))
+ while (pango2_line_breaker_has_line (breaker))
{
- PangoLine *line;
- PangoRectangle ext;
+ Pango2Line *line;
+ Pango2Rectangle ext;
retry:
- line = pango_line_breaker_next_line (breaker,
+ line = pango2_line_breaker_next_line (breaker,
x, width,
- PANGO_WRAP_CHAR,
- PANGO_ELLIPSIZE_NONE);
+ PANGO2_WRAP_CHAR,
+ PANGO2_ELLIPSIZE_NONE);
- if (!pango_line_is_paragraph_end (line))
- line = pango_line_justify (line, width);
+ if (!pango2_line_is_paragraph_end (line))
+ line = pango2_line_justify (line, width);
- pango_line_get_extents (line, NULL, &ext);
+ pango2_line_get_extents (line, NULL, &ext);
if (y + ext.height > height)
{
gboolean width_changed = FALSE;
if (col == 0)
- x0 += 300 * PANGO_SCALE;
+ x0 += 300 * PANGO2_SCALE;
else if (col == 1)
{
- x0 = margin * PANGO_SCALE;
- y0 = (300 + margin) * PANGO_SCALE;
- width = (200 - 2 * margin) * PANGO_SCALE;
- height = (600 - 2 * margin) * PANGO_SCALE;
+ x0 = margin * PANGO2_SCALE;
+ y0 = (300 + margin) * PANGO2_SCALE;
+ width = (200 - 2 * margin) * PANGO2_SCALE;
+ height = (600 - 2 * margin) * PANGO2_SCALE;
width_changed = TRUE;
}
else
- x0 += 200 * PANGO_SCALE;
+ x0 += 200 * PANGO2_SCALE;
x = x0;
y = y0;
@@ -103,19 +103,19 @@ retry:
col++;
if (width_changed &&
- pango_line_breaker_undo_line (breaker, line))
+ pango2_line_breaker_undo_line (breaker, line))
{
g_object_unref (line);
goto retry;
}
}
- pango_lines_add_line (lines, line, x, y - ext.y);
+ pango2_lines_add_line (lines, line, x, y - ext.y);
y += ext.height;
}
- pango_cairo_show_lines (cr, lines);
+ pango2_cairo_show_lines (cr, lines);
cairo_surface_write_to_png (surface, filename);
g_print ("Output written to %s\n", filename);
diff --git a/examples/first-steps.c b/examples/first-steps.c
index ea27bee1..df9f460c 100644
--- a/examples/first-steps.c
+++ b/examples/first-steps.c
@@ -6,22 +6,22 @@
static void
draw_text (cairo_t *cr)
{
- PangoLayout *layout;
- PangoFontDescription *desc;
+ Pango2Layout *layout;
+ Pango2FontDescription *desc;
- /* Create a PangoLayout */
- layout = pango_cairo_create_layout (cr);
+ /* Create a Pango2Layout */
+ layout = pango2_cairo_create_layout (cr);
/* Set the text */
- pango_layout_set_text (layout, "Text", -1);
+ pango2_layout_set_text (layout, "Text", -1);
/* Set a font for the layout */
- desc = pango_font_description_from_string ("Sans Bold 20");
- pango_layout_set_font_description (layout, desc);
- pango_font_description_free (desc);
+ desc = pango2_font_description_from_string ("Sans Bold 20");
+ pango2_layout_set_font_description (layout, desc);
+ pango2_font_description_free (desc);
/* Show the layout */
- pango_cairo_show_layout (cr, layout);
+ pango2_cairo_show_layout (cr, layout);
/* Free the layout object */
g_object_unref (layout);
diff --git a/examples/pangowin32tobmp.c b/examples/pangowin32tobmp.c
index aa39273f..0708d026 100644
--- a/examples/pangowin32tobmp.c
+++ b/examples/pangowin32tobmp.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* Copyright (C) 1999 Red Hat Software
*
* testfonts.c:
@@ -53,38 +53,38 @@ static int
compare_font_family (gconstpointer a,
gconstpointer b)
{
- PangoFontFamily **aa = (PangoFontFamily **)a;
- PangoFontFamily **bb = (PangoFontFamily **)b;
- return strcmp (pango_font_family_get_name (*aa),
- pango_font_family_get_name (*bb));
+ Pango2FontFamily **aa = (Pango2FontFamily **)a;
+ Pango2FontFamily **bb = (Pango2FontFamily **)b;
+ return strcmp (pango2_font_family_get_name (*aa),
+ pango2_font_family_get_name (*bb));
}
int main (int argc, char **argv)
{
- PangoFontMap *fontmap = pango_win32_font_map_for_display();
- PangoContext *context;
- PangoCoverage * coverage = NULL;
- PangoFont* font = NULL;
- PangoFontFamily** families = NULL;
- PangoFontFace** faces = NULL;
+ Pango2FontMap *fontmap = pango2_win32_font_map_for_display();
+ Pango2Context *context;
+ Pango2Coverage * coverage = NULL;
+ Pango2Font* font = NULL;
+ Pango2FontFamily** families = NULL;
+ Pango2FontFace** faces = NULL;
int nb, i;
char *family_name = NULL;
- PangoLanguage *lang = pango_language_from_string (g_win32_getlocale ());
+ Pango2Language *lang = pango2_language_from_string (g_win32_getlocale ());
HDC hdc = NULL;
int line = 0;
GTimeVal tv0, tv1;
int my_font_size = 12;
- printf ("# Pango Font Test\n"
+ printf ("# Pango2 Font Test\n"
"# Language: %s\n"
- "#\n", pango_language_to_string (lang));
+ "#\n", pango2_language_to_string (lang));
/* this wasn't necessary with previous version
*
* force initialization of built-in engines, otherwise
* the rendering get's really fast - too fast to work :-(
*/
- context = pango_font_map_create_context (pango_win32_font_map_for_display ());
+ context = pango2_font_map_create_context (pango2_win32_font_map_for_display ());
if (argc == 1) /* No arguments given */
{
@@ -93,17 +93,17 @@ int main (int argc, char **argv)
/* try to load some fonts often hardcoded */
for (i = 0; i < G_N_ELEMENTS (std_fonts); i++)
{
- PangoFontDescription *desc = pango_font_description_from_string(std_fonts[i]);
+ Pango2FontDescription *desc = pango2_font_description_from_string(std_fonts[i]);
/* spits warnings if font cannot be loaded */
- font = pango_font_map_load_font (fontmap, context, desc);
+ font = pango2_font_map_load_font (fontmap, context, desc);
g_object_unref (font);
}
}
else
{
- PangoFontDescription *desc = NULL;
+ Pango2FontDescription *desc = NULL;
GString *s;
s = g_string_new (argv[1]);
@@ -116,34 +116,34 @@ int main (int argc, char **argv)
my_font_size = atoi (argv[i]);
}
- desc = pango_font_description_from_string(s->str);
- family_name = g_strdup (pango_font_description_get_family (desc));
+ desc = pango2_font_description_from_string(s->str);
+ family_name = g_strdup (pango2_font_description_get_family (desc));
- font = pango_font_map_load_font (fontmap, context, desc);
+ font = pango2_font_map_load_font (fontmap, context, desc);
- coverage = pango_font_get_coverage (font, lang);
+ coverage = pango2_font_get_coverage (font, lang);
/* ... */
g_object_unref (coverage);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_object_unref (font);
}
- pango_font_map_list_families (fontmap, &families, &nb);
+ pango2_font_map_list_families (fontmap, &families, &nb);
if (!family_name)
{
- qsort (families, nb, sizeof (PangoFontFamily*), compare_font_family);
+ qsort (families, nb, sizeof (Pango2FontFamily*), compare_font_family);
}
else
{
/* Get on the family faces. No simple way ? */
for (i = 0; i < nb; i++)
{
- if (0 == g_ascii_strcasecmp (pango_font_family_get_name (families[i]), family_name))
+ if (0 == g_ascii_strcasecmp (pango2_font_family_get_name (families[i]), family_name))
{
- pango_font_family_list_faces (families[i], &faces, &nb);
+ pango2_font_family_list_faces (families[i], &faces, &nb);
/* now nb is the number of faces */
break;
}
@@ -158,91 +158,91 @@ int main (int argc, char **argv)
for (i = 0; i < nb; i++)
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
const char *f_name;
- PangoWeight weight;
- PangoStyle style;
+ Pango2Weight weight;
+ Pango2Style style;
if (families)
{
- desc = pango_font_description_new ();
+ desc = pango2_font_description_new ();
- f_name = pango_font_family_get_name (families[i]);
- pango_font_description_set_family (desc, f_name);
+ f_name = pango2_font_family_get_name (families[i]);
+ pango2_font_description_set_family (desc, f_name);
}
else
{
- desc = pango_font_face_describe (faces[i]);
+ desc = pango2_font_face_describe (faces[i]);
/* this is _not_ the family name from above */
- f_name = pango_font_description_get_family (desc);
+ f_name = pango2_font_description_get_family (desc);
}
- weight = pango_font_description_get_weight (desc);
- style = pango_font_description_get_style (desc);
+ weight = pango2_font_description_get_weight (desc);
+ style = pango2_font_description_get_style (desc);
g_print ("%s; Style: %d; Weight: %d\n",
f_name, style, weight);
/* give it an arbitray size to load it */
- pango_font_description_set_size (desc, my_font_size * PANGO_SCALE);
+ pango2_font_description_set_size (desc, my_font_size * PANGO2_SCALE);
g_get_current_time (&tv0);
- font = pango_font_map_load_font (fontmap, context, desc);
+ font = pango2_font_map_load_font (fontmap, context, desc);
g_get_current_time (&tv1);
- g_print ("\tpango_font_map_load_font took %.3f sec\n", calc_duration (&tv1, &tv0));
+ g_print ("\tpango2_font_map_load_font took %.3f sec\n", calc_duration (&tv1, &tv0));
if (font)
{
- PangoItem *item;
- PangoGlyphString * glyphs;
+ Pango2Item *item;
+ Pango2GlyphString * glyphs;
char s[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"1234567890 -+*/!\xc2\xa7$%&()[]{}<>|#=?@";
g_get_current_time (&tv0);
- coverage = pango_font_get_coverage (font, lang);
+ coverage = pango2_font_get_coverage (font, lang);
g_get_current_time (&tv1);
- g_print ("\tpango_font_get_coverage took %.3f sec\n", calc_duration (&tv1, &tv0));
+ g_print ("\tpango2_font_get_coverage took %.3f sec\n", calc_duration (&tv1, &tv0));
/* ... */
- pango_context_set_language (context, lang);
- pango_context_set_base_dir (context, PANGO_DIRECTION_LTR);
- pango_context_set_font_description (context, desc);
+ pango2_context_set_language (context, lang);
+ pango2_context_set_base_dir (context, PANGO2_DIRECTION_LTR);
+ pango2_context_set_font_description (context, desc);
- glyphs = pango_glyph_string_new ();
- item = pango_item_new ();
+ glyphs = pango2_glyph_string_new ();
+ item = pango2_item_new ();
item->analysis.font = g_object_ref (font);
- pango_shape ( s, sizeof(s), &(item->analysis), glyphs);
+ pango2_shape ( s, sizeof(s), &(item->analysis), glyphs);
if (hdc)
{
/* the positioning isn't correct */
char* name = g_strdup_printf ("%s (%s%s)",
f_name,
- weight == PANGO_WEIGHT_NORMAL ? "n" :
- (weight == PANGO_WEIGHT_HEAVY ? "h" :
- (weight > PANGO_WEIGHT_NORMAL ? "b" : "l")),
- style == PANGO_STYLE_OBLIQUE ? "o" :
- (style == PANGO_STYLE_ITALIC ? "i" : "n"));
+ weight == PANGO2_WEIGHT_NORMAL ? "n" :
+ (weight == PANGO2_WEIGHT_HEAVY ? "h" :
+ (weight > PANGO2_WEIGHT_NORMAL ? "b" : "l")),
+ style == PANGO2_STYLE_OBLIQUE ? "o" :
+ (style == PANGO2_STYLE_ITALIC ? "i" : "n"));
TextOut (hdc, 0, line, name, strlen(name));
g_get_current_time (&tv0);
- pango_win32_render (hdc, font, glyphs, 200, line);
+ pango2_win32_render (hdc, font, glyphs, 200, line);
g_get_current_time (&tv1);
- g_print ("\tpango_win32_render took %.3f sec\n",
+ g_print ("\tpango2_win32_render took %.3f sec\n",
calc_duration (&tv1, &tv0));
line += (3 * my_font_size / 2);
g_free(name);
}
/* free glyphs, ... */
- pango_glyph_string_free (glyphs);
- pango_item_free (item);
+ pango2_glyph_string_free (glyphs);
+ pango2_item_free (item);
g_object_unref (coverage);
g_object_unref (font);
}
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
}
if (hdc)
diff --git a/examples/parshape.c b/examples/parshape.c
index 3774834d..ad6e972b 100644
--- a/examples/parshape.c
+++ b/examples/parshape.c
@@ -1,52 +1,52 @@
#include <pango/pango.h>
#include <pango/pangocairo.h>
-static PangoLines *
+static Pango2Lines *
format_text (const char *text)
{
- PangoContext *context;
- PangoLineBreaker *breaker;
- PangoLines *lines;
+ Pango2Context *context;
+ Pango2LineBreaker *breaker;
+ Pango2Lines *lines;
int x, y, width;
int inc, m, w, w2;
- context = pango_context_new ();
- breaker = pango_line_breaker_new (context);
+ context = pango2_context_new ();
+ breaker = pango2_line_breaker_new (context);
- pango_line_breaker_add_text (breaker, text, -1, NULL);
+ pango2_line_breaker_add_text (breaker, text, -1, NULL);
- lines = pango_lines_new ();
+ lines = pango2_lines_new ();
m = 200;
w = 10;
w2 = -200;
inc = 40;
- y = 40 * PANGO_SCALE;
- x = (m - w / 2) * PANGO_SCALE;
- width = w * PANGO_SCALE;
+ y = 40 * PANGO2_SCALE;
+ x = (m - w / 2) * PANGO2_SCALE;
+ width = w * PANGO2_SCALE;
- while (pango_line_breaker_has_line (breaker))
+ while (pango2_line_breaker_has_line (breaker))
{
- PangoLine *line;
- PangoRectangle ext;
+ Pango2Line *line;
+ Pango2Rectangle ext;
gboolean ltr;
- line = pango_line_breaker_next_line (breaker,
+ line = pango2_line_breaker_next_line (breaker,
x, width,
- PANGO_WRAP_CHAR,
- PANGO_ELLIPSIZE_NONE);
+ PANGO2_WRAP_CHAR,
+ PANGO2_ELLIPSIZE_NONE);
- pango_line_get_extents (line, NULL, &ext);
- line = pango_line_justify (line, width);
- pango_lines_add_line (lines, line, x, y - ext.y);
+ pango2_line_get_extents (line, NULL, &ext);
+ line = pango2_line_justify (line, width);
+ pango2_lines_add_line (lines, line, x, y - ext.y);
- ltr = pango_line_breaker_get_direction (breaker) == PANGO_DIRECTION_LTR;
+ ltr = pango2_line_breaker_get_direction (breaker) == PANGO2_DIRECTION_LTR;
- if (w2 > 0 && ltr && x <= m * PANGO_SCALE)
- x = (m + w2 / 2) * PANGO_SCALE;
- else if (w2 > 0 && !ltr && x > m * PANGO_SCALE)
- x = (m - w2 / 2) * PANGO_SCALE;
+ if (w2 > 0 && ltr && x <= m * PANGO2_SCALE)
+ x = (m + w2 / 2) * PANGO2_SCALE;
+ else if (w2 > 0 && !ltr && x > m * PANGO2_SCALE)
+ x = (m - w2 / 2) * PANGO2_SCALE;
else
{
y += ext.height;
@@ -57,14 +57,14 @@ format_text (const char *text)
inc = - inc;
if (w2 > 0)
- width = ((w - w2) / 2) * PANGO_SCALE;
+ width = ((w - w2) / 2) * PANGO2_SCALE;
else
- width = w * PANGO_SCALE;
+ width = w * PANGO2_SCALE;
if (ltr)
- x = (m - w / 2) * PANGO_SCALE;
+ x = (m - w / 2) * PANGO2_SCALE;
else
- x = (m + w / 2) * PANGO_SCALE;
+ x = (m + w / 2) * PANGO2_SCALE;
}
}
@@ -75,18 +75,18 @@ format_text (const char *text)
}
static void
-draw_lines (cairo_t *cr, PangoLines *lines)
+draw_lines (cairo_t *cr, Pango2Lines *lines)
{
- for (int i = 0; i < pango_lines_get_line_count (lines); i++)
+ for (int i = 0; i < pango2_lines_get_line_count (lines); i++)
{
- PangoLine *line = pango_lines_get_lines (lines)[i];
+ Pango2Line *line = pango2_lines_get_lines (lines)[i];
int x, y;
- pango_lines_get_line_position (lines, i, &x, &y);
+ pango2_lines_get_line_position (lines, i, &x, &y);
cairo_save (cr);
- cairo_move_to (cr, x / (double)PANGO_SCALE, y / (double)PANGO_SCALE);
- pango_cairo_show_line (cr, line);
+ cairo_move_to (cr, x / (double)PANGO2_SCALE, y / (double)PANGO2_SCALE);
+ pango2_cairo_show_line (cr, line);
cairo_restore (cr);
}
}
@@ -95,7 +95,7 @@ int
main (int argc, char *argv[])
{
const char *filename;
- PangoLines *lines;
+ Pango2Lines *lines;
cairo_surface_t *surface;
cairo_t *cr;
char *text;
diff --git a/examples/userfont.c b/examples/userfont.c
index 40b472cd..c9edaee1 100644
--- a/examples/userfont.c
+++ b/examples/userfont.c
@@ -1,4 +1,4 @@
-/* Example code to show how to use user fonts with Pango
+/* Example code to show how to use user fonts with Pango2
*
* Written by Matthias Clasen, 2022
*
@@ -16,7 +16,7 @@
#include <pango/pangocairo.h>
-static PangoFontMap *fontmap;
+static Pango2FontMap *fontmap;
#define END_GLYPH 0
#define STROKE 126
@@ -74,31 +74,31 @@ static const test_scaled_font_glyph_t glyphs [] = {
const char text[] = "finally... pango user-font";
-static PangoLayout *
+static Pango2Layout *
get_layout (void)
{
- PangoContext *context;
- PangoLayout *layout;
- PangoFontDescription *desc;
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2FontDescription *desc;
- /* Create a PangoLayout, set the font and text */
- context = pango_context_new_with_font_map (fontmap);
- layout = pango_layout_new (context);
+ /* Create a Pango2Layout, set the font and text */
+ context = pango2_context_new_with_font_map (fontmap);
+ layout = pango2_layout_new (context);
g_object_unref (context);
- pango_layout_set_text (layout, text, -1);
+ pango2_layout_set_text (layout, text, -1);
- desc = pango_font_description_from_string ("Userfont 20");
- pango_layout_set_font_description (layout, desc);
- pango_font_description_free (desc);
+ desc = pango2_font_description_from_string ("Userfont 20");
+ pango2_layout_set_font_description (layout, desc);
+ pango2_font_description_free (desc);
- pango_layout_write_to_file (layout, "out.layout");
+ pango2_layout_write_to_file (layout, "out.layout");
return layout;
}
static gboolean
-glyph_cb (PangoUserFace *face,
+glyph_cb (Pango2UserFace *face,
hb_codepoint_t unicode,
hb_codepoint_t *glyph,
gpointer user_data)
@@ -118,7 +118,7 @@ glyph_cb (PangoUserFace *face,
}
static gboolean
-glyph_info_cb (PangoUserFace *face,
+glyph_info_cb (Pango2UserFace *face,
int size,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents,
@@ -142,13 +142,13 @@ glyph_info_cb (PangoUserFace *face,
}
static gboolean
-shape_cb (PangoUserFace *face,
+shape_cb (Pango2UserFace *face,
int size,
const char *text,
int length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags,
+ const Pango2Analysis *analysis,
+ Pango2GlyphString *glyphs,
+ Pango2ShapeFlags flags,
gpointer user_data)
{
int n_chars;
@@ -162,7 +162,7 @@ shape_cb (PangoUserFace *face,
n_chars = g_utf8_strlen (text, length);
- pango_glyph_string_set_size (glyphs, n_chars);
+ pango2_glyph_string_set_size (glyphs, n_chars);
last_cluster = -1;
@@ -171,8 +171,8 @@ shape_cb (PangoUserFace *face,
for (i = 0; i < n_chars; i++)
{
gunichar wc;
- PangoGlyph glyph = 0;
- PangoRectangle logical_rect;
+ Pango2Glyph glyph = 0;
+ Pango2Rectangle logical_rect;
wc = g_utf8_get_char (p);
@@ -186,13 +186,13 @@ shape_cb (PangoUserFace *face,
i++;
glyph_cb (face, 0xe000, &glyph, user_data);
}
- else if (pango_is_zero_width (wc))
- glyph = PANGO_GLYPH_EMPTY;
+ else if (pango2_is_zero_width (wc))
+ glyph = PANGO2_GLYPH_EMPTY;
else if (!glyph_cb (face, wc, &glyph, user_data))
- glyph = PANGO_GET_UNKNOWN_GLYPH (wc);
+ glyph = PANGO2_GET_UNKNOWN_GLYPH (wc);
glyph_info_cb (face, size, glyph, &ext, &dummy, &dummy, &is_color, user_data);
- pango_font_get_glyph_extents (pango_analysis_get_font (analysis), glyph, NULL, &logical_rect);
+ pango2_font_get_glyph_extents (pango2_analysis_get_font (analysis), glyph, NULL, &logical_rect);
glyphs->glyphs[j].glyph = glyph;
@@ -217,14 +217,14 @@ shape_cb (PangoUserFace *face,
#if 0
/* FIXME export this */
if (analysis->level & 1)
- pango_glyph_string_reverse_range (glyphs, 0, glyphs->num_glyphs);
+ pango2_glyph_string_reverse_range (glyphs, 0, glyphs->num_glyphs);
#endif
return TRUE;
}
static gboolean
-font_info_cb (PangoUserFace *face,
+font_info_cb (Pango2UserFace *face,
int size,
hb_font_extents_t *extents,
gpointer user_data)
@@ -237,7 +237,7 @@ font_info_cb (PangoUserFace *face,
}
static gboolean
-render_cb (PangoUserFace *face,
+render_cb (Pango2UserFace *face,
int size,
hb_codepoint_t glyph,
gpointer user_data,
@@ -284,22 +284,22 @@ render_cb (PangoUserFace *face,
}
static void
-setup_fontmap (PangoFontMap *fontmap)
+setup_fontmap (Pango2FontMap *fontmap)
{
- PangoFontDescription *desc;
- PangoUserFace *face;
+ Pango2FontDescription *desc;
+ Pango2UserFace *face;
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, "Userfont");
- face = pango_user_face_new (font_info_cb,
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, "Userfont");
+ face = pango2_user_face_new (font_info_cb,
glyph_cb,
glyph_info_cb,
shape_cb,
render_cb,
(gpointer) glyphs, NULL,
"Black", desc);
- pango_font_map_add_face (fontmap, PANGO_FONT_FACE (face));
- pango_font_description_free (desc);
+ pango2_font_map_add_face (fontmap, PANGO2_FONT_FACE (face));
+ pango2_font_description_free (desc);
}
int
@@ -309,8 +309,8 @@ main (int argc, char **argv)
char *filename;
cairo_status_t status;
cairo_surface_t *surface;
- PangoLayout *layout;
- PangoRectangle ext;
+ Pango2Layout *layout;
+ Pango2Rectangle ext;
if (argc != 2)
{
@@ -320,13 +320,13 @@ main (int argc, char **argv)
filename = argv[1];
- fontmap = PANGO_FONT_MAP (pango_font_map_new_default ());
- setup_fontmap (PANGO_FONT_MAP (fontmap));
+ fontmap = PANGO2_FONT_MAP (pango2_font_map_new_default ());
+ setup_fontmap (PANGO2_FONT_MAP (fontmap));
layout = get_layout ();
- pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
- pango_extents_to_pixels (&ext, NULL);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), NULL, &ext);
+ pango2_extents_to_pixels (&ext, NULL);
/* Now create the final surface and draw to it. */
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, ext.width + 20, ext.height + 20);
@@ -337,7 +337,7 @@ main (int argc, char **argv)
cairo_set_source_rgb (cr, 0.0, 0.0, 0.5);
cairo_move_to (cr, 10, 10);
- pango_cairo_show_layout (cr, layout);
+ pango2_cairo_show_layout (cr, layout);
cairo_destroy (cr);
diff --git a/meson.build b/meson.build
index addc1bff..2f8319d6 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('pango', 'c', 'cpp',
+project('pango2', 'c', 'cpp',
version: '1.90.0',
license: 'LGPLv2.1+',
default_options: [
@@ -42,11 +42,11 @@ pango_api_path = join_paths(pango_api_name, 'pango')
pango_conf = configuration_data()
-pango_conf.set('PANGO_BINARY_AGE', pango_binary_age)
-pango_conf.set('PANGO_INTERFACE_AGE', pango_interface_age)
-pango_conf.set('PANGO_VERSION_MAJOR', pango_major_version)
-pango_conf.set('PANGO_VERSION_MINOR', pango_minor_version)
-pango_conf.set('PANGO_VERSION_MICRO', pango_micro_version)
+pango_conf.set('PANGO2_BINARY_AGE', pango_binary_age)
+pango_conf.set('PANGO2_INTERFACE_AGE', pango_interface_age)
+pango_conf.set('PANGO2_VERSION_MAJOR', pango_major_version)
+pango_conf.set('PANGO2_VERSION_MINOR', pango_minor_version)
+pango_conf.set('PANGO2_VERSION_MICRO', pango_micro_version)
# Maintain version scheme with libtool
pango_soversion = 0
@@ -165,12 +165,12 @@ endif
if get_option('default_library') != 'static'
if host_system == 'windows'
pango_conf.set('DLL_EXPORT', true)
- pango_conf.set('_PANGO_EXTERN', '__declspec(dllexport) extern')
+ pango_conf.set('_PANGO2_EXTERN', '__declspec(dllexport) extern')
if cc.get_id() != 'msvc'
test_cflags += ['-fvisibility=hidden']
endif
else
- pango_conf.set('_PANGO_EXTERN', '__attribute__((visibility("default"))) extern')
+ pango_conf.set('_PANGO2_EXTERN', '__attribute__((visibility("default"))) extern')
test_cflags += ['-fvisibility=hidden']
endif
endif
diff --git a/pango/break-arabic.c b/pango/break-arabic.c
index 5e2f6068..2368586b 100644
--- a/pango/break-arabic.c
+++ b/pango/break-arabic.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* break-arabic.c:
*
* Copyright (C) 2006 Red Hat Software
@@ -48,11 +48,11 @@
#define IS_COMPOSITE_WITH_ALEF(c) (MADDAH_ABOVE <= (c) && (c) <= HAMZA_BELOW)
static void
-break_arabic (const char *text,
- int length,
- const PangoAnalysis *analysis G_GNUC_UNUSED,
- PangoLogAttr *attrs,
- int attrs_len G_GNUC_UNUSED)
+break_arabic (const char *text,
+ int length,
+ const Pango2Analysis *analysis G_GNUC_UNUSED,
+ Pango2LogAttr *attrs,
+ int attrs_len G_GNUC_UNUSED)
{
int i;
const char *p;
diff --git a/pango/break-indic.c b/pango/break-indic.c
index 17f9c124..62ecdaab 100644
--- a/pango/break-indic.c
+++ b/pango/break-indic.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* break-indic.c:
*
* Copyright (C) 2006 Red Hat Software
@@ -11,7 +11,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -79,21 +79,21 @@
#define MLYM_AU 0x0D4C
#define IS_COMPOSITE_WITH_BRAHMI_NUKTA(c) ( \
- (c >= BENGALI_RRA && c <= BENGALI_YYA) || \
- (c >= DEV_QA && c <= DEV_YA) || (c == DEV_RRA) || (c >= DEV_KHHA && c <= DEV_YYA) || \
- (c >= KNDA_EE && c <= KNDA_AI) ||(c >= KNDA_O && c <= KNDA_OO) || \
- (c == TAMIL_O) || (c == TAMIL_OO) || (c == TAMIL_AU) || \
- (c == TELUGU_EE) || (c == TELUGU_AI) || \
- (c == ORIYA_AI) || (c == ORIYA_O) || (c == ORIYA_AU) || \
- (c >= GURUMUKHI_KHHA && c <= GURUMUKHI_RRA) || (c == GURUMUKHI_FA)|| (c == GURUMUKHI_LLA)|| (c == GURUMUKHI_SHA) || \
- FALSE)
+ (c >= BENGALI_RRA && c <= BENGALI_YYA) || \
+ (c >= DEV_QA && c <= DEV_YA) || (c == DEV_RRA) || (c >= DEV_KHHA && c <= DEV_YYA) || \
+ (c >= KNDA_EE && c <= KNDA_AI) ||(c >= KNDA_O && c <= KNDA_OO) || \
+ (c == TAMIL_O) || (c == TAMIL_OO) || (c == TAMIL_AU) || \
+ (c == TELUGU_EE) || (c == TELUGU_AI) || \
+ (c == ORIYA_AI) || (c == ORIYA_O) || (c == ORIYA_AU) || \
+ (c >= GURUMUKHI_KHHA && c <= GURUMUKHI_RRA) || (c == GURUMUKHI_FA)|| (c == GURUMUKHI_LLA)|| (c == GURUMUKHI_SHA) || \
+ FALSE)
#define IS_SPLIT_MATRA_BRAHMI(c) ( \
- (c == BENGALI_SIGN_O) || (c == BENGALI_SIGN_AU) || \
- (c >= MLYM_O && c <= MLYM_AU) || \
- FALSE)
+ (c == BENGALI_SIGN_O) || (c == BENGALI_SIGN_AU) || \
+ (c >= MLYM_O && c <= MLYM_AU) || \
+ FALSE)
static void
-not_cursor_position (PangoLogAttr *attr)
+not_cursor_position (Pango2LogAttr *attr)
{
if (!attr->is_mandatory_break)
{
@@ -105,11 +105,11 @@ not_cursor_position (PangoLogAttr *attr)
}
static void
-break_indic (const char *text,
- int length,
- const PangoAnalysis *analysis,
- PangoLogAttr *attrs,
- int attrs_len G_GNUC_UNUSED)
+break_indic (const char *text,
+ int length,
+ const Pango2Analysis *analysis,
+ Pango2LogAttr *attrs,
+ int attrs_len G_GNUC_UNUSED)
{
const char *p, *next = NULL, *next_next;
gunichar prev_wc, this_wc, next_wc, next_next_wc;
@@ -129,84 +129,84 @@ break_indic (const char *text,
}
if (next != NULL && next < (text + length))
- {
- next_wc = g_utf8_get_char (next);
- next_next = g_utf8_next_char (next);
- }
+ {
+ next_wc = g_utf8_get_char (next);
+ next_next = g_utf8_next_char (next);
+ }
else
- {
- next_wc = 0;
- next_next = NULL;
- }
+ {
+ next_wc = 0;
+ next_next = NULL;
+ }
if (next_next != NULL && next_next < (text + length))
- next_next_wc = g_utf8_get_char (next_next);
+ next_next_wc = g_utf8_get_char (next_next);
else
- next_next_wc = 0;
+ next_next_wc = 0;
switch (analysis->script)
{
case G_UNICODE_SCRIPT_SINHALA:
- /*
- * TODO: The cursor position should be based on the state table.
- * This is the wrong place to be doing this.
- */
-
- /*
- * The cursor should treat as a single glyph:
- * SINHALA CONS + 0x0DCA + 0x200D + SINHALA CONS
- * SINHALA CONS + 0x200D + 0x0DCA + SINHALA CONS
- */
- if ((this_wc == 0x0DCA && next_wc == 0x200D)
- || (this_wc == 0x200D && next_wc == 0x0DCA))
- {
- not_cursor_position(&attrs[i]);
- not_cursor_position(&attrs[i + 1]);
- is_conjunct = TRUE;
- }
- else if (is_conjunct
- && (prev_wc == 0x200D || prev_wc == 0x0DCA)
- && this_wc >= 0x0D9A
- && this_wc <= 0x0DC6)
- {
- not_cursor_position(&attrs[i]);
- is_conjunct = FALSE;
- }
- /*
- * Consonant clusters do NOT result in implicit conjuncts
- * in SINHALA orthography.
- */
- else if (!is_conjunct && prev_wc == 0x0DCA && this_wc != 0x200D)
- {
- attrs[i].is_cursor_position = TRUE;
- }
-
- break;
-
- default:
-
- if (prev_wc != 0 && (this_wc == 0x200D || this_wc == 0x200C))
- {
- not_cursor_position(&attrs[i]);
- if (next_wc != 0)
- {
- not_cursor_position(&attrs[i+1]);
- if ((next_next_wc != 0) &&
- (next_wc == 0x09CD || /* Bengali */
- next_wc == 0x0ACD || /* Gujarati */
- next_wc == 0x094D || /* Hindi */
- next_wc == 0x0CCD || /* Kannada */
- next_wc == 0x0D4D || /* Malayalam */
- next_wc == 0x0B4D || /* Oriya */
- next_wc == 0x0A4D || /* Punjabi */
- next_wc == 0x0BCD || /* Tamil */
- next_wc == 0x0C4D)) /* Telugu */
- {
- not_cursor_position(&attrs[i+2]);
- }
- }
- }
-
- break;
+ /*
+ * TODO: The cursor position should be based on the state table.
+ * This is the wrong place to be doing this.
+ */
+
+ /*
+ * The cursor should treat as a single glyph:
+ * SINHALA CONS + 0x0DCA + 0x200D + SINHALA CONS
+ * SINHALA CONS + 0x200D + 0x0DCA + SINHALA CONS
+ */
+ if ((this_wc == 0x0DCA && next_wc == 0x200D)
+ || (this_wc == 0x200D && next_wc == 0x0DCA))
+ {
+ not_cursor_position(&attrs[i]);
+ not_cursor_position(&attrs[i + 1]);
+ is_conjunct = TRUE;
+ }
+ else if (is_conjunct
+ && (prev_wc == 0x200D || prev_wc == 0x0DCA)
+ && this_wc >= 0x0D9A
+ && this_wc <= 0x0DC6)
+ {
+ not_cursor_position(&attrs[i]);
+ is_conjunct = FALSE;
+ }
+ /*
+ * Consonant clusters do NOT result in implicit conjuncts
+ * in SINHALA orthography.
+ */
+ else if (!is_conjunct && prev_wc == 0x0DCA && this_wc != 0x200D)
+ {
+ attrs[i].is_cursor_position = TRUE;
+ }
+
+ break;
+
+ default:
+
+ if (prev_wc != 0 && (this_wc == 0x200D || this_wc == 0x200C))
+ {
+ not_cursor_position(&attrs[i]);
+ if (next_wc != 0)
+ {
+ not_cursor_position(&attrs[i+1]);
+ if ((next_next_wc != 0) &&
+ (next_wc == 0x09CD || /* Bengali */
+ next_wc == 0x0ACD || /* Gujarati */
+ next_wc == 0x094D || /* Hindi */
+ next_wc == 0x0CCD || /* Kannada */
+ next_wc == 0x0D4D || /* Malayalam */
+ next_wc == 0x0B4D || /* Oriya */
+ next_wc == 0x0A4D || /* Punjabi */
+ next_wc == 0x0BCD || /* Tamil */
+ next_wc == 0x0C4D)) /* Telugu */
+ {
+ not_cursor_position(&attrs[i+2]);
+ }
+ }
+ }
+
+ break;
}
}
}
diff --git a/pango/break-latin.c b/pango/break-latin.c
index 384c7e20..ffbc8f9e 100644
--- a/pango/break-latin.c
+++ b/pango/break-latin.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* break-latin.c:
*
* Copyright (C) 2021 Jordi Mas i Hernàndez <jmas@softcatala.org>
@@ -25,18 +25,18 @@
#include "pango-impl-utils.h"
static void
-break_latin (const char *text,
- int length,
- const PangoAnalysis *analysis,
- PangoLogAttr *attrs,
- int attrs_len G_GNUC_UNUSED)
+break_latin (const char *text,
+ int length,
+ const Pango2Analysis *analysis,
+ Pango2LogAttr *attrs,
+ int attrs_len G_GNUC_UNUSED)
{
int i;
const char *p, *next;
gunichar wc, prev_wc;
if (!analysis || !analysis->language ||
- g_ascii_strncasecmp (pango_language_to_string (analysis->language), "ca-", 3) != 0)
+ g_ascii_strncasecmp (pango2_language_to_string (analysis->language), "ca-", 3) != 0)
return;
for (p = text, i = 0, prev_wc = 0;
diff --git a/pango/break-thai.c b/pango/break-thai.c
index 02a18cc5..ce38cfc1 100644
--- a/pango/break-thai.c
+++ b/pango/break-thai.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* break-thai.c:
*
* Copyright (C) 2003 Theppitak Karoonboonyanan <thep@linux.thai.net>
@@ -10,7 +10,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -35,7 +35,7 @@ static ThBrk *thai_brk = NULL;
/*
* tis_text is assumed to be large enough to hold the converted string,
- * i.e. it must be at least pango_utf8_strlen(text, len)+1 bytes.
+ * i.e. it must be at least pango2_utf8_strlen(text, len)+1 bytes.
*/
static thchar_t *
utf8_to_tis (const char *text, int len, thchar_t *tis_text, int *tis_cnt)
@@ -54,11 +54,11 @@ utf8_to_tis (const char *text, int len, thchar_t *tis_text, int *tis_cnt)
#endif
static void
-break_thai (const char *text,
- int len,
- const PangoAnalysis *analysis G_GNUC_UNUSED,
- PangoLogAttr *attrs,
- int attrs_len G_GNUC_UNUSED)
+break_thai (const char *text,
+ int len,
+ const Pango2Analysis *analysis G_GNUC_UNUSED,
+ Pango2LogAttr *attrs,
+ int attrs_len G_GNUC_UNUSED)
{
#ifdef HAVE_LIBTHAI
thchar_t tis_stack[512];
@@ -67,7 +67,7 @@ break_thai (const char *text,
int *brk_pnts;
int cnt;
- cnt = pango_utf8_strlen (text, len) + 1;
+ cnt = pango2_utf8_strlen (text, len) + 1;
tis_text = tis_stack;
if (cnt > (int) G_N_ELEMENTS (tis_stack))
diff --git a/pango/break.c b/pango/break.c
index f8b5e5b4..404f3058 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* break.c:
*
* Copyright (C) 1999 Red Hat Software
@@ -10,7 +10,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -56,7 +56,7 @@ typedef enum
/* need to sync the break range to glib/gunicode.h . */
#define BREAK_TYPE_SAFE(btype) \
- ((btype) <= G_UNICODE_BREAK_ZERO_WIDTH_JOINER ? (btype) : G_UNICODE_BREAK_UNKNOWN)
+ ((btype) <= G_UNICODE_BREAK_ZERO_WIDTH_JOINER ? (btype) : G_UNICODE_BREAK_UNKNOWN)
/*
@@ -73,12 +73,12 @@ typedef enum
**/
typedef enum
{
- JAMO_L, /* G_UNICODE_BREAK_HANGUL_L_JAMO */
- JAMO_V, /* G_UNICODE_BREAK_HANGUL_V_JAMO */
- JAMO_T, /* G_UNICODE_BREAK_HANGUL_T_JAMO */
- JAMO_LV, /* G_UNICODE_BREAK_HANGUL_LV_SYLLABLE */
- JAMO_LVT, /* G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE */
- NO_JAMO /* Other */
+ JAMO_L, /* G_UNICODE_BREAK_HANGUL_L_JAMO */
+ JAMO_V, /* G_UNICODE_BREAK_HANGUL_V_JAMO */
+ JAMO_T, /* G_UNICODE_BREAK_HANGUL_T_JAMO */
+ JAMO_LV, /* G_UNICODE_BREAK_HANGUL_LV_SYLLABLE */
+ JAMO_LVT, /* G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE */
+ NO_JAMO /* Other */
} JamoType;
/* There are Hangul syllables encoded as characters, that act like a
@@ -97,12 +97,12 @@ typedef struct _CharJamoProps
* JamoTypes (no LV or LVT) or none.
*/
static const CharJamoProps HangulJamoProps[] = {
- {JAMO_L, JAMO_L}, /* JAMO_L */
- {JAMO_V, JAMO_V}, /* JAMO_V */
- {JAMO_T, JAMO_T}, /* JAMO_T */
- {JAMO_L, JAMO_V}, /* JAMO_LV */
- {JAMO_L, JAMO_T}, /* JAMO_LVT */
- {NO_JAMO, NO_JAMO} /* NO_JAMO */
+ {JAMO_L, JAMO_L}, /* JAMO_L */
+ {JAMO_V, JAMO_V}, /* JAMO_V */
+ {JAMO_T, JAMO_T}, /* JAMO_T */
+ {JAMO_L, JAMO_V}, /* JAMO_LV */
+ {JAMO_L, JAMO_T}, /* JAMO_LVT */
+ {NO_JAMO, NO_JAMO} /* NO_JAMO */
};
/* A character forms a syllable with the previous character if and only if:
@@ -114,10 +114,10 @@ static const CharJamoProps HangulJamoProps[] = {
*/
#define IS_JAMO(btype) \
- ((btype >= G_UNICODE_BREAK_HANGUL_L_JAMO) && \
- (btype <= G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE))
+ ((btype >= G_UNICODE_BREAK_HANGUL_L_JAMO) && \
+ (btype <= G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE))
#define JAMO_TYPE(btype) \
- (IS_JAMO(btype) ? (btype - G_UNICODE_BREAK_HANGUL_L_JAMO) : NO_JAMO)
+ (IS_JAMO(btype) ? (btype - G_UNICODE_BREAK_HANGUL_L_JAMO) : NO_JAMO)
/* Types of Japanese characters */
#define JAPANESE(wc) ((wc) >= 0x2F00 && (wc) <= 0x30FF)
@@ -130,7 +130,7 @@ static const CharJamoProps HangulJamoProps[] = {
#define GREEK(wc) (((wc) >= 0x0370 && (wc) <= 0x3FF) || ((wc) >= 0x1F00 && (wc) <= 0x1FFF))
#define KANA(wc) ((wc) >= 0x3040 && (wc) <= 0x30FF)
#define HANGUL(wc) ((wc) >= 0xAC00 && (wc) <= 0xD7A3)
-#define EMOJI(wc) (_pango_Is_Emoji_Base_Character (wc))
+#define EMOJI(wc) (_pango2_Is_Emoji_Base_Character (wc))
#define BACKSPACE_DELETES_CHARACTER(wc) (!LATIN (wc) && !CYRILLIC (wc) && !GREEK (wc) && !KANA (wc) && !HANGUL (wc) && !EMOJI (wc))
/* Previously "123foo" was two words. But in UAX 29 of Unicode,
@@ -144,10 +144,10 @@ typedef enum
} WordType;
static void
-default_break (const char *text,
- int length,
- PangoLogAttr *attrs,
- int attrs_len G_GNUC_UNUSED)
+default_break (const char *text,
+ int length,
+ Pango2LogAttr *attrs,
+ int attrs_len G_GNUC_UNUSED)
{
/* The rationale for all this is in section 5.15 of the Unicode 3.0 book,
* the line breaking stuff is also in TR14 on unicode.org
@@ -306,49 +306,49 @@ default_break (const char *text,
break_type = next_break_type;
if (almost_done)
- {
- /*
- * If we have already reached the end of @text g_utf8_next_char()
- * may not increment next
- */
- next_wc = 0;
- next_break_type = G_UNICODE_BREAK_UNKNOWN;
- done = TRUE;
- }
+ {
+ /*
+ * If we have already reached the end of @text g_utf8_next_char()
+ * may not increment next
+ */
+ next_wc = 0;
+ next_break_type = G_UNICODE_BREAK_UNKNOWN;
+ done = TRUE;
+ }
else
- {
- next = g_utf8_next_char (next);
-
- if ((length >= 0 && next >= text + length) || *next == '\0')
- {
- /* This is how we fill in the last element (end position) of the
- * attr array - assume there's a paragraph separators off the end
- * of @text.
- */
- next_wc = PARAGRAPH_SEPARATOR;
- almost_done = TRUE;
- }
- else
- next_wc = g_utf8_get_char (next);
-
- next_break_type = g_unichar_break_type (next_wc);
- next_break_type = BREAK_TYPE_SAFE (next_break_type);
- }
+ {
+ next = g_utf8_next_char (next);
+
+ if ((length >= 0 && next >= text + length) || *next == '\0')
+ {
+ /* This is how we fill in the last element (end position) of the
+ * attr array - assume there's a paragraph separators off the end
+ * of @text.
+ */
+ next_wc = PARAGRAPH_SEPARATOR;
+ almost_done = TRUE;
+ }
+ else
+ next_wc = g_utf8_get_char (next);
+
+ next_break_type = g_unichar_break_type (next_wc);
+ next_break_type = BREAK_TYPE_SAFE (next_break_type);
+ }
type = g_unichar_type (wc);
jamo = JAMO_TYPE (break_type);
/* Determine wheter this forms a Hangul syllable with prev. */
if (jamo == NO_JAMO)
- makes_hangul_syllable = FALSE;
+ makes_hangul_syllable = FALSE;
else
- {
- JamoType prev_end = HangulJamoProps[prev_jamo].end ;
- JamoType this_start = HangulJamoProps[ jamo].start;
+ {
+ JamoType prev_end = HangulJamoProps[prev_jamo].end ;
+ JamoType this_start = HangulJamoProps[ jamo].start;
- /* See comments before IS_JAMO */
- makes_hangul_syllable = (prev_end == this_start) || (prev_end + 1 == this_start);
- }
+ /* See comments before IS_JAMO */
+ makes_hangul_syllable = (prev_end == this_start) || (prev_end + 1 == this_start);
+ }
switch ((int)type)
{
@@ -372,28 +372,28 @@ default_break (const char *text,
*/
attrs[i].is_expandable_space = (0x0020 == wc || 0x00A0 == wc);
is_Extended_Pictographic =
- _pango_Is_Emoji_Extended_Pictographic (wc);
+ _pango2_Is_Emoji_Extended_Pictographic (wc);
/* ---- UAX#29 Grapheme Boundaries ---- */
{
- GraphemeBreakType GB_type;
+ GraphemeBreakType GB_type;
/* Find the GraphemeBreakType of wc */
- GB_type = GB_Other;
- switch ((int)type)
- {
- case G_UNICODE_FORMAT:
- if (G_UNLIKELY (wc == 0x200C))
- {
- GB_type = GB_Extend;
- break;
- }
- if (G_UNLIKELY (wc == 0x200D))
- {
- GB_type = GB_ZWJ;
- break;
- }
+ GB_type = GB_Other;
+ switch ((int)type)
+ {
+ case G_UNICODE_FORMAT:
+ if (G_UNLIKELY (wc == 0x200C))
+ {
+ GB_type = GB_Extend;
+ break;
+ }
+ if (G_UNLIKELY (wc == 0x200D))
+ {
+ GB_type = GB_ZWJ;
+ break;
+ }
if (G_UNLIKELY((wc >= 0x600 && wc <= 0x605) ||
wc == 0x6DD ||
wc == 0x70F ||
@@ -411,54 +411,54 @@ default_break (const char *text,
break;
}
G_GNUC_FALLTHROUGH;
- case G_UNICODE_CONTROL:
- case G_UNICODE_LINE_SEPARATOR:
- case G_UNICODE_PARAGRAPH_SEPARATOR:
- case G_UNICODE_SURROGATE:
- GB_type = GB_ControlCRLF;
- break;
-
- case G_UNICODE_UNASSIGNED:
- /* Unassigned default ignorables */
- if ((wc >= 0xFFF0 && wc <= 0xFFF8) ||
- (wc >= 0xE0000 && wc <= 0xE0FFF))
- {
- GB_type = GB_ControlCRLF;
- break;
- }
+ case G_UNICODE_CONTROL:
+ case G_UNICODE_LINE_SEPARATOR:
+ case G_UNICODE_PARAGRAPH_SEPARATOR:
+ case G_UNICODE_SURROGATE:
+ GB_type = GB_ControlCRLF;
+ break;
+
+ case G_UNICODE_UNASSIGNED:
+ /* Unassigned default ignorables */
+ if ((wc >= 0xFFF0 && wc <= 0xFFF8) ||
+ (wc >= 0xE0000 && wc <= 0xE0FFF))
+ {
+ GB_type = GB_ControlCRLF;
+ break;
+ }
G_GNUC_FALLTHROUGH;
- case G_UNICODE_OTHER_LETTER:
- if (makes_hangul_syllable)
- GB_type = GB_InHangulSyllable;
-
- if (_pango_is_Consonant_Preceding_Repha (wc) ||
- _pango_is_Consonant_Prefixed (wc))
- GB_type = GB_Prepend;
- break;
-
- case G_UNICODE_MODIFIER_LETTER:
- if (wc >= 0xFF9E && wc <= 0xFF9F)
- GB_type = GB_Extend; /* Other_Grapheme_Extend */
- break;
-
- case G_UNICODE_SPACING_MARK:
- GB_type = GB_SpacingMark; /* SpacingMark */
- if (wc >= 0x0900)
- {
- if (wc == 0x09BE || wc == 0x09D7 ||
- wc == 0x0B3E || wc == 0x0B57 || wc == 0x0BBE || wc == 0x0BD7 ||
- wc == 0x0CC2 || wc == 0x0CD5 || wc == 0x0CD6 ||
- wc == 0x0D3E || wc == 0x0D57 || wc == 0x0DCF || wc == 0x0DDF ||
- wc == 0x1D165 || (wc >= 0x1D16E && wc <= 0x1D172))
- GB_type = GB_Extend; /* Other_Grapheme_Extend */
- }
- break;
-
- case G_UNICODE_ENCLOSING_MARK:
- case G_UNICODE_NON_SPACING_MARK:
- GB_type = GB_Extend; /* Grapheme_Extend */
- break;
+ case G_UNICODE_OTHER_LETTER:
+ if (makes_hangul_syllable)
+ GB_type = GB_InHangulSyllable;
+
+ if (_pango2_is_Consonant_Preceding_Repha (wc) ||
+ _pango2_is_Consonant_Prefixed (wc))
+ GB_type = GB_Prepend;
+ break;
+
+ case G_UNICODE_MODIFIER_LETTER:
+ if (wc >= 0xFF9E && wc <= 0xFF9F)
+ GB_type = GB_Extend; /* Other_Grapheme_Extend */
+ break;
+
+ case G_UNICODE_SPACING_MARK:
+ GB_type = GB_SpacingMark; /* SpacingMark */
+ if (wc >= 0x0900)
+ {
+ if (wc == 0x09BE || wc == 0x09D7 ||
+ wc == 0x0B3E || wc == 0x0B57 || wc == 0x0BBE || wc == 0x0BD7 ||
+ wc == 0x0CC2 || wc == 0x0CD5 || wc == 0x0CD6 ||
+ wc == 0x0D3E || wc == 0x0D57 || wc == 0x0DCF || wc == 0x0DDF ||
+ wc == 0x1D165 || (wc >= 0x1D16E && wc <= 0x1D172))
+ GB_type = GB_Extend; /* Other_Grapheme_Extend */
+ }
+ break;
+
+ case G_UNICODE_ENCLOSING_MARK:
+ case G_UNICODE_NON_SPACING_MARK:
+ GB_type = GB_Extend; /* Grapheme_Extend */
+ break;
case G_UNICODE_OTHER_SYMBOL:
if (G_UNLIKELY(wc >=0x1F1E6 && wc <=0x1F1FF))
@@ -479,472 +479,472 @@ default_break (const char *text,
default:
break;
- }
-
- /* Rule GB11 */
- if (met_Extended_Pictographic)
- {
- if (GB_type == GB_Extend)
- met_Extended_Pictographic = TRUE;
- else if (_pango_Is_Emoji_Extended_Pictographic (prev_wc) &&
- GB_type == GB_ZWJ)
- met_Extended_Pictographic = TRUE;
- else if (prev_GB_type == GB_Extend && GB_type == GB_ZWJ)
- met_Extended_Pictographic = TRUE;
- else if (prev_GB_type == GB_ZWJ && is_Extended_Pictographic)
- met_Extended_Pictographic = TRUE;
- else
- met_Extended_Pictographic = FALSE;
- }
-
- /* Grapheme Cluster Boundary Rules */
- is_grapheme_boundary = TRUE; /* Rule GB999 */
-
- /* We apply Rules GB1 and GB2 at the end of the function */
- if (wc == '\n' && prev_wc == '\r')
+ }
+
+ /* Rule GB11 */
+ if (met_Extended_Pictographic)
+ {
+ if (GB_type == GB_Extend)
+ met_Extended_Pictographic = TRUE;
+ else if (_pango2_Is_Emoji_Extended_Pictographic (prev_wc) &&
+ GB_type == GB_ZWJ)
+ met_Extended_Pictographic = TRUE;
+ else if (prev_GB_type == GB_Extend && GB_type == GB_ZWJ)
+ met_Extended_Pictographic = TRUE;
+ else if (prev_GB_type == GB_ZWJ && is_Extended_Pictographic)
+ met_Extended_Pictographic = TRUE;
+ else
+ met_Extended_Pictographic = FALSE;
+ }
+
+ /* Grapheme Cluster Boundary Rules */
+ is_grapheme_boundary = TRUE; /* Rule GB999 */
+
+ /* We apply Rules GB1 and GB2 at the end of the function */
+ if (wc == '\n' && prev_wc == '\r')
is_grapheme_boundary = FALSE; /* Rule GB3 */
- else if (prev_GB_type == GB_ControlCRLF || GB_type == GB_ControlCRLF)
- is_grapheme_boundary = TRUE; /* Rules GB4 and GB5 */
- else if (GB_type == GB_InHangulSyllable)
- is_grapheme_boundary = FALSE; /* Rules GB6, GB7, GB8 */
- else if (GB_type == GB_Extend)
- is_grapheme_boundary = FALSE; /* Rule GB9 */
+ else if (prev_GB_type == GB_ControlCRLF || GB_type == GB_ControlCRLF)
+ is_grapheme_boundary = TRUE; /* Rules GB4 and GB5 */
+ else if (GB_type == GB_InHangulSyllable)
+ is_grapheme_boundary = FALSE; /* Rules GB6, GB7, GB8 */
+ else if (GB_type == GB_Extend)
+ is_grapheme_boundary = FALSE; /* Rule GB9 */
else if (GB_type == GB_ZWJ)
- is_grapheme_boundary = FALSE; /* Rule GB9 */
- else if (GB_type == GB_SpacingMark)
- is_grapheme_boundary = FALSE; /* Rule GB9a */
- else if (prev_GB_type == GB_Prepend)
- is_grapheme_boundary = FALSE; /* Rule GB9b */
- else if (is_Extended_Pictographic)
- { /* Rule GB11 */
- if (prev_GB_type == GB_ZWJ && met_Extended_Pictographic)
- is_grapheme_boundary = FALSE;
- }
- else if (prev_GB_type == GB_RI_Odd && GB_type == GB_RI_Even)
- is_grapheme_boundary = FALSE; /* Rule GB12 and GB13 */
-
- if (is_Extended_Pictographic)
- met_Extended_Pictographic = TRUE;
-
- attrs[i].is_cursor_position = is_grapheme_boundary;
- /* If this is a grapheme boundary, we have to decide if backspace
- * deletes a character or the whole grapheme cluster */
- if (is_grapheme_boundary)
+ is_grapheme_boundary = FALSE; /* Rule GB9 */
+ else if (GB_type == GB_SpacingMark)
+ is_grapheme_boundary = FALSE; /* Rule GB9a */
+ else if (prev_GB_type == GB_Prepend)
+ is_grapheme_boundary = FALSE; /* Rule GB9b */
+ else if (is_Extended_Pictographic)
+ { /* Rule GB11 */
+ if (prev_GB_type == GB_ZWJ && met_Extended_Pictographic)
+ is_grapheme_boundary = FALSE;
+ }
+ else if (prev_GB_type == GB_RI_Odd && GB_type == GB_RI_Even)
+ is_grapheme_boundary = FALSE; /* Rule GB12 and GB13 */
+
+ if (is_Extended_Pictographic)
+ met_Extended_Pictographic = TRUE;
+
+ attrs[i].is_cursor_position = is_grapheme_boundary;
+ /* If this is a grapheme boundary, we have to decide if backspace
+ * deletes a character or the whole grapheme cluster */
+ if (is_grapheme_boundary)
{
- attrs[i].backspace_deletes_character = BACKSPACE_DELETES_CHARACTER (base_character);
+ attrs[i].backspace_deletes_character = BACKSPACE_DELETES_CHARACTER (base_character);
- /* Dependent Vowels for Indic language */
- if (_pango_is_Virama (prev_wc) ||
- _pango_is_Vowel_Dependent (prev_wc))
- attrs[i].backspace_deletes_character = TRUE;
+ /* Dependent Vowels for Indic language */
+ if (_pango2_is_Virama (prev_wc) ||
+ _pango2_is_Vowel_Dependent (prev_wc))
+ attrs[i].backspace_deletes_character = TRUE;
}
- else
- attrs[i].backspace_deletes_character = FALSE;
+ else
+ attrs[i].backspace_deletes_character = FALSE;
- prev_GB_type = GB_type;
+ prev_GB_type = GB_type;
}
script = g_unichar_get_script (wc);
/* ---- UAX#29 Word Boundaries ---- */
{
- is_word_boundary = FALSE;
- if (is_grapheme_boundary ||
- G_UNLIKELY(wc >=0x1F1E6 && wc <=0x1F1FF)) /* Rules WB3 and WB4 */
- {
- WordBreakType WB_type;
-
- /* Find the WordBreakType of wc */
- WB_type = WB_Other;
-
- if (script == G_UNICODE_SCRIPT_KATAKANA)
- WB_type = WB_Katakana;
-
- if (script == G_UNICODE_SCRIPT_HEBREW && type == G_UNICODE_OTHER_LETTER)
- WB_type = WB_Hebrew_Letter;
-
- if (WB_type == WB_Other)
- switch (wc >> 8)
- {
- case 0x30:
- if (wc == 0x3031 || wc == 0x3032 || wc == 0x3033 || wc == 0x3034 || wc == 0x3035 ||
- wc == 0x309b || wc == 0x309c || wc == 0x30a0 || wc == 0x30fc)
- WB_type = WB_Katakana; /* Katakana exceptions */
- break;
- case 0xFF:
- if (wc == 0xFF70)
- WB_type = WB_Katakana; /* Katakana exceptions */
- else if (wc >= 0xFF9E && wc <= 0xFF9F)
- WB_type = WB_ExtendFormat; /* Other_Grapheme_Extend */
- break;
- case 0x05:
- if (wc == 0x058A)
- WB_type = WB_ALetter; /* ALetter exceptions */
- break;
+ is_word_boundary = FALSE;
+ if (is_grapheme_boundary ||
+ G_UNLIKELY(wc >=0x1F1E6 && wc <=0x1F1FF)) /* Rules WB3 and WB4 */
+ {
+ WordBreakType WB_type;
+
+ /* Find the WordBreakType of wc */
+ WB_type = WB_Other;
+
+ if (script == G_UNICODE_SCRIPT_KATAKANA)
+ WB_type = WB_Katakana;
+
+ if (script == G_UNICODE_SCRIPT_HEBREW && type == G_UNICODE_OTHER_LETTER)
+ WB_type = WB_Hebrew_Letter;
+
+ if (WB_type == WB_Other)
+ switch (wc >> 8)
+ {
+ case 0x30:
+ if (wc == 0x3031 || wc == 0x3032 || wc == 0x3033 || wc == 0x3034 || wc == 0x3035 ||
+ wc == 0x309b || wc == 0x309c || wc == 0x30a0 || wc == 0x30fc)
+ WB_type = WB_Katakana; /* Katakana exceptions */
+ break;
+ case 0xFF:
+ if (wc == 0xFF70)
+ WB_type = WB_Katakana; /* Katakana exceptions */
+ else if (wc >= 0xFF9E && wc <= 0xFF9F)
+ WB_type = WB_ExtendFormat; /* Other_Grapheme_Extend */
+ break;
+ case 0x05:
+ if (wc == 0x058A)
+ WB_type = WB_ALetter; /* ALetter exceptions */
+ break;
default:
break;
- }
-
- if (WB_type == WB_Other)
- switch ((int) break_type)
- {
- case G_UNICODE_BREAK_NUMERIC:
- if (wc != 0x066C)
- WB_type = WB_Numeric; /* Numeric */
- break;
- case G_UNICODE_BREAK_INFIX_SEPARATOR:
- if (wc != 0x003A && wc != 0xFE13 && wc != 0x002E)
- WB_type = WB_MidNum; /* MidNum */
- break;
+ }
+
+ if (WB_type == WB_Other)
+ switch ((int) break_type)
+ {
+ case G_UNICODE_BREAK_NUMERIC:
+ if (wc != 0x066C)
+ WB_type = WB_Numeric; /* Numeric */
+ break;
+ case G_UNICODE_BREAK_INFIX_SEPARATOR:
+ if (wc != 0x003A && wc != 0xFE13 && wc != 0x002E)
+ WB_type = WB_MidNum; /* MidNum */
+ break;
default:
break;
- }
-
- if (WB_type == WB_Other)
- switch ((int) type)
- {
- case G_UNICODE_CONTROL:
- if (wc != 0x000D && wc != 0x000A && wc != 0x000B && wc != 0x000C && wc != 0x0085)
- break;
+ }
+
+ if (WB_type == WB_Other)
+ switch ((int) type)
+ {
+ case G_UNICODE_CONTROL:
+ if (wc != 0x000D && wc != 0x000A && wc != 0x000B && wc != 0x000C && wc != 0x0085)
+ break;
G_GNUC_FALLTHROUGH;
- case G_UNICODE_LINE_SEPARATOR:
- case G_UNICODE_PARAGRAPH_SEPARATOR:
- WB_type = WB_NewlineCRLF; /* CR, LF, Newline */
- break;
-
- case G_UNICODE_FORMAT:
- case G_UNICODE_SPACING_MARK:
- case G_UNICODE_ENCLOSING_MARK:
- case G_UNICODE_NON_SPACING_MARK:
- WB_type = WB_ExtendFormat; /* Extend, Format */
- break;
-
- case G_UNICODE_CONNECT_PUNCTUATION:
- WB_type = WB_ExtendNumLet; /* ExtendNumLet */
- break;
-
- case G_UNICODE_INITIAL_PUNCTUATION:
- case G_UNICODE_FINAL_PUNCTUATION:
- if (wc == 0x2018 || wc == 0x2019)
- WB_type = WB_MidNumLet; /* MidNumLet */
- break;
- case G_UNICODE_OTHER_PUNCTUATION:
- if ((wc >= 0x055a && wc <= 0x055c) ||
- wc == 0x055e || wc == 0x05f3)
- WB_type = WB_ALetter; /* ALetter */
- else if (wc == 0x0027 || wc == 0x002e || wc == 0x2024 ||
- wc == 0xfe52 || wc == 0xff07 || wc == 0xff0e)
- WB_type = WB_MidNumLet; /* MidNumLet */
- else if (wc == 0x00b7 || wc == 0x05f4 || wc == 0x2027 ||
- wc == 0x003a || wc == 0x0387 || wc == 0x055f ||
- wc == 0xfe13 || wc == 0xfe55 || wc == 0xff1a)
- WB_type = WB_MidLetter; /* MidLetter */
- else if (wc == 0x066c ||
- wc == 0xfe50 || wc == 0xfe54 || wc == 0xff0c || wc == 0xff1b)
- WB_type = WB_MidNum; /* MidNum */
- break;
-
- case G_UNICODE_OTHER_SYMBOL:
- if (wc >= 0x24B6 && wc <= 0x24E9) /* Other_Alphabetic */
- goto Alphabetic;
-
- if (G_UNLIKELY(wc >= 0x1F1E6 && wc <= 0x1F1FF))
- {
+ case G_UNICODE_LINE_SEPARATOR:
+ case G_UNICODE_PARAGRAPH_SEPARATOR:
+ WB_type = WB_NewlineCRLF; /* CR, LF, Newline */
+ break;
+
+ case G_UNICODE_FORMAT:
+ case G_UNICODE_SPACING_MARK:
+ case G_UNICODE_ENCLOSING_MARK:
+ case G_UNICODE_NON_SPACING_MARK:
+ WB_type = WB_ExtendFormat; /* Extend, Format */
+ break;
+
+ case G_UNICODE_CONNECT_PUNCTUATION:
+ WB_type = WB_ExtendNumLet; /* ExtendNumLet */
+ break;
+
+ case G_UNICODE_INITIAL_PUNCTUATION:
+ case G_UNICODE_FINAL_PUNCTUATION:
+ if (wc == 0x2018 || wc == 0x2019)
+ WB_type = WB_MidNumLet; /* MidNumLet */
+ break;
+ case G_UNICODE_OTHER_PUNCTUATION:
+ if ((wc >= 0x055a && wc <= 0x055c) ||
+ wc == 0x055e || wc == 0x05f3)
+ WB_type = WB_ALetter; /* ALetter */
+ else if (wc == 0x0027 || wc == 0x002e || wc == 0x2024 ||
+ wc == 0xfe52 || wc == 0xff07 || wc == 0xff0e)
+ WB_type = WB_MidNumLet; /* MidNumLet */
+ else if (wc == 0x00b7 || wc == 0x05f4 || wc == 0x2027 ||
+ wc == 0x003a || wc == 0x0387 || wc == 0x055f ||
+ wc == 0xfe13 || wc == 0xfe55 || wc == 0xff1a)
+ WB_type = WB_MidLetter; /* MidLetter */
+ else if (wc == 0x066c ||
+ wc == 0xfe50 || wc == 0xfe54 || wc == 0xff0c || wc == 0xff1b)
+ WB_type = WB_MidNum; /* MidNum */
+ break;
+
+ case G_UNICODE_OTHER_SYMBOL:
+ if (wc >= 0x24B6 && wc <= 0x24E9) /* Other_Alphabetic */
+ goto Alphabetic;
+
+ if (G_UNLIKELY(wc >= 0x1F1E6 && wc <= 0x1F1FF))
+ {
if (prev_WB_type == WB_RI_Odd)
WB_type = WB_RI_Even;
else
WB_type = WB_RI_Odd;
- }
-
- break;
-
- case G_UNICODE_OTHER_LETTER:
- case G_UNICODE_LETTER_NUMBER:
- if (wc == 0x3006 || wc == 0x3007 ||
- (wc >= 0x3021 && wc <= 0x3029) ||
- (wc >= 0x3038 && wc <= 0x303A) ||
- (wc >= 0x3400 && wc <= 0x4DB5) ||
- (wc >= 0x4E00 && wc <= 0x9FC3) ||
- (wc >= 0xF900 && wc <= 0xFA2D) ||
- (wc >= 0xFA30 && wc <= 0xFA6A) ||
- (wc >= 0xFA70 && wc <= 0xFAD9) ||
- (wc >= 0x20000 && wc <= 0x2A6D6) ||
- (wc >= 0x2F800 && wc <= 0x2FA1D))
- break; /* ALetter exceptions: Ideographic */
- goto Alphabetic;
-
- case G_UNICODE_LOWERCASE_LETTER:
- case G_UNICODE_MODIFIER_LETTER:
- case G_UNICODE_TITLECASE_LETTER:
- case G_UNICODE_UPPERCASE_LETTER:
- Alphabetic:
- if (break_type != G_UNICODE_BREAK_COMPLEX_CONTEXT && script != G_UNICODE_SCRIPT_HIRAGANA)
- WB_type = WB_ALetter; /* ALetter */
- break;
+ }
+
+ break;
+
+ case G_UNICODE_OTHER_LETTER:
+ case G_UNICODE_LETTER_NUMBER:
+ if (wc == 0x3006 || wc == 0x3007 ||
+ (wc >= 0x3021 && wc <= 0x3029) ||
+ (wc >= 0x3038 && wc <= 0x303A) ||
+ (wc >= 0x3400 && wc <= 0x4DB5) ||
+ (wc >= 0x4E00 && wc <= 0x9FC3) ||
+ (wc >= 0xF900 && wc <= 0xFA2D) ||
+ (wc >= 0xFA30 && wc <= 0xFA6A) ||
+ (wc >= 0xFA70 && wc <= 0xFAD9) ||
+ (wc >= 0x20000 && wc <= 0x2A6D6) ||
+ (wc >= 0x2F800 && wc <= 0x2FA1D))
+ break; /* ALetter exceptions: Ideographic */
+ goto Alphabetic;
+
+ case G_UNICODE_LOWERCASE_LETTER:
+ case G_UNICODE_MODIFIER_LETTER:
+ case G_UNICODE_TITLECASE_LETTER:
+ case G_UNICODE_UPPERCASE_LETTER:
+ Alphabetic:
+ if (break_type != G_UNICODE_BREAK_COMPLEX_CONTEXT && script != G_UNICODE_SCRIPT_HIRAGANA)
+ WB_type = WB_ALetter; /* ALetter */
+ break;
default:
break;
- }
-
- if (WB_type == WB_Other)
- {
- if (type == G_UNICODE_SPACE_SEPARATOR &&
- break_type != G_UNICODE_BREAK_NON_BREAKING_GLUE)
- WB_type = WB_WSegSpace;
- }
-
- /* Word Cluster Boundary Rules */
-
- /* We apply Rules WB1 and WB2 at the end of the function */
-
- if (prev_wc == 0x3031 && wc == 0x41)
- g_debug ("Y %d %d", prev_WB_type, WB_type);
- if (prev_WB_type == WB_NewlineCRLF && prev_WB_i + 1 == i)
- {
- /* The extra check for prev_WB_i is to correctly handle sequences like
- * Newline ÷ Extend × Extend
- * since we have not skipped ExtendFormat yet.
- */
- is_word_boundary = TRUE; /* Rule WB3a */
- }
- else if (WB_type == WB_NewlineCRLF)
- is_word_boundary = TRUE; /* Rule WB3b */
- else if (prev_wc == 0x200D && is_Extended_Pictographic)
- is_word_boundary = FALSE; /* Rule WB3c */
- else if (prev_WB_type == WB_WSegSpace &&
- WB_type == WB_WSegSpace && prev_WB_i + 1 == i)
- is_word_boundary = FALSE; /* Rule WB3d */
- else if (WB_type == WB_ExtendFormat)
- is_word_boundary = FALSE; /* Rules WB4? */
- else if ((prev_WB_type == WB_ALetter ||
+ }
+
+ if (WB_type == WB_Other)
+ {
+ if (type == G_UNICODE_SPACE_SEPARATOR &&
+ break_type != G_UNICODE_BREAK_NON_BREAKING_GLUE)
+ WB_type = WB_WSegSpace;
+ }
+
+ /* Word Cluster Boundary Rules */
+
+ /* We apply Rules WB1 and WB2 at the end of the function */
+
+ if (prev_wc == 0x3031 && wc == 0x41)
+ g_debug ("Y %d %d", prev_WB_type, WB_type);
+ if (prev_WB_type == WB_NewlineCRLF && prev_WB_i + 1 == i)
+ {
+ /* The extra check for prev_WB_i is to correctly handle sequences like
+ * Newline ÷ Extend × Extend
+ * since we have not skipped ExtendFormat yet.
+ */
+ is_word_boundary = TRUE; /* Rule WB3a */
+ }
+ else if (WB_type == WB_NewlineCRLF)
+ is_word_boundary = TRUE; /* Rule WB3b */
+ else if (prev_wc == 0x200D && is_Extended_Pictographic)
+ is_word_boundary = FALSE; /* Rule WB3c */
+ else if (prev_WB_type == WB_WSegSpace &&
+ WB_type == WB_WSegSpace && prev_WB_i + 1 == i)
+ is_word_boundary = FALSE; /* Rule WB3d */
+ else if (WB_type == WB_ExtendFormat)
+ is_word_boundary = FALSE; /* Rules WB4? */
+ else if ((prev_WB_type == WB_ALetter ||
prev_WB_type == WB_Hebrew_Letter ||
prev_WB_type == WB_Numeric) &&
(WB_type == WB_ALetter ||
WB_type == WB_Hebrew_Letter ||
WB_type == WB_Numeric))
- is_word_boundary = FALSE; /* Rules WB5, WB8, WB9, WB10 */
- else if (prev_WB_type == WB_Katakana && WB_type == WB_Katakana)
- is_word_boundary = FALSE; /* Rule WB13 */
- else if ((prev_WB_type == WB_ALetter ||
+ is_word_boundary = FALSE; /* Rules WB5, WB8, WB9, WB10 */
+ else if (prev_WB_type == WB_Katakana && WB_type == WB_Katakana)
+ is_word_boundary = FALSE; /* Rule WB13 */
+ else if ((prev_WB_type == WB_ALetter ||
prev_WB_type == WB_Hebrew_Letter ||
prev_WB_type == WB_Numeric ||
prev_WB_type == WB_Katakana ||
prev_WB_type == WB_ExtendNumLet) &&
WB_type == WB_ExtendNumLet)
- is_word_boundary = FALSE; /* Rule WB13a */
- else if (prev_WB_type == WB_ExtendNumLet &&
+ is_word_boundary = FALSE; /* Rule WB13a */
+ else if (prev_WB_type == WB_ExtendNumLet &&
(WB_type == WB_ALetter ||
WB_type == WB_Hebrew_Letter ||
WB_type == WB_Numeric ||
WB_type == WB_Katakana))
- is_word_boundary = FALSE; /* Rule WB13b */
- else if (((prev_prev_WB_type == WB_ALetter ||
+ is_word_boundary = FALSE; /* Rule WB13b */
+ else if (((prev_prev_WB_type == WB_ALetter ||
prev_prev_WB_type == WB_Hebrew_Letter) &&
(WB_type == WB_ALetter ||
WB_type == WB_Hebrew_Letter)) &&
- (prev_WB_type == WB_MidLetter ||
+ (prev_WB_type == WB_MidLetter ||
prev_WB_type == WB_MidNumLet ||
prev_wc == 0x0027))
- {
- attrs[prev_WB_i].is_word_boundary = FALSE; /* Rule WB6 */
- is_word_boundary = FALSE; /* Rule WB7 */
- }
- else if (prev_WB_type == WB_Hebrew_Letter && wc == 0x0027)
+ {
+ attrs[prev_WB_i].is_word_boundary = FALSE; /* Rule WB6 */
+ is_word_boundary = FALSE; /* Rule WB7 */
+ }
+ else if (prev_WB_type == WB_Hebrew_Letter && wc == 0x0027)
is_word_boundary = FALSE; /* Rule WB7a */
- else if (prev_prev_WB_type == WB_Hebrew_Letter && prev_wc == 0x0022 &&
+ else if (prev_prev_WB_type == WB_Hebrew_Letter && prev_wc == 0x0022 &&
WB_type == WB_Hebrew_Letter) {
attrs[prev_WB_i].is_word_boundary = FALSE; /* Rule WB7b */
is_word_boundary = FALSE; /* Rule WB7c */
}
- else if ((prev_prev_WB_type == WB_Numeric && WB_type == WB_Numeric) &&
+ else if ((prev_prev_WB_type == WB_Numeric && WB_type == WB_Numeric) &&
(prev_WB_type == WB_MidNum || prev_WB_type == WB_MidNumLet ||
prev_wc == 0x0027))
- {
- is_word_boundary = FALSE; /* Rule WB11 */
- attrs[prev_WB_i].is_word_boundary = FALSE; /* Rule WB12 */
- }
- else if (prev_WB_type == WB_RI_Odd && WB_type == WB_RI_Even)
- is_word_boundary = FALSE; /* Rule WB15 and WB16 */
- else
- is_word_boundary = TRUE; /* Rule WB999 */
-
- if (WB_type != WB_ExtendFormat)
- {
- prev_prev_WB_type = prev_WB_type;
- prev_WB_type = WB_type;
- prev_WB_i = i;
- }
- }
-
- attrs[i].is_word_boundary = is_word_boundary;
+ {
+ is_word_boundary = FALSE; /* Rule WB11 */
+ attrs[prev_WB_i].is_word_boundary = FALSE; /* Rule WB12 */
+ }
+ else if (prev_WB_type == WB_RI_Odd && WB_type == WB_RI_Even)
+ is_word_boundary = FALSE; /* Rule WB15 and WB16 */
+ else
+ is_word_boundary = TRUE; /* Rule WB999 */
+
+ if (WB_type != WB_ExtendFormat)
+ {
+ prev_prev_WB_type = prev_WB_type;
+ prev_WB_type = WB_type;
+ prev_WB_i = i;
+ }
+ }
+
+ attrs[i].is_word_boundary = is_word_boundary;
}
/* ---- UAX#29 Sentence Boundaries ---- */
{
- is_sentence_boundary = FALSE;
- if (is_word_boundary ||
- wc == '\r' || wc == '\n') /* Rules SB3 and SB5 */
- {
- SentenceBreakType SB_type;
-
- /* Find the SentenceBreakType of wc */
- SB_type = SB_Other;
-
- if (break_type == G_UNICODE_BREAK_NUMERIC)
- SB_type = SB_Numeric; /* Numeric */
-
- if (SB_type == SB_Other)
- switch ((int) type)
- {
- case G_UNICODE_CONTROL:
- if (wc == '\r' || wc == '\n')
- SB_type = SB_ParaSep;
- else if (wc == 0x0009 || wc == 0x000B || wc == 0x000C)
- SB_type = SB_Sp;
- else if (wc == 0x0085)
- SB_type = SB_ParaSep;
- break;
-
- case G_UNICODE_SPACE_SEPARATOR:
- if (wc == 0x0020 || wc == 0x00A0 || wc == 0x1680 ||
- (wc >= 0x2000 && wc <= 0x200A) ||
- wc == 0x202F || wc == 0x205F || wc == 0x3000)
- SB_type = SB_Sp;
- break;
-
- case G_UNICODE_LINE_SEPARATOR:
- case G_UNICODE_PARAGRAPH_SEPARATOR:
- SB_type = SB_ParaSep;
- break;
-
- case G_UNICODE_FORMAT:
- case G_UNICODE_SPACING_MARK:
- case G_UNICODE_ENCLOSING_MARK:
- case G_UNICODE_NON_SPACING_MARK:
- SB_type = SB_ExtendFormat; /* Extend, Format */
- break;
-
- case G_UNICODE_MODIFIER_LETTER:
- if (wc >= 0xFF9E && wc <= 0xFF9F)
- SB_type = SB_ExtendFormat; /* Other_Grapheme_Extend */
- break;
-
- case G_UNICODE_TITLECASE_LETTER:
- SB_type = SB_Upper;
- break;
-
- case G_UNICODE_DASH_PUNCTUATION:
- if (wc == 0x002D ||
- (wc >= 0x2013 && wc <= 0x2014) ||
- (wc >= 0xFE31 && wc <= 0xFE32) ||
- wc == 0xFE58 ||
- wc == 0xFE63 ||
- wc == 0xFF0D)
- SB_type = SB_SContinue;
- break;
-
- case G_UNICODE_OTHER_PUNCTUATION:
- if (wc == 0x05F3)
- SB_type = SB_OLetter;
- else if (wc == 0x002E || wc == 0x2024 ||
- wc == 0xFE52 || wc == 0xFF0E)
- SB_type = SB_ATerm;
-
- if (wc == 0x002C ||
- wc == 0x003A ||
- wc == 0x055D ||
- (wc >= 0x060C && wc <= 0x060D) ||
- wc == 0x07F8 ||
- wc == 0x1802 ||
- wc == 0x1808 ||
- wc == 0x3001 ||
- (wc >= 0xFE10 && wc <= 0xFE11) ||
- wc == 0xFE13 ||
- (wc >= 0xFE50 && wc <= 0xFE51) ||
- wc == 0xFE55 ||
- wc == 0xFF0C ||
- wc == 0xFF1A ||
- wc == 0xFF64)
- SB_type = SB_SContinue;
-
- if (_pango_is_STerm(wc))
- SB_type = SB_STerm;
-
- break;
+ is_sentence_boundary = FALSE;
+ if (is_word_boundary ||
+ wc == '\r' || wc == '\n') /* Rules SB3 and SB5 */
+ {
+ SentenceBreakType SB_type;
+
+ /* Find the SentenceBreakType of wc */
+ SB_type = SB_Other;
+
+ if (break_type == G_UNICODE_BREAK_NUMERIC)
+ SB_type = SB_Numeric; /* Numeric */
+
+ if (SB_type == SB_Other)
+ switch ((int) type)
+ {
+ case G_UNICODE_CONTROL:
+ if (wc == '\r' || wc == '\n')
+ SB_type = SB_ParaSep;
+ else if (wc == 0x0009 || wc == 0x000B || wc == 0x000C)
+ SB_type = SB_Sp;
+ else if (wc == 0x0085)
+ SB_type = SB_ParaSep;
+ break;
+
+ case G_UNICODE_SPACE_SEPARATOR:
+ if (wc == 0x0020 || wc == 0x00A0 || wc == 0x1680 ||
+ (wc >= 0x2000 && wc <= 0x200A) ||
+ wc == 0x202F || wc == 0x205F || wc == 0x3000)
+ SB_type = SB_Sp;
+ break;
+
+ case G_UNICODE_LINE_SEPARATOR:
+ case G_UNICODE_PARAGRAPH_SEPARATOR:
+ SB_type = SB_ParaSep;
+ break;
+
+ case G_UNICODE_FORMAT:
+ case G_UNICODE_SPACING_MARK:
+ case G_UNICODE_ENCLOSING_MARK:
+ case G_UNICODE_NON_SPACING_MARK:
+ SB_type = SB_ExtendFormat; /* Extend, Format */
+ break;
+
+ case G_UNICODE_MODIFIER_LETTER:
+ if (wc >= 0xFF9E && wc <= 0xFF9F)
+ SB_type = SB_ExtendFormat; /* Other_Grapheme_Extend */
+ break;
+
+ case G_UNICODE_TITLECASE_LETTER:
+ SB_type = SB_Upper;
+ break;
+
+ case G_UNICODE_DASH_PUNCTUATION:
+ if (wc == 0x002D ||
+ (wc >= 0x2013 && wc <= 0x2014) ||
+ (wc >= 0xFE31 && wc <= 0xFE32) ||
+ wc == 0xFE58 ||
+ wc == 0xFE63 ||
+ wc == 0xFF0D)
+ SB_type = SB_SContinue;
+ break;
+
+ case G_UNICODE_OTHER_PUNCTUATION:
+ if (wc == 0x05F3)
+ SB_type = SB_OLetter;
+ else if (wc == 0x002E || wc == 0x2024 ||
+ wc == 0xFE52 || wc == 0xFF0E)
+ SB_type = SB_ATerm;
+
+ if (wc == 0x002C ||
+ wc == 0x003A ||
+ wc == 0x055D ||
+ (wc >= 0x060C && wc <= 0x060D) ||
+ wc == 0x07F8 ||
+ wc == 0x1802 ||
+ wc == 0x1808 ||
+ wc == 0x3001 ||
+ (wc >= 0xFE10 && wc <= 0xFE11) ||
+ wc == 0xFE13 ||
+ (wc >= 0xFE50 && wc <= 0xFE51) ||
+ wc == 0xFE55 ||
+ wc == 0xFF0C ||
+ wc == 0xFF1A ||
+ wc == 0xFF64)
+ SB_type = SB_SContinue;
+
+ if (_pango2_is_STerm(wc))
+ SB_type = SB_STerm;
+
+ break;
default:
break;
- }
+ }
- if (SB_type == SB_Other)
- {
+ if (SB_type == SB_Other)
+ {
if (type == G_UNICODE_LOWERCASE_LETTER)
- SB_type = SB_Lower;
+ SB_type = SB_Lower;
else if (type == G_UNICODE_UPPERCASE_LETTER)
- SB_type = SB_Upper;
+ SB_type = SB_Upper;
else if (type == G_UNICODE_TITLECASE_LETTER ||
type == G_UNICODE_MODIFIER_LETTER ||
type == G_UNICODE_OTHER_LETTER)
- SB_type = SB_OLetter;
-
- if (type == G_UNICODE_OPEN_PUNCTUATION ||
- type == G_UNICODE_CLOSE_PUNCTUATION ||
- break_type == G_UNICODE_BREAK_QUOTATION)
- SB_type = SB_Close;
- }
-
- /* Sentence Boundary Rules */
-
- /* We apply Rules SB1 and SB2 at the end of the function */
-
-#define IS_OTHER_TERM(SB_type) \
- /* not in (OLetter | Upper | Lower | ParaSep | SATerm) */ \
- !(SB_type == SB_OLetter || \
- SB_type == SB_Upper || SB_type == SB_Lower || \
- SB_type == SB_ParaSep || \
- SB_type == SB_ATerm || SB_type == SB_STerm || \
- SB_type == SB_ATerm_Close_Sp || \
- SB_type == SB_STerm_Close_Sp)
-
-
- if (wc == '\n' && prev_wc == '\r')
- is_sentence_boundary = FALSE; /* Rule SB3 */
- else if (prev_SB_type == SB_ParaSep && prev_SB_i + 1 == i)
- {
- /* The extra check for prev_SB_i is to correctly handle sequences like
- * ParaSep ÷ Extend × Extend
- * since we have not skipped ExtendFormat yet.
- */
-
- is_sentence_boundary = TRUE; /* Rule SB4 */
- }
- else if (SB_type == SB_ExtendFormat)
- is_sentence_boundary = FALSE; /* Rule SB5? */
- else if (prev_SB_type == SB_ATerm && SB_type == SB_Numeric)
- is_sentence_boundary = FALSE; /* Rule SB6 */
- else if ((prev_prev_SB_type == SB_Upper ||
- prev_prev_SB_type == SB_Lower) &&
- prev_SB_type == SB_ATerm &&
- SB_type == SB_Upper)
- is_sentence_boundary = FALSE; /* Rule SB7 */
- else if (prev_SB_type == SB_ATerm && SB_type == SB_Close)
- SB_type = SB_ATerm;
- else if (prev_SB_type == SB_STerm && SB_type == SB_Close)
- SB_type = SB_STerm;
- else if (prev_SB_type == SB_ATerm && SB_type == SB_Sp)
- SB_type = SB_ATerm_Close_Sp;
- else if (prev_SB_type == SB_STerm && SB_type == SB_Sp)
- SB_type = SB_STerm_Close_Sp;
- /* Rule SB8 */
- else if ((prev_SB_type == SB_ATerm ||
- prev_SB_type == SB_ATerm_Close_Sp) &&
- SB_type == SB_Lower)
- is_sentence_boundary = FALSE;
- else if ((prev_prev_SB_type == SB_ATerm ||
- prev_prev_SB_type == SB_ATerm_Close_Sp) &&
- IS_OTHER_TERM(prev_SB_type) &&
- SB_type == SB_Lower)
+ SB_type = SB_OLetter;
+
+ if (type == G_UNICODE_OPEN_PUNCTUATION ||
+ type == G_UNICODE_CLOSE_PUNCTUATION ||
+ break_type == G_UNICODE_BREAK_QUOTATION)
+ SB_type = SB_Close;
+ }
+
+ /* Sentence Boundary Rules */
+
+ /* We apply Rules SB1 and SB2 at the end of the function */
+
+#define IS_OTHER_TERM(SB_type) \
+ /* not in (OLetter | Upper | Lower | ParaSep | SATerm) */ \
+ !(SB_type == SB_OLetter || \
+ SB_type == SB_Upper || SB_type == SB_Lower || \
+ SB_type == SB_ParaSep || \
+ SB_type == SB_ATerm || SB_type == SB_STerm || \
+ SB_type == SB_ATerm_Close_Sp || \
+ SB_type == SB_STerm_Close_Sp)
+
+
+ if (wc == '\n' && prev_wc == '\r')
+ is_sentence_boundary = FALSE; /* Rule SB3 */
+ else if (prev_SB_type == SB_ParaSep && prev_SB_i + 1 == i)
{
- attrs[prev_SB_i].is_sentence_boundary = FALSE;
- attrs[prev_SB_i].is_sentence_end = FALSE;
+ /* The extra check for prev_SB_i is to correctly handle sequences like
+ * ParaSep ÷ Extend × Extend
+ * since we have not skipped ExtendFormat yet.
+ */
+
+ is_sentence_boundary = TRUE; /* Rule SB4 */
+ }
+ else if (SB_type == SB_ExtendFormat)
+ is_sentence_boundary = FALSE; /* Rule SB5? */
+ else if (prev_SB_type == SB_ATerm && SB_type == SB_Numeric)
+ is_sentence_boundary = FALSE; /* Rule SB6 */
+ else if ((prev_prev_SB_type == SB_Upper ||
+ prev_prev_SB_type == SB_Lower) &&
+ prev_SB_type == SB_ATerm &&
+ SB_type == SB_Upper)
+ is_sentence_boundary = FALSE; /* Rule SB7 */
+ else if (prev_SB_type == SB_ATerm && SB_type == SB_Close)
+ SB_type = SB_ATerm;
+ else if (prev_SB_type == SB_STerm && SB_type == SB_Close)
+ SB_type = SB_STerm;
+ else if (prev_SB_type == SB_ATerm && SB_type == SB_Sp)
+ SB_type = SB_ATerm_Close_Sp;
+ else if (prev_SB_type == SB_STerm && SB_type == SB_Sp)
+ SB_type = SB_STerm_Close_Sp;
+ /* Rule SB8 */
+ else if ((prev_SB_type == SB_ATerm ||
+ prev_SB_type == SB_ATerm_Close_Sp) &&
+ SB_type == SB_Lower)
+ is_sentence_boundary = FALSE;
+ else if ((prev_prev_SB_type == SB_ATerm ||
+ prev_prev_SB_type == SB_ATerm_Close_Sp) &&
+ IS_OTHER_TERM(prev_SB_type) &&
+ SB_type == SB_Lower)
+ {
+ attrs[prev_SB_i].is_sentence_boundary = FALSE;
+ attrs[prev_SB_i].is_sentence_end = FALSE;
last_sentence_start = -1;
for (int j = prev_SB_i - 1; j >= 0; j--)
{
@@ -956,38 +956,38 @@ default_break (const char *text,
}
}
}
- else if ((prev_SB_type == SB_ATerm ||
- prev_SB_type == SB_ATerm_Close_Sp ||
- prev_SB_type == SB_STerm ||
- prev_SB_type == SB_STerm_Close_Sp) &&
- (SB_type == SB_SContinue ||
- SB_type == SB_ATerm || SB_type == SB_STerm))
- is_sentence_boundary = FALSE; /* Rule SB8a */
- else if ((prev_SB_type == SB_ATerm ||
- prev_SB_type == SB_STerm) &&
- (SB_type == SB_Close || SB_type == SB_Sp ||
- SB_type == SB_ParaSep))
- is_sentence_boundary = FALSE; /* Rule SB9 */
- else if ((prev_SB_type == SB_ATerm ||
- prev_SB_type == SB_ATerm_Close_Sp ||
- prev_SB_type == SB_STerm ||
- prev_SB_type == SB_STerm_Close_Sp) &&
- (SB_type == SB_Sp || SB_type == SB_ParaSep))
- is_sentence_boundary = FALSE; /* Rule SB10 */
- else if ((prev_SB_type == SB_ATerm ||
- prev_SB_type == SB_ATerm_Close_Sp ||
- prev_SB_type == SB_STerm ||
- prev_SB_type == SB_STerm_Close_Sp) &&
- SB_type != SB_ParaSep)
- is_sentence_boundary = TRUE; /* Rule SB11 */
- else
- is_sentence_boundary = FALSE; /* Rule SB998 */
-
- if (SB_type != SB_ExtendFormat &&
- !((prev_prev_SB_type == SB_ATerm ||
- prev_prev_SB_type == SB_ATerm_Close_Sp) &&
- IS_OTHER_TERM(prev_SB_type) &&
- IS_OTHER_TERM(SB_type)))
+ else if ((prev_SB_type == SB_ATerm ||
+ prev_SB_type == SB_ATerm_Close_Sp ||
+ prev_SB_type == SB_STerm ||
+ prev_SB_type == SB_STerm_Close_Sp) &&
+ (SB_type == SB_SContinue ||
+ SB_type == SB_ATerm || SB_type == SB_STerm))
+ is_sentence_boundary = FALSE; /* Rule SB8a */
+ else if ((prev_SB_type == SB_ATerm ||
+ prev_SB_type == SB_STerm) &&
+ (SB_type == SB_Close || SB_type == SB_Sp ||
+ SB_type == SB_ParaSep))
+ is_sentence_boundary = FALSE; /* Rule SB9 */
+ else if ((prev_SB_type == SB_ATerm ||
+ prev_SB_type == SB_ATerm_Close_Sp ||
+ prev_SB_type == SB_STerm ||
+ prev_SB_type == SB_STerm_Close_Sp) &&
+ (SB_type == SB_Sp || SB_type == SB_ParaSep))
+ is_sentence_boundary = FALSE; /* Rule SB10 */
+ else if ((prev_SB_type == SB_ATerm ||
+ prev_SB_type == SB_ATerm_Close_Sp ||
+ prev_SB_type == SB_STerm ||
+ prev_SB_type == SB_STerm_Close_Sp) &&
+ SB_type != SB_ParaSep)
+ is_sentence_boundary = TRUE; /* Rule SB11 */
+ else
+ is_sentence_boundary = FALSE; /* Rule SB998 */
+
+ if (SB_type != SB_ExtendFormat &&
+ !((prev_prev_SB_type == SB_ATerm ||
+ prev_prev_SB_type == SB_ATerm_Close_Sp) &&
+ IS_OTHER_TERM(prev_SB_type) &&
+ IS_OTHER_TERM(SB_type)))
{
prev_prev_SB_type = prev_SB_type;
prev_SB_type = SB_type;
@@ -996,12 +996,12 @@ default_break (const char *text,
#undef IS_OTHER_TERM
- }
+ }
- if (i == 0 || done)
- is_sentence_boundary = TRUE; /* Rules SB1 and SB2 */
+ if (i == 0 || done)
+ is_sentence_boundary = TRUE; /* Rules SB1 and SB2 */
- attrs[i].is_sentence_boundary = is_sentence_boundary;
+ attrs[i].is_sentence_boundary = is_sentence_boundary;
}
/* ---- Line breaking ---- */
@@ -1009,7 +1009,7 @@ default_break (const char *text,
break_op = BREAK_ALREADY_HANDLED;
row_break_type = prev_break_type == G_UNICODE_BREAK_SPACE ?
- prev_prev_break_type : prev_break_type;
+ prev_prev_break_type : prev_break_type;
g_assert (row_break_type != G_UNICODE_BREAK_SPACE);
attrs[i].is_char_break = FALSE;
@@ -1017,434 +1017,434 @@ default_break (const char *text,
attrs[i].is_mandatory_break = FALSE;
/* Rule LB1:
- assign a line breaking class to each code point of the input. */
+ assign a line breaking class to each code point of the input. */
switch ((int)break_type)
- {
- case G_UNICODE_BREAK_AMBIGUOUS:
- case G_UNICODE_BREAK_SURROGATE:
- case G_UNICODE_BREAK_UNKNOWN:
- break_type = G_UNICODE_BREAK_ALPHABETIC;
- break;
-
- case G_UNICODE_BREAK_COMPLEX_CONTEXT:
- if (type == G_UNICODE_NON_SPACING_MARK ||
- type == G_UNICODE_SPACING_MARK)
- break_type = G_UNICODE_BREAK_COMBINING_MARK;
- else
- break_type = G_UNICODE_BREAK_ALPHABETIC;
- break;
-
- case G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER:
- break_type = G_UNICODE_BREAK_NON_STARTER;
- break;
-
- default:
+ {
+ case G_UNICODE_BREAK_AMBIGUOUS:
+ case G_UNICODE_BREAK_SURROGATE:
+ case G_UNICODE_BREAK_UNKNOWN:
+ break_type = G_UNICODE_BREAK_ALPHABETIC;
+ break;
+
+ case G_UNICODE_BREAK_COMPLEX_CONTEXT:
+ if (type == G_UNICODE_NON_SPACING_MARK ||
+ type == G_UNICODE_SPACING_MARK)
+ break_type = G_UNICODE_BREAK_COMBINING_MARK;
+ else
+ break_type = G_UNICODE_BREAK_ALPHABETIC;
break;
- }
+
+ case G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER:
+ break_type = G_UNICODE_BREAK_NON_STARTER;
+ break;
+
+ default:
+ break;
+ }
/* If it's not a grapheme boundary, it's not a line break either */
if (attrs[i].is_cursor_position ||
- break_type == G_UNICODE_BREAK_COMBINING_MARK ||
- break_type == G_UNICODE_BREAK_ZERO_WIDTH_JOINER ||
- break_type == G_UNICODE_BREAK_HANGUL_L_JAMO ||
- break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
- break_type == G_UNICODE_BREAK_HANGUL_T_JAMO ||
- break_type == G_UNICODE_BREAK_HANGUL_LV_SYLLABLE ||
- break_type == G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE ||
- break_type == G_UNICODE_BREAK_EMOJI_MODIFIER ||
- break_type == G_UNICODE_BREAK_REGIONAL_INDICATOR)
- {
- LineBreakType LB_type;
-
- /* Find the LineBreakType of wc */
- LB_type = LB_Other;
-
- if (break_type == G_UNICODE_BREAK_NUMERIC)
- LB_type = LB_Numeric;
-
- if (break_type == G_UNICODE_BREAK_SYMBOL ||
- break_type == G_UNICODE_BREAK_INFIX_SEPARATOR)
- {
- if (!(prev_LB_type == LB_Numeric))
- LB_type = LB_Other;
- }
-
- if (break_type == G_UNICODE_BREAK_CLOSE_PUNCTUATION ||
- break_type == G_UNICODE_BREAK_CLOSE_PARANTHESIS)
- {
- if (prev_LB_type == LB_Numeric)
- LB_type = LB_Numeric_Close;
- else
- LB_type = LB_Other;
- }
-
- if (break_type == G_UNICODE_BREAK_REGIONAL_INDICATOR)
- {
- if (prev_LB_type == LB_RI_Odd)
- LB_type = LB_RI_Even;
- else
- LB_type = LB_RI_Odd;
- }
-
- attrs[i].is_line_break = TRUE; /* Rule LB31 */
- /* Unicode doesn't specify char wrap;
- we wrap around all chars currently. */
- if (attrs[i].is_cursor_position)
- attrs[i].is_char_break = TRUE;
-
- /* Make any necessary replacements first */
- if (row_break_type == G_UNICODE_BREAK_UNKNOWN)
- row_break_type = G_UNICODE_BREAK_ALPHABETIC;
-
- /* add the line break rules in reverse order to override
- the lower priority rules. */
-
- /* Rule LB30 */
- if ((prev_break_type == G_UNICODE_BREAK_ALPHABETIC ||
- prev_break_type == G_UNICODE_BREAK_HEBREW_LETTER ||
- prev_break_type == G_UNICODE_BREAK_NUMERIC) &&
- break_type == G_UNICODE_BREAK_OPEN_PUNCTUATION &&
- !_pango_is_EastAsianWide (wc))
- break_op = BREAK_PROHIBITED;
-
- if (prev_break_type == G_UNICODE_BREAK_CLOSE_PARANTHESIS &&
- !_pango_is_EastAsianWide (prev_wc)&&
- (break_type == G_UNICODE_BREAK_ALPHABETIC ||
- break_type == G_UNICODE_BREAK_HEBREW_LETTER ||
- break_type == G_UNICODE_BREAK_NUMERIC))
- break_op = BREAK_PROHIBITED;
-
- /* Rule LB30a */
- if (prev_LB_type == LB_RI_Odd && LB_type == LB_RI_Even)
- break_op = BREAK_PROHIBITED;
-
- /* Rule LB30b */
- if (prev_break_type == G_UNICODE_BREAK_EMOJI_BASE &&
- break_type == G_UNICODE_BREAK_EMOJI_MODIFIER)
- break_op = BREAK_PROHIBITED;
-
- if ((_pango_Is_Emoji_Extended_Pictographic (prev_wc) &&
- g_unichar_type (prev_wc) == G_UNICODE_UNASSIGNED) &&
- break_type == G_UNICODE_BREAK_EMOJI_MODIFIER)
- break_op = BREAK_PROHIBITED;
-
- /* Rule LB29 */
- if (prev_break_type == G_UNICODE_BREAK_INFIX_SEPARATOR &&
- (break_type == G_UNICODE_BREAK_ALPHABETIC ||
- break_type == G_UNICODE_BREAK_HEBREW_LETTER))
- break_op = BREAK_PROHIBITED;
-
- /* Rule LB28 */
- if ((prev_break_type == G_UNICODE_BREAK_ALPHABETIC ||
- prev_break_type == G_UNICODE_BREAK_HEBREW_LETTER) &&
- (break_type == G_UNICODE_BREAK_ALPHABETIC ||
- break_type == G_UNICODE_BREAK_HEBREW_LETTER))
- break_op = BREAK_PROHIBITED;
-
- /* Rule LB27 */
- if ((prev_break_type == G_UNICODE_BREAK_HANGUL_L_JAMO ||
- prev_break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
- prev_break_type == G_UNICODE_BREAK_HANGUL_T_JAMO ||
- prev_break_type == G_UNICODE_BREAK_HANGUL_LV_SYLLABLE ||
- prev_break_type == G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE) &&
- break_type == G_UNICODE_BREAK_POSTFIX)
- break_op = BREAK_PROHIBITED;
-
- if (prev_break_type == G_UNICODE_BREAK_PREFIX &&
- (break_type == G_UNICODE_BREAK_HANGUL_L_JAMO ||
- break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
- break_type == G_UNICODE_BREAK_HANGUL_T_JAMO ||
- break_type == G_UNICODE_BREAK_HANGUL_LV_SYLLABLE ||
- break_type == G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE))
- break_op = BREAK_PROHIBITED;
-
- /* Rule LB26 */
- if (prev_break_type == G_UNICODE_BREAK_HANGUL_L_JAMO &&
- (break_type == G_UNICODE_BREAK_HANGUL_L_JAMO ||
- break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
- break_type == G_UNICODE_BREAK_HANGUL_LV_SYLLABLE ||
- break_type == G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE))
- break_op = BREAK_PROHIBITED;
-
- if ((prev_break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
- prev_break_type == G_UNICODE_BREAK_HANGUL_LV_SYLLABLE) &&
- (break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
- break_type == G_UNICODE_BREAK_HANGUL_T_JAMO))
- break_op = BREAK_PROHIBITED;
-
- if ((prev_break_type == G_UNICODE_BREAK_HANGUL_T_JAMO ||
- prev_break_type == G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE) &&
- break_type == G_UNICODE_BREAK_HANGUL_T_JAMO)
- break_op = BREAK_PROHIBITED;
-
- /* Rule LB25 with Example 7 of Customization */
- if ((prev_break_type == G_UNICODE_BREAK_PREFIX ||
- prev_break_type == G_UNICODE_BREAK_POSTFIX) &&
- break_type == G_UNICODE_BREAK_NUMERIC)
- break_op = BREAK_PROHIBITED;
-
- if ((prev_break_type == G_UNICODE_BREAK_PREFIX ||
- prev_break_type == G_UNICODE_BREAK_POSTFIX) &&
- (break_type == G_UNICODE_BREAK_OPEN_PUNCTUATION ||
- break_type == G_UNICODE_BREAK_HYPHEN) &&
- next_break_type == G_UNICODE_BREAK_NUMERIC)
- break_op = BREAK_PROHIBITED;
-
- if ((prev_break_type == G_UNICODE_BREAK_OPEN_PUNCTUATION ||
- prev_break_type == G_UNICODE_BREAK_HYPHEN) &&
- break_type == G_UNICODE_BREAK_NUMERIC)
- break_op = BREAK_PROHIBITED;
-
- if (prev_break_type == G_UNICODE_BREAK_NUMERIC &&
- (break_type == G_UNICODE_BREAK_NUMERIC ||
- break_type == G_UNICODE_BREAK_SYMBOL ||
- break_type == G_UNICODE_BREAK_INFIX_SEPARATOR))
- break_op = BREAK_PROHIBITED;
-
- if (prev_LB_type == LB_Numeric &&
- (break_type == G_UNICODE_BREAK_NUMERIC ||
- break_type == G_UNICODE_BREAK_SYMBOL ||
- break_type == G_UNICODE_BREAK_INFIX_SEPARATOR ||
- break_type == G_UNICODE_BREAK_CLOSE_PUNCTUATION ||
- break_type == G_UNICODE_BREAK_CLOSE_PARANTHESIS))
- break_op = BREAK_PROHIBITED;
-
- if ((prev_LB_type == LB_Numeric ||
- prev_LB_type == LB_Numeric_Close) &&
- (break_type == G_UNICODE_BREAK_POSTFIX ||
- break_type == G_UNICODE_BREAK_PREFIX))
- break_op = BREAK_PROHIBITED;
-
- /* Rule LB24 */
- if ((prev_break_type == G_UNICODE_BREAK_PREFIX ||
- prev_break_type == G_UNICODE_BREAK_POSTFIX) &&
- (break_type == G_UNICODE_BREAK_ALPHABETIC ||
- break_type == G_UNICODE_BREAK_HEBREW_LETTER))
- break_op = BREAK_PROHIBITED;
-
- if ((prev_break_type == G_UNICODE_BREAK_ALPHABETIC ||
- prev_break_type == G_UNICODE_BREAK_HEBREW_LETTER) &&
- (break_type == G_UNICODE_BREAK_PREFIX ||
- break_type == G_UNICODE_BREAK_POSTFIX))
- break_op = BREAK_PROHIBITED;
-
- /* Rule LB23 */
- if ((prev_break_type == G_UNICODE_BREAK_ALPHABETIC ||
- prev_break_type == G_UNICODE_BREAK_HEBREW_LETTER) &&
- break_type == G_UNICODE_BREAK_NUMERIC)
- break_op = BREAK_PROHIBITED;
-
- if (prev_break_type == G_UNICODE_BREAK_NUMERIC &&
- (break_type == G_UNICODE_BREAK_ALPHABETIC ||
- break_type == G_UNICODE_BREAK_HEBREW_LETTER))
- break_op = BREAK_PROHIBITED;
-
- /* Rule LB23a */
- if (prev_break_type == G_UNICODE_BREAK_PREFIX &&
- (break_type == G_UNICODE_BREAK_IDEOGRAPHIC ||
- break_type == G_UNICODE_BREAK_EMOJI_BASE ||
- break_type == G_UNICODE_BREAK_EMOJI_MODIFIER))
- break_op = BREAK_PROHIBITED;
-
- if ((prev_break_type == G_UNICODE_BREAK_IDEOGRAPHIC ||
- prev_break_type == G_UNICODE_BREAK_EMOJI_BASE ||
- prev_break_type == G_UNICODE_BREAK_EMOJI_MODIFIER) &&
- break_type == G_UNICODE_BREAK_POSTFIX)
- break_op = BREAK_PROHIBITED;
-
- /* Rule LB22 */
- if (break_type == G_UNICODE_BREAK_INSEPARABLE)
- break_op = BREAK_PROHIBITED;
-
- if (break_type == G_UNICODE_BREAK_AFTER ||
- break_type == G_UNICODE_BREAK_HYPHEN ||
- break_type == G_UNICODE_BREAK_NON_STARTER ||
- prev_break_type == G_UNICODE_BREAK_BEFORE)
- break_op = BREAK_PROHIBITED; /* Rule LB21 */
-
- if (prev_prev_break_type == G_UNICODE_BREAK_HEBREW_LETTER &&
- (prev_break_type == G_UNICODE_BREAK_HYPHEN ||
- prev_break_type == G_UNICODE_BREAK_AFTER))
- break_op = BREAK_PROHIBITED; /* Rule LB21a */
-
- if (prev_break_type == G_UNICODE_BREAK_SYMBOL &&
- break_type == G_UNICODE_BREAK_HEBREW_LETTER)
- break_op = BREAK_PROHIBITED; /* Rule LB21b */
-
- if (prev_break_type == G_UNICODE_BREAK_CONTINGENT ||
- break_type == G_UNICODE_BREAK_CONTINGENT)
- break_op = BREAK_ALLOWED; /* Rule LB20 */
-
- if (prev_break_type == G_UNICODE_BREAK_QUOTATION ||
- break_type == G_UNICODE_BREAK_QUOTATION)
- break_op = BREAK_PROHIBITED; /* Rule LB19 */
-
- /* handle related rules for Space as state machine here,
- and override the pair table result. */
- if (prev_break_type == G_UNICODE_BREAK_SPACE) /* Rule LB18 */
- break_op = BREAK_ALLOWED;
-
- if (row_break_type == G_UNICODE_BREAK_BEFORE_AND_AFTER &&
- break_type == G_UNICODE_BREAK_BEFORE_AND_AFTER)
- break_op = BREAK_PROHIBITED; /* Rule LB17 */
-
- if ((row_break_type == G_UNICODE_BREAK_CLOSE_PUNCTUATION ||
- row_break_type == G_UNICODE_BREAK_CLOSE_PARANTHESIS) &&
- break_type == G_UNICODE_BREAK_NON_STARTER)
- break_op = BREAK_PROHIBITED; /* Rule LB16 */
-
- if (row_break_type == G_UNICODE_BREAK_QUOTATION &&
- break_type == G_UNICODE_BREAK_OPEN_PUNCTUATION)
- break_op = BREAK_PROHIBITED; /* Rule LB15 */
-
- if (row_break_type == G_UNICODE_BREAK_OPEN_PUNCTUATION)
- break_op = BREAK_PROHIBITED; /* Rule LB14 */
-
- /* Rule LB13 with Example 7 of Customization */
- if (break_type == G_UNICODE_BREAK_EXCLAMATION)
- break_op = BREAK_PROHIBITED;
-
- if (prev_break_type != G_UNICODE_BREAK_NUMERIC &&
- (break_type == G_UNICODE_BREAK_CLOSE_PUNCTUATION ||
- break_type == G_UNICODE_BREAK_CLOSE_PARANTHESIS ||
- break_type == G_UNICODE_BREAK_INFIX_SEPARATOR ||
- break_type == G_UNICODE_BREAK_SYMBOL))
- break_op = BREAK_PROHIBITED;
-
- if (prev_break_type == G_UNICODE_BREAK_NON_BREAKING_GLUE)
- break_op = BREAK_PROHIBITED; /* Rule LB12 */
-
- if (break_type == G_UNICODE_BREAK_NON_BREAKING_GLUE &&
- (prev_break_type != G_UNICODE_BREAK_SPACE &&
- prev_break_type != G_UNICODE_BREAK_AFTER &&
- prev_break_type != G_UNICODE_BREAK_HYPHEN))
- break_op = BREAK_PROHIBITED; /* Rule LB12a */
-
- if (prev_break_type == G_UNICODE_BREAK_WORD_JOINER ||
- break_type == G_UNICODE_BREAK_WORD_JOINER)
- break_op = BREAK_PROHIBITED; /* Rule LB11 */
-
-
- /* Rule LB9 */
- if (break_type == G_UNICODE_BREAK_COMBINING_MARK ||
+ break_type == G_UNICODE_BREAK_COMBINING_MARK ||
+ break_type == G_UNICODE_BREAK_ZERO_WIDTH_JOINER ||
+ break_type == G_UNICODE_BREAK_HANGUL_L_JAMO ||
+ break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
+ break_type == G_UNICODE_BREAK_HANGUL_T_JAMO ||
+ break_type == G_UNICODE_BREAK_HANGUL_LV_SYLLABLE ||
+ break_type == G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE ||
+ break_type == G_UNICODE_BREAK_EMOJI_MODIFIER ||
+ break_type == G_UNICODE_BREAK_REGIONAL_INDICATOR)
+ {
+ LineBreakType LB_type;
+
+ /* Find the LineBreakType of wc */
+ LB_type = LB_Other;
+
+ if (break_type == G_UNICODE_BREAK_NUMERIC)
+ LB_type = LB_Numeric;
+
+ if (break_type == G_UNICODE_BREAK_SYMBOL ||
+ break_type == G_UNICODE_BREAK_INFIX_SEPARATOR)
+ {
+ if (!(prev_LB_type == LB_Numeric))
+ LB_type = LB_Other;
+ }
+
+ if (break_type == G_UNICODE_BREAK_CLOSE_PUNCTUATION ||
+ break_type == G_UNICODE_BREAK_CLOSE_PARANTHESIS)
+ {
+ if (prev_LB_type == LB_Numeric)
+ LB_type = LB_Numeric_Close;
+ else
+ LB_type = LB_Other;
+ }
+
+ if (break_type == G_UNICODE_BREAK_REGIONAL_INDICATOR)
+ {
+ if (prev_LB_type == LB_RI_Odd)
+ LB_type = LB_RI_Even;
+ else
+ LB_type = LB_RI_Odd;
+ }
+
+ attrs[i].is_line_break = TRUE; /* Rule LB31 */
+ /* Unicode doesn't specify char wrap;
+ we wrap around all chars currently. */
+ if (attrs[i].is_cursor_position)
+ attrs[i].is_char_break = TRUE;
+
+ /* Make any necessary replacements first */
+ if (row_break_type == G_UNICODE_BREAK_UNKNOWN)
+ row_break_type = G_UNICODE_BREAK_ALPHABETIC;
+
+ /* add the line break rules in reverse order to override
+ the lower priority rules. */
+
+ /* Rule LB30 */
+ if ((prev_break_type == G_UNICODE_BREAK_ALPHABETIC ||
+ prev_break_type == G_UNICODE_BREAK_HEBREW_LETTER ||
+ prev_break_type == G_UNICODE_BREAK_NUMERIC) &&
+ break_type == G_UNICODE_BREAK_OPEN_PUNCTUATION &&
+ !_pango2_is_EastAsianWide (wc))
+ break_op = BREAK_PROHIBITED;
+
+ if (prev_break_type == G_UNICODE_BREAK_CLOSE_PARANTHESIS &&
+ !_pango2_is_EastAsianWide (prev_wc)&&
+ (break_type == G_UNICODE_BREAK_ALPHABETIC ||
+ break_type == G_UNICODE_BREAK_HEBREW_LETTER ||
+ break_type == G_UNICODE_BREAK_NUMERIC))
+ break_op = BREAK_PROHIBITED;
+
+ /* Rule LB30a */
+ if (prev_LB_type == LB_RI_Odd && LB_type == LB_RI_Even)
+ break_op = BREAK_PROHIBITED;
+
+ /* Rule LB30b */
+ if (prev_break_type == G_UNICODE_BREAK_EMOJI_BASE &&
+ break_type == G_UNICODE_BREAK_EMOJI_MODIFIER)
+ break_op = BREAK_PROHIBITED;
+
+ if ((_pango2_Is_Emoji_Extended_Pictographic (prev_wc) &&
+ g_unichar_type (prev_wc) == G_UNICODE_UNASSIGNED) &&
+ break_type == G_UNICODE_BREAK_EMOJI_MODIFIER)
+ break_op = BREAK_PROHIBITED;
+
+ /* Rule LB29 */
+ if (prev_break_type == G_UNICODE_BREAK_INFIX_SEPARATOR &&
+ (break_type == G_UNICODE_BREAK_ALPHABETIC ||
+ break_type == G_UNICODE_BREAK_HEBREW_LETTER))
+ break_op = BREAK_PROHIBITED;
+
+ /* Rule LB28 */
+ if ((prev_break_type == G_UNICODE_BREAK_ALPHABETIC ||
+ prev_break_type == G_UNICODE_BREAK_HEBREW_LETTER) &&
+ (break_type == G_UNICODE_BREAK_ALPHABETIC ||
+ break_type == G_UNICODE_BREAK_HEBREW_LETTER))
+ break_op = BREAK_PROHIBITED;
+
+ /* Rule LB27 */
+ if ((prev_break_type == G_UNICODE_BREAK_HANGUL_L_JAMO ||
+ prev_break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
+ prev_break_type == G_UNICODE_BREAK_HANGUL_T_JAMO ||
+ prev_break_type == G_UNICODE_BREAK_HANGUL_LV_SYLLABLE ||
+ prev_break_type == G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE) &&
+ break_type == G_UNICODE_BREAK_POSTFIX)
+ break_op = BREAK_PROHIBITED;
+
+ if (prev_break_type == G_UNICODE_BREAK_PREFIX &&
+ (break_type == G_UNICODE_BREAK_HANGUL_L_JAMO ||
+ break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
+ break_type == G_UNICODE_BREAK_HANGUL_T_JAMO ||
+ break_type == G_UNICODE_BREAK_HANGUL_LV_SYLLABLE ||
+ break_type == G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE))
+ break_op = BREAK_PROHIBITED;
+
+ /* Rule LB26 */
+ if (prev_break_type == G_UNICODE_BREAK_HANGUL_L_JAMO &&
+ (break_type == G_UNICODE_BREAK_HANGUL_L_JAMO ||
+ break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
+ break_type == G_UNICODE_BREAK_HANGUL_LV_SYLLABLE ||
+ break_type == G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE))
+ break_op = BREAK_PROHIBITED;
+
+ if ((prev_break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
+ prev_break_type == G_UNICODE_BREAK_HANGUL_LV_SYLLABLE) &&
+ (break_type == G_UNICODE_BREAK_HANGUL_V_JAMO ||
+ break_type == G_UNICODE_BREAK_HANGUL_T_JAMO))
+ break_op = BREAK_PROHIBITED;
+
+ if ((prev_break_type == G_UNICODE_BREAK_HANGUL_T_JAMO ||
+ prev_break_type == G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE) &&
+ break_type == G_UNICODE_BREAK_HANGUL_T_JAMO)
+ break_op = BREAK_PROHIBITED;
+
+ /* Rule LB25 with Example 7 of Customization */
+ if ((prev_break_type == G_UNICODE_BREAK_PREFIX ||
+ prev_break_type == G_UNICODE_BREAK_POSTFIX) &&
+ break_type == G_UNICODE_BREAK_NUMERIC)
+ break_op = BREAK_PROHIBITED;
+
+ if ((prev_break_type == G_UNICODE_BREAK_PREFIX ||
+ prev_break_type == G_UNICODE_BREAK_POSTFIX) &&
+ (break_type == G_UNICODE_BREAK_OPEN_PUNCTUATION ||
+ break_type == G_UNICODE_BREAK_HYPHEN) &&
+ next_break_type == G_UNICODE_BREAK_NUMERIC)
+ break_op = BREAK_PROHIBITED;
+
+ if ((prev_break_type == G_UNICODE_BREAK_OPEN_PUNCTUATION ||
+ prev_break_type == G_UNICODE_BREAK_HYPHEN) &&
+ break_type == G_UNICODE_BREAK_NUMERIC)
+ break_op = BREAK_PROHIBITED;
+
+ if (prev_break_type == G_UNICODE_BREAK_NUMERIC &&
+ (break_type == G_UNICODE_BREAK_NUMERIC ||
+ break_type == G_UNICODE_BREAK_SYMBOL ||
+ break_type == G_UNICODE_BREAK_INFIX_SEPARATOR))
+ break_op = BREAK_PROHIBITED;
+
+ if (prev_LB_type == LB_Numeric &&
+ (break_type == G_UNICODE_BREAK_NUMERIC ||
+ break_type == G_UNICODE_BREAK_SYMBOL ||
+ break_type == G_UNICODE_BREAK_INFIX_SEPARATOR ||
+ break_type == G_UNICODE_BREAK_CLOSE_PUNCTUATION ||
+ break_type == G_UNICODE_BREAK_CLOSE_PARANTHESIS))
+ break_op = BREAK_PROHIBITED;
+
+ if ((prev_LB_type == LB_Numeric ||
+ prev_LB_type == LB_Numeric_Close) &&
+ (break_type == G_UNICODE_BREAK_POSTFIX ||
+ break_type == G_UNICODE_BREAK_PREFIX))
+ break_op = BREAK_PROHIBITED;
+
+ /* Rule LB24 */
+ if ((prev_break_type == G_UNICODE_BREAK_PREFIX ||
+ prev_break_type == G_UNICODE_BREAK_POSTFIX) &&
+ (break_type == G_UNICODE_BREAK_ALPHABETIC ||
+ break_type == G_UNICODE_BREAK_HEBREW_LETTER))
+ break_op = BREAK_PROHIBITED;
+
+ if ((prev_break_type == G_UNICODE_BREAK_ALPHABETIC ||
+ prev_break_type == G_UNICODE_BREAK_HEBREW_LETTER) &&
+ (break_type == G_UNICODE_BREAK_PREFIX ||
+ break_type == G_UNICODE_BREAK_POSTFIX))
+ break_op = BREAK_PROHIBITED;
+
+ /* Rule LB23 */
+ if ((prev_break_type == G_UNICODE_BREAK_ALPHABETIC ||
+ prev_break_type == G_UNICODE_BREAK_HEBREW_LETTER) &&
+ break_type == G_UNICODE_BREAK_NUMERIC)
+ break_op = BREAK_PROHIBITED;
+
+ if (prev_break_type == G_UNICODE_BREAK_NUMERIC &&
+ (break_type == G_UNICODE_BREAK_ALPHABETIC ||
+ break_type == G_UNICODE_BREAK_HEBREW_LETTER))
+ break_op = BREAK_PROHIBITED;
+
+ /* Rule LB23a */
+ if (prev_break_type == G_UNICODE_BREAK_PREFIX &&
+ (break_type == G_UNICODE_BREAK_IDEOGRAPHIC ||
+ break_type == G_UNICODE_BREAK_EMOJI_BASE ||
+ break_type == G_UNICODE_BREAK_EMOJI_MODIFIER))
+ break_op = BREAK_PROHIBITED;
+
+ if ((prev_break_type == G_UNICODE_BREAK_IDEOGRAPHIC ||
+ prev_break_type == G_UNICODE_BREAK_EMOJI_BASE ||
+ prev_break_type == G_UNICODE_BREAK_EMOJI_MODIFIER) &&
+ break_type == G_UNICODE_BREAK_POSTFIX)
+ break_op = BREAK_PROHIBITED;
+
+ /* Rule LB22 */
+ if (break_type == G_UNICODE_BREAK_INSEPARABLE)
+ break_op = BREAK_PROHIBITED;
+
+ if (break_type == G_UNICODE_BREAK_AFTER ||
+ break_type == G_UNICODE_BREAK_HYPHEN ||
+ break_type == G_UNICODE_BREAK_NON_STARTER ||
+ prev_break_type == G_UNICODE_BREAK_BEFORE)
+ break_op = BREAK_PROHIBITED; /* Rule LB21 */
+
+ if (prev_prev_break_type == G_UNICODE_BREAK_HEBREW_LETTER &&
+ (prev_break_type == G_UNICODE_BREAK_HYPHEN ||
+ prev_break_type == G_UNICODE_BREAK_AFTER))
+ break_op = BREAK_PROHIBITED; /* Rule LB21a */
+
+ if (prev_break_type == G_UNICODE_BREAK_SYMBOL &&
+ break_type == G_UNICODE_BREAK_HEBREW_LETTER)
+ break_op = BREAK_PROHIBITED; /* Rule LB21b */
+
+ if (prev_break_type == G_UNICODE_BREAK_CONTINGENT ||
+ break_type == G_UNICODE_BREAK_CONTINGENT)
+ break_op = BREAK_ALLOWED; /* Rule LB20 */
+
+ if (prev_break_type == G_UNICODE_BREAK_QUOTATION ||
+ break_type == G_UNICODE_BREAK_QUOTATION)
+ break_op = BREAK_PROHIBITED; /* Rule LB19 */
+
+ /* handle related rules for Space as state machine here,
+ and override the pair table result. */
+ if (prev_break_type == G_UNICODE_BREAK_SPACE) /* Rule LB18 */
+ break_op = BREAK_ALLOWED;
+
+ if (row_break_type == G_UNICODE_BREAK_BEFORE_AND_AFTER &&
+ break_type == G_UNICODE_BREAK_BEFORE_AND_AFTER)
+ break_op = BREAK_PROHIBITED; /* Rule LB17 */
+
+ if ((row_break_type == G_UNICODE_BREAK_CLOSE_PUNCTUATION ||
+ row_break_type == G_UNICODE_BREAK_CLOSE_PARANTHESIS) &&
+ break_type == G_UNICODE_BREAK_NON_STARTER)
+ break_op = BREAK_PROHIBITED; /* Rule LB16 */
+
+ if (row_break_type == G_UNICODE_BREAK_QUOTATION &&
+ break_type == G_UNICODE_BREAK_OPEN_PUNCTUATION)
+ break_op = BREAK_PROHIBITED; /* Rule LB15 */
+
+ if (row_break_type == G_UNICODE_BREAK_OPEN_PUNCTUATION)
+ break_op = BREAK_PROHIBITED; /* Rule LB14 */
+
+ /* Rule LB13 with Example 7 of Customization */
+ if (break_type == G_UNICODE_BREAK_EXCLAMATION)
+ break_op = BREAK_PROHIBITED;
+
+ if (prev_break_type != G_UNICODE_BREAK_NUMERIC &&
+ (break_type == G_UNICODE_BREAK_CLOSE_PUNCTUATION ||
+ break_type == G_UNICODE_BREAK_CLOSE_PARANTHESIS ||
+ break_type == G_UNICODE_BREAK_INFIX_SEPARATOR ||
+ break_type == G_UNICODE_BREAK_SYMBOL))
+ break_op = BREAK_PROHIBITED;
+
+ if (prev_break_type == G_UNICODE_BREAK_NON_BREAKING_GLUE)
+ break_op = BREAK_PROHIBITED; /* Rule LB12 */
+
+ if (break_type == G_UNICODE_BREAK_NON_BREAKING_GLUE &&
+ (prev_break_type != G_UNICODE_BREAK_SPACE &&
+ prev_break_type != G_UNICODE_BREAK_AFTER &&
+ prev_break_type != G_UNICODE_BREAK_HYPHEN))
+ break_op = BREAK_PROHIBITED; /* Rule LB12a */
+
+ if (prev_break_type == G_UNICODE_BREAK_WORD_JOINER ||
+ break_type == G_UNICODE_BREAK_WORD_JOINER)
+ break_op = BREAK_PROHIBITED; /* Rule LB11 */
+
+
+ /* Rule LB9 */
+ if (break_type == G_UNICODE_BREAK_COMBINING_MARK ||
break_type == G_UNICODE_BREAK_ZERO_WIDTH_JOINER)
- {
- if (!(prev_break_type == G_UNICODE_BREAK_MANDATORY ||
- prev_break_type == G_UNICODE_BREAK_CARRIAGE_RETURN ||
- prev_break_type == G_UNICODE_BREAK_LINE_FEED ||
- prev_break_type == G_UNICODE_BREAK_NEXT_LINE ||
- prev_break_type == G_UNICODE_BREAK_SPACE ||
- prev_break_type == G_UNICODE_BREAK_ZERO_WIDTH_SPACE))
- break_op = BREAK_PROHIBITED;
- }
-
- if (row_break_type == G_UNICODE_BREAK_ZERO_WIDTH_SPACE)
- break_op = BREAK_ALLOWED; /* Rule LB8 */
-
- if (prev_wc == 0x200D)
- break_op = BREAK_PROHIBITED; /* Rule LB8a */
-
- if (break_type == G_UNICODE_BREAK_SPACE ||
- break_type == G_UNICODE_BREAK_ZERO_WIDTH_SPACE)
- break_op = BREAK_PROHIBITED; /* Rule LB7 */
-
- /* Rule LB6 */
- if (break_type == G_UNICODE_BREAK_MANDATORY ||
- break_type == G_UNICODE_BREAK_CARRIAGE_RETURN ||
- break_type == G_UNICODE_BREAK_LINE_FEED ||
- break_type == G_UNICODE_BREAK_NEXT_LINE)
- break_op = BREAK_PROHIBITED;
-
- /* Rules LB4 and LB5 */
- if (prev_break_type == G_UNICODE_BREAK_MANDATORY ||
- (prev_break_type == G_UNICODE_BREAK_CARRIAGE_RETURN &&
- wc != '\n') ||
- prev_break_type == G_UNICODE_BREAK_LINE_FEED ||
- prev_break_type == G_UNICODE_BREAK_NEXT_LINE)
- {
- attrs[i].is_mandatory_break = TRUE;
- break_op = BREAK_ALLOWED;
- }
-
- switch (break_op)
- {
- case BREAK_PROHIBITED:
- /* can't break here */
- attrs[i].is_line_break = FALSE;
- break;
-
- case BREAK_IF_SPACES:
- /* break if prev char was space */
- if (prev_break_type != G_UNICODE_BREAK_SPACE)
- attrs[i].is_line_break = FALSE;
- break;
-
- case BREAK_ALLOWED:
- attrs[i].is_line_break = TRUE;
- break;
-
- case BREAK_ALREADY_HANDLED:
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- /* Rule LB9 */
- if (!(break_type == G_UNICODE_BREAK_COMBINING_MARK ||
- break_type == G_UNICODE_BREAK_ZERO_WIDTH_JOINER))
- {
- /* Rule LB25 with Example 7 of Customization */
- if (break_type == G_UNICODE_BREAK_NUMERIC ||
- break_type == G_UNICODE_BREAK_SYMBOL ||
- break_type == G_UNICODE_BREAK_INFIX_SEPARATOR)
- {
- if (prev_LB_type != LB_Numeric)
- prev_LB_type = LB_type;
- /* else don't change the prev_LB_type */
- }
- else
- {
- prev_LB_type = LB_type;
- }
- }
- /* else don't change the prev_LB_type for Rule LB9 */
- }
+ {
+ if (!(prev_break_type == G_UNICODE_BREAK_MANDATORY ||
+ prev_break_type == G_UNICODE_BREAK_CARRIAGE_RETURN ||
+ prev_break_type == G_UNICODE_BREAK_LINE_FEED ||
+ prev_break_type == G_UNICODE_BREAK_NEXT_LINE ||
+ prev_break_type == G_UNICODE_BREAK_SPACE ||
+ prev_break_type == G_UNICODE_BREAK_ZERO_WIDTH_SPACE))
+ break_op = BREAK_PROHIBITED;
+ }
+
+ if (row_break_type == G_UNICODE_BREAK_ZERO_WIDTH_SPACE)
+ break_op = BREAK_ALLOWED; /* Rule LB8 */
+
+ if (prev_wc == 0x200D)
+ break_op = BREAK_PROHIBITED; /* Rule LB8a */
+
+ if (break_type == G_UNICODE_BREAK_SPACE ||
+ break_type == G_UNICODE_BREAK_ZERO_WIDTH_SPACE)
+ break_op = BREAK_PROHIBITED; /* Rule LB7 */
+
+ /* Rule LB6 */
+ if (break_type == G_UNICODE_BREAK_MANDATORY ||
+ break_type == G_UNICODE_BREAK_CARRIAGE_RETURN ||
+ break_type == G_UNICODE_BREAK_LINE_FEED ||
+ break_type == G_UNICODE_BREAK_NEXT_LINE)
+ break_op = BREAK_PROHIBITED;
+
+ /* Rules LB4 and LB5 */
+ if (prev_break_type == G_UNICODE_BREAK_MANDATORY ||
+ (prev_break_type == G_UNICODE_BREAK_CARRIAGE_RETURN &&
+ wc != '\n') ||
+ prev_break_type == G_UNICODE_BREAK_LINE_FEED ||
+ prev_break_type == G_UNICODE_BREAK_NEXT_LINE)
+ {
+ attrs[i].is_mandatory_break = TRUE;
+ break_op = BREAK_ALLOWED;
+ }
+
+ switch (break_op)
+ {
+ case BREAK_PROHIBITED:
+ /* can't break here */
+ attrs[i].is_line_break = FALSE;
+ break;
+
+ case BREAK_IF_SPACES:
+ /* break if prev char was space */
+ if (prev_break_type != G_UNICODE_BREAK_SPACE)
+ attrs[i].is_line_break = FALSE;
+ break;
+
+ case BREAK_ALLOWED:
+ attrs[i].is_line_break = TRUE;
+ break;
+
+ case BREAK_ALREADY_HANDLED:
+ break;
+
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ /* Rule LB9 */
+ if (!(break_type == G_UNICODE_BREAK_COMBINING_MARK ||
+ break_type == G_UNICODE_BREAK_ZERO_WIDTH_JOINER))
+ {
+ /* Rule LB25 with Example 7 of Customization */
+ if (break_type == G_UNICODE_BREAK_NUMERIC ||
+ break_type == G_UNICODE_BREAK_SYMBOL ||
+ break_type == G_UNICODE_BREAK_INFIX_SEPARATOR)
+ {
+ if (prev_LB_type != LB_Numeric)
+ prev_LB_type = LB_type;
+ /* else don't change the prev_LB_type */
+ }
+ else
+ {
+ prev_LB_type = LB_type;
+ }
+ }
+ /* else don't change the prev_LB_type for Rule LB9 */
+ }
if (break_type != G_UNICODE_BREAK_SPACE)
- {
- /* Rule LB9 */
- if (break_type == G_UNICODE_BREAK_COMBINING_MARK ||
- break_type == G_UNICODE_BREAK_ZERO_WIDTH_JOINER)
- {
- if (i == 0 /* start of text */ ||
- prev_break_type == G_UNICODE_BREAK_MANDATORY ||
- prev_break_type == G_UNICODE_BREAK_CARRIAGE_RETURN ||
- prev_break_type == G_UNICODE_BREAK_LINE_FEED ||
- prev_break_type == G_UNICODE_BREAK_NEXT_LINE ||
- prev_break_type == G_UNICODE_BREAK_SPACE ||
- prev_break_type == G_UNICODE_BREAK_ZERO_WIDTH_SPACE)
- prev_break_type = G_UNICODE_BREAK_ALPHABETIC; /* Rule LB10 */
- /* else don't change the prev_break_type for Rule LB9 */
- }
- else
- {
- prev_prev_break_type = prev_break_type;
- prev_break_type = break_type;
- }
-
- prev_jamo = jamo;
- }
+ {
+ /* Rule LB9 */
+ if (break_type == G_UNICODE_BREAK_COMBINING_MARK ||
+ break_type == G_UNICODE_BREAK_ZERO_WIDTH_JOINER)
+ {
+ if (i == 0 /* start of text */ ||
+ prev_break_type == G_UNICODE_BREAK_MANDATORY ||
+ prev_break_type == G_UNICODE_BREAK_CARRIAGE_RETURN ||
+ prev_break_type == G_UNICODE_BREAK_LINE_FEED ||
+ prev_break_type == G_UNICODE_BREAK_NEXT_LINE ||
+ prev_break_type == G_UNICODE_BREAK_SPACE ||
+ prev_break_type == G_UNICODE_BREAK_ZERO_WIDTH_SPACE)
+ prev_break_type = G_UNICODE_BREAK_ALPHABETIC; /* Rule LB10 */
+ /* else don't change the prev_break_type for Rule LB9 */
+ }
+ else
+ {
+ prev_prev_break_type = prev_break_type;
+ prev_break_type = break_type;
+ }
+
+ prev_jamo = jamo;
+ }
else
- {
- if (prev_break_type != G_UNICODE_BREAK_SPACE)
- {
- prev_prev_break_type = prev_break_type;
- prev_break_type = break_type;
- }
- /* else don't change the prev_break_type */
- }
+ {
+ if (prev_break_type != G_UNICODE_BREAK_SPACE)
+ {
+ prev_prev_break_type = prev_break_type;
+ prev_break_type = break_type;
+ }
+ /* else don't change the prev_break_type */
+ }
/* ---- Word breaks ---- */
@@ -1453,117 +1453,117 @@ default_break (const char *text,
attrs[i].is_word_end = FALSE;
if (current_word_type != WordNone)
- {
- /* Check for a word end */
- switch ((int) type)
- {
- case G_UNICODE_SPACING_MARK:
- case G_UNICODE_ENCLOSING_MARK:
- case G_UNICODE_NON_SPACING_MARK:
- case G_UNICODE_FORMAT:
- /* nothing, we just eat these up as part of the word */
- break;
-
- case G_UNICODE_LOWERCASE_LETTER:
- case G_UNICODE_MODIFIER_LETTER:
- case G_UNICODE_OTHER_LETTER:
- case G_UNICODE_TITLECASE_LETTER:
- case G_UNICODE_UPPERCASE_LETTER:
- if (current_word_type == WordLetters)
- {
- /* Japanese special cases for ending the word */
- if (JAPANESE (last_word_letter) ||
- JAPANESE (wc))
- {
- if ((HIRAGANA (last_word_letter) &&
- !HIRAGANA (wc)) ||
- (KATAKANA (last_word_letter) &&
- !(KATAKANA (wc) || HIRAGANA (wc))) ||
- (KANJI (last_word_letter) &&
- !(HIRAGANA (wc) || KANJI (wc))) ||
- (JAPANESE (last_word_letter) &&
- !JAPANESE (wc)) ||
- (!JAPANESE (last_word_letter) &&
- JAPANESE (wc)))
- attrs[i].is_word_end = TRUE;
- }
- }
- last_word_letter = wc;
- break;
-
- case G_UNICODE_DECIMAL_NUMBER:
- case G_UNICODE_LETTER_NUMBER:
- case G_UNICODE_OTHER_NUMBER:
- last_word_letter = wc;
- break;
-
- default:
- /* Punctuation, control/format chars, etc. all end a word. */
- attrs[i].is_word_end = TRUE;
- current_word_type = WordNone;
- break;
- }
- }
+ {
+ /* Check for a word end */
+ switch ((int) type)
+ {
+ case G_UNICODE_SPACING_MARK:
+ case G_UNICODE_ENCLOSING_MARK:
+ case G_UNICODE_NON_SPACING_MARK:
+ case G_UNICODE_FORMAT:
+ /* nothing, we just eat these up as part of the word */
+ break;
+
+ case G_UNICODE_LOWERCASE_LETTER:
+ case G_UNICODE_MODIFIER_LETTER:
+ case G_UNICODE_OTHER_LETTER:
+ case G_UNICODE_TITLECASE_LETTER:
+ case G_UNICODE_UPPERCASE_LETTER:
+ if (current_word_type == WordLetters)
+ {
+ /* Japanese special cases for ending the word */
+ if (JAPANESE (last_word_letter) ||
+ JAPANESE (wc))
+ {
+ if ((HIRAGANA (last_word_letter) &&
+ !HIRAGANA (wc)) ||
+ (KATAKANA (last_word_letter) &&
+ !(KATAKANA (wc) || HIRAGANA (wc))) ||
+ (KANJI (last_word_letter) &&
+ !(HIRAGANA (wc) || KANJI (wc))) ||
+ (JAPANESE (last_word_letter) &&
+ !JAPANESE (wc)) ||
+ (!JAPANESE (last_word_letter) &&
+ JAPANESE (wc)))
+ attrs[i].is_word_end = TRUE;
+ }
+ }
+ last_word_letter = wc;
+ break;
+
+ case G_UNICODE_DECIMAL_NUMBER:
+ case G_UNICODE_LETTER_NUMBER:
+ case G_UNICODE_OTHER_NUMBER:
+ last_word_letter = wc;
+ break;
+
+ default:
+ /* Punctuation, control/format chars, etc. all end a word. */
+ attrs[i].is_word_end = TRUE;
+ current_word_type = WordNone;
+ break;
+ }
+ }
else
- {
- /* Check for a word start */
- switch ((int) type)
- {
- case G_UNICODE_LOWERCASE_LETTER:
- case G_UNICODE_MODIFIER_LETTER:
- case G_UNICODE_OTHER_LETTER:
- case G_UNICODE_TITLECASE_LETTER:
- case G_UNICODE_UPPERCASE_LETTER:
- current_word_type = WordLetters;
- last_word_letter = wc;
- attrs[i].is_word_start = TRUE;
- break;
-
- case G_UNICODE_DECIMAL_NUMBER:
- case G_UNICODE_LETTER_NUMBER:
- case G_UNICODE_OTHER_NUMBER:
- current_word_type = WordNumbers;
- last_word_letter = wc;
- attrs[i].is_word_start = TRUE;
- break;
-
- default:
- /* No word here */
- break;
- }
- }
+ {
+ /* Check for a word start */
+ switch ((int) type)
+ {
+ case G_UNICODE_LOWERCASE_LETTER:
+ case G_UNICODE_MODIFIER_LETTER:
+ case G_UNICODE_OTHER_LETTER:
+ case G_UNICODE_TITLECASE_LETTER:
+ case G_UNICODE_UPPERCASE_LETTER:
+ current_word_type = WordLetters;
+ last_word_letter = wc;
+ attrs[i].is_word_start = TRUE;
+ break;
+
+ case G_UNICODE_DECIMAL_NUMBER:
+ case G_UNICODE_LETTER_NUMBER:
+ case G_UNICODE_OTHER_NUMBER:
+ current_word_type = WordNumbers;
+ last_word_letter = wc;
+ attrs[i].is_word_start = TRUE;
+ break;
+
+ default:
+ /* No word here */
+ break;
+ }
+ }
/* ---- Sentence breaks ---- */
{
- /* default to not a sentence start/end */
- attrs[i].is_sentence_start = FALSE;
- attrs[i].is_sentence_end = FALSE;
-
- /* maybe start sentence */
- if (last_sentence_start == -1 && !is_sentence_boundary)
- last_sentence_start = i - 1;
-
- /* remember last non space character position */
- if (i > 0 && !attrs[i - 1].is_white)
- last_non_space = i;
-
- /* meets sentence end, mark both sentence start and end */
- if (last_sentence_start != -1 && is_sentence_boundary) {
- if (last_non_space >= last_sentence_start) {
- attrs[last_sentence_start].is_sentence_start = TRUE;
- attrs[last_non_space].is_sentence_end = TRUE;
- }
-
- last_sentence_start = -1;
- last_non_space = -1;
- }
-
- /* meets space character, move sentence start */
- if (last_sentence_start != -1 &&
- last_sentence_start == i - 1 &&
- attrs[i - 1].is_white) {
- last_sentence_start++;
+ /* default to not a sentence start/end */
+ attrs[i].is_sentence_start = FALSE;
+ attrs[i].is_sentence_end = FALSE;
+
+ /* maybe start sentence */
+ if (last_sentence_start == -1 && !is_sentence_boundary)
+ last_sentence_start = i - 1;
+
+ /* remember last non space character position */
+ if (i > 0 && !attrs[i - 1].is_white)
+ last_non_space = i;
+
+ /* meets sentence end, mark both sentence start and end */
+ if (last_sentence_start != -1 && is_sentence_boundary) {
+ if (last_non_space >= last_sentence_start) {
+ attrs[last_sentence_start].is_sentence_start = TRUE;
+ attrs[last_non_space].is_sentence_end = TRUE;
+ }
+
+ last_sentence_start = -1;
+ last_non_space = -1;
+ }
+
+ /* meets space character, move sentence start */
+ if (last_sentence_start != -1 &&
+ last_sentence_start == i - 1 &&
+ attrs[i - 1].is_white) {
+ last_sentence_start++;
}
}
@@ -1641,9 +1641,9 @@ default_break (const char *text,
/* wc might not be a valid Unicode base character, but really all we
* need to know is the last non-combining character */
if (type != G_UNICODE_SPACING_MARK &&
- type != G_UNICODE_ENCLOSING_MARK &&
- type != G_UNICODE_NON_SPACING_MARK)
- base_character = wc;
+ type != G_UNICODE_ENCLOSING_MARK &&
+ type != G_UNICODE_NON_SPACING_MARK)
+ base_character = wc;
}
i--;
@@ -1670,10 +1670,10 @@ default_break (const char *text,
static gboolean
break_script (const char *item_text,
- unsigned int item_length,
- const PangoAnalysis *analysis,
- PangoLogAttr *attrs,
- int attrs_len)
+ unsigned int item_length,
+ const Pango2Analysis *analysis,
+ Pango2LogAttr *attrs,
+ int attrs_len)
{
switch (analysis->script)
{
@@ -1709,7 +1709,7 @@ break_script (const char *item_text,
return TRUE;
}
-/* }}} */
+/* }}} */
/* {{{ Attribute-based customization */
/* We allow customizing log attrs in two ways:
@@ -1733,7 +1733,7 @@ break_script (const char *item_text,
static void
remove_breaks_from_range (const char *text,
int start,
- PangoLogAttr *log_attrs,
+ Pango2LogAttr *log_attrs,
int start_pos,
int end_pos)
{
@@ -1782,19 +1782,19 @@ remove_breaks_from_range (const char *text,
static gboolean
handle_allow_breaks (const char *text,
int length,
- PangoAttrList *attrs,
+ Pango2AttrList *attrs,
int offset,
- PangoLogAttr *log_attrs,
+ Pango2LogAttr *log_attrs,
int log_attrs_len)
{
- PangoAttrIterator iter;
+ Pango2AttrIterator iter;
gboolean tailored = FALSE;
- pango_attr_list_init_iterator (attrs, &iter);
+ pango2_attr_list_init_iterator (attrs, &iter);
do
{
- const PangoAttribute *attr = pango_attr_iterator_get (&iter, PANGO_ATTR_ALLOW_BREAKS);
+ const Pango2Attribute *attr = pango2_attr_iterator_get (&iter, PANGO2_ATTR_ALLOW_BREAKS);
if (!attr)
continue;
@@ -1824,9 +1824,9 @@ handle_allow_breaks (const char *text,
tailored = TRUE;
}
}
- while (pango_attr_iterator_next (&iter));
+ while (pango2_attr_iterator_next (&iter));
- pango_attr_iterator_clear (&iter);
+ pango2_attr_iterator_clear (&iter);
return tailored;
}
@@ -1835,19 +1835,19 @@ handle_allow_breaks (const char *text,
static gboolean
handle_words (const char *text,
int length,
- PangoAttrList *attrs,
+ Pango2AttrList *attrs,
int offset,
- PangoLogAttr *log_attrs,
+ Pango2LogAttr *log_attrs,
int log_attrs_len)
{
- PangoAttrIterator iter;
+ Pango2AttrIterator iter;
gboolean tailored = FALSE;
- pango_attr_list_init_iterator (attrs, &iter);
+ pango2_attr_list_init_iterator (attrs, &iter);
do
{
- const PangoAttribute *attr = pango_attr_iterator_get (&iter, PANGO_ATTR_WORD);
+ const Pango2Attribute *attr = pango2_attr_iterator_get (&iter, PANGO2_ATTR_WORD);
int start, end;
int start_pos, end_pos;
int pos;
@@ -1930,9 +1930,9 @@ handle_words (const char *text,
tailored = TRUE;
}
}
- while (pango_attr_iterator_next (&iter));
+ while (pango2_attr_iterator_next (&iter));
- pango_attr_iterator_clear (&iter);
+ pango2_attr_iterator_clear (&iter);
return tailored;
}
@@ -1940,19 +1940,19 @@ handle_words (const char *text,
static gboolean
handle_sentences (const char *text,
int length,
- PangoAttrList *attrs,
+ Pango2AttrList *attrs,
int offset,
- PangoLogAttr *log_attrs,
+ Pango2LogAttr *log_attrs,
int log_attrs_len)
{
- PangoAttrIterator iter;
+ Pango2AttrIterator iter;
gboolean tailored = FALSE;
- pango_attr_list_init_iterator (attrs, &iter);
+ pango2_attr_list_init_iterator (attrs, &iter);
do
{
- const PangoAttribute *attr = pango_attr_iterator_get (&iter, PANGO_ATTR_SENTENCE);
+ const Pango2Attribute *attr = pango2_attr_iterator_get (&iter, PANGO2_ATTR_SENTENCE);
int start, end;
int start_pos, end_pos;
int pos;
@@ -2018,9 +2018,9 @@ handle_sentences (const char *text,
tailored = TRUE;
}
}
- while (pango_attr_iterator_next (&iter));
+ while (pango2_attr_iterator_next (&iter));
- pango_attr_iterator_clear (&iter);
+ pango2_attr_iterator_clear (&iter);
return tailored;
}
@@ -2028,18 +2028,18 @@ handle_sentences (const char *text,
static gboolean
handle_hyphens (const char *text,
int length,
- PangoAttrList *attrs,
+ Pango2AttrList *attrs,
int offset,
- PangoLogAttr *log_attrs,
+ Pango2LogAttr *log_attrs,
int log_attrs_len)
{
- PangoAttrIterator iter;
+ Pango2AttrIterator iter;
gboolean tailored = FALSE;
- pango_attr_list_init_iterator (attrs, &iter);
+ pango2_attr_list_init_iterator (attrs, &iter);
do {
- const PangoAttribute *attr = pango_attr_iterator_get (&iter, PANGO_ATTR_INSERT_HYPHENS);
+ const Pango2Attribute *attr = pango2_attr_iterator_get (&iter, PANGO2_ATTR_INSERT_HYPHENS);
if (attr && attr->int_value == 0)
{
@@ -2047,7 +2047,7 @@ handle_hyphens (const char *text,
int start_pos, end_pos;
int pos;
- pango_attr_iterator_range (&iter, &start, &end);
+ pango2_attr_iterator_range (&iter, &start, &end);
if (start < offset)
start_pos = 0;
else
@@ -2067,9 +2067,9 @@ handle_hyphens (const char *text,
}
}
}
- } while (pango_attr_iterator_next (&iter));
+ } while (pango2_attr_iterator_next (&iter));
- pango_attr_iterator_clear (&iter);
+ pango2_attr_iterator_clear (&iter);
return tailored;
}
@@ -2079,33 +2079,33 @@ break_attrs (const char *text,
int length,
GSList *attributes,
int offset,
- PangoLogAttr *log_attrs,
+ Pango2LogAttr *log_attrs,
int log_attrs_len)
{
- PangoAttrList allow_breaks;
- PangoAttrList words;
- PangoAttrList sentences;
- PangoAttrList hyphens;
+ Pango2AttrList allow_breaks;
+ Pango2AttrList words;
+ Pango2AttrList sentences;
+ Pango2AttrList hyphens;
GSList *l;
gboolean tailored = FALSE;
- pango_attr_list_init (&allow_breaks);
- pango_attr_list_init (&words);
- pango_attr_list_init (&sentences);
- pango_attr_list_init (&hyphens);
+ pango2_attr_list_init (&allow_breaks);
+ pango2_attr_list_init (&words);
+ pango2_attr_list_init (&sentences);
+ pango2_attr_list_init (&hyphens);
for (l = attributes; l; l = l->next)
{
- PangoAttribute *attr = l->data;
-
- if (attr->type == PANGO_ATTR_ALLOW_BREAKS)
- pango_attr_list_insert (&allow_breaks, pango_attribute_copy (attr));
- else if (attr->type == PANGO_ATTR_WORD)
- pango_attr_list_insert (&words, pango_attribute_copy (attr));
- else if (attr->type == PANGO_ATTR_SENTENCE)
- pango_attr_list_insert (&sentences, pango_attribute_copy (attr));
- else if (attr->type == PANGO_ATTR_INSERT_HYPHENS)
- pango_attr_list_insert (&hyphens, pango_attribute_copy (attr));
+ Pango2Attribute *attr = l->data;
+
+ if (attr->type == PANGO2_ATTR_ALLOW_BREAKS)
+ pango2_attr_list_insert (&allow_breaks, pango2_attribute_copy (attr));
+ else if (attr->type == PANGO2_ATTR_WORD)
+ pango2_attr_list_insert (&words, pango2_attribute_copy (attr));
+ else if (attr->type == PANGO2_ATTR_SENTENCE)
+ pango2_attr_list_insert (&sentences, pango2_attribute_copy (attr));
+ else if (attr->type == PANGO2_ATTR_INSERT_HYPHENS)
+ pango2_attr_list_insert (&hyphens, pango2_attribute_copy (attr));
}
tailored |= handle_words (text, length, &words, offset,
@@ -2120,10 +2120,10 @@ break_attrs (const char *text,
tailored |= handle_allow_breaks (text, length, &allow_breaks, offset,
log_attrs, log_attrs_len);
- pango_attr_list_destroy (&allow_breaks);
- pango_attr_list_destroy (&words);
- pango_attr_list_destroy (&sentences);
- pango_attr_list_destroy (&hyphens);
+ pango2_attr_list_destroy (&allow_breaks);
+ pango2_attr_list_destroy (&words);
+ pango2_attr_list_destroy (&sentences);
+ pango2_attr_list_destroy (&hyphens);
return tailored;
}
@@ -2131,12 +2131,12 @@ break_attrs (const char *text,
/* }}} */
static gboolean
-tailor_break (const char *text,
- int length,
- PangoAnalysis *analysis,
- int item_offset,
- PangoLogAttr *attrs,
- int attrs_len)
+tailor_break (const char *text,
+ int length,
+ Pango2Analysis *analysis,
+ int item_offset,
+ Pango2LogAttr *attrs,
+ int attrs_len)
{
gboolean res;
@@ -2157,7 +2157,7 @@ tailor_break (const char *text,
/* {{{ Public API */
/**
- * pango_default_break:
+ * pango2_default_break:
* @text: text to break. Must be valid UTF-8
* @length: length of text in bytes (may be -1 if @text is nul-terminated)
* @attrs: logical attributes to fill in
@@ -2168,17 +2168,17 @@ tailor_break (const char *text,
* It applies rules from the [Unicode Line Breaking Algorithm](http://www.unicode.org/unicode/reports/tr14/)
* without language-specific tailoring.
*
- * See [func@Pango.tailor_break] for language-specific breaks.
+ * See [func@Pango2.tailor_break] for language-specific breaks.
*
- * See [func@Pango.attr_break] for attribute-based customization.
+ * See [func@Pango2.attr_break] for attribute-based customization.
*/
void
-pango_default_break (const char *text,
+pango2_default_break (const char *text,
int length,
- PangoLogAttr *attrs,
+ Pango2LogAttr *attrs,
int attrs_len G_GNUC_UNUSED)
{
- PangoLogAttr before = *attrs;
+ Pango2LogAttr before = *attrs;
default_break (text, length, attrs, attrs_len);
@@ -2188,36 +2188,36 @@ pango_default_break (const char *text,
}
/**
- * pango_tailor_break:
+ * pango2_tailor_break:
* @text: text to process. Must be valid UTF-8
* @length: length in bytes of @text
- * @analysis: `PangoAnalysis` for @text
+ * @analysis: `Pango2Analysis` for @text
* @offset: Byte offset of @text from the beginning of the
* paragraph, or -1 to ignore attributes from @analysis
- * @attrs: (array length=attrs_len): array with one `PangoLogAttr`
+ * @attrs: (array length=attrs_len): array with one `Pango2LogAttr`
* per character in @text, plus one extra, to be filled in
* @attrs_len: length of @attrs array
*
* Apply language-specific tailoring to the breaks in @attrs.
*
- * The line breaks are assumed to have been produced by [func@Pango.default_break].
+ * The line breaks are assumed to have been produced by [func@Pango2.default_break].
*
* If @offset is not -1, it is used to apply attributes from @analysis that are
* relevant to line breaking.
*
- * Note that it is better to pass -1 for @offset and use [func@Pango.attr_break]
+ * Note that it is better to pass -1 for @offset and use [func@Pango2.attr_break]
* to apply attributes to the whole paragraph.
*/
void
-pango_tailor_break (const char *text,
+pango2_tailor_break (const char *text,
int length,
- PangoAnalysis *analysis,
+ Pango2Analysis *analysis,
int offset,
- PangoLogAttr *attrs,
+ Pango2LogAttr *attrs,
int attrs_len)
{
- PangoLogAttr *start = attrs;
- PangoLogAttr attr_before = *start;
+ Pango2LogAttr *start = attrs;
+ Pango2LogAttr attr_before = *start;
if (tailor_break (text, length, analysis, offset, attrs, attrs_len))
{
@@ -2234,33 +2234,33 @@ pango_tailor_break (const char *text,
}
/**
- * pango_attr_break:
+ * pango2_attr_break:
* @text: text to break. Must be valid UTF-8
* @length: length of text in bytes (may be -1 if @text is nul-terminated)
- * @attr_list: `PangoAttrList` to apply
+ * @attr_list: `Pango2AttrList` to apply
* @offset: Byte offset of @text from the beginning of the paragraph
- * @attrs: (array length=attrs_len): array with one `PangoLogAttr`
+ * @attrs: (array length=attrs_len): array with one `Pango2LogAttr`
* per character in @text, plus one extra, to be filled in
* @attrs_len: length of @attrs array
*
* Apply customization from attributes to the breaks in @attrs.
*
* The line breaks are assumed to have been produced
- * by [func@Pango.default_break] and [func@Pango.tailor_break].
+ * by [func@Pango2.default_break] and [func@Pango2.tailor_break].
*/
void
-pango_attr_break (const char *text,
+pango2_attr_break (const char *text,
int length,
- PangoAttrList *attr_list,
+ Pango2AttrList *attr_list,
int offset,
- PangoLogAttr *attrs,
+ Pango2LogAttr *attrs,
int attrs_len)
{
- PangoLogAttr *start = attrs;
- PangoLogAttr attr_before = *start;
+ Pango2LogAttr *start = attrs;
+ Pango2LogAttr attr_before = *start;
GSList *attributes;
- attributes = pango_attr_list_get_attributes (attr_list);
+ attributes = pango2_attr_list_get_attributes (attr_list);
if (break_attrs (text, length, attributes, offset, attrs, attrs_len))
{
/* if tailored, we enforce some of the attrs from before
@@ -2274,23 +2274,23 @@ pango_attr_break (const char *text,
start->is_cursor_position |= attr_before.is_cursor_position;
}
- g_slist_free_full (attributes, (GDestroyNotify)pango_attribute_destroy);
+ g_slist_free_full (attributes, (GDestroyNotify)pango2_attribute_destroy);
}
/**
- * pango_get_log_attrs:
+ * pango2_get_log_attrs:
* @text: text to process. Must be valid UTF-8
* @length: length in bytes of @text
- * @attr_list: (nullable): `PangoAttrList` to apply
+ * @attr_list: (nullable): `Pango2AttrList` to apply
* @level: embedding level, or -1 if unknown
* @language: language tag
- * @attrs: (array length=attrs_len): array with one `PangoLogAttr`
+ * @attrs: (array length=attrs_len): array with one `Pango2LogAttr`
* per character in @text, plus one extra, to be filled in
* @attrs_len: length of @attrs array
*
- * Computes a `PangoLogAttr` for each character in @text.
+ * Computes a `Pango2LogAttr` for each character in @text.
*
- * The @attrs array must have one `PangoLogAttr` for
+ * The @attrs array must have one `Pango2LogAttr` for
* each position in @text; if @text contains N characters,
* it has N+1 positions, including the last position at the
* end of the text. @text should be an entire paragraph;
@@ -2299,17 +2299,17 @@ pango_attr_break (const char *text,
* a word to know the word is a word).
*/
void
-pango_get_log_attrs (const char *text,
- int length,
- PangoAttrList *attr_list,
- int level,
- PangoLanguage *language,
- PangoLogAttr *attrs,
- int attrs_len)
+pango2_get_log_attrs (const char *text,
+ int length,
+ Pango2AttrList *attr_list,
+ int level,
+ Pango2Language *language,
+ Pango2LogAttr *attrs,
+ int attrs_len)
{
int chars_broken;
- PangoAnalysis analysis = { NULL };
- PangoScriptIter iter;
+ Pango2Analysis analysis = { NULL };
+ Pango2ScriptIter iter;
g_return_if_fail (length == 0 || text != NULL);
g_return_if_fail (attrs != NULL);
@@ -2317,23 +2317,23 @@ pango_get_log_attrs (const char *text,
analysis.level = level;
analysis.language = language;
- pango_default_break (text, length, attrs, attrs_len);
+ pango2_default_break (text, length, attrs, attrs_len);
chars_broken = 0;
- _pango_script_iter_init (&iter, text, length);
+ _pango2_script_iter_init (&iter, text, length);
do
{
const char *run_start, *run_end;
GUnicodeScript script;
int chars_in_range;
- pango_script_iter_get_range (&iter, &run_start, &run_end, &script);
+ pango2_script_iter_get_range (&iter, &run_start, &run_end, &script);
analysis.script = script;
- chars_in_range = pango_utf8_strlen (run_start, run_end - run_start);
+ chars_in_range = pango2_utf8_strlen (run_start, run_end - run_start);
- pango_tailor_break (run_start,
+ pango2_tailor_break (run_start,
run_end - run_start,
&analysis,
-1,
@@ -2342,14 +2342,14 @@ pango_get_log_attrs (const char *text,
chars_broken += chars_in_range;
}
- while (pango_script_iter_next (&iter));
- _pango_script_iter_fini (&iter);
+ while (pango2_script_iter_next (&iter));
+ _pango2_script_iter_fini (&iter);
if (attr_list)
- pango_attr_break (text, length, attr_list, 0, attrs, attrs_len);
+ pango2_attr_break (text, length, attr_list, 0, attrs, attrs_len);
if (chars_broken + 1 > attrs_len)
- g_warning ("pango_get_log_attrs: attrs_len should have been at least %d, but was %d. Expect corrupted memory.",
+ g_warning ("pango2_get_log_attrs: attrs_len should have been at least %d, but was %d. Expect corrupted memory.",
chars_broken + 1,
attrs_len);
}
diff --git a/pango/ellipsize.c b/pango/ellipsize.c
index d9f2d994..a5f74131 100644
--- a/pango/ellipsize.c
+++ b/pango/ellipsize.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* ellipsize.c: Routine to ellipsize layout lines
*
* Copyright (C) 2004 Red Hat Software
@@ -71,63 +71,63 @@ typedef struct _LineIter LineIter;
/* Keeps information about a single run */
struct _RunInfo
{
- PangoGlyphItem *run;
+ Pango2GlyphItem *run;
int start_offset; /* Character offset of run start */
- int width; /* Width of run in Pango units */
+ int width; /* Width of run in Pango2 units */
};
/* Iterator to a position within the ellipsized line */
struct _LineIter
{
- PangoGlyphItemIter run_iter;
+ Pango2GlyphItemIter run_iter;
int run_index;
};
/* State of ellipsization process */
struct _EllipsizeState
{
- PangoContext *context;
+ Pango2Context *context;
const char *text;
- PangoLogAttr *log_attrs;
- PangoEllipsizeMode ellipsize;
- PangoAttrList *attrs; /* Attributes used for itemization/shaping */
+ Pango2LogAttr *log_attrs;
+ Pango2EllipsizeMode ellipsize;
+ Pango2AttrList *attrs; /* Attributes used for itemization/shaping */
RunInfo *run_info; /* Array of information about each run */
int n_runs;
- int total_width; /* Original width of line in Pango units */
+ int total_width; /* Original width of line in Pango2 units */
int gap_center; /* Goal for center of gap */
- PangoGlyphItem *ellipsis_run; /* Run created to hold ellipsis */
- int ellipsis_width; /* Width of ellipsis, in Pango units */
+ Pango2GlyphItem *ellipsis_run; /* Run created to hold ellipsis */
+ int ellipsis_width; /* Width of ellipsis, in Pango2 units */
int ellipsis_is_cjk; /* Whether the first character in the ellipsized
* is wide; this triggers us to try to use a
* mid-line ellipsis instead of a baseline
*/
- PangoAttrIterator *line_start_attr; /* Cached PangoAttrIterator for the start of the run */
+ Pango2AttrIterator *line_start_attr; /* Cached Pango2AttrIterator for the start of the run */
LineIter gap_start_iter; /* Iteratator pointig to the first cluster in gap */
- int gap_start_x; /* x position of start of gap, in Pango units */
- PangoAttrIterator *gap_start_attr; /* Attribute iterator pointing to a range containing
+ int gap_start_x; /* x position of start of gap, in Pango2 units */
+ Pango2AttrIterator *gap_start_attr; /* Attribute iterator pointing to a range containing
* the first character in gap */
LineIter gap_end_iter; /* Iterator pointing to last cluster in gap */
- int gap_end_x; /* x position of end of gap, in Pango units */
+ int gap_end_x; /* x position of end of gap, in Pango2 units */
- PangoShapeFlags shape_flags;
+ Pango2ShapeFlags shape_flags;
};
static void
-init_state (EllipsizeState *state,
- PangoContext *context,
- const char *text,
- int start_index,
- PangoLogAttr *log_attrs,
- PangoEllipsizeMode ellipsize,
- GSList *runs,
- PangoAttrList *attrs,
- PangoShapeFlags shape_flags)
+init_state (EllipsizeState *state,
+ Pango2Context *context,
+ const char *text,
+ int start_index,
+ Pango2LogAttr *log_attrs,
+ Pango2EllipsizeMode ellipsize,
+ GSList *runs,
+ Pango2AttrList *attrs,
+ Pango2ShapeFlags shape_flags)
{
GSList *l;
int i;
@@ -139,22 +139,22 @@ init_state (EllipsizeState *state,
state->ellipsize = ellipsize;
if (attrs)
- state->attrs = pango_attr_list_ref (attrs);
+ state->attrs = pango2_attr_list_ref (attrs);
else
- state->attrs = pango_attr_list_new ();
+ state->attrs = pango2_attr_list_new ();
state->shape_flags = shape_flags;
state->n_runs = g_slist_length (runs);
state->run_info = g_new (RunInfo, state->n_runs);
- start_offset = pango_utf8_strlen (state->text, start_index);
+ start_offset = pango2_utf8_strlen (state->text, start_index);
state->total_width = 0;
for (l = runs, i = 0; l; l = l->next, i++)
{
- PangoGlyphItem *run = l->data;
- int width = pango_glyph_string_get_width (run->glyphs);
+ Pango2GlyphItem *run = l->data;
+ int width = pango2_glyph_string_get_width (run->glyphs);
state->run_info[i].run = run;
state->run_info[i].width = width;
state->run_info[i].start_offset = start_offset;
@@ -174,11 +174,11 @@ init_state (EllipsizeState *state,
static void
free_state (EllipsizeState *state)
{
- pango_attr_list_unref (state->attrs);
+ pango2_attr_list_unref (state->attrs);
if (state->line_start_attr)
- pango_attr_iterator_destroy (state->line_start_attr);
+ pango2_attr_iterator_destroy (state->line_start_attr);
if (state->gap_start_attr)
- pango_attr_iterator_destroy (state->gap_start_attr);
+ pango2_attr_iterator_destroy (state->gap_start_attr);
g_free (state->run_info);
}
@@ -187,8 +187,8 @@ free_state (EllipsizeState *state)
static int
get_cluster_width (LineIter *iter)
{
- PangoGlyphItemIter *run_iter = &iter->run_iter;
- PangoGlyphString *glyphs = run_iter->glyph_item->glyphs;
+ Pango2GlyphItemIter *run_iter = &iter->run_iter;
+ Pango2GlyphString *glyphs = run_iter->glyph_item->glyphs;
int width = 0;
int i;
@@ -212,14 +212,14 @@ static gboolean
line_iter_next_cluster (EllipsizeState *state,
LineIter *iter)
{
- if (!pango_glyph_item_iter_next_cluster (&iter->run_iter))
+ if (!pango2_glyph_item_iter_next_cluster (&iter->run_iter))
{
if (iter->run_index == state->n_runs - 1)
return FALSE;
else
{
iter->run_index++;
- pango_glyph_item_iter_init_start (&iter->run_iter,
+ pango2_glyph_item_iter_init_start (&iter->run_iter,
state->run_info[iter->run_index].run,
state->text);
}
@@ -234,14 +234,14 @@ static gboolean
line_iter_prev_cluster (EllipsizeState *state,
LineIter *iter)
{
- if (!pango_glyph_item_iter_prev_cluster (&iter->run_iter))
+ if (!pango2_glyph_item_iter_prev_cluster (&iter->run_iter))
{
if (iter->run_index == 0)
return FALSE;
else
{
iter->run_index--;
- pango_glyph_item_iter_init_end (&iter->run_iter,
+ pango2_glyph_item_iter_init_end (&iter->run_iter,
state->run_info[iter->run_index].run,
state->text);
}
@@ -257,7 +257,7 @@ line_iter_prev_cluster (EllipsizeState *state,
* - Starts a grapheme - checked here
*
* In the future we'd also like to add a check for cursive connectivity here.
- * This should be an addition to `PangoGlyphVisAttr`
+ * This should be an addition to `Pango2GlyphVisAttr`
*
*/
@@ -291,17 +291,17 @@ ends_at_ellipsization_boundary (EllipsizeState *state,
/* Helper function to re-itemize a string of text
*/
-static PangoItem *
+static Pango2Item *
itemize_text (EllipsizeState *state,
const char *text,
- PangoAttrList *attrs)
+ Pango2AttrList *attrs)
{
GList *items;
- PangoItem *item;
- PangoDirection dir;
+ Pango2Item *item;
+ Pango2Direction dir;
- dir = pango_context_get_base_dir (state->context);
- items = pango_itemize (state->context, dir, text, 0, strlen (text), attrs);
+ dir = pango2_context_get_base_dir (state->context);
+ items = pango2_itemize (state->context, dir, text, 0, strlen (text), attrs);
g_assert (g_list_length (items) == 1);
item = items->data;
@@ -316,56 +316,56 @@ itemize_text (EllipsizeState *state,
static void
shape_ellipsis (EllipsizeState *state)
{
- PangoAttrList attrs;
+ Pango2AttrList attrs;
GSList *run_attrs;
- PangoItem *item;
- PangoGlyphString *glyphs;
+ Pango2Item *item;
+ Pango2GlyphString *glyphs;
GSList *l;
- PangoAttribute *fallback;
+ Pango2Attribute *fallback;
const char *ellipsis_text;
int len;
int i;
- pango_attr_list_init (&attrs);
+ pango2_attr_list_init (&attrs);
/* Create/reset state->ellipsis_run
*/
if (!state->ellipsis_run)
{
- state->ellipsis_run = g_slice_new0 (PangoGlyphItem);
- state->ellipsis_run->glyphs = pango_glyph_string_new ();
+ state->ellipsis_run = g_slice_new0 (Pango2GlyphItem);
+ state->ellipsis_run->glyphs = pango2_glyph_string_new ();
}
if (state->ellipsis_run->item)
{
- pango_item_free (state->ellipsis_run->item);
+ pango2_item_free (state->ellipsis_run->item);
state->ellipsis_run->item = NULL;
}
/* Create an attribute list
*/
- run_attrs = pango_attr_iterator_get_attrs (state->gap_start_attr);
+ run_attrs = pango2_attr_iterator_get_attrs (state->gap_start_attr);
int s, e;
- pango_attr_iterator_range (state->gap_start_attr, &s, &e);
+ pango2_attr_iterator_range (state->gap_start_attr, &s, &e);
for (l = run_attrs; l; l = l->next)
{
- PangoAttribute *attr = l->data;
- attr->start_index = PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING;
- attr->end_index = PANGO_ATTR_INDEX_TO_TEXT_END;
+ Pango2Attribute *attr = l->data;
+ attr->start_index = PANGO2_ATTR_INDEX_FROM_TEXT_BEGINNING;
+ attr->end_index = PANGO2_ATTR_INDEX_TO_TEXT_END;
- if (pango_attribute_affects_itemization (attr, NULL) ||
- pango_attribute_affects_break_or_shape (attr, NULL))
- pango_attr_list_insert (&attrs, attr);
+ if (pango2_attribute_affects_itemization (attr, NULL) ||
+ pango2_attribute_affects_break_or_shape (attr, NULL))
+ pango2_attr_list_insert (&attrs, attr);
else
- pango_attribute_destroy (attr);
+ pango2_attribute_destroy (attr);
}
g_slist_free (run_attrs);
- fallback = pango_attr_fallback_new (FALSE);
+ fallback = pango2_attr_fallback_new (FALSE);
fallback->start_index = 0;
fallback->end_index = G_MAXINT;
- pango_attr_list_insert (&attrs, fallback);
+ pango2_attr_list_insert (&attrs, fallback);
/* First try using a specific ellipsis character in the best matching font
*/
@@ -379,12 +379,12 @@ shape_ellipsis (EllipsizeState *state)
/* If that fails we use "..." in the first matching font
*/
if (!item->analysis.font ||
- !pango_font_face_has_char (item->analysis.font->face,
+ !pango2_font_face_has_char (item->analysis.font->face,
g_utf8_get_char (ellipsis_text)))
{
- pango_item_free (item);
+ pango2_item_free (item);
- /* Modify the fallback iter while it is inside the PangoAttrList; Don't try this at home
+ /* Modify the fallback iter while it is inside the Pango2AttrList; Don't try this at home
*/
fallback->int_value = TRUE;
@@ -392,7 +392,7 @@ shape_ellipsis (EllipsizeState *state)
item = itemize_text (state, ellipsis_text, &attrs);
}
- pango_attr_list_destroy (&attrs);
+ pango2_attr_list_destroy (&attrs);
state->ellipsis_run->item = item;
@@ -401,7 +401,7 @@ shape_ellipsis (EllipsizeState *state)
glyphs = state->ellipsis_run->glyphs;
len = strlen (ellipsis_text);
- pango_shape (ellipsis_text, len,
+ pango2_shape (ellipsis_text, len,
ellipsis_text, len,
&item->analysis, glyphs,
state->shape_flags);
@@ -411,22 +411,22 @@ shape_ellipsis (EllipsizeState *state)
state->ellipsis_width += glyphs->glyphs[i].geometry.width;
}
-/* Helper function to advance a PangoAttrIterator to a particular
+/* Helper function to advance a Pango2AttrIterator to a particular
* byte index.
*/
static void
-advance_iterator_to (PangoAttrIterator *iter,
- int new_index)
+advance_iterator_to (Pango2AttrIterator *iter,
+ int new_index)
{
int start, end;
do
{
- pango_attr_iterator_range (iter, &start, &end);
+ pango2_attr_iterator_range (iter, &start, &end);
if (end > new_index)
break;
}
- while (pango_attr_iterator_next (iter));
+ while (pango2_attr_iterator_next (iter));
}
/* Updates the shaping of the ellipsis if necessary when we move the
@@ -447,13 +447,13 @@ update_ellipsis_shape (EllipsizeState *state)
gunichar start_wc;
gboolean is_cjk;
- /* Unfortunately, we can only advance PangoAttrIterator forward; so each
+ /* Unfortunately, we can only advance Pango2AttrIterator forward; so each
* time we back up we need to go forward to find the new position. To make
* this not utterly slow, we cache an iterator at the start of the line
*/
if (!state->line_start_attr)
{
- state->line_start_attr = pango_attr_list_get_iterator (state->attrs);
+ state->line_start_attr = pango2_attr_list_get_iterator (state->attrs);
advance_iterator_to (state->line_start_attr, state->run_info[0].run->item->offset);
}
@@ -463,11 +463,11 @@ update_ellipsis_shape (EllipsizeState *state)
*/
int start, end;
- pango_attr_iterator_range (state->gap_start_attr, &start, &end);
+ pango2_attr_iterator_range (state->gap_start_attr, &start, &end);
if (state->gap_start_iter.run_iter.start_index < start)
{
- pango_attr_iterator_destroy (state->gap_start_attr);
+ pango2_attr_iterator_destroy (state->gap_start_attr);
state->gap_start_attr = NULL;
}
}
@@ -476,7 +476,7 @@ update_ellipsis_shape (EllipsizeState *state)
*/
if (!state->gap_start_attr)
{
- state->gap_start_attr = pango_attr_iterator_copy (state->line_start_attr);
+ state->gap_start_attr = pango2_attr_iterator_copy (state->line_start_attr);
advance_iterator_to (state->gap_start_attr,
state->run_info[state->gap_start_iter.run_index].run->item->offset);
@@ -504,8 +504,8 @@ update_ellipsis_shape (EllipsizeState *state)
static void
find_initial_span (EllipsizeState *state)
{
- PangoGlyphItem *glyph_item;
- PangoGlyphItemIter *run_iter;
+ Pango2GlyphItem *glyph_item;
+ Pango2GlyphItemIter *run_iter;
gboolean have_cluster;
int i;
int x;
@@ -513,16 +513,16 @@ find_initial_span (EllipsizeState *state)
switch (state->ellipsize)
{
- case PANGO_ELLIPSIZE_NONE:
+ case PANGO2_ELLIPSIZE_NONE:
default:
g_assert_not_reached ();
- case PANGO_ELLIPSIZE_START:
+ case PANGO2_ELLIPSIZE_START:
state->gap_center = 0;
break;
- case PANGO_ELLIPSIZE_MIDDLE:
+ case PANGO2_ELLIPSIZE_MIDDLE:
state->gap_center = state->total_width / 2;
break;
- case PANGO_ELLIPSIZE_END:
+ case PANGO2_ELLIPSIZE_END:
state->gap_center = state->total_width;
break;
}
@@ -551,9 +551,9 @@ find_initial_span (EllipsizeState *state)
glyph_item = state->run_info[i].run;
cluster_width = 0; /* Quiet GCC, the line must have at least one cluster */
- for (have_cluster = pango_glyph_item_iter_init_start (run_iter, glyph_item, state->text);
+ for (have_cluster = pango2_glyph_item_iter_init_start (run_iter, glyph_item, state->text);
have_cluster;
- have_cluster = pango_glyph_item_iter_next_cluster (run_iter))
+ have_cluster = pango2_glyph_item_iter_next_cluster (run_iter))
{
cluster_width = get_cluster_width (&state->gap_start_iter);
@@ -658,8 +658,8 @@ static void
fixup_ellipsis_run (EllipsizeState *state,
int extra_width)
{
- PangoGlyphString *glyphs = state->ellipsis_run->glyphs;
- PangoItem *item = state->ellipsis_run->item;
+ Pango2GlyphString *glyphs = state->ellipsis_run->glyphs;
+ Pango2Item *item = state->ellipsis_run->item;
int level;
int i;
@@ -677,7 +677,7 @@ fixup_ellipsis_run (EllipsizeState *state,
/* Fix up the item to point to the entire elided text */
item->offset = state->gap_start_iter.run_iter.start_index;
item->length = state->gap_end_iter.run_iter.end_index - item->offset;
- item->num_chars = pango_utf8_strlen (state->text + item->offset, item->length);
+ item->num_chars = pango2_utf8_strlen (state->text + item->offset, item->length);
/* The level for the item is the minimum level of the elided text */
level = G_MAXINT;
@@ -686,7 +686,7 @@ fixup_ellipsis_run (EllipsizeState *state,
item->analysis.level = level;
- item->analysis.flags |= PANGO_ANALYSIS_FLAG_IS_ELLIPSIS;
+ item->analysis.flags |= PANGO2_ANALYSIS_FLAG_IS_ELLIPSIS;
}
/* Computes the new list of runs for the line
@@ -694,11 +694,11 @@ fixup_ellipsis_run (EllipsizeState *state,
static GSList *
get_run_list (EllipsizeState *state)
{
- PangoGlyphItem *partial_start_run = NULL;
- PangoGlyphItem *partial_end_run = NULL;
+ Pango2GlyphItem *partial_start_run = NULL;
+ Pango2GlyphItem *partial_end_run = NULL;
GSList *result = NULL;
RunInfo *run_info;
- PangoGlyphItemIter *run_iter;
+ Pango2GlyphItemIter *run_iter;
int i;
/* We first cut out the pieces of the starting and ending runs we want to
@@ -710,7 +710,7 @@ get_run_list (EllipsizeState *state)
if (run_iter->end_char != run_info->run->item->num_chars)
{
partial_end_run = run_info->run;
- run_info->run = pango_glyph_item_split (run_info->run, state->text,
+ run_info->run = pango2_glyph_item_split (run_info->run, state->text,
run_iter->end_index - run_info->run->item->offset);
}
@@ -718,7 +718,7 @@ get_run_list (EllipsizeState *state)
run_iter = &state->gap_start_iter.run_iter;
if (run_iter->start_char != 0)
{
- partial_start_run = pango_glyph_item_split (run_info->run, state->text,
+ partial_start_run = pango2_glyph_item_split (run_info->run, state->text,
run_iter->start_index - run_info->run->item->offset);
}
@@ -741,7 +741,7 @@ get_run_list (EllipsizeState *state)
/* And free the ones we didn't use
*/
for (i = state->gap_start_iter.run_index; i <= state->gap_end_iter.run_index; i++)
- pango_glyph_item_free (state->run_info[i].run);
+ pango2_glyph_item_free (state->run_info[i].run);
return g_slist_reverse (result);
}
@@ -755,23 +755,23 @@ current_width (EllipsizeState *state)
}
void
-pango_line_ellipsize (PangoLine *line,
- PangoContext *context,
- PangoEllipsizeMode ellipsize,
- int goal_width)
+pango2_line_ellipsize (Pango2Line *line,
+ Pango2Context *context,
+ Pango2EllipsizeMode ellipsize,
+ int goal_width)
{
EllipsizeState state;
const char *text = line->data->text;
- PangoAttrList *attrs = line->data->attrs;
- PangoLogAttr *log_attrs = line->data->log_attrs;
- PangoShapeFlags shape_flags;
+ Pango2AttrList *attrs = line->data->attrs;
+ Pango2LogAttr *log_attrs = line->data->log_attrs;
+ Pango2ShapeFlags shape_flags;
- g_return_if_fail (ellipsize != PANGO_ELLIPSIZE_NONE && goal_width >= 0);
+ g_return_if_fail (ellipsize != PANGO2_ELLIPSIZE_NONE && goal_width >= 0);
- if (pango_context_get_round_glyph_positions (context))
- shape_flags = PANGO_SHAPE_ROUND_POSITIONS;
+ if (pango2_context_get_round_glyph_positions (context))
+ shape_flags = PANGO2_SHAPE_ROUND_POSITIONS;
else
- shape_flags = PANGO_SHAPE_NONE;
+ shape_flags = PANGO2_SHAPE_NONE;
init_state (&state, context, text, line->start_index, log_attrs, ellipsize, line->runs, attrs, shape_flags);
diff --git a/pango/emoji_presentation_scanner.c b/pango/emoji_presentation_scanner.c
index 87e55aa7..e40b9d45 100644
--- a/pango/emoji_presentation_scanner.c
+++ b/pango/emoji_presentation_scanner.c
@@ -7,76 +7,76 @@
#line 9 "emoji_presentation_scanner.c"
static const char _emoji_presentation_actions[] = {
- 0, 1, 0, 1, 1, 1, 5, 1,
- 6, 1, 7, 1, 8, 1, 9, 1,
- 10, 1, 11, 2, 2, 3, 2, 2,
- 4
+ 0, 1, 0, 1, 1, 1, 5, 1,
+ 6, 1, 7, 1, 8, 1, 9, 1,
+ 10, 1, 11, 2, 2, 3, 2, 2,
+ 4
};
static const char _emoji_presentation_key_offsets[] = {
- 0, 5, 7, 14, 18, 20, 21, 24,
- 29, 30, 34, 36
+ 0, 5, 7, 14, 18, 20, 21, 24,
+ 29, 30, 34, 36
};
static const unsigned char _emoji_presentation_trans_keys[] = {
- 3u, 7u, 13u, 0u, 2u, 14u, 15u, 2u,
- 3u, 6u, 7u, 13u, 0u, 1u, 9u, 10u,
- 11u, 12u, 10u, 12u, 10u, 4u, 10u, 12u,
- 4u, 9u, 10u, 11u, 12u, 6u, 9u, 10u,
- 11u, 12u, 8u, 10u, 9u, 10u, 11u, 12u,
- 14u, 0
+ 3u, 7u, 13u, 0u, 2u, 14u, 15u, 2u,
+ 3u, 6u, 7u, 13u, 0u, 1u, 9u, 10u,
+ 11u, 12u, 10u, 12u, 10u, 4u, 10u, 12u,
+ 4u, 9u, 10u, 11u, 12u, 6u, 9u, 10u,
+ 11u, 12u, 8u, 10u, 9u, 10u, 11u, 12u,
+ 14u, 0
};
static const char _emoji_presentation_single_lengths[] = {
- 3, 2, 5, 4, 2, 1, 3, 5,
- 1, 4, 2, 5
+ 3, 2, 5, 4, 2, 1, 3, 5,
+ 1, 4, 2, 5
};
static const char _emoji_presentation_range_lengths[] = {
- 1, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0
+ 1, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
};
static const char _emoji_presentation_index_offsets[] = {
- 0, 5, 8, 15, 20, 23, 25, 29,
- 35, 37, 42, 45
+ 0, 5, 8, 15, 20, 23, 25, 29,
+ 35, 37, 42, 45
};
static const char _emoji_presentation_indicies[] = {
- 2, 1, 1, 1, 0, 4, 5, 3,
- 7, 8, 10, 11, 12, 6, 9, 5,
- 13, 14, 15, 0, 13, 15, 16, 13,
- 16, 15, 13, 15, 16, 15, 5, 13,
- 14, 15, 16, 5, 17, 5, 13, 14,
- 18, 17, 5, 13, 16, 5, 13, 14,
- 15, 4, 16, 0
+ 2, 1, 1, 1, 0, 4, 5, 3,
+ 7, 8, 10, 11, 12, 6, 9, 5,
+ 13, 14, 15, 0, 13, 15, 16, 13,
+ 16, 15, 13, 15, 16, 15, 5, 13,
+ 14, 15, 16, 5, 17, 5, 13, 14,
+ 18, 17, 5, 13, 16, 5, 13, 14,
+ 15, 4, 16, 0
};
static const char _emoji_presentation_trans_targs[] = {
- 2, 4, 6, 2, 1, 2, 3, 3,
- 7, 2, 8, 9, 11, 0, 2, 5,
- 2, 2, 10
+ 2, 4, 6, 2, 1, 2, 3, 3,
+ 7, 2, 8, 9, 11, 0, 2, 5,
+ 2, 2, 10
};
static const char _emoji_presentation_trans_actions[] = {
- 17, 19, 19, 15, 0, 7, 22, 19,
- 19, 9, 0, 22, 19, 0, 5, 19,
- 11, 13, 19
+ 17, 19, 19, 15, 0, 7, 22, 19,
+ 19, 9, 0, 22, 19, 0, 5, 19,
+ 11, 13, 19
};
static const char _emoji_presentation_to_state_actions[] = {
- 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0
+ 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
};
static const char _emoji_presentation_from_state_actions[] = {
- 0, 0, 3, 0, 0, 0, 0, 0,
- 0, 0, 0, 0
+ 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0
};
static const char _emoji_presentation_eof_trans[] = {
- 1, 4, 0, 1, 17, 17, 17, 17,
- 18, 18, 17, 17
+ 1, 4, 0, 1, 17, 17, 17, 17,
+ 18, 18, 17, 17
};
static const int emoji_presentation_start = 2;
@@ -104,172 +104,172 @@ scan_emoji_presentation (emoji_text_iter_t p,
#line 107 "emoji_presentation_scanner.c"
- {
- cs = emoji_presentation_start;
- te = 0;
- act = 0;
- }
+ {
+ cs = emoji_presentation_start;
+ te = 0;
+ act = 0;
+ }
#line 115 "emoji_presentation_scanner.c"
- {
- int _klen;
- unsigned int _trans;
- const char *_acts;
- unsigned int _nacts;
- const unsigned char *_keys;
-
- if ( p == pe )
- goto _test_eof;
+ {
+ int _klen;
+ unsigned int _trans;
+ const char *_acts;
+ unsigned int _nacts;
+ const unsigned char *_keys;
+
+ if ( p == pe )
+ goto _test_eof;
_resume:
- _acts = _emoji_presentation_actions + _emoji_presentation_from_state_actions[cs];
- _nacts = (unsigned int) *_acts++;
- while ( _nacts-- > 0 ) {
- switch ( *_acts++ ) {
- case 1:
+ _acts = _emoji_presentation_actions + _emoji_presentation_from_state_actions[cs];
+ _nacts = (unsigned int) *_acts++;
+ while ( _nacts-- > 0 ) {
+ switch ( *_acts++ ) {
+ case 1:
#line 1 "NONE"
- break;
+ break;
#line 134 "emoji_presentation_scanner.c"
- }
- }
-
- _keys = _emoji_presentation_trans_keys + _emoji_presentation_key_offsets[cs];
- _trans = _emoji_presentation_index_offsets[cs];
-
- _klen = _emoji_presentation_single_lengths[cs];
- if ( _klen > 0 ) {
- const unsigned char *_lower = _keys;
- const unsigned char *_mid;
- const unsigned char *_upper = _keys + _klen - 1;
- while (1) {
- if ( _upper < _lower )
- break;
-
- _mid = _lower + ((_upper-_lower) >> 1);
- if ( (*p) < *_mid )
- _upper = _mid - 1;
- else if ( (*p) > *_mid )
- _lower = _mid + 1;
- else {
- _trans += (unsigned int)(_mid - _keys);
- goto _match;
- }
- }
- _keys += _klen;
- _trans += _klen;
- }
-
- _klen = _emoji_presentation_range_lengths[cs];
- if ( _klen > 0 ) {
- const unsigned char *_lower = _keys;
- const unsigned char *_mid;
- const unsigned char *_upper = _keys + (_klen<<1) - 2;
- while (1) {
- if ( _upper < _lower )
- break;
-
- _mid = _lower + (((_upper-_lower) >> 1) & ~1);
- if ( (*p) < _mid[0] )
- _upper = _mid - 2;
- else if ( (*p) > _mid[1] )
- _lower = _mid + 2;
- else {
- _trans += (unsigned int)((_mid - _keys)>>1);
- goto _match;
- }
- }
- _trans += _klen;
- }
+ }
+ }
+
+ _keys = _emoji_presentation_trans_keys + _emoji_presentation_key_offsets[cs];
+ _trans = _emoji_presentation_index_offsets[cs];
+
+ _klen = _emoji_presentation_single_lengths[cs];
+ if ( _klen > 0 ) {
+ const unsigned char *_lower = _keys;
+ const unsigned char *_mid;
+ const unsigned char *_upper = _keys + _klen - 1;
+ while (1) {
+ if ( _upper < _lower )
+ break;
+
+ _mid = _lower + ((_upper-_lower) >> 1);
+ if ( (*p) < *_mid )
+ _upper = _mid - 1;
+ else if ( (*p) > *_mid )
+ _lower = _mid + 1;
+ else {
+ _trans += (unsigned int)(_mid - _keys);
+ goto _match;
+ }
+ }
+ _keys += _klen;
+ _trans += _klen;
+ }
+
+ _klen = _emoji_presentation_range_lengths[cs];
+ if ( _klen > 0 ) {
+ const unsigned char *_lower = _keys;
+ const unsigned char *_mid;
+ const unsigned char *_upper = _keys + (_klen<<1) - 2;
+ while (1) {
+ if ( _upper < _lower )
+ break;
+
+ _mid = _lower + (((_upper-_lower) >> 1) & ~1);
+ if ( (*p) < _mid[0] )
+ _upper = _mid - 2;
+ else if ( (*p) > _mid[1] )
+ _lower = _mid + 2;
+ else {
+ _trans += (unsigned int)((_mid - _keys)>>1);
+ goto _match;
+ }
+ }
+ _trans += _klen;
+ }
_match:
- _trans = _emoji_presentation_indicies[_trans];
+ _trans = _emoji_presentation_indicies[_trans];
_eof_trans:
- cs = _emoji_presentation_trans_targs[_trans];
-
- if ( _emoji_presentation_trans_actions[_trans] == 0 )
- goto _again;
-
- _acts = _emoji_presentation_actions + _emoji_presentation_trans_actions[_trans];
- _nacts = (unsigned int) *_acts++;
- while ( _nacts-- > 0 )
- {
- switch ( *_acts++ )
- {
- case 2:
+ cs = _emoji_presentation_trans_targs[_trans];
+
+ if ( _emoji_presentation_trans_actions[_trans] == 0 )
+ goto _again;
+
+ _acts = _emoji_presentation_actions + _emoji_presentation_trans_actions[_trans];
+ _nacts = (unsigned int) *_acts++;
+ while ( _nacts-- > 0 )
+ {
+ switch ( *_acts++ )
+ {
+ case 2:
#line 1 "NONE"
- {te = p+1;}
- break;
- case 3:
+ {te = p+1;}
+ break;
+ case 3:
#line 74 "emoji_presentation_scanner.rl"
- {act = 2;}
- break;
- case 4:
+ {act = 2;}
+ break;
+ case 4:
#line 75 "emoji_presentation_scanner.rl"
- {act = 3;}
- break;
- case 5:
+ {act = 3;}
+ break;
+ case 5:
#line 73 "emoji_presentation_scanner.rl"
- {te = p+1;{ *is_emoji = false; return te; }}
- break;
- case 6:
+ {te = p+1;{ *is_emoji = false; return te; }}
+ break;
+ case 6:
#line 74 "emoji_presentation_scanner.rl"
- {te = p+1;{ *is_emoji = true; return te; }}
- break;
- case 7:
+ {te = p+1;{ *is_emoji = true; return te; }}
+ break;
+ case 7:
#line 75 "emoji_presentation_scanner.rl"
- {te = p+1;{ *is_emoji = false; return te; }}
- break;
- case 8:
+ {te = p+1;{ *is_emoji = false; return te; }}
+ break;
+ case 8:
#line 74 "emoji_presentation_scanner.rl"
- {te = p;p--;{ *is_emoji = true; return te; }}
- break;
- case 9:
+ {te = p;p--;{ *is_emoji = true; return te; }}
+ break;
+ case 9:
#line 75 "emoji_presentation_scanner.rl"
- {te = p;p--;{ *is_emoji = false; return te; }}
- break;
- case 10:
+ {te = p;p--;{ *is_emoji = false; return te; }}
+ break;
+ case 10:
#line 74 "emoji_presentation_scanner.rl"
- {{p = ((te))-1;}{ *is_emoji = true; return te; }}
- break;
- case 11:
+ {{p = ((te))-1;}{ *is_emoji = true; return te; }}
+ break;
+ case 11:
#line 1 "NONE"
- { switch( act ) {
- case 2:
- {{p = ((te))-1;} *is_emoji = true; return te; }
- break;
- case 3:
- {{p = ((te))-1;} *is_emoji = false; return te; }
- break;
- }
- }
- break;
+ { switch( act ) {
+ case 2:
+ {{p = ((te))-1;} *is_emoji = true; return te; }
+ break;
+ case 3:
+ {{p = ((te))-1;} *is_emoji = false; return te; }
+ break;
+ }
+ }
+ break;
#line 248 "emoji_presentation_scanner.c"
- }
- }
+ }
+ }
_again:
- _acts = _emoji_presentation_actions + _emoji_presentation_to_state_actions[cs];
- _nacts = (unsigned int) *_acts++;
- while ( _nacts-- > 0 ) {
- switch ( *_acts++ ) {
- case 0:
+ _acts = _emoji_presentation_actions + _emoji_presentation_to_state_actions[cs];
+ _nacts = (unsigned int) *_acts++;
+ while ( _nacts-- > 0 ) {
+ switch ( *_acts++ ) {
+ case 0:
#line 1 "NONE"
- break;
+ break;
#line 261 "emoji_presentation_scanner.c"
- }
- }
-
- if ( ++p != pe )
- goto _resume;
- _test_eof: {}
- if ( p == eof )
- {
- if ( _emoji_presentation_eof_trans[cs] > 0 ) {
- _trans = _emoji_presentation_eof_trans[cs] - 1;
- goto _eof_trans;
- }
- }
-
- }
+ }
+ }
+
+ if ( ++p != pe )
+ goto _resume;
+ _test_eof: {}
+ if ( p == eof )
+ {
+ if ( _emoji_presentation_eof_trans[cs] > 0 ) {
+ _trans = _emoji_presentation_eof_trans[cs] - 1;
+ goto _eof_trans;
+ }
+ }
+
+ }
#line 94 "emoji_presentation_scanner.rl"
diff --git a/pango/glyphstring.c b/pango/glyphstring.c
index 70331d59..9ae86b93 100644
--- a/pango/glyphstring.c
+++ b/pango/glyphstring.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* glyphstring.c:
*
* Copyright (C) 1999 Red Hat Software
@@ -10,7 +10,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -30,17 +30,17 @@
#include <hb-ot.h>
/**
- * pango_glyph_string_new:
+ * pango2_glyph_string_new:
*
- * Create a new `PangoGlyphString`.
+ * Create a new `Pango2GlyphString`.
*
- * Return value: the newly allocated `PangoGlyphString`, which
- * should be freed with [method@Pango.GlyphString.free].
+ * Return value: the newly allocated `Pango2GlyphString`, which
+ * should be freed with [method@Pango2.GlyphString.free].
*/
-PangoGlyphString *
-pango_glyph_string_new (void)
+Pango2GlyphString *
+pango2_glyph_string_new (void)
{
- PangoGlyphString *string = g_slice_new (PangoGlyphString);
+ Pango2GlyphString *string = g_slice_new (Pango2GlyphString);
string->num_glyphs = 0;
string->space = 0;
@@ -51,76 +51,77 @@ pango_glyph_string_new (void)
}
/**
- * pango_glyph_string_set_size:
- * @string: a `PangoGlyphString`.
+ * pango2_glyph_string_set_size:
+ * @string: a `Pango2GlyphString`.
* @new_len: the new length of the string
*
* Resize a glyph string to the given length.
*/
void
-pango_glyph_string_set_size (PangoGlyphString *string, int new_len)
+pango2_glyph_string_set_size (Pango2GlyphString *string,
+ int new_len)
{
g_return_if_fail (new_len >= 0);
while (new_len > string->space)
{
if (string->space == 0)
- {
- string->space = 4;
- }
+ {
+ string->space = 4;
+ }
else
- {
- const guint max_space =
- MIN (G_MAXINT, G_MAXSIZE / MAX (sizeof(PangoGlyphInfo), sizeof(int)));
+ {
+ const guint max_space =
+ MIN (G_MAXINT, G_MAXSIZE / MAX (sizeof(Pango2GlyphInfo), sizeof(int)));
- guint more_space = (guint)string->space * 2;
+ guint more_space = (guint)string->space * 2;
- if (more_space > max_space)
- {
- more_space = max_space;
+ if (more_space > max_space)
+ {
+ more_space = max_space;
- if ((guint)new_len > max_space)
- {
- g_error ("%s: failed to allocate glyph string of length %i\n",
- G_STRLOC, new_len);
- }
- }
+ if ((guint)new_len > max_space)
+ {
+ g_error ("%s: failed to allocate glyph string of length %i\n",
+ G_STRLOC, new_len);
+ }
+ }
- string->space = more_space;
- }
+ string->space = more_space;
+ }
}
- string->glyphs = g_realloc (string->glyphs, string->space * sizeof (PangoGlyphInfo));
+ string->glyphs = g_realloc (string->glyphs, string->space * sizeof (Pango2GlyphInfo));
string->log_clusters = g_realloc (string->log_clusters, string->space * sizeof (int));
string->num_glyphs = new_len;
}
-G_DEFINE_BOXED_TYPE (PangoGlyphString, pango_glyph_string,
- pango_glyph_string_copy,
- pango_glyph_string_free);
+G_DEFINE_BOXED_TYPE (Pango2GlyphString, pango2_glyph_string,
+ pango2_glyph_string_copy,
+ pango2_glyph_string_free);
/**
- * pango_glyph_string_copy:
- * @string: (nullable): a `PangoGlyphString`
+ * pango2_glyph_string_copy:
+ * @string: (nullable): a `Pango2GlyphString`
*
* Copy a glyph string and associated storage.
*
- * Return value: (nullable): the newly allocated `PangoGlyphString`
+ * Return value: (nullable): the newly allocated `Pango2GlyphString`
*/
-PangoGlyphString *
-pango_glyph_string_copy (PangoGlyphString *string)
+Pango2GlyphString *
+pango2_glyph_string_copy (Pango2GlyphString *string)
{
- PangoGlyphString *new_string;
+ Pango2GlyphString *new_string;
if (string == NULL)
return NULL;
- new_string = g_slice_new (PangoGlyphString);
+ new_string = g_slice_new (Pango2GlyphString);
*new_string = *string;
new_string->glyphs = g_memdup2 (string->glyphs,
- string->space * sizeof (PangoGlyphInfo));
+ string->space * sizeof (Pango2GlyphInfo));
new_string->log_clusters = g_memdup2 (string->log_clusters,
string->space * sizeof (int));
@@ -128,29 +129,29 @@ pango_glyph_string_copy (PangoGlyphString *string)
}
/**
- * pango_glyph_string_free:
- * @string: (nullable): a `PangoGlyphString`, may be %NULL
+ * pango2_glyph_string_free:
+ * @string: (nullable): a `Pango2GlyphString`, may be %NULL
*
* Free a glyph string and associated storage.
*/
void
-pango_glyph_string_free (PangoGlyphString *string)
+pango2_glyph_string_free (Pango2GlyphString *string)
{
if (string == NULL)
return;
g_free (string->glyphs);
g_free (string->log_clusters);
- g_slice_free (PangoGlyphString, string);
+ g_slice_free (Pango2GlyphString, string);
}
/**
- * pango_glyph_string_extents_range:
- * @glyphs: a `PangoGlyphString`
+ * pango2_glyph_string_extents_range:
+ * @glyphs: a `Pango2GlyphString`
* @start: start index
* @end: end index (the range is the set of bytes with
* indices such that start <= index < end)
- * @font: a `PangoFont`
+ * @font: a `Pango2Font`
* @ink_rect: (out caller-allocates) (optional): rectangle used to
* store the extents of the glyph string range as drawn
* @logical_rect: (out caller-allocates) (optional): rectangle used to
@@ -163,12 +164,12 @@ pango_glyph_string_free (PangoGlyphString *string)
* not at the start of the entire glyph string).
*/
void
-pango_glyph_string_extents_range (PangoGlyphString *glyphs,
- int start,
- int end,
- PangoFont *font,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_glyph_string_extents_range (Pango2GlyphString *glyphs,
+ int start,
+ int end,
+ Pango2Font *font,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
int x_pos = 0;
int i;
@@ -204,72 +205,72 @@ pango_glyph_string_extents_range (PangoGlyphString *glyphs,
for (i = start; i < end; i++)
{
- PangoRectangle glyph_ink;
- PangoRectangle glyph_logical;
+ Pango2Rectangle glyph_ink;
+ Pango2Rectangle glyph_logical;
- PangoGlyphGeometry *geometry = &glyphs->glyphs[i].geometry;
+ Pango2GlyphGeometry *geometry = &glyphs->glyphs[i].geometry;
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph,
- ink_rect ? &glyph_ink : NULL,
- logical_rect ? &glyph_logical : NULL);
+ pango2_font_get_glyph_extents (font, glyphs->glyphs[i].glyph,
+ ink_rect ? &glyph_ink : NULL,
+ logical_rect ? &glyph_logical : NULL);
if (ink_rect && glyph_ink.width != 0 && glyph_ink.height != 0)
- {
- if (ink_rect->width == 0 || ink_rect->height == 0)
- {
- ink_rect->x = x_pos + glyph_ink.x + geometry->x_offset;
- ink_rect->width = glyph_ink.width;
- ink_rect->y = glyph_ink.y + geometry->y_offset;
- ink_rect->height = glyph_ink.height;
- }
- else
- {
- int new_x, new_y;
-
- new_x = MIN (ink_rect->x, x_pos + glyph_ink.x + geometry->x_offset);
- ink_rect->width = MAX (ink_rect->x + ink_rect->width,
- x_pos + glyph_ink.x + glyph_ink.width + geometry->x_offset) - new_x;
- ink_rect->x = new_x;
-
- new_y = MIN (ink_rect->y, glyph_ink.y + geometry->y_offset);
- ink_rect->height = MAX (ink_rect->y + ink_rect->height,
- glyph_ink.y + glyph_ink.height + geometry->y_offset) - new_y;
- ink_rect->y = new_y;
- }
- }
+ {
+ if (ink_rect->width == 0 || ink_rect->height == 0)
+ {
+ ink_rect->x = x_pos + glyph_ink.x + geometry->x_offset;
+ ink_rect->width = glyph_ink.width;
+ ink_rect->y = glyph_ink.y + geometry->y_offset;
+ ink_rect->height = glyph_ink.height;
+ }
+ else
+ {
+ int new_x, new_y;
+
+ new_x = MIN (ink_rect->x, x_pos + glyph_ink.x + geometry->x_offset);
+ ink_rect->width = MAX (ink_rect->x + ink_rect->width,
+ x_pos + glyph_ink.x + glyph_ink.width + geometry->x_offset) - new_x;
+ ink_rect->x = new_x;
+
+ new_y = MIN (ink_rect->y, glyph_ink.y + geometry->y_offset);
+ ink_rect->height = MAX (ink_rect->y + ink_rect->height,
+ glyph_ink.y + glyph_ink.height + geometry->y_offset) - new_y;
+ ink_rect->y = new_y;
+ }
+ }
if (logical_rect)
- {
- logical_rect->width += geometry->width;
-
- if (i == start)
- {
- logical_rect->y = glyph_logical.y;
- logical_rect->height = glyph_logical.height;
- }
- else
- {
- int new_y = MIN (logical_rect->y, glyph_logical.y);
- logical_rect->height = MAX (logical_rect->y + logical_rect->height,
- glyph_logical.y + glyph_logical.height) - new_y;
- logical_rect->y = new_y;
- }
- }
+ {
+ logical_rect->width += geometry->width;
+
+ if (i == start)
+ {
+ logical_rect->y = glyph_logical.y;
+ logical_rect->height = glyph_logical.height;
+ }
+ else
+ {
+ int new_y = MIN (logical_rect->y, glyph_logical.y);
+ logical_rect->height = MAX (logical_rect->y + logical_rect->height,
+ glyph_logical.y + glyph_logical.height) - new_y;
+ logical_rect->y = new_y;
+ }
+ }
x_pos += geometry->width;
}
}
/**
- * pango_glyph_string_extents:
- * @glyphs: a `PangoGlyphString`
- * @font: a `PangoFont`
+ * pango2_glyph_string_extents:
+ * @glyphs: a `Pango2GlyphString`
+ * @font: a `Pango2Font`
* @ink_rect: (out) (optional): rectangle used to store the extents of the glyph string as drawn
* @logical_rect: (out) (optional): rectangle used to store the logical extents of the glyph string
*
* Compute the logical and ink extents of a glyph string.
*
- * See the documentation for [method@Pango.Font.get_glyph_extents] for details
+ * See the documentation for [method@Pango2.Font.get_glyph_extents] for details
* about the interpretation of the rectangles.
*
* Examples of logical (red) and ink (green) rects:
@@ -277,22 +278,22 @@ pango_glyph_string_extents_range (PangoGlyphString *glyphs,
* ![](rects1.png) ![](rects2.png)
*/
void
-pango_glyph_string_extents (PangoGlyphString *glyphs,
- PangoFont *font,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_glyph_string_extents (Pango2GlyphString *glyphs,
+ Pango2Font *font,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
- pango_glyph_string_extents_range (glyphs, 0, glyphs->num_glyphs,
- font, ink_rect, logical_rect);
+ pango2_glyph_string_extents_range (glyphs, 0, glyphs->num_glyphs,
+ font, ink_rect, logical_rect);
}
/**
- * pango_glyph_string_get_width:
- * @glyphs: a `PangoGlyphString`
+ * pango2_glyph_string_get_width:
+ * @glyphs: a `Pango2GlyphString`
*
* Computes the logical width of the glyph string.
*
- * This can also be computed using [method@Pango.GlyphString.extents].
+ * This can also be computed using [method@Pango2.GlyphString.extents].
* However, since this only computes the width, it's much faster. This
* is in fact only a convenience function that computes the sum of
* @geometry.width for each glyph in the @glyphs.
@@ -300,7 +301,7 @@ pango_glyph_string_extents (PangoGlyphString *glyphs,
* Return value: the logical width of the glyph string.
*/
int
-pango_glyph_string_get_width (PangoGlyphString *glyphs)
+pango2_glyph_string_get_width (Pango2GlyphString *glyphs)
{
int i;
int width = 0;
@@ -312,8 +313,8 @@ pango_glyph_string_get_width (PangoGlyphString *glyphs)
}
/**
- * pango_glyph_string_get_logical_widths:
- * @glyphs: a `PangoGlyphString`
+ * pango2_glyph_string_get_logical_widths:
+ * @glyphs: a `Pango2GlyphString`
* @text: the text corresponding to the glyphs
* @length: the length of @text, in bytes
* @embedding_level: the embedding level of the string
@@ -321,28 +322,28 @@ pango_glyph_string_get_width (PangoGlyphString *glyphs)
* characters in text (equal to `g_utf8_strlen (text, length)` unless
* text has `NUL` bytes) to be filled in with the resulting character widths.
*
- * Given a `PangoGlyphString` and corresponding text, determine the width
+ * Given a `Pango2GlyphString` and corresponding text, determine the width
* corresponding to each character.
*
* When multiple characters compose a single cluster, the width of the
* entire cluster is divided equally among the characters.
*/
void
-pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs,
- const char *text,
- int length,
- int embedding_level,
- int *logical_widths)
+pango2_glyph_string_get_logical_widths (Pango2GlyphString *glyphs,
+ const char *text,
+ int length,
+ int embedding_level,
+ int *logical_widths)
{
- /* Build a PangoGlyphItem and call the other API */
- PangoItem item = {0, length, pango_utf8_strlen (text, length), 0,
+ /* Build a Pango2GlyphItem and call the other API */
+ Pango2Item item = {0, length, pango2_utf8_strlen (text, length), 0,
{NULL, NULL,
- embedding_level, PANGO_GRAVITY_AUTO, 0,
+ embedding_level, PANGO2_GRAVITY_AUTO, 0,
G_UNICODE_SCRIPT_UNKNOWN, NULL,
NULL}};
- PangoGlyphItem glyph_item = {&item, glyphs};
+ Pango2GlyphItem glyph_item = {&item, glyphs};
- pango_glyph_item_get_logical_widths (&glyph_item, text, logical_widths);
+ pango2_glyph_item_get_logical_widths (&glyph_item, text, logical_widths);
}
/* The initial implementation here is script independent,
@@ -355,7 +356,7 @@ pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs,
*/
/**
- * pango_glyph_string_index_to_x:
+ * pango2_glyph_string_index_to_x:
* @glyphs: the glyphs return from [func@shape]
* @text: the text for the run
* @length: the number of bytes (not characters) in @text.
@@ -378,15 +379,15 @@ pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs,
* </picture>
*/
void
-pango_glyph_string_index_to_x (PangoGlyphString *glyphs,
- const char *text,
- int length,
- const PangoAnalysis *analysis,
- int index,
- gboolean trailing,
- int *x_pos)
+pango2_glyph_string_index_to_x (Pango2GlyphString *glyphs,
+ const char *text,
+ int length,
+ const Pango2Analysis *analysis,
+ int index,
+ gboolean trailing,
+ int *x_pos)
{
- pango_glyph_string_index_to_x_full (glyphs,
+ pango2_glyph_string_index_to_x_full (glyphs,
text, length,
analysis,
NULL,
@@ -395,12 +396,12 @@ pango_glyph_string_index_to_x (PangoGlyphString *glyphs,
}
/**
- * pango_glyph_string_index_to_x_full:
+ * pango2_glyph_string_index_to_x_full:
* @glyphs: the glyphs return from [func@shape]
* @text: the text for the run
* @length: the number of bytes (not characters) in @text.
* @analysis: the analysis information return from [func@itemize]
- * @attrs: (nullable): `PangoLogAttr` array for @text
+ * @attrs: (nullable): `Pango2LogAttr` array for @text
* @index_: the byte index within @text
* @trailing: whether we should compute the result for the beginning (%FALSE)
* or end (%TRUE) of the character.
@@ -408,20 +409,20 @@ pango_glyph_string_index_to_x (PangoGlyphString *glyphs,
*
* Converts from character position to x position.
*
- * This variant of [method@Pango.GlyphString.index_to_x] additionally
- * accepts a `PangoLogAttr` array. The grapheme boundary information
+ * This variant of [method@Pango2.GlyphString.index_to_x] additionally
+ * accepts a `Pango2LogAttr` array. The grapheme boundary information
* in it can be used to disambiguate positioning inside some complex
* clusters.
*/
void
-pango_glyph_string_index_to_x_full (PangoGlyphString *glyphs,
- const char *text,
- int length,
- const PangoAnalysis *analysis,
- PangoLogAttr *attrs,
- int index,
- gboolean trailing,
- int *x_pos)
+pango2_glyph_string_index_to_x_full (Pango2GlyphString *glyphs,
+ const char *text,
+ int length,
+ const Pango2Analysis *analysis,
+ Pango2LogAttr *attrs,
+ int index,
+ gboolean trailing,
+ int *x_pos)
{
int i;
int start_xpos = 0;
@@ -564,7 +565,7 @@ pango_glyph_string_index_to_x_full (PangoGlyphString *glyphs,
int glyph_pos;
int num_carets;
- hb_font = pango_font_get_hb_font (analysis->font);
+ hb_font = pango2_font_get_hb_font (analysis->font);
if (start_glyph_pos == end_glyph_pos)
glyph_pos = start_glyph_pos;
@@ -619,12 +620,12 @@ fallback:
}
/**
- * pango_glyph_string_x_to_index:
+ * pango2_glyph_string_x_to_index:
* @glyphs: the glyphs returned from [func@shape]
* @text: the text for the run
* @length: the number of bytes (not characters) in text.
* @analysis: the analysis information return from [func@itemize]
- * @x_pos: the x offset (in Pango units)
+ * @x_pos: the x offset (in Pango2 units)
* @index_: (out): location to store calculated byte index within @text
* @trailing: (out): location to store a boolean indicating whether the
* user clicked on the leading or trailing edge of the character
@@ -638,13 +639,13 @@ fallback:
* attributes for the text to compute the valid cursor position.
*/
void
-pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
- const char *text,
- int length,
- const PangoAnalysis *analysis,
- int x_pos,
- int *index,
- gboolean *trailing)
+pango2_glyph_string_x_to_index (Pango2GlyphString *glyphs,
+ const char *text,
+ int length,
+ const Pango2Analysis *analysis,
+ int x_pos,
+ int *index,
+ gboolean *trailing)
{
int i;
int start_xpos = 0;
@@ -666,55 +667,55 @@ pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
if (analysis->level % 2) /* Right to left */
{
for (i = glyphs->num_glyphs - 1; i >= 0; i--)
- width += glyphs->glyphs[i].geometry.width;
+ width += glyphs->glyphs[i].geometry.width;
for (i = glyphs->num_glyphs - 1; i >= 0; i--)
- {
- if (glyphs->log_clusters[i] != start_index)
- {
- if (found)
- {
- end_index = glyphs->log_clusters[i];
- end_xpos = width;
- break;
- }
- else
- {
- start_index = glyphs->log_clusters[i];
- start_xpos = width;
- }
- }
-
- width -= glyphs->glyphs[i].geometry.width;
-
- if (width <= x_pos && x_pos < width + glyphs->glyphs[i].geometry.width)
- found = TRUE;
- }
+ {
+ if (glyphs->log_clusters[i] != start_index)
+ {
+ if (found)
+ {
+ end_index = glyphs->log_clusters[i];
+ end_xpos = width;
+ break;
+ }
+ else
+ {
+ start_index = glyphs->log_clusters[i];
+ start_xpos = width;
+ }
+ }
+
+ width -= glyphs->glyphs[i].geometry.width;
+
+ if (width <= x_pos && x_pos < width + glyphs->glyphs[i].geometry.width)
+ found = TRUE;
+ }
}
else /* Left to right */
{
for (i = 0; i < glyphs->num_glyphs; i++)
- {
- if (glyphs->log_clusters[i] != start_index)
- {
- if (found)
- {
- end_index = glyphs->log_clusters[i];
- end_xpos = width;
- break;
- }
- else
- {
- start_index = glyphs->log_clusters[i];
- start_xpos = width;
- }
- }
-
- if (width <= x_pos && x_pos < width + glyphs->glyphs[i].geometry.width)
- found = TRUE;
-
- width += glyphs->glyphs[i].geometry.width;
- }
+ {
+ if (glyphs->log_clusters[i] != start_index)
+ {
+ if (found)
+ {
+ end_index = glyphs->log_clusters[i];
+ end_xpos = width;
+ break;
+ }
+ else
+ {
+ start_index = glyphs->log_clusters[i];
+ start_xpos = width;
+ }
+ }
+
+ if (width <= x_pos && x_pos < width + glyphs->glyphs[i].geometry.width)
+ found = TRUE;
+
+ width += glyphs->glyphs[i].geometry.width;
+ }
}
if (end_index == -1)
@@ -734,9 +735,9 @@ pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
if (start_xpos == end_xpos)
{
if (index)
- *index = start_index;
+ *index = start_index;
if (trailing)
- *trailing = FALSE;
+ *trailing = FALSE;
}
else
{
@@ -748,45 +749,45 @@ pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
* character for LTR, with the previous character for RTL.
*/
if (start_xpos < end_xpos) /* Left-to-right */
- {
- if (index)
- {
- const char *p = text + start_index;
- int i = 0;
-
- while (i + 1 <= cp)
- {
- p = g_utf8_next_char (p);
- i++;
- }
-
- *index = (p - text);
- }
-
- if (trailing)
- *trailing = (cp - (int)cp >= 0.5) ? TRUE : FALSE;
- }
+ {
+ if (index)
+ {
+ const char *p = text + start_index;
+ int i = 0;
+
+ while (i + 1 <= cp)
+ {
+ p = g_utf8_next_char (p);
+ i++;
+ }
+
+ *index = (p - text);
+ }
+
+ if (trailing)
+ *trailing = (cp - (int)cp >= 0.5) ? TRUE : FALSE;
+ }
else /* Right-to-left */
- {
- if (index)
- {
- const char *p = text + start_index;
- int i = 0;
-
- while (i + 1 < cp)
- {
- p = g_utf8_next_char (p);
- i++;
- }
-
- *index = (p - text);
- }
-
- if (trailing)
- {
- double cp_flip = cluster_chars - cp;
- *trailing = (cp_flip - (int)cp_flip >= 0.5) ? FALSE : TRUE;
- }
- }
+ {
+ if (index)
+ {
+ const char *p = text + start_index;
+ int i = 0;
+
+ while (i + 1 < cp)
+ {
+ p = g_utf8_next_char (p);
+ i++;
+ }
+
+ *index = (p - text);
+ }
+
+ if (trailing)
+ {
+ double cp_flip = cluster_chars - cp;
+ *trailing = (cp_flip - (int)cp_flip >= 0.5) ? FALSE : TRUE;
+ }
+ }
}
}
diff --git a/pango/itemize.c b/pango/itemize.c
index f1b4fd8d..1cf4e6ea 100644
--- a/pango/itemize.c
+++ b/pango/itemize.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* itemize.c: Turning text into items
*
* Copyright (C) 2000, 2006 Red Hat Software
@@ -49,7 +49,7 @@ typedef struct {
} FontCache;
typedef struct {
- PangoFont *font;
+ Pango2Font *font;
int position; /* position of the font in the fontset */
} FontElement;
@@ -69,7 +69,7 @@ font_element_destroy (FontElement *element)
}
static FontCache *
-get_font_cache (PangoFontset *fontset)
+get_font_cache (Pango2Fontset *fontset)
{
FontCache *cache;
@@ -97,10 +97,10 @@ retry:
}
static gboolean
-font_cache_get (FontCache *cache,
- gunichar wc,
- PangoFont **font,
- int *position)
+font_cache_get (FontCache *cache,
+ gunichar wc,
+ Pango2Font **font,
+ int *position)
{
FontElement *element;
@@ -116,10 +116,10 @@ font_cache_get (FontCache *cache,
}
static void
-font_cache_insert (FontCache *cache,
- gunichar wc,
- PangoFont *font,
- int position)
+font_cache_insert (FontCache *cache,
+ gunichar wc,
+ Pango2Font *font,
+ int position)
{
FontElement *element = g_slice_new (FontElement);
element->font = font ? g_object_ref (font) : NULL;
@@ -129,17 +129,17 @@ font_cache_insert (FontCache *cache,
}
/* }}} */
-/* {{{ Width Iter */
+/* {{{ Width Iter */
-typedef struct _PangoWidthIter PangoWidthIter;
+typedef struct _Pango2WidthIter Pango2WidthIter;
-struct _PangoWidthIter
+struct _Pango2WidthIter
{
- const char *text_start;
- const char *text_end;
- const char *start;
- const char *end;
- gboolean upright;
+ const char *text_start;
+ const char *text_end;
+ const char *start;
+ const char *end;
+ gboolean upright;
};
static gboolean
@@ -200,7 +200,7 @@ width_iter_is_upright (gunichar ch)
}
static void
-width_iter_next (PangoWidthIter *iter)
+width_iter_next (Pango2WidthIter *iter)
{
gboolean met_joiner = FALSE;
iter->start = iter->end;
@@ -248,9 +248,9 @@ width_iter_next (PangoWidthIter *iter)
}
static void
-width_iter_init (PangoWidthIter *iter,
- const char *text,
- int length)
+width_iter_init (Pango2WidthIter *iter,
+ const char *text,
+ int length)
{
iter->text_start = text;
iter->text_end = text + length;
@@ -260,12 +260,12 @@ width_iter_init (PangoWidthIter *iter,
}
static void
-width_iter_fini (PangoWidthIter *iter)
+width_iter_fini (Pango2WidthIter *iter)
{
}
/* }}} */
-/* {{{ Itemization */
+ /* {{{ Itemization */
typedef struct _ItemizeState ItemizeState;
@@ -283,7 +283,7 @@ typedef enum {
struct _ItemizeState
{
- PangoContext *context;
+ Pango2Context *context;
const char *text;
const char *end;
@@ -291,42 +291,42 @@ struct _ItemizeState
const char *run_end;
GList *result;
- PangoItem *item;
+ Pango2Item *item;
guint8 *embedding_levels;
int embedding_end_offset;
const char *embedding_end;
guint8 embedding;
- PangoGravity gravity;
- PangoGravityHint gravity_hint;
- PangoGravity resolved_gravity;
- PangoGravity font_desc_gravity;
+ Pango2Gravity gravity;
+ Pango2GravityHint gravity_hint;
+ Pango2Gravity resolved_gravity;
+ Pango2Gravity font_desc_gravity;
gboolean centered_baseline;
- PangoAttrIterator *attr_iter;
+ Pango2AttrIterator *attr_iter;
gboolean free_attr_iter;
const char *attr_end;
- PangoFontDescription *font_desc;
- PangoFontDescription *emoji_font_desc;
- PangoLanguage *lang;
+ Pango2FontDescription *font_desc;
+ Pango2FontDescription *emoji_font_desc;
+ Pango2Language *lang;
GSList *extra_attrs;
gboolean copy_extra_attrs;
ChangedFlags changed;
- PangoScriptIter script_iter;
+ Pango2ScriptIter script_iter;
const char *script_end;
GUnicodeScript script;
- PangoWidthIter width_iter;
- PangoEmojiIter emoji_iter;
+ Pango2WidthIter width_iter;
+ Pango2EmojiIter emoji_iter;
- PangoLanguage *derived_lang;
+ Pango2Language *derived_lang;
- PangoFontset *current_fonts;
+ Pango2Fontset *current_fonts;
FontCache *cache;
- PangoFont *base_font;
+ Pango2Font *base_font;
gboolean enable_fallback;
const char *first_space; /* first of a sequence of spaces we've seen */
@@ -347,15 +347,15 @@ update_embedding_end (ItemizeState *state)
state->changed |= EMBEDDING_CHANGED;
}
-static PangoAttribute *
+static Pango2Attribute *
find_attribute (GSList *attr_list,
- PangoAttrType type)
+ Pango2AttrType type)
{
GSList *node;
for (node = attr_list; node; node = node->next)
- if (((PangoAttribute *) node->data)->type == type)
- return (PangoAttribute *) node->data;
+ if (((Pango2Attribute *) node->data)->type == type)
+ return (Pango2Attribute *) node->data;
return NULL;
}
@@ -363,11 +363,11 @@ find_attribute (GSList *attr_list,
static void
update_attr_iterator (ItemizeState *state)
{
- PangoLanguage *old_lang;
- PangoAttribute *attr;
+ Pango2Language *old_lang;
+ Pango2Attribute *attr;
int end_index;
- pango_attr_iterator_range (state->attr_iter, NULL, &end_index);
+ pango2_attr_iterator_range (state->attr_iter, NULL, &end_index);
if (end_index < state->end - state->text)
state->attr_end = state->text + end_index;
else
@@ -375,34 +375,34 @@ update_attr_iterator (ItemizeState *state)
if (state->emoji_font_desc)
{
- pango_font_description_free (state->emoji_font_desc);
+ pango2_font_description_free (state->emoji_font_desc);
state->emoji_font_desc = NULL;
}
old_lang = state->lang;
if (state->font_desc)
- pango_font_description_free (state->font_desc);
- state->font_desc = pango_font_description_copy_static (state->context->font_desc);
- pango_attr_iterator_get_font (state->attr_iter, state->font_desc,
+ pango2_font_description_free (state->font_desc);
+ state->font_desc = pango2_font_description_copy_static (state->context->font_desc);
+ pango2_attr_iterator_get_font (state->attr_iter, state->font_desc,
&state->lang, &state->extra_attrs);
- if (pango_font_description_get_set_fields (state->font_desc) & PANGO_FONT_MASK_GRAVITY)
- state->font_desc_gravity = pango_font_description_get_gravity (state->font_desc);
+ if (pango2_font_description_get_set_fields (state->font_desc) & PANGO2_FONT_MASK_GRAVITY)
+ state->font_desc_gravity = pango2_font_description_get_gravity (state->font_desc);
else
- state->font_desc_gravity = PANGO_GRAVITY_AUTO;
+ state->font_desc_gravity = PANGO2_GRAVITY_AUTO;
state->copy_extra_attrs = FALSE;
if (!state->lang)
state->lang = state->context->language;
- attr = find_attribute (state->extra_attrs, PANGO_ATTR_FALLBACK);
+ attr = find_attribute (state->extra_attrs, PANGO2_ATTR_FALLBACK);
state->enable_fallback = (attr == NULL || attr->int_value);
- attr = find_attribute (state->extra_attrs, PANGO_ATTR_GRAVITY);
- state->gravity = attr == NULL ? PANGO_GRAVITY_AUTO : attr->int_value;
+ attr = find_attribute (state->extra_attrs, PANGO2_ATTR_GRAVITY);
+ state->gravity = attr == NULL ? PANGO2_GRAVITY_AUTO : attr->int_value;
- attr = find_attribute (state->extra_attrs, PANGO_ATTR_GRAVITY_HINT);
- state->gravity_hint = attr == NULL ? state->context->gravity_hint : (PangoGravityHint)attr->int_value;
+ attr = find_attribute (state->extra_attrs, PANGO2_ATTR_GRAVITY_HINT);
+ state->gravity_hint = attr == NULL ? state->context->gravity_hint : (Pango2GravityHint)attr->int_value;
state->changed |= FONT_CHANGED;
if (state->lang != old_lang)
@@ -425,15 +425,15 @@ update_end (ItemizeState *state)
static void
-itemize_state_init (ItemizeState *state,
- PangoContext *context,
- const char *text,
- PangoDirection base_dir,
- int start_index,
- int length,
- PangoAttrList *attrs,
- PangoAttrIterator *cached_iter,
- const PangoFontDescription *desc)
+itemize_state_init (ItemizeState *state,
+ Pango2Context *context,
+ const char *text,
+ Pango2Direction base_dir,
+ int start_index,
+ int length,
+ Pango2AttrList *attrs,
+ Pango2AttrIterator *cached_iter,
+ const Pango2FontDescription *desc)
{
state->context = context;
state->text = text;
@@ -449,16 +449,16 @@ itemize_state_init (ItemizeState *state,
/* First, apply the bidirectional algorithm to break
* the text into directional runs.
*/
- state->embedding_levels = pango_log2vis_get_embedding_levels (text + start_index, length, &base_dir);
+ state->embedding_levels = pango2_log2vis_get_embedding_levels (text + start_index, length, &base_dir);
state->embedding_end_offset = 0;
state->embedding_end = text + start_index;
update_embedding_end (state);
- state->gravity = PANGO_GRAVITY_AUTO;
- state->centered_baseline = PANGO_GRAVITY_IS_VERTICAL (state->context->resolved_gravity);
+ state->gravity = PANGO2_GRAVITY_AUTO;
+ state->centered_baseline = PANGO2_GRAVITY_IS_VERTICAL (state->context->resolved_gravity);
state->gravity_hint = state->context->gravity_hint;
- state->resolved_gravity = PANGO_GRAVITY_AUTO;
+ state->resolved_gravity = PANGO2_GRAVITY_AUTO;
/* Initialize the attribute iterator
*/
@@ -469,7 +469,7 @@ itemize_state_init (ItemizeState *state,
}
else if (attrs)
{
- state->attr_iter = pango_attr_list_get_iterator (attrs);
+ state->attr_iter = pango2_attr_list_get_iterator (attrs);
state->free_attr_iter = TRUE;
}
else
@@ -484,12 +484,12 @@ itemize_state_init (ItemizeState *state,
state->font_desc = NULL;
state->lang = NULL;
- pango_attr_iterator_advance (state->attr_iter, start_index);
+ pango2_attr_iterator_advance (state->attr_iter, start_index);
update_attr_iterator (state);
}
else
{
- state->font_desc = pango_font_description_copy_static (desc ? desc : state->context->font_desc);
+ state->font_desc = pango2_font_description_copy_static (desc ? desc : state->context->font_desc);
state->lang = state->context->language;
state->extra_attrs = NULL;
state->copy_extra_attrs = FALSE;
@@ -500,24 +500,24 @@ itemize_state_init (ItemizeState *state,
/* Initialize the script iterator
*/
- _pango_script_iter_init (&state->script_iter, text + start_index, length);
- pango_script_iter_get_range (&state->script_iter, NULL,
+ _pango2_script_iter_init (&state->script_iter, text + start_index, length);
+ pango2_script_iter_get_range (&state->script_iter, NULL,
&state->script_end, &state->script);
width_iter_init (&state->width_iter, text + start_index, length);
- _pango_emoji_iter_init (&state->emoji_iter, text + start_index, length);
+ _pango2_emoji_iter_init (&state->emoji_iter, text + start_index, length);
- if (!PANGO_GRAVITY_IS_VERTICAL (state->context->resolved_gravity))
+ if (!PANGO2_GRAVITY_IS_VERTICAL (state->context->resolved_gravity))
state->width_iter.end = state->end;
else if (state->emoji_iter.is_emoji)
state->width_iter.end = MAX (state->width_iter.end, state->emoji_iter.end);
update_end (state);
- if (pango_font_description_get_set_fields (state->font_desc) & PANGO_FONT_MASK_GRAVITY)
- state->font_desc_gravity = pango_font_description_get_gravity (state->font_desc);
+ if (pango2_font_description_get_set_fields (state->font_desc) & PANGO2_FONT_MASK_GRAVITY)
+ state->font_desc_gravity = pango2_font_description_get_gravity (state->font_desc);
else
- state->font_desc_gravity = PANGO_GRAVITY_AUTO;
+ state->font_desc_gravity = PANGO2_GRAVITY_AUTO;
state->derived_lang = NULL;
state->current_fonts = NULL;
@@ -544,20 +544,20 @@ itemize_state_next (ItemizeState *state)
if (state->run_end == state->attr_end)
{
- pango_attr_iterator_next (state->attr_iter);
+ pango2_attr_iterator_next (state->attr_iter);
update_attr_iterator (state);
}
if (state->run_end == state->script_end)
{
- pango_script_iter_next (&state->script_iter);
- pango_script_iter_get_range (&state->script_iter, NULL,
+ pango2_script_iter_next (&state->script_iter);
+ pango2_script_iter_get_range (&state->script_iter, NULL,
&state->script_end, &state->script);
state->changed |= SCRIPT_CHANGED;
}
if (state->run_end == state->emoji_iter.end)
{
- _pango_emoji_iter_next (&state->emoji_iter);
+ _pango2_emoji_iter_next (&state->emoji_iter);
state->changed |= EMOJI_CHANGED;
if (state->emoji_iter.is_emoji)
@@ -581,20 +581,20 @@ copy_attr_slist (GSList *attr_slist)
GSList *l;
for (l = attr_slist; l; l = l->next)
- new_list = g_slist_prepend (new_list, pango_attribute_copy (l->data));
+ new_list = g_slist_prepend (new_list, pango2_attribute_copy (l->data));
return g_slist_reverse (new_list);
}
static void
itemize_state_fill_font (ItemizeState *state,
- PangoFont *font)
+ Pango2Font *font)
{
GList *l;
for (l = state->result; l; l = l->next)
{
- PangoItem *item = l->data;
+ Pango2Item *item = l->data;
if (item->analysis.font)
break;
if (font)
@@ -603,12 +603,12 @@ itemize_state_fill_font (ItemizeState *state,
}
static void
-itemize_state_add_character (ItemizeState *state,
- PangoFont *font,
- int font_position,
- gboolean force_break,
- const char *pos,
- gboolean is_space)
+itemize_state_add_character (ItemizeState *state,
+ Pango2Font *font,
+ int font_position,
+ gboolean force_break,
+ const char *pos,
+ gboolean is_space)
{
const char *first_space = state->first_space;
int n_spaces = 0;
@@ -659,7 +659,7 @@ itemize_state_add_character (ItemizeState *state,
state->item->length = (pos - state->text) - state->item->offset;
}
- state->item = pango_item_new ();
+ state->item = pango2_item_new ();
state->item->offset = pos - state->text;
state->item->length = 0;
state->item->num_chars = n_spaces + 1;
@@ -688,22 +688,22 @@ itemize_state_add_character (ItemizeState *state,
*/
switch (state->item->analysis.gravity)
{
- case PANGO_GRAVITY_SOUTH:
+ case PANGO2_GRAVITY_SOUTH:
default:
break;
- case PANGO_GRAVITY_NORTH:
+ case PANGO2_GRAVITY_NORTH:
state->item->analysis.level++;
break;
- case PANGO_GRAVITY_EAST:
+ case PANGO2_GRAVITY_EAST:
state->item->analysis.level += 1;
state->item->analysis.level &= ~1;
break;
- case PANGO_GRAVITY_WEST:
+ case PANGO2_GRAVITY_WEST:
state->item->analysis.level |= 1;
break;
}
- state->item->analysis.flags |= state->centered_baseline ? PANGO_ANALYSIS_FLAG_CENTERED_BASELINE : 0;
+ state->item->analysis.flags |= state->centered_baseline ? PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE : 0;
state->item->analysis.script = state->script;
state->item->analysis.language = state->derived_lang;
@@ -722,14 +722,14 @@ itemize_state_add_character (ItemizeState *state,
}
typedef struct {
- PangoFont *font;
+ Pango2Font *font;
int position;
} GetFontInfo;
static gboolean
-get_font_foreach (PangoFontset *fontset,
- PangoFont *font,
- gpointer data)
+get_font_foreach (Pango2Fontset *fontset,
+ Pango2Font *font,
+ gpointer data)
{
GetFontInfo *info = data;
@@ -741,21 +741,21 @@ get_font_foreach (PangoFontset *fontset,
return FALSE;
}
-static PangoFont *
+static Pango2Font *
get_base_font (ItemizeState *state)
{
if (!state->base_font)
- state->base_font = pango_font_map_load_font (state->context->font_map,
+ state->base_font = pango2_font_map_load_font (state->context->font_map,
state->context,
state->font_desc);
return state->base_font;
}
static gboolean
-get_font (ItemizeState *state,
- gunichar wc,
- PangoFont **font,
- int *position)
+get_font (ItemizeState *state,
+ gunichar wc,
+ Pango2Font **font,
+ int *position)
{
GetFontInfo info;
@@ -770,10 +770,10 @@ get_font (ItemizeState *state,
if (state->enable_fallback)
{
- info.font = pango_fontset_get_font (state->current_fonts, wc);
+ info.font = pango2_fontset_get_font (state->current_fonts, wc);
if (info.font)
g_object_unref (info.font);
- pango_fontset_foreach (state->current_fonts, get_font_foreach, &info);
+ pango2_fontset_foreach (state->current_fonts, get_font_foreach, &info);
}
if (!info.font)
@@ -789,30 +789,30 @@ get_font (ItemizeState *state,
return TRUE;
}
-static PangoLanguage *
-compute_derived_language (PangoLanguage *lang,
- GUnicodeScript script)
+static Pango2Language *
+compute_derived_language (Pango2Language *lang,
+ GUnicodeScript script)
{
- PangoLanguage *derived_lang;
+ Pango2Language *derived_lang;
/* Make sure the language tag is consistent with the derived
* script. There is no point in marking up a section of
* Arabic text with the "en" language tag.
*/
- if (lang && pango_language_includes_script (lang, script))
+ if (lang && pango2_language_includes_script (lang, script))
derived_lang = lang;
else
{
- derived_lang = pango_script_get_sample_language (script);
+ derived_lang = pango2_script_get_sample_language (script);
/* If we don't find a sample language for the script, we
* use a language tag that shouldn't actually be used
- * anywhere. This keeps fontconfig (for the PangoFc*
+ * anywhere. This keeps fontconfig (for the Pango2Fc*
* backend) from using the language tag to affect the
* sort order. I don't have a reference for 'xx' being
* safe here, though Keith Packard claims it is.
*/
if (!derived_lang)
- derived_lang = pango_language_from_string ("xx");
+ derived_lang = pango2_language_from_string ("xx");
}
return derived_lang;
@@ -826,19 +826,19 @@ itemize_state_update_for_new_run (ItemizeState *state)
if (state->changed & (FONT_CHANGED | SCRIPT_CHANGED | WIDTH_CHANGED))
{
/* Font-desc gravity overrides everything */
- if (state->font_desc_gravity != PANGO_GRAVITY_AUTO)
+ if (state->font_desc_gravity != PANGO2_GRAVITY_AUTO)
{
state->resolved_gravity = state->font_desc_gravity;
}
else
{
- PangoGravity gravity = state->gravity;
- PangoGravityHint gravity_hint = state->gravity_hint;
+ Pango2Gravity gravity = state->gravity;
+ Pango2GravityHint gravity_hint = state->gravity_hint;
- if (G_LIKELY (gravity == PANGO_GRAVITY_AUTO))
+ if (G_LIKELY (gravity == PANGO2_GRAVITY_AUTO))
gravity = state->context->resolved_gravity;
- state->resolved_gravity = pango_gravity_get_for_script_and_width (state->script,
+ state->resolved_gravity = pango2_gravity_get_for_script_and_width (state->script,
state->width_iter.upright,
gravity,
gravity_hint);
@@ -846,14 +846,14 @@ itemize_state_update_for_new_run (ItemizeState *state)
if (state->font_desc_gravity != state->resolved_gravity)
{
- pango_font_description_set_gravity (state->font_desc, state->resolved_gravity);
+ pango2_font_description_set_gravity (state->font_desc, state->resolved_gravity);
state->changed |= FONT_CHANGED;
}
}
if (state->changed & (SCRIPT_CHANGED | LANG_CHANGED))
{
- PangoLanguage *old_derived_lang = state->derived_lang;
+ Pango2Language *old_derived_lang = state->derived_lang;
state->derived_lang = compute_derived_language (state->lang, state->script);
if (old_derived_lang != state->derived_lang)
state->changed |= DERIVED_LANG_CHANGED;
@@ -877,10 +877,10 @@ itemize_state_update_for_new_run (ItemizeState *state)
gboolean is_emoji = state->emoji_iter.is_emoji;
if (is_emoji && !state->emoji_font_desc)
{
- state->emoji_font_desc = pango_font_description_copy_static (state->font_desc);
- pango_font_description_set_family_static (state->emoji_font_desc, "emoji");
+ state->emoji_font_desc = pango2_font_description_copy_static (state->font_desc);
+ pango2_font_description_set_family_static (state->emoji_font_desc, "emoji");
}
- state->current_fonts = pango_font_map_load_fontset (state->context->font_map,
+ state->current_fonts = pango2_font_map_load_fontset (state->context->font_map,
state->context,
is_emoji ? state->emoji_font_desc : state->font_desc,
state->derived_lang);
@@ -953,7 +953,7 @@ itemize_state_process_run (ItemizeState *state)
gunichar wc = g_utf8_get_char (p);
gboolean is_forced_break = wc == '\t' || wc == '\r' || wc == '\n' ||
wc == 0x2028 || wc == 0x2029;
- PangoFont *font;
+ Pango2Font *font;
int font_position;
if (consider_as_space (wc))
@@ -985,13 +985,13 @@ itemize_state_process_run (ItemizeState *state)
state->item->length = (p - state->text) - state->item->offset;
if (!state->item->analysis.font)
{
- PangoFont *font;
+ Pango2Font *font;
int position;
if (G_UNLIKELY (!get_font (state, ' ', &font, &position)))
{
/* If no font was found, warn once per fontmap/script pair */
- PangoFontMap *fontmap = state->context->font_map;
+ Pango2FontMap *fontmap = state->context->font_map;
char *script_tag = g_strdup_printf ("g-unicode-script-%d", state->script);
if (!g_object_get_data (G_OBJECT (fontmap), script_tag))
@@ -1017,12 +1017,12 @@ itemize_state_finish (ItemizeState *state)
{
g_free (state->embedding_levels);
if (state->free_attr_iter)
- pango_attr_iterator_destroy (state->attr_iter);
- _pango_script_iter_fini (&state->script_iter);
- pango_font_description_free (state->font_desc);
- pango_font_description_free (state->emoji_font_desc);
+ pango2_attr_iterator_destroy (state->attr_iter);
+ _pango2_script_iter_fini (&state->script_iter);
+ pango2_font_description_free (state->font_desc);
+ pango2_font_description_free (state->emoji_font_desc);
width_iter_fini (&state->width_iter);
- _pango_emoji_iter_fini (&state->emoji_iter);
+ _pango2_emoji_iter_fini (&state->emoji_iter);
if (state->current_fonts)
g_object_unref (state->current_fonts);
@@ -1031,31 +1031,31 @@ itemize_state_finish (ItemizeState *state)
}
/* }}} */
-/* {{{ Post-processing */
+ /* {{{ Post-processing */
- /* {{{ Handling font scale */
+ /* {{{ Handling font scale */
typedef struct {
- PangoAttribute *attr;
+ Pango2Attribute *attr;
double scale;
} ScaleItem;
static gboolean
-collect_font_scale (PangoContext *context,
- GList **stack,
- PangoItem *item,
- PangoItem *prev,
- double *scale,
- gboolean *is_small_caps)
+collect_font_scale (Pango2Context *context,
+ GList **stack,
+ Pango2Item *item,
+ Pango2Item *prev,
+ double *scale,
+ gboolean *is_small_caps)
{
gboolean retval = FALSE;
GList *l;
for (GSList *l = item->analysis.extra_attrs; l; l = l->next)
{
- PangoAttribute *attr = l->data;
+ Pango2Attribute *attr = l->data;
- if (attr->type == PANGO_ATTR_FONT_SCALE)
+ if (attr->type == PANGO2_ATTR_FONT_SCALE)
{
if (attr->start_index == item->offset)
{
@@ -1071,15 +1071,15 @@ collect_font_scale (PangoContext *context,
switch (attr->int_value)
{
- case PANGO_FONT_SCALE_NONE:
+ case PANGO2_FONT_SCALE_NONE:
break;
- case PANGO_FONT_SCALE_SUPERSCRIPT:
+ case PANGO2_FONT_SCALE_SUPERSCRIPT:
if (prev &&
- hb_ot_metrics_get_position (pango_font_get_hb_font (prev->analysis.font),
+ hb_ot_metrics_get_position (pango2_font_get_hb_font (prev->analysis.font),
HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_SIZE,
&y_size))
{
- hb_font_get_scale (pango_font_get_hb_font (prev->analysis.font), NULL, &y_scale);
+ hb_font_get_scale (pango2_font_get_hb_font (prev->analysis.font), NULL, &y_scale);
entry->scale = y_size / (double) y_scale;
}
else
@@ -1087,13 +1087,13 @@ collect_font_scale (PangoContext *context,
entry->scale = 1 / 1.2;
}
break;
- case PANGO_FONT_SCALE_SUBSCRIPT:
+ case PANGO2_FONT_SCALE_SUBSCRIPT:
if (prev &&
- hb_ot_metrics_get_position (pango_font_get_hb_font (prev->analysis.font),
+ hb_ot_metrics_get_position (pango2_font_get_hb_font (prev->analysis.font),
HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_SIZE,
&y_size))
{
- hb_font_get_scale (pango_font_get_hb_font (prev->analysis.font), NULL, &y_scale);
+ hb_font_get_scale (pango2_font_get_hb_font (prev->analysis.font), NULL, &y_scale);
entry->scale = y_size / (double) y_scale;
}
else
@@ -1101,11 +1101,11 @@ collect_font_scale (PangoContext *context,
entry->scale = 1 / 1.2;
}
break;
- case PANGO_FONT_SCALE_SMALL_CAPS:
- if (hb_ot_metrics_get_position (pango_font_get_hb_font (item->analysis.font),
+ case PANGO2_FONT_SCALE_SMALL_CAPS:
+ if (hb_ot_metrics_get_position (pango2_font_get_hb_font (item->analysis.font),
HB_OT_METRICS_TAG_CAP_HEIGHT,
&cap_height) &&
- hb_ot_metrics_get_position (pango_font_get_hb_font (item->analysis.font),
+ hb_ot_metrics_get_position (pango2_font_get_hb_font (item->analysis.font),
HB_OT_METRICS_TAG_X_HEIGHT,
&x_height))
{
@@ -1130,7 +1130,7 @@ collect_font_scale (PangoContext *context,
{
ScaleItem *entry = l->data;
*scale *= entry->scale;
- if (entry->attr->int_value != PANGO_FONT_SCALE_SMALL_CAPS)
+ if (entry->attr->int_value != PANGO2_FONT_SCALE_SMALL_CAPS)
*is_small_caps = FALSE;
retval = TRUE;
}
@@ -1154,44 +1154,44 @@ collect_font_scale (PangoContext *context,
}
static void
-apply_scale_to_item (PangoContext *context,
- PangoItem *item,
- double scale,
- gboolean is_small_caps)
+apply_scale_to_item (Pango2Context *context,
+ Pango2Item *item,
+ double scale,
+ gboolean is_small_caps)
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
double size;
if (!item->analysis.font)
return;
if (is_small_caps)
- pango_analysis_set_size_font (&item->analysis, item->analysis.font);
+ pango2_analysis_set_size_font (&item->analysis, item->analysis.font);
- desc = pango_font_describe (item->analysis.font);
- size = scale * pango_font_description_get_size (desc);
+ desc = pango2_font_describe (item->analysis.font);
+ size = scale * pango2_font_description_get_size (desc);
- if (pango_font_description_get_size_is_absolute (desc))
- pango_font_description_set_absolute_size (desc, size);
+ if (pango2_font_description_get_size_is_absolute (desc))
+ pango2_font_description_set_absolute_size (desc, size);
else
- pango_font_description_set_size (desc, size);
+ pango2_font_description_set_size (desc, size);
g_object_unref (item->analysis.font);
- item->analysis.font = pango_font_map_load_font (context->font_map, context, desc);
+ item->analysis.font = pango2_font_map_load_font (context->font_map, context, desc);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
}
static void
-apply_font_scale (PangoContext *context,
- GList *items)
+apply_font_scale (Pango2Context *context,
+ GList *items)
{
- PangoItem *prev = NULL;
+ Pango2Item *prev = NULL;
GList *stack = NULL;
for (GList *l = items; l; l = l->next)
{
- PangoItem *item = l->data;
+ Pango2Item *item = l->data;
double scale;
gboolean is_small_caps;
@@ -1209,14 +1209,14 @@ apply_font_scale (PangoContext *context,
}
/* }}} */
-/* {{{ Handling Casing variants */
+/* { {{ Handling Casing variants */
static gboolean
-all_features_supported (PangoItem *item,
- hb_tag_t *features,
- guint n_features)
+all_features_supported (Pango2Item *item,
+ hb_tag_t *features,
+ guint n_features)
{
- hb_font_t *font = pango_font_get_hb_font (item->analysis.font);
+ hb_font_t *font = pango2_font_get_hb_font (item->analysis.font);
hb_face_t *face = hb_font_get_face (font);
hb_script_t script;
hb_language_t language;
@@ -1229,7 +1229,7 @@ all_features_supported (PangoItem *item,
guint index;
script = g_unicode_script_to_iso15924 (item->analysis.script);
- language = hb_language_from_string (pango_language_to_string (item->analysis.language), -1);
+ language = hb_language_from_string (pango2_language_to_string (item->analysis.language), -1);
hb_ot_tags_from_script_and_language (script, language,
&script_count, script_tags,
@@ -1256,32 +1256,32 @@ all_features_supported (PangoItem *item,
}
static gboolean
-variant_supported (PangoItem *item,
- PangoVariant variant)
+variant_supported (Pango2Item *item,
+ Pango2Variant variant)
{
hb_tag_t features[2];
guint num_features = 0;
switch (variant)
{
- case PANGO_VARIANT_NORMAL:
- case PANGO_VARIANT_TITLE_CAPS:
+ case PANGO2_VARIANT_NORMAL:
+ case PANGO2_VARIANT_TITLE_CAPS:
return TRUE;
- case PANGO_VARIANT_SMALL_CAPS:
+ case PANGO2_VARIANT_SMALL_CAPS:
features[num_features++] = HB_TAG ('s', 'm', 'c', 'p');
break;
- case PANGO_VARIANT_ALL_SMALL_CAPS:
+ case PANGO2_VARIANT_ALL_SMALL_CAPS:
features[num_features++] = HB_TAG ('s', 'm', 'c', 'p');
features[num_features++] = HB_TAG ('c', '2', 's', 'c');
break;
- case PANGO_VARIANT_PETITE_CAPS:
+ case PANGO2_VARIANT_PETITE_CAPS:
features[num_features++] = HB_TAG ('p', 'c', 'a', 'p');
break;
- case PANGO_VARIANT_ALL_PETITE_CAPS:
+ case PANGO2_VARIANT_ALL_PETITE_CAPS:
features[num_features++] = HB_TAG ('p', 'c', 'a', 'p');
features[num_features++] = HB_TAG ('c', '2', 'p', 'c');
break;
- case PANGO_VARIANT_UNICASE:
+ case PANGO2_VARIANT_UNICASE:
features[num_features++] = HB_TAG ('u', 'n', 'i', 'c');
break;
default:
@@ -1291,34 +1291,34 @@ variant_supported (PangoItem *item,
return all_features_supported (item, features, num_features);
}
-static PangoVariant
-get_font_variant (PangoItem *item)
+static Pango2Variant
+get_font_variant (Pango2Item *item)
{
- PangoFontDescription *desc;
- PangoVariant variant = PANGO_VARIANT_NORMAL;
+ Pango2FontDescription *desc;
+ Pango2Variant variant = PANGO2_VARIANT_NORMAL;
if (item->analysis.font)
{
- desc = pango_font_describe (item->analysis.font);
- variant = pango_font_description_get_variant (desc);
- pango_font_description_free (desc);
+ desc = pango2_font_describe (item->analysis.font);
+ variant = pango2_font_description_get_variant (desc);
+ pango2_font_description_free (desc);
}
return variant;
}
-static PangoTextTransform
-find_text_transform (const PangoAnalysis *analysis)
+static Pango2TextTransform
+find_text_transform (const Pango2Analysis *analysis)
{
GSList *l;
- PangoTextTransform transform = PANGO_TEXT_TRANSFORM_NONE;
+ Pango2TextTransform transform = PANGO2_TEXT_TRANSFORM_NONE;
for (l = analysis->extra_attrs; l; l = l->next)
{
- PangoAttribute *attr = l->data;
+ Pango2Attribute *attr = l->data;
- if (attr->type == PANGO_ATTR_TEXT_TRANSFORM)
- transform = (PangoTextTransform) attr->int_value;
+ if (attr->type == PANGO2_ATTR_TEXT_TRANSFORM)
+ transform = (Pango2TextTransform) attr->int_value;
}
return transform;
@@ -1331,38 +1331,38 @@ find_text_transform (const PangoAnalysis *analysis)
* determining the case of characters int he run.
*/
static void
-split_item_for_variant (const char *text,
- PangoLogAttr *log_attrs,
- PangoVariant variant,
- GList *list_item)
+split_item_for_variant (const char *text,
+ Pango2LogAttr *log_attrs,
+ Pango2Variant variant,
+ GList *list_item)
{
- PangoItem *item = list_item->data;
+ Pango2Item *item = list_item->data;
const char *start, *end;
const char *p, *p0;
gunichar wc;
- PangoTextTransform transform = PANGO_TEXT_TRANSFORM_NONE;
- PangoFontScale lowercase_scale = PANGO_FONT_SCALE_NONE;
- PangoFontScale uppercase_scale = PANGO_FONT_SCALE_NONE;
- PangoTextTransform item_transform;
+ Pango2TextTransform transform = PANGO2_TEXT_TRANSFORM_NONE;
+ Pango2FontScale lowercase_scale = PANGO2_FONT_SCALE_NONE;
+ Pango2FontScale uppercase_scale = PANGO2_FONT_SCALE_NONE;
+ Pango2TextTransform item_transform;
gboolean is_word_start;
int offset;
switch (variant)
{
- case PANGO_VARIANT_ALL_SMALL_CAPS:
- case PANGO_VARIANT_ALL_PETITE_CAPS:
- uppercase_scale = PANGO_FONT_SCALE_SMALL_CAPS;
+ case PANGO2_VARIANT_ALL_SMALL_CAPS:
+ case PANGO2_VARIANT_ALL_PETITE_CAPS:
+ uppercase_scale = PANGO2_FONT_SCALE_SMALL_CAPS;
G_GNUC_FALLTHROUGH;
- case PANGO_VARIANT_SMALL_CAPS:
- case PANGO_VARIANT_PETITE_CAPS:
- transform = PANGO_TEXT_TRANSFORM_UPPERCASE;
- lowercase_scale = PANGO_FONT_SCALE_SMALL_CAPS;
+ case PANGO2_VARIANT_SMALL_CAPS:
+ case PANGO2_VARIANT_PETITE_CAPS:
+ transform = PANGO2_TEXT_TRANSFORM_UPPERCASE;
+ lowercase_scale = PANGO2_FONT_SCALE_SMALL_CAPS;
break;
- case PANGO_VARIANT_UNICASE:
- uppercase_scale = PANGO_FONT_SCALE_SMALL_CAPS;
+ case PANGO2_VARIANT_UNICASE:
+ uppercase_scale = PANGO2_FONT_SCALE_SMALL_CAPS;
break;
- case PANGO_VARIANT_NORMAL:
- case PANGO_VARIANT_TITLE_CAPS:
+ case PANGO2_VARIANT_NORMAL:
+ case PANGO2_VARIANT_TITLE_CAPS:
default:
g_assert_not_reached ();
}
@@ -1379,11 +1379,11 @@ split_item_for_variant (const char *text,
p0 = p;
wc = g_utf8_get_char (p);
is_word_start = log_attrs && log_attrs[offset].is_word_start;
- while (p < end && (item_transform == PANGO_TEXT_TRANSFORM_LOWERCASE ||
+ while (p < end && (item_transform == PANGO2_TEXT_TRANSFORM_LOWERCASE ||
consider_as_space (wc) ||
(g_unichar_islower (wc) &&
- !(item_transform == PANGO_TEXT_TRANSFORM_UPPERCASE ||
- (item_transform == PANGO_TEXT_TRANSFORM_CAPITALIZE && is_word_start)))))
+ !(item_transform == PANGO2_TEXT_TRANSFORM_UPPERCASE ||
+ (item_transform == PANGO2_TEXT_TRANSFORM_CAPITALIZE && is_word_start)))))
{
p = g_utf8_next_char (p);
wc = g_utf8_get_char (p);
@@ -1393,13 +1393,13 @@ split_item_for_variant (const char *text,
if (p0 < p)
{
- PangoItem *new_item;
- PangoAttribute *attr;
+ Pango2Item *new_item;
+ Pango2Attribute *attr;
/* p0 .. p is a lowercase segment */
if (p < end)
{
- new_item = pango_item_split (item, p - p0, g_utf8_strlen (p0, p - p0));
+ new_item = pango2_item_split (item, p - p0, g_utf8_strlen (p0, p - p0));
list_item->data = new_item;
list_item = g_list_insert_before (list_item, list_item->next, item);
list_item = list_item->next;
@@ -1409,17 +1409,17 @@ split_item_for_variant (const char *text,
new_item = item;
}
- if (transform != PANGO_TEXT_TRANSFORM_NONE)
+ if (transform != PANGO2_TEXT_TRANSFORM_NONE)
{
- attr = pango_attr_text_transform_new (transform);
+ attr = pango2_attr_text_transform_new (transform);
attr->start_index = new_item->offset;
attr->end_index = new_item->offset + new_item->length;
new_item->analysis.extra_attrs = g_slist_append (new_item->analysis.extra_attrs, attr);
}
- if (lowercase_scale != PANGO_FONT_SCALE_NONE)
+ if (lowercase_scale != PANGO2_FONT_SCALE_NONE)
{
- attr = pango_attr_font_scale_new (lowercase_scale);
+ attr = pango2_attr_font_scale_new (lowercase_scale);
attr->start_index = new_item->offset;
attr->end_index = new_item->offset + new_item->length;
new_item->analysis.extra_attrs = g_slist_append (new_item->analysis.extra_attrs, attr);
@@ -1429,10 +1429,10 @@ split_item_for_variant (const char *text,
p0 = p;
wc = g_utf8_get_char (p);
is_word_start = log_attrs && log_attrs[offset].is_word_start;
- while (p < end && (item_transform == PANGO_TEXT_TRANSFORM_UPPERCASE ||
+ while (p < end && (item_transform == PANGO2_TEXT_TRANSFORM_UPPERCASE ||
consider_as_space (wc) ||
- !(item_transform == PANGO_TEXT_TRANSFORM_LOWERCASE || g_unichar_islower (wc)) ||
- (item_transform == PANGO_TEXT_TRANSFORM_CAPITALIZE && is_word_start)))
+ !(item_transform == PANGO2_TEXT_TRANSFORM_LOWERCASE || g_unichar_islower (wc)) ||
+ (item_transform == PANGO2_TEXT_TRANSFORM_CAPITALIZE && is_word_start)))
{
p = g_utf8_next_char (p);
wc = g_utf8_get_char (p);
@@ -1442,13 +1442,13 @@ split_item_for_variant (const char *text,
if (p0 < p)
{
- PangoItem *new_item;
- PangoAttribute *attr;
+ Pango2Item *new_item;
+ Pango2Attribute *attr;
/* p0 .. p is a uppercase segment */
if (p < end)
{
- new_item = pango_item_split (item, p - p0, g_utf8_strlen (p0, p - p0));
+ new_item = pango2_item_split (item, p - p0, g_utf8_strlen (p0, p - p0));
list_item->data = new_item;
list_item = g_list_insert_before (list_item, list_item->next, item);
list_item = list_item->next;
@@ -1458,9 +1458,9 @@ split_item_for_variant (const char *text,
new_item = item;
}
- if (uppercase_scale != PANGO_FONT_SCALE_NONE)
+ if (uppercase_scale != PANGO2_FONT_SCALE_NONE)
{
- attr = pango_attr_font_scale_new (uppercase_scale);
+ attr = pango2_attr_font_scale_new (uppercase_scale);
attr->start_index = new_item->offset;
attr->end_index = new_item->offset + new_item->length;
new_item->analysis.extra_attrs = g_slist_append (new_item->analysis.extra_attrs, attr);
@@ -1470,12 +1470,12 @@ split_item_for_variant (const char *text,
}
static void
-handle_variants_for_item (const char *text,
- PangoLogAttr *log_attrs,
- GList *l)
+handle_variants_for_item (const char *text,
+ Pango2LogAttr *log_attrs,
+ GList *l)
{
- PangoItem *item = l->data;
- PangoVariant variant;
+ Pango2Item *item = l->data;
+ Pango2Variant variant;
variant = get_font_variant (item);
if (!variant_supported (item, variant))
@@ -1483,9 +1483,9 @@ handle_variants_for_item (const char *text,
}
static void
-handle_variants (const char *text,
- PangoLogAttr *log_attrs,
- GList *items)
+handle_variants (const char *text,
+ Pango2LogAttr *log_attrs,
+ GList *items)
{
GList *next;
@@ -1499,8 +1499,8 @@ handle_variants (const char *text,
/* }}} */
static GList *
-reorder_items (PangoContext *context,
- GList *items)
+reorder_items (Pango2Context *context,
+ GList *items)
{
int char_offset = 0;
@@ -1509,7 +1509,7 @@ reorder_items (PangoContext *context,
/* Also cmpute the char offset for each item here */
for (GList *l = items; l; l = l->next)
{
- PangoItem *item = l->data;
+ Pango2Item *item = l->data;
item->char_offset = char_offset;
char_offset += item->num_chars;
}
@@ -1518,10 +1518,10 @@ reorder_items (PangoContext *context,
}
static GList *
-post_process_items (PangoContext *context,
- const char *text,
- PangoLogAttr *log_attrs,
- GList *items)
+post_process_items (Pango2Context *context,
+ const char *text,
+ Pango2LogAttr *log_attrs,
+ GList *items)
{
handle_variants (text, log_attrs, items);
apply_font_scale (context, items);
@@ -1532,21 +1532,21 @@ post_process_items (PangoContext *context,
/* }}} */
/* {{{ Private API */
-/* Like pango_itemize, but takes a font description.
- * In contrast to pango_itemize, this function does
- * not call pango_itemize_post_process_items, so you need to do that
+/* Like pango2_itemize, but takes a font description.
+ * In contrast to pango2_itemize, this function does
+ * not call pango2_itemize_post_process_items, so you need to do that
* separately, after applying attributes that affect segmentation and
* computing the log attrs.
*/
GList *
-pango_itemize_with_font (PangoContext *context,
- PangoDirection base_dir,
- const char *text,
- int start_index,
- int length,
- PangoAttrList *attrs,
- PangoAttrIterator *cached_iter,
- const PangoFontDescription *desc)
+pango2_itemize_with_font (Pango2Context *context,
+ Pango2Direction base_dir,
+ const char *text,
+ int start_index,
+ int length,
+ Pango2AttrList *attrs,
+ Pango2AttrIterator *cached_iter,
+ const Pango2FontDescription *desc)
{
ItemizeState state;
@@ -1570,19 +1570,19 @@ pango_itemize_with_font (PangoContext *context,
/* Apply post-processing steps that may require log attrs.
*/
GList *
-pango_itemize_post_process_items (PangoContext *context,
- const char *text,
- PangoLogAttr *log_attrs,
- GList *items)
+pango2_itemize_post_process_items (Pango2Context *context,
+ const char *text,
+ Pango2LogAttr *log_attrs,
+ GList *items)
{
return post_process_items (context, text, log_attrs, items);
}
-/* }}} */
+/* }}} */
/* {{{ Public API */
/**
- * pango_itemize:
+ * pango2_itemize:
* @context: a structure holding information that affects
* the itemization process.
* @base_dir: base direction to use for bidirectional processing
@@ -1600,20 +1600,20 @@ pango_itemize_post_process_items (PangoContext *context,
* start offsets of the items are ascending).
*
* The base direction is used when computing bidirectional levels.
- * [func@itemize] gets the base direction from the `PangoContext`
- * (see [method@Pango.Context.set_base_dir]).
+ * [func@itemize] gets the base direction from the `Pango2Context`
+ * (see [method@Pango2.Context.set_base_dir]).
*
- * Return value: (transfer full) (element-type Pango.Item): a `GList` of
- * [struct@Pango.Item] structures. The items should be freed using
- * [method@Pango.Item.free] probably in combination with [func@GLib.List.free_full].
+ * Return value: (transfer full) (element-type Pango2.Item): a `GList` of
+ * [struct@Pango2.Item] structures. The items should be freed using
+ * [method@Pango2.Item.free] probably in combination with [func@GLib.List.free_full].
*/
GList *
-pango_itemize (PangoContext *context,
- PangoDirection base_dir,
- const char *text,
- int start_index,
- int length,
- PangoAttrList *attrs)
+pango2_itemize (Pango2Context *context,
+ Pango2Direction base_dir,
+ const char *text,
+ int start_index,
+ int length,
+ Pango2AttrList *attrs)
{
GList *items;
@@ -1622,13 +1622,13 @@ pango_itemize (PangoContext *context,
g_return_val_if_fail (length >= 0, NULL);
g_return_val_if_fail (length == 0 || text != NULL, NULL);
- items = pango_itemize_with_font (context, base_dir,
+ items = pango2_itemize_with_font (context, base_dir,
text, start_index, length,
attrs, NULL, NULL);
- return pango_itemize_post_process_items (context, text, NULL, items);
+ return pango2_itemize_post_process_items (context, text, NULL, items);
}
-/* }}} */
+/* }}} */
/* vim:set foldmethod=marker expandtab: */
diff --git a/pango/meson.build b/pango/meson.build
index 8ff603cb..5d3c5ead 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -167,13 +167,13 @@ install_headers(pango_installed_headers, subdir: pango_api_path)
# Features header
pango_features_conf = configuration_data()
-pango_features_conf.set('PANGO_VERSION_MAJOR', pango_major_version)
-pango_features_conf.set('PANGO_VERSION_MINOR', pango_minor_version)
-pango_features_conf.set('PANGO_VERSION_MICRO', pango_micro_version)
-pango_features_conf.set('PANGO_API_VERSION', pango_api_version)
-pango_features_conf.set('PANGO_CURRENT_MINUS_AGE', '0')
+pango_features_conf.set('PANGO2_VERSION_MAJOR', pango_major_version)
+pango_features_conf.set('PANGO2_VERSION_MINOR', pango_minor_version)
+pango_features_conf.set('PANGO2_VERSION_MICRO', pango_micro_version)
+pango_features_conf.set('PANGO2_API_VERSION', pango_api_version)
+pango_features_conf.set('PANGO2_CURRENT_MINUS_AGE', '0')
if cairo_dep.found()
- pango_features_conf.set('PANGO_RENDERING_CAIRO', 1)
+ pango_features_conf.set('PANGO2_RENDERING_CAIRO', 1)
endif
pango_features_h = configure_file(
@@ -188,6 +188,8 @@ pango_features_h = configure_file(
pango_enums = gnome.mkenums(
'pango-enum-types',
sources: pango_headers,
+ identifier_prefix: 'Pango2',
+ symbol_prefix: 'PANGO2',
c_template: 'pango-enum-types.c.template',
h_template: 'pango-enum-types.h.template',
install_dir: join_paths(pango_includedir, pango_api_path),
@@ -249,10 +251,10 @@ if build_gir
pango_gir = gnome.generate_gir(
libpango,
sources: pango_sources + pango_headers + [ pango_enum_h, pango_features_h ],
- namespace: 'Pango',
+ namespace: 'Pango2',
nsversion: pango_api_version,
- identifier_prefix: 'Pango',
- symbol_prefix: 'pango',
+ identifier_prefix: 'Pango2',
+ symbol_prefix: 'pango2',
export_packages: 'pango',
dependencies: pango_deps,
includes: pango_gir_includes,
diff --git a/pango/pango-attr-iterator-private.h b/pango/pango-attr-iterator-private.h
index 03229fdb..30d64ede 100644
--- a/pango/pango-attr-iterator-private.h
+++ b/pango/pango-attr-iterator-private.h
@@ -22,7 +22,7 @@
#include <pango/pango-attr-iterator.h>
-struct _PangoAttrIterator
+struct _Pango2AttrIterator
{
GPtrArray *attrs; /* From the list */
guint n_attrs; /* Copied from the list */
@@ -34,6 +34,6 @@ struct _PangoAttrIterator
guint end_index;
};
-void pango_attr_iterator_clear (PangoAttrIterator *iterator);
-gboolean pango_attr_iterator_advance (PangoAttrIterator *iterator,
- int index);
+void pango2_attr_iterator_clear (Pango2AttrIterator *iterator);
+gboolean pango2_attr_iterator_advance (Pango2AttrIterator *iterator,
+ int index);
diff --git a/pango/pango-attr-iterator.c b/pango/pango-attr-iterator.c
index 86c8d1aa..59bb1255 100644
--- a/pango/pango-attr-iterator.c
+++ b/pango/pango-attr-iterator.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-attr-iterator.c: Attribute iterator
*
* Copyright (C) 2000-2002 Red Hat Software
@@ -28,16 +28,16 @@
#include "pango-impl-utils.h"
-G_DEFINE_BOXED_TYPE (PangoAttrIterator,
- pango_attr_iterator,
- pango_attr_iterator_copy,
- pango_attr_iterator_destroy)
+G_DEFINE_BOXED_TYPE (Pango2AttrIterator,
+ pango2_attr_iterator,
+ pango2_attr_iterator_copy,
+ pango2_attr_iterator_destroy)
/* {{{ Private API */
void
-pango_attr_list_init_iterator (PangoAttrList *list,
- PangoAttrIterator *iterator)
+pango2_attr_list_init_iterator (Pango2AttrList *list,
+ Pango2AttrIterator *iterator)
{
iterator->attribute_stack = NULL;
iterator->attrs = list->attributes;
@@ -47,34 +47,34 @@ pango_attr_list_init_iterator (PangoAttrList *list,
iterator->start_index = 0;
iterator->end_index = 0;
- if (!pango_attr_iterator_next (iterator))
+ if (!pango2_attr_iterator_next (iterator))
iterator->end_index = G_MAXUINT;
}
void
-pango_attr_iterator_clear (PangoAttrIterator *iterator)
+pango2_attr_iterator_clear (Pango2AttrIterator *iterator)
{
if (iterator->attribute_stack)
g_ptr_array_free (iterator->attribute_stack, TRUE);
}
gboolean
-pango_attr_iterator_advance (PangoAttrIterator *iterator,
- int index)
+pango2_attr_iterator_advance (Pango2AttrIterator *iterator,
+ int index)
{
int start_range, end_range;
- pango_attr_iterator_range (iterator, &start_range, &end_range);
+ pango2_attr_iterator_range (iterator, &start_range, &end_range);
while (index >= end_range)
{
- if (!pango_attr_iterator_next (iterator))
+ if (!pango2_attr_iterator_next (iterator))
return FALSE;
- pango_attr_iterator_range (iterator, &start_range, &end_range);
+ pango2_attr_iterator_range (iterator, &start_range, &end_range);
}
if (start_range > index)
- g_warning ("pango_attr_iterator_advance(): iterator had already "
+ g_warning ("pango2_attr_iterator_advance(): iterator had already "
"moved beyond the index");
return TRUE;
@@ -84,63 +84,63 @@ pango_attr_iterator_advance (PangoAttrIterator *iterator,
/* {{{ Public API */
/**
- * pango_attr_list_get_iterator:
- * @list: a `PangoAttrList`
+ * pango2_attr_list_get_iterator:
+ * @list: a `Pango2AttrList`
*
* Create a iterator initialized to the beginning of the list.
*
* @list must not be modified until this iterator is freed.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttrIterator`, which should be freed with
- * [method@Pango.AttrIterator.destroy]
+ * `Pango2AttrIterator`, which should be freed with
+ * [method@Pango2.AttrIterator.destroy]
*/
-PangoAttrIterator *
-pango_attr_list_get_iterator (PangoAttrList *list)
+Pango2AttrIterator *
+pango2_attr_list_get_iterator (Pango2AttrList *list)
{
- PangoAttrIterator *iterator;
+ Pango2AttrIterator *iterator;
g_return_val_if_fail (list != NULL, NULL);
- iterator = g_slice_new (PangoAttrIterator);
- pango_attr_list_init_iterator (list, iterator);
+ iterator = g_slice_new (Pango2AttrIterator);
+ pango2_attr_list_init_iterator (list, iterator);
return iterator;
}
/**
- * pango_attr_iterator_destroy:
- * @iterator: a `PangoAttrIterator`
+ * pango2_attr_iterator_destroy:
+ * @iterator: a `Pango2AttrIterator`
*
- * Destroy a `PangoAttrIterator` and free all associated memory.
+ * Destroy a `Pango2AttrIterator` and free all associated memory.
*/
void
-pango_attr_iterator_destroy (PangoAttrIterator *iterator)
+pango2_attr_iterator_destroy (Pango2AttrIterator *iterator)
{
g_return_if_fail (iterator != NULL);
- pango_attr_iterator_clear (iterator);
- g_slice_free (PangoAttrIterator, iterator);
+ pango2_attr_iterator_clear (iterator);
+ g_slice_free (Pango2AttrIterator, iterator);
}
/**
- * pango_attr_iterator_copy:
- * @iterator: a `PangoAttrIterator`
+ * pango2_attr_iterator_copy:
+ * @iterator: a `Pango2AttrIterator`
*
- * Copy a `PangoAttrIterator`.
+ * Copy a `Pango2AttrIterator`.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttrIterator`, which should be freed with
- * [method@Pango.AttrIterator.destroy]
+ * `Pango2AttrIterator`, which should be freed with
+ * [method@Pango2.AttrIterator.destroy]
*/
-PangoAttrIterator *
-pango_attr_iterator_copy (PangoAttrIterator *iterator)
+Pango2AttrIterator *
+pango2_attr_iterator_copy (Pango2AttrIterator *iterator)
{
- PangoAttrIterator *copy;
+ Pango2AttrIterator *copy;
g_return_val_if_fail (iterator != NULL, NULL);
- copy = g_slice_new (PangoAttrIterator);
+ copy = g_slice_new (Pango2AttrIterator);
*copy = *iterator;
@@ -153,22 +153,22 @@ pango_attr_iterator_copy (PangoAttrIterator *iterator)
}
/**
- * pango_attr_iterator_range:
- * @iterator: a PangoAttrIterator
+ * pango2_attr_iterator_range:
+ * @iterator: a Pango2AttrIterator
* @start: (out): location to store the start of the range
* @end: (out): location to store the end of the range
*
* Get the range of the current segment.
*
* Note that the stored return values are signed, not unsigned
- * like the values in `PangoAttribute`. To deal with this API
+ * like the values in `Pango2Attribute`. To deal with this API
* oversight, stored return values that wouldn't fit into
* a signed integer are clamped to %G_MAXINT.
*/
void
-pango_attr_iterator_range (PangoAttrIterator *iterator,
- int *start,
- int *end)
+pango2_attr_iterator_range (Pango2AttrIterator *iterator,
+ int *start,
+ int *end)
{
g_return_if_fail (iterator != NULL);
@@ -179,8 +179,8 @@ pango_attr_iterator_range (PangoAttrIterator *iterator,
}
/**
- * pango_attr_iterator_next:
- * @iterator: a `PangoAttrIterator`
+ * pango2_attr_iterator_next:
+ * @iterator: a `Pango2AttrIterator`
*
* Advance the iterator until the next change of style.
*
@@ -188,7 +188,7 @@ pango_attr_iterator_range (PangoAttrIterator *iterator,
* of the list, otherwise %TRUE
*/
gboolean
-pango_attr_iterator_next (PangoAttrIterator *iterator)
+pango2_attr_iterator_next (Pango2AttrIterator *iterator)
{
int i;
@@ -205,7 +205,7 @@ pango_attr_iterator_next (PangoAttrIterator *iterator)
{
for (i = iterator->attribute_stack->len - 1; i>= 0; i--)
{
- const PangoAttribute *attr = g_ptr_array_index (iterator->attribute_stack, i);
+ const Pango2Attribute *attr = g_ptr_array_index (iterator->attribute_stack, i);
if (attr->end_index == iterator->start_index)
g_ptr_array_remove_index (iterator->attribute_stack, i); /* Can't use index_fast :( */
@@ -216,7 +216,7 @@ pango_attr_iterator_next (PangoAttrIterator *iterator)
while (1)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
if (iterator->attr_index >= iterator->n_attrs)
break;
@@ -241,7 +241,7 @@ pango_attr_iterator_next (PangoAttrIterator *iterator)
if (iterator->attr_index < iterator->n_attrs)
{
- PangoAttribute *attr = g_ptr_array_index (iterator->attrs, iterator->attr_index);
+ Pango2Attribute *attr = g_ptr_array_index (iterator->attrs, iterator->attr_index);
iterator->end_index = MIN (iterator->end_index, attr->start_index);
}
@@ -250,8 +250,8 @@ pango_attr_iterator_next (PangoAttrIterator *iterator)
}
/**
- * pango_attr_iterator_get:
- * @iterator: a `PangoAttrIterator`
+ * pango2_attr_iterator_get:
+ * @iterator: a `Pango2AttrIterator`
* @type: the type of attribute to find
*
* Find the current attribute of a particular type
@@ -265,9 +265,9 @@ pango_attr_iterator_next (PangoAttrIterator *iterator)
* attribute of the given type, or %NULL if no attribute
* of that type applies to the current location.
*/
-PangoAttribute *
-pango_attr_iterator_get (PangoAttrIterator *iterator,
- guint type)
+Pango2Attribute *
+pango2_attr_iterator_get (Pango2AttrIterator *iterator,
+ guint type)
{
int i;
@@ -278,7 +278,7 @@ pango_attr_iterator_get (PangoAttrIterator *iterator,
for (i = iterator->attribute_stack->len - 1; i>= 0; i--)
{
- PangoAttribute *attr = g_ptr_array_index (iterator->attribute_stack, i);
+ Pango2Attribute *attr = g_ptr_array_index (iterator->attribute_stack, i);
if (attr->type == type)
return attr;
@@ -288,34 +288,34 @@ pango_attr_iterator_get (PangoAttrIterator *iterator,
}
/**
- * pango_attr_iterator_get_font:
- * @iterator: a `PangoAttrIterator`
- * @desc: (out caller-allocates): a `PangoFontDescription` to fill in with the current
+ * pango2_attr_iterator_get_font:
+ * @iterator: a `Pango2AttrIterator`
+ * @desc: (out caller-allocates): a `Pango2FontDescription` to fill in with the current
* values. The family name in this structure will be set using
- * [method@Pango.FontDescription.set_family_static] using
- * values from an attribute in the `PangoAttrList` associated
+ * [method@Pango2.FontDescription.set_family_static] using
+ * values from an attribute in the `Pango2AttrList` associated
* with the iterator, so if you plan to keep it around, you
* must call:
- * `pango_font_description_set_family (desc, pango_font_description_get_family (desc))`.
+ * `pango2_font_description_set_family (desc, pango2_font_description_get_family (desc))`.
* @language: (out) (optional): location to store language tag
* for item, or %NULL if none is found.
- * @extra_attrs: (out) (optional) (element-type Pango.Attribute) (transfer full):
+ * @extra_attrs: (out) (optional) (element-type Pango2.Attribute) (transfer full):
* location in which to store a list of non-font attributes
* at the the current position; only the highest priority
* value of each attribute will be added to this list. In
* order to free this value, you must call
- * [method@Pango.Attribute.destroy] on each member.
+ * [method@Pango2.Attribute.destroy] on each member.
*
* Get the font and other attributes at the current
* iterator position.
*/
void
-pango_attr_iterator_get_font (PangoAttrIterator *iterator,
- PangoFontDescription *desc,
- PangoLanguage **language,
- GSList **extra_attrs)
+pango2_attr_iterator_get_font (Pango2AttrIterator *iterator,
+ Pango2FontDescription *desc,
+ Pango2Language **language,
+ GSList **extra_attrs)
{
- PangoFontMask mask = 0;
+ Pango2FontMask mask = 0;
gboolean have_language = FALSE;
double scale = 0;
gboolean have_scale = FALSE;
@@ -335,76 +335,76 @@ pango_attr_iterator_get_font (PangoAttrIterator *iterator,
for (i = iterator->attribute_stack->len - 1; i >= 0; i--)
{
- const PangoAttribute *attr = g_ptr_array_index (iterator->attribute_stack, i);
+ const Pango2Attribute *attr = g_ptr_array_index (iterator->attribute_stack, i);
switch ((int) attr->type)
{
- case PANGO_ATTR_FONT_DESC:
+ case PANGO2_ATTR_FONT_DESC:
{
- PangoFontMask new_mask = pango_font_description_get_set_fields (attr->font_value) & ~mask;
+ Pango2FontMask new_mask = pango2_font_description_get_set_fields (attr->font_value) & ~mask;
mask |= new_mask;
- pango_font_description_unset_fields (desc, new_mask);
- pango_font_description_merge_static (desc, attr->font_value, FALSE);
+ pango2_font_description_unset_fields (desc, new_mask);
+ pango2_font_description_merge_static (desc, attr->font_value, FALSE);
break;
}
- case PANGO_ATTR_FAMILY:
- if (!(mask & PANGO_FONT_MASK_FAMILY))
+ case PANGO2_ATTR_FAMILY:
+ if (!(mask & PANGO2_FONT_MASK_FAMILY))
{
- mask |= PANGO_FONT_MASK_FAMILY;
- pango_font_description_set_family (desc, attr->str_value);
+ mask |= PANGO2_FONT_MASK_FAMILY;
+ pango2_font_description_set_family (desc, attr->str_value);
}
break;
- case PANGO_ATTR_STYLE:
- if (!(mask & PANGO_FONT_MASK_STYLE))
+ case PANGO2_ATTR_STYLE:
+ if (!(mask & PANGO2_FONT_MASK_STYLE))
{
- mask |= PANGO_FONT_MASK_STYLE;
- pango_font_description_set_style (desc, attr->int_value);
+ mask |= PANGO2_FONT_MASK_STYLE;
+ pango2_font_description_set_style (desc, attr->int_value);
}
break;
- case PANGO_ATTR_VARIANT:
- if (!(mask & PANGO_FONT_MASK_VARIANT))
+ case PANGO2_ATTR_VARIANT:
+ if (!(mask & PANGO2_FONT_MASK_VARIANT))
{
- mask |= PANGO_FONT_MASK_VARIANT;
- pango_font_description_set_variant (desc, attr->int_value);
+ mask |= PANGO2_FONT_MASK_VARIANT;
+ pango2_font_description_set_variant (desc, attr->int_value);
}
break;
- case PANGO_ATTR_WEIGHT:
- if (!(mask & PANGO_FONT_MASK_WEIGHT))
+ case PANGO2_ATTR_WEIGHT:
+ if (!(mask & PANGO2_FONT_MASK_WEIGHT))
{
- mask |= PANGO_FONT_MASK_WEIGHT;
- pango_font_description_set_weight (desc, attr->int_value);
+ mask |= PANGO2_FONT_MASK_WEIGHT;
+ pango2_font_description_set_weight (desc, attr->int_value);
}
break;
- case PANGO_ATTR_STRETCH:
- if (!(mask & PANGO_FONT_MASK_STRETCH))
+ case PANGO2_ATTR_STRETCH:
+ if (!(mask & PANGO2_FONT_MASK_STRETCH))
{
- mask |= PANGO_FONT_MASK_STRETCH;
- pango_font_description_set_stretch (desc, attr->int_value);
+ mask |= PANGO2_FONT_MASK_STRETCH;
+ pango2_font_description_set_stretch (desc, attr->int_value);
}
break;
- case PANGO_ATTR_SIZE:
- if (!(mask & PANGO_FONT_MASK_SIZE))
+ case PANGO2_ATTR_SIZE:
+ if (!(mask & PANGO2_FONT_MASK_SIZE))
{
- mask |= PANGO_FONT_MASK_SIZE;
- pango_font_description_set_size (desc, attr->int_value);
+ mask |= PANGO2_FONT_MASK_SIZE;
+ pango2_font_description_set_size (desc, attr->int_value);
}
break;
- case PANGO_ATTR_ABSOLUTE_SIZE:
- if (!(mask & PANGO_FONT_MASK_SIZE))
+ case PANGO2_ATTR_ABSOLUTE_SIZE:
+ if (!(mask & PANGO2_FONT_MASK_SIZE))
{
- mask |= PANGO_FONT_MASK_SIZE;
- pango_font_description_set_absolute_size (desc, attr->int_value);
+ mask |= PANGO2_FONT_MASK_SIZE;
+ pango2_font_description_set_absolute_size (desc, attr->int_value);
}
break;
- case PANGO_ATTR_SCALE:
+ case PANGO2_ATTR_SCALE:
if (!have_scale)
{
have_scale = TRUE;
scale = attr->double_value;
}
break;
- case PANGO_ATTR_LANGUAGE:
+ case PANGO2_ATTR_LANGUAGE:
if (language)
{
if (!have_language)
@@ -419,12 +419,12 @@ pango_attr_iterator_get_font (PangoAttrIterator *iterator,
{
gboolean found = FALSE;
- if (PANGO_ATTR_MERGE (attr) == PANGO_ATTR_MERGE_OVERRIDES)
+ if (PANGO2_ATTR_MERGE (attr) == PANGO2_ATTR_MERGE_OVERRIDES)
{
GSList *tmp_list = *extra_attrs;
while (tmp_list)
{
- PangoAttribute *old_attr = tmp_list->data;
+ Pango2Attribute *old_attr = tmp_list->data;
if (attr->type == old_attr->type)
{
found = TRUE;
@@ -436,7 +436,7 @@ pango_attr_iterator_get_font (PangoAttrIterator *iterator,
}
if (!found)
- *extra_attrs = g_slist_prepend (*extra_attrs, pango_attribute_copy (attr));
+ *extra_attrs = g_slist_prepend (*extra_attrs, pango2_attribute_copy (attr));
}
}
}
@@ -447,29 +447,29 @@ pango_attr_iterator_get_font (PangoAttrIterator *iterator,
* implicitly cast it to integer while the result is kept in registers,
* leading to a wrong approximation in i386 (with 387 FPU)
*/
- volatile double size = scale * pango_font_description_get_size (desc);
+ volatile double size = scale * pango2_font_description_get_size (desc);
- if (pango_font_description_get_size_is_absolute (desc))
- pango_font_description_set_absolute_size (desc, size);
+ if (pango2_font_description_get_size_is_absolute (desc))
+ pango2_font_description_set_absolute_size (desc, size);
else
- pango_font_description_set_size (desc, size);
+ pango2_font_description_set_size (desc, size);
}
}
/**
- * pango_attr_iterator_get_attrs:
- * @iterator: a `PangoAttrIterator`
+ * pango2_attr_iterator_get_attrs:
+ * @iterator: a `Pango2AttrIterator`
*
* Gets a list of all attributes at the current position of the
* iterator.
*
- * Return value: (element-type Pango.Attribute) (transfer full):
+ * Return value: (element-type Pango2.Attribute) (transfer full):
* a list of all attributes for the current range. To free
- * this value, call [method@Pango.Attribute.destroy] on each
+ * this value, call [method@Pango2.Attribute.destroy] on each
* value and [func@GLib.SList.free] on the list.
*/
GSList *
-pango_attr_iterator_get_attrs (PangoAttrIterator *iterator)
+pango2_attr_iterator_get_attrs (Pango2AttrIterator *iterator)
{
GSList *attrs = NULL;
int i;
@@ -480,15 +480,15 @@ pango_attr_iterator_get_attrs (PangoAttrIterator *iterator)
for (i = iterator->attribute_stack->len - 1; i >= 0; i--)
{
- PangoAttribute *attr = g_ptr_array_index (iterator->attribute_stack, i);
+ Pango2Attribute *attr = g_ptr_array_index (iterator->attribute_stack, i);
GSList *tmp_list2;
gboolean found = FALSE;
- if (PANGO_ATTR_MERGE (attr) == PANGO_ATTR_MERGE_OVERRIDES)
+ if (PANGO2_ATTR_MERGE (attr) == PANGO2_ATTR_MERGE_OVERRIDES)
{
for (tmp_list2 = attrs; tmp_list2; tmp_list2 = tmp_list2->next)
{
- PangoAttribute *old_attr = tmp_list2->data;
+ Pango2Attribute *old_attr = tmp_list2->data;
if (attr->type == old_attr->type)
{
found = TRUE;
@@ -498,7 +498,7 @@ pango_attr_iterator_get_attrs (PangoAttrIterator *iterator)
}
if (!found)
- attrs = g_slist_prepend (attrs, pango_attribute_copy (attr));
+ attrs = g_slist_prepend (attrs, pango2_attribute_copy (attr));
}
return attrs;
diff --git a/pango/pango-attr-iterator.h b/pango/pango-attr-iterator.h
index f41f8edb..283b710a 100644
--- a/pango/pango-attr-iterator.h
+++ b/pango/pango-attr-iterator.h
@@ -26,41 +26,41 @@ G_BEGIN_DECLS
/**
- * PangoAttrIterator:
+ * Pango2AttrIterator:
*
- * A `PangoAttrIterator` is used to iterate through a `PangoAttrList`.
+ * A `Pango2AttrIterator` is used to iterate through a `Pango2AttrList`.
*
- * A new iterator is created with [method@Pango.AttrList.get_iterator].
+ * A new iterator is created with [method@Pango2.AttrList.get_iterator].
* Once the iterator is created, it can be advanced through the style
- * changes in the text using [method@Pango.AttrIterator.next]. At each
+ * changes in the text using [method@Pango2.AttrIterator.next]. At each
* style change, the range of the current style segment and the attributes
* currently in effect can be queried.
*/
-PANGO_AVAILABLE_IN_ALL
-GType pango_attr_iterator_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_attr_iterator_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-void pango_attr_iterator_range (PangoAttrIterator *iterator,
- int *start,
- int *end);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_attr_iterator_next (PangoAttrIterator *iterator);
-PANGO_AVAILABLE_IN_ALL
-PangoAttrIterator * pango_attr_iterator_copy (PangoAttrIterator *iterator);
-PANGO_AVAILABLE_IN_ALL
-void pango_attr_iterator_destroy (PangoAttrIterator *iterator);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_iterator_get (PangoAttrIterator *iterator,
- guint type);
-PANGO_AVAILABLE_IN_ALL
-void pango_attr_iterator_get_font (PangoAttrIterator *iterator,
- PangoFontDescription *desc,
- PangoLanguage **language,
- GSList **extra_attrs);
-PANGO_AVAILABLE_IN_ALL
-GSList * pango_attr_iterator_get_attrs (PangoAttrIterator *iterator);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attr_iterator_range (Pango2AttrIterator *iterator,
+ int *start,
+ int *end);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_attr_iterator_next (Pango2AttrIterator *iterator);
+PANGO2_AVAILABLE_IN_ALL
+Pango2AttrIterator * pango2_attr_iterator_copy (Pango2AttrIterator *iterator);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attr_iterator_destroy (Pango2AttrIterator *iterator);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_iterator_get (Pango2AttrIterator *iterator,
+ guint type);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attr_iterator_get_font (Pango2AttrIterator *iterator,
+ Pango2FontDescription *desc,
+ Pango2Language **language,
+ GSList **extra_attrs);
+PANGO2_AVAILABLE_IN_ALL
+GSList * pango2_attr_iterator_get_attrs (Pango2AttrIterator *iterator);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttrIterator, pango_attr_iterator_destroy)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2AttrIterator, pango2_attr_iterator_destroy)
G_END_DECLS
diff --git a/pango/pango-attr-list-private.h b/pango/pango-attr-list-private.h
index 5f93b0df..fb007beb 100644
--- a/pango/pango-attr-list-private.h
+++ b/pango/pango-attr-list-private.h
@@ -22,15 +22,15 @@
#include <pango/pango-attr-list.h>
-struct _PangoAttrList
+struct _Pango2AttrList
{
guint ref_count;
GPtrArray *attributes;
};
-void pango_attr_list_init (PangoAttrList *list);
-void pango_attr_list_destroy (PangoAttrList *list);
-gboolean pango_attr_list_has_attributes (const PangoAttrList *list);
+void pango2_attr_list_init (Pango2AttrList *list);
+void pango2_attr_list_destroy (Pango2AttrList *list);
+gboolean pango2_attr_list_has_attributes (const Pango2AttrList *list);
-void pango_attr_list_init_iterator (PangoAttrList *list,
- PangoAttrIterator *iterator);
+void pango2_attr_list_init_iterator (Pango2AttrList *list,
+ Pango2AttrIterator *iterator);
diff --git a/pango/pango-attr-list.c b/pango/pango-attr-list.c
index 3f5c00f8..6f0f47d0 100644
--- a/pango/pango-attr-list.c
+++ b/pango/pango-attr-list.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-attr-list.c: Attribute lists
*
* Copyright (C) 2000-2002 Red Hat Software
@@ -27,19 +27,19 @@
#include "pango-impl-utils.h"
-G_DEFINE_BOXED_TYPE (PangoAttrList, pango_attr_list,
- pango_attr_list_copy,
- pango_attr_list_unref);
+G_DEFINE_BOXED_TYPE (Pango2AttrList, pango2_attr_list,
+ pango2_attr_list_copy,
+ pango2_attr_list_unref);
/* {{{ Utilities */
static void
-pango_attr_list_insert_internal (PangoAttrList *list,
- PangoAttribute *attr,
- gboolean before)
+pango2_attr_list_insert_internal (Pango2AttrList *list,
+ Pango2Attribute *attr,
+ gboolean before)
{
const guint start_index = attr->start_index;
- PangoAttribute *last_attr;
+ Pango2Attribute *last_attr;
if (G_UNLIKELY (!list->attributes))
list->attributes = g_ptr_array_new ();
@@ -65,7 +65,7 @@ pango_attr_list_insert_internal (PangoAttrList *list,
for (i = 0, p = list->attributes->len; i < p; i++)
{
- PangoAttribute *cur = g_ptr_array_index (list->attributes, i);
+ Pango2Attribute *cur = g_ptr_array_index (list->attributes, i);
if (cur->start_index > start_index ||
(before && cur->start_index == start_index))
@@ -81,14 +81,14 @@ pango_attr_list_insert_internal (PangoAttrList *list,
/* {{{ Private API */
void
-pango_attr_list_init (PangoAttrList *list)
+pango2_attr_list_init (Pango2AttrList *list)
{
list->ref_count = 1;
list->attributes = NULL;
}
void
-pango_attr_list_destroy (PangoAttrList *list)
+pango2_attr_list_destroy (Pango2AttrList *list)
{
if (!list->attributes)
return;
@@ -97,7 +97,7 @@ pango_attr_list_destroy (PangoAttrList *list)
}
gboolean
-pango_attr_list_has_attributes (const PangoAttrList *list)
+pango2_attr_list_has_attributes (const Pango2AttrList *list)
{
return list && list->attributes != NULL && list->attributes->len > 0;
}
@@ -106,36 +106,36 @@ pango_attr_list_has_attributes (const PangoAttrList *list)
/* {{{ Public API */
/**
- * pango_attr_list_new:
+ * pango2_attr_list_new:
*
* Create a new empty attribute list with a reference
* count of one.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttrList`, which should be freed with
- * [method@Pango.AttrList.unref]
+ * `Pango2AttrList`, which should be freed with
+ * [method@Pango2.AttrList.unref]
*/
-PangoAttrList *
-pango_attr_list_new (void)
+Pango2AttrList *
+pango2_attr_list_new (void)
{
- PangoAttrList *list = g_slice_new (PangoAttrList);
+ Pango2AttrList *list = g_slice_new (Pango2AttrList);
- pango_attr_list_init (list);
+ pango2_attr_list_init (list);
return list;
}
/**
- * pango_attr_list_ref:
- * @list: (nullable): a `PangoAttrList`
+ * pango2_attr_list_ref:
+ * @list: (nullable): a `Pango2AttrList`
*
* Increase the reference count of the given attribute
* list by one.
*
* Return value: The attribute list passed in
*/
-PangoAttrList *
-pango_attr_list_ref (PangoAttrList *list)
+Pango2AttrList *
+pango2_attr_list_ref (Pango2AttrList *list)
{
if (list == NULL)
return NULL;
@@ -146,8 +146,8 @@ pango_attr_list_ref (PangoAttrList *list)
}
/**
- * pango_attr_list_unref:
- * @list: (nullable): a `PangoAttrList`
+ * pango2_attr_list_unref:
+ * @list: (nullable): a `Pango2AttrList`
*
* Decrease the reference count of the given attribute
* list by one.
@@ -156,7 +156,7 @@ pango_attr_list_ref (PangoAttrList *list)
* and the attributes it contains.
*/
void
-pango_attr_list_unref (PangoAttrList *list)
+pango2_attr_list_unref (Pango2AttrList *list)
{
if (list == NULL)
return;
@@ -165,99 +165,99 @@ pango_attr_list_unref (PangoAttrList *list)
if (g_atomic_int_dec_and_test ((int *) &list->ref_count))
{
- pango_attr_list_destroy (list);
- g_slice_free (PangoAttrList, list);
+ pango2_attr_list_destroy (list);
+ g_slice_free (Pango2AttrList, list);
}
}
/**
- * pango_attr_list_copy:
- * @list: (nullable): a `PangoAttrList`
+ * pango2_attr_list_copy:
+ * @list: (nullable): a `Pango2AttrList`
*
* Copy @list and return an identical new list.
*
* Return value: (nullable): the newly allocated
- * `PangoAttrList`, with a reference count of one,
- * which should be freed with [method@Pango.AttrList.unref]
+ * `Pango2AttrList`, with a reference count of one,
+ * which should be freed with [method@Pango2.AttrList.unref]
*/
-PangoAttrList *
-pango_attr_list_copy (PangoAttrList *list)
+Pango2AttrList *
+pango2_attr_list_copy (Pango2AttrList *list)
{
- PangoAttrList *new;
+ Pango2AttrList *new;
if (list == NULL)
return NULL;
- new = pango_attr_list_new ();
+ new = pango2_attr_list_new ();
if (!list->attributes || list->attributes->len == 0)
return new;
- new->attributes = g_ptr_array_copy (list->attributes, (GCopyFunc)pango_attribute_copy, NULL);
+ new->attributes = g_ptr_array_copy (list->attributes, (GCopyFunc)pango2_attribute_copy, NULL);
return new;
}
/**
- * pango_attr_list_insert:
- * @list: a `PangoAttrList`
+ * pango2_attr_list_insert:
+ * @list: a `Pango2AttrList`
* @attr: (transfer full): the attribute to insert
*
- * Insert the given attribute into the `PangoAttrList`.
+ * Insert the given attribute into the `Pango2AttrList`.
*
* It will be inserted after all other attributes with a
* matching @start_index.
*/
void
-pango_attr_list_insert (PangoAttrList *list,
- PangoAttribute *attr)
+pango2_attr_list_insert (Pango2AttrList *list,
+ Pango2Attribute *attr)
{
g_return_if_fail (list != NULL);
g_return_if_fail (attr != NULL);
- pango_attr_list_insert_internal (list, attr, FALSE);
+ pango2_attr_list_insert_internal (list, attr, FALSE);
}
/**
- * pango_attr_list_insert_before:
- * @list: a `PangoAttrList`
+ * pango2_attr_list_insert_before:
+ * @list: a `Pango2AttrList`
* @attr: (transfer full): the attribute to insert
*
- * Insert the given attribute into the `PangoAttrList`.
+ * Insert the given attribute into the `Pango2AttrList`.
*
* It will be inserted before all other attributes with a
* matching @start_index.
*/
void
-pango_attr_list_insert_before (PangoAttrList *list,
- PangoAttribute *attr)
+pango2_attr_list_insert_before (Pango2AttrList *list,
+ Pango2Attribute *attr)
{
g_return_if_fail (list != NULL);
g_return_if_fail (attr != NULL);
- pango_attr_list_insert_internal (list, attr, TRUE);
+ pango2_attr_list_insert_internal (list, attr, TRUE);
}
/**
- * pango_attr_list_change:
- * @list: a `PangoAttrList`
+ * pango2_attr_list_change:
+ * @list: a `Pango2AttrList`
* @attr: (transfer full): the attribute to insert
*
- * Insert the given attribute into the `PangoAttrList`.
+ * Insert the given attribute into the `Pango2AttrList`.
*
* It will replace any attributes of the same type
* on that segment and be merged with any adjoining
* attributes that are identical.
*
- * This function is slower than [method@Pango.AttrList.insert]
+ * This function is slower than [method@Pango2.AttrList.insert]
* for creating an attribute list in order (potentially
* much slower for large lists). However,
- * [method@Pango.AttrList.insert] is not suitable for
+ * [method@Pango2.AttrList.insert] is not suitable for
* continually changing a set of attributes since it
* never removes or combines existing attributes.
*/
void
-pango_attr_list_change (PangoAttrList *list,
- PangoAttribute *attr)
+pango2_attr_list_change (Pango2AttrList *list,
+ Pango2Attribute *attr)
{
guint i, p;
guint start_index = attr->start_index;
@@ -268,20 +268,20 @@ pango_attr_list_change (PangoAttrList *list,
if (start_index == end_index) /* empty, nothing to do */
{
- pango_attribute_destroy (attr);
+ pango2_attribute_destroy (attr);
return;
}
if (!list->attributes || list->attributes->len == 0)
{
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
return;
}
inserted = FALSE;
for (i = 0, p = list->attributes->len; i < p; i++)
{
- PangoAttribute *tmp_attr = g_ptr_array_index (list->attributes, i);
+ Pango2Attribute *tmp_attr = g_ptr_array_index (list->attributes, i);
if (tmp_attr->start_index > start_index)
{
@@ -299,7 +299,7 @@ pango_attr_list_change (PangoAttrList *list,
g_assert (tmp_attr->start_index <= start_index);
g_assert (tmp_attr->end_index >= start_index);
- if (pango_attribute_equal (tmp_attr, attr))
+ if (pango2_attribute_equal (tmp_attr, attr))
{
/* We can merge the new attribute with this attribute
*/
@@ -308,12 +308,12 @@ pango_attr_list_change (PangoAttrList *list,
/* We are totally overlapping the previous attribute.
* No action is needed.
*/
- pango_attribute_destroy (attr);
+ pango2_attribute_destroy (attr);
return;
}
tmp_attr->end_index = end_index;
- pango_attribute_destroy (attr);
+ pango2_attribute_destroy (attr);
attr = tmp_attr;
inserted = TRUE;
@@ -325,15 +325,15 @@ pango_attr_list_change (PangoAttrList *list,
*/
if (tmp_attr->end_index > end_index)
{
- PangoAttribute *end_attr = pango_attribute_copy (tmp_attr);
+ Pango2Attribute *end_attr = pango2_attribute_copy (tmp_attr);
end_attr->start_index = end_index;
- pango_attr_list_insert (list, end_attr);
+ pango2_attr_list_insert (list, end_attr);
}
if (tmp_attr->start_index == start_index)
{
- pango_attribute_destroy (tmp_attr);
+ pango2_attribute_destroy (tmp_attr);
g_ptr_array_remove_index (list->attributes, i);
break;
}
@@ -346,7 +346,7 @@ pango_attr_list_change (PangoAttrList *list,
if (!inserted)
/* we didn't insert attr yet */
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
/* We now have the range inserted into the list one way or the
* other. Fix up the remainder
@@ -354,7 +354,7 @@ pango_attr_list_change (PangoAttrList *list,
/* Attention: No i = 0 here. */
for (i = i + 1, p = list->attributes->len; i < p; i++)
{
- PangoAttribute *tmp_attr = g_ptr_array_index (list->attributes, i);
+ Pango2Attribute *tmp_attr = g_ptr_array_index (list->attributes, i);
if (tmp_attr->start_index > end_index)
break;
@@ -366,11 +366,11 @@ pango_attr_list_change (PangoAttrList *list,
continue;
if (tmp_attr->end_index <= attr->end_index ||
- pango_attribute_equal (tmp_attr, attr))
+ pango2_attribute_equal (tmp_attr, attr))
{
/* We can merge the new attribute with this attribute. */
attr->end_index = MAX (end_index, tmp_attr->end_index);
- pango_attribute_destroy (tmp_attr);
+ pango2_attribute_destroy (tmp_attr);
g_ptr_array_remove_index (list->attributes, i);
i--;
p--;
@@ -388,7 +388,7 @@ pango_attr_list_change (PangoAttrList *list,
for (k = i + 1, m = list->attributes->len; k < m; k++)
{
- PangoAttribute *tmp_attr2 = g_ptr_array_index (list->attributes, k);
+ Pango2Attribute *tmp_attr2 = g_ptr_array_index (list->attributes, k);
if (tmp_attr2->start_index >= tmp_attr->start_index)
break;
@@ -401,8 +401,8 @@ pango_attr_list_change (PangoAttrList *list,
}
/**
- * pango_attr_list_update:
- * @list: a `PangoAttrList`
+ * pango2_attr_list_update:
+ * @list: a `Pango2AttrList`
* @pos: the position of the change
* @remove: the number of removed bytes
* @add: the number of added bytes
@@ -423,10 +423,10 @@ pango_attr_list_change (PangoAttrList *list,
* behind @pos + @remove.
*/
void
-pango_attr_list_update (PangoAttrList *list,
- int pos,
- int remove,
- int add)
+pango2_attr_list_update (Pango2AttrList *list,
+ int pos,
+ int remove,
+ int add)
{
guint i, p;
@@ -437,19 +437,19 @@ pango_attr_list_update (PangoAttrList *list,
if (list->attributes)
for (i = 0, p = list->attributes->len; i < p; i++)
{
- PangoAttribute *attr = g_ptr_array_index (list->attributes, i);
+ Pango2Attribute *attr = g_ptr_array_index (list->attributes, i);
if (attr->start_index >= pos &&
attr->end_index < pos + remove)
{
- pango_attribute_destroy (attr);
+ pango2_attribute_destroy (attr);
g_ptr_array_remove_index (list->attributes, i);
i--; /* Look at this index again */
p--;
continue;
}
- if (attr->start_index != PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING)
+ if (attr->start_index != PANGO2_ATTR_INDEX_FROM_TEXT_BEGINNING)
{
if (attr->start_index >= pos &&
attr->start_index < pos + remove)
@@ -462,7 +462,7 @@ pango_attr_list_update (PangoAttrList *list,
}
}
- if (attr->end_index != PANGO_ATTR_INDEX_TO_TEXT_END)
+ if (attr->end_index != PANGO2_ATTR_INDEX_TO_TEXT_END)
{
if (attr->end_index >= pos &&
attr->end_index < pos + remove)
@@ -482,9 +482,9 @@ pango_attr_list_update (PangoAttrList *list,
}
/**
- * pango_attr_list_splice:
- * @list: a `PangoAttrList`
- * @other: another `PangoAttrList`
+ * pango2_attr_list_splice:
+ * @list: a `Pango2AttrList`
+ * @other: another `Pango2AttrList`
* @pos: the position in @list at which to insert @other
* @len: the length of the spliced segment. (Note that this
* must be specified since the attributes in @other may only
@@ -496,7 +496,7 @@ pango_attr_list_update (PangoAttrList *list,
*
* This operation is equivalent to stretching every attribute
* that applies at position @pos in @list by an amount @len,
- * and then calling [method@Pango.AttrList.change] with a copy
+ * and then calling [method@Pango2.AttrList.change] with a copy
* of each attribute in @other in sequence (offset in position
* by @pos, and limited in length to @len).
*
@@ -510,10 +510,10 @@ pango_attr_list_update (PangoAttrList *list,
* This mode is useful for merging two lists of attributes together.
*/
void
-pango_attr_list_splice (PangoAttrList *list,
- PangoAttrList *other,
- int pos,
- int len)
+pango2_attr_list_splice (Pango2AttrList *list,
+ Pango2AttrList *other,
+ int pos,
+ int len)
{
guint i, p;
guint upos, ulen;
@@ -537,7 +537,7 @@ pango_attr_list_splice (PangoAttrList *list,
if (list->attributes)
for (i = 0, p = list->attributes->len; i < p; i++)
{
- PangoAttribute *attr = g_ptr_array_index (list->attributes, i);;
+ Pango2Attribute *attr = g_ptr_array_index (list->attributes, i);;
if (attr->start_index <= upos)
{
@@ -561,7 +561,7 @@ pango_attr_list_splice (PangoAttrList *list,
for (i = 0, p = other->attributes->len; i < p; i++)
{
- PangoAttribute *attr = pango_attribute_copy (g_ptr_array_index (other->attributes, i));
+ Pango2Attribute *attr = pango2_attribute_copy (g_ptr_array_index (other->attributes, i));
if (ulen > 0)
{
attr->start_index = MIN (CLAMP_ADD (attr->start_index, upos), end);
@@ -574,26 +574,26 @@ pango_attr_list_splice (PangoAttrList *list,
}
/* Same as above, the attribute could be squashed to zero-length; here
- * pango_attr_list_change() will take care of deleting it.
+ * pango2_attr_list_change() will take care of deleting it.
*/
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
}
#undef CLAMP_ADD
}
/**
- * pango_attr_list_get_attributes:
- * @list: a `PangoAttrList`
+ * pango2_attr_list_get_attributes:
+ * @list: a `Pango2AttrList`
*
* Gets a list of all attributes in @list.
*
- * Return value: (element-type Pango.Attribute) (transfer full):
+ * Return value: (element-type Pango2.Attribute) (transfer full):
* a list of all attributes in @list. To free this value,
- * call [method@Pango.Attribute.destroy] on each value and
+ * call [method@Pango2.Attribute.destroy] on each value and
* [func@GLib.SList.free] on the list
*/
GSList *
-pango_attr_list_get_attributes (PangoAttrList *list)
+pango2_attr_list_get_attributes (Pango2AttrList *list)
{
GSList *result = NULL;
guint i, p;
@@ -605,18 +605,18 @@ pango_attr_list_get_attributes (PangoAttrList *list)
for (i = 0, p = list->attributes->len; i < p; i++)
{
- PangoAttribute *attr = g_ptr_array_index (list->attributes, i);
+ Pango2Attribute *attr = g_ptr_array_index (list->attributes, i);
- result = g_slist_prepend (result, pango_attribute_copy (attr));
+ result = g_slist_prepend (result, pango2_attribute_copy (attr));
}
return g_slist_reverse (result);
}
/**
- * pango_attr_list_equal:
- * @list: a `PangoAttrList`
- * @other_list: the other `PangoAttrList`
+ * pango2_attr_list_equal:
+ * @list: a `Pango2AttrList`
+ * @other_list: the other `Pango2AttrList`
*
* Checks whether @list and @other_list contain the same
* attributes and whether those attributes apply to the
@@ -629,8 +629,8 @@ pango_attr_list_get_attributes (PangoAttrList *list)
* they aren't
*/
gboolean
-pango_attr_list_equal (PangoAttrList *list,
- PangoAttrList *other_list)
+pango2_attr_list_equal (Pango2AttrList *list,
+ Pango2AttrList *other_list)
{
GPtrArray *attrs, *other_attrs;
guint64 skip_bitmask = 0;
@@ -653,13 +653,13 @@ pango_attr_list_equal (PangoAttrList *list,
for (i = 0; i < attrs->len; i++)
{
- PangoAttribute *attr = g_ptr_array_index (attrs, i);
+ Pango2Attribute *attr = g_ptr_array_index (attrs, i);
gboolean attr_equal = FALSE;
guint other_attr_index;
for (other_attr_index = 0; other_attr_index < other_attrs->len; other_attr_index++)
{
- PangoAttribute *other_attr = g_ptr_array_index (other_attrs, other_attr_index);
+ Pango2Attribute *other_attr = g_ptr_array_index (other_attrs, other_attr_index);
guint64 other_attr_bitmask = other_attr_index < 64 ? 1 << other_attr_index : 0;
if ((skip_bitmask & other_attr_bitmask) != 0)
@@ -667,7 +667,7 @@ pango_attr_list_equal (PangoAttrList *list,
if (attr->start_index == other_attr->start_index &&
attr->end_index == other_attr->end_index &&
- pango_attribute_equal (attr, other_attr))
+ pango2_attribute_equal (attr, other_attr))
{
skip_bitmask |= other_attr_bitmask;
attr_equal = TRUE;
@@ -684,27 +684,27 @@ pango_attr_list_equal (PangoAttrList *list,
}
/**
- * pango_attr_list_filter:
- * @list: a `PangoAttrList`
+ * pango2_attr_list_filter:
+ * @list: a `Pango2AttrList`
* @func: (scope call) (closure data): callback function;
* returns %TRUE if an attribute should be filtered out
* @data: (closure): Data to be passed to @func
*
- * Given a `PangoAttrList` and callback function, removes
+ * Given a `Pango2AttrList` and callback function, removes
* any elements of @list for which @func returns %TRUE and
* inserts them into a new list.
*
* Return value: (transfer full) (nullable): the new
- * `PangoAttrList` or %NULL if no attributes of the
+ * `Pango2AttrList` or %NULL if no attributes of the
* given types were found
*/
-PangoAttrList *
-pango_attr_list_filter (PangoAttrList *list,
- PangoAttrFilterFunc func,
- gpointer data)
+Pango2AttrList *
+pango2_attr_list_filter (Pango2AttrList *list,
+ Pango2AttrFilterFunc func,
+ gpointer data)
{
- PangoAttrList *new = NULL;
+ Pango2AttrList *new = NULL;
guint i, p;
g_return_val_if_fail (list != NULL, NULL);
@@ -714,7 +714,7 @@ pango_attr_list_filter (PangoAttrList *list,
for (i = 0, p = list->attributes->len; i < p; i++)
{
- PangoAttribute *tmp_attr = g_ptr_array_index (list->attributes, i);
+ Pango2Attribute *tmp_attr = g_ptr_array_index (list->attributes, i);
if ((*func) (tmp_attr, data))
{
@@ -724,7 +724,7 @@ pango_attr_list_filter (PangoAttrList *list,
if (G_UNLIKELY (!new))
{
- new = pango_attr_list_new ();
+ new = pango2_attr_list_new ();
new->attributes = g_ptr_array_new ();
}
@@ -750,22 +750,22 @@ pango_attr_list_filter (PangoAttrList *list,
*/
static GType
-get_attr_value_type (PangoAttrType type)
+get_attr_value_type (Pango2AttrType type)
{
switch ((int)type)
{
- case PANGO_ATTR_STYLE: return PANGO_TYPE_STYLE;
- case PANGO_ATTR_WEIGHT: return PANGO_TYPE_WEIGHT;
- case PANGO_ATTR_VARIANT: return PANGO_TYPE_VARIANT;
- case PANGO_ATTR_STRETCH: return PANGO_TYPE_STRETCH;
- case PANGO_ATTR_GRAVITY: return PANGO_TYPE_GRAVITY;
- case PANGO_ATTR_GRAVITY_HINT: return PANGO_TYPE_GRAVITY_HINT;
- case PANGO_ATTR_UNDERLINE: return PANGO_TYPE_LINE_STYLE;
- case PANGO_ATTR_STRIKETHROUGH: return PANGO_TYPE_LINE_STYLE;
- case PANGO_ATTR_OVERLINE: return PANGO_TYPE_LINE_STYLE;
- case PANGO_ATTR_BASELINE_SHIFT: return PANGO_TYPE_BASELINE_SHIFT;
- case PANGO_ATTR_FONT_SCALE: return PANGO_TYPE_FONT_SCALE;
- case PANGO_ATTR_TEXT_TRANSFORM: return PANGO_TYPE_TEXT_TRANSFORM;
+ case PANGO2_ATTR_STYLE: return PANGO2_TYPE_STYLE;
+ case PANGO2_ATTR_WEIGHT: return PANGO2_TYPE_WEIGHT;
+ case PANGO2_ATTR_VARIANT: return PANGO2_TYPE_VARIANT;
+ case PANGO2_ATTR_STRETCH: return PANGO2_TYPE_STRETCH;
+ case PANGO2_ATTR_GRAVITY: return PANGO2_TYPE_GRAVITY;
+ case PANGO2_ATTR_GRAVITY_HINT: return PANGO2_TYPE_GRAVITY_HINT;
+ case PANGO2_ATTR_UNDERLINE: return PANGO2_TYPE_LINE_STYLE;
+ case PANGO2_ATTR_STRIKETHROUGH: return PANGO2_TYPE_LINE_STYLE;
+ case PANGO2_ATTR_OVERLINE: return PANGO2_TYPE_LINE_STYLE;
+ case PANGO2_ATTR_BASELINE_SHIFT: return PANGO2_TYPE_BASELINE_SHIFT;
+ case PANGO2_ATTR_FONT_SCALE: return PANGO2_TYPE_FONT_SCALE;
+ case PANGO2_ATTR_TEXT_TRANSFORM: return PANGO2_TYPE_TEXT_TRANSFORM;
default: return G_TYPE_INVALID;
}
}
@@ -790,48 +790,48 @@ append_enum_value (GString *str,
static void
attr_print (GString *str,
- PangoAttribute *attr)
+ Pango2Attribute *attr)
{
const char *name;
- name = pango_attr_type_get_name (attr->type);
+ name = pango2_attr_type_get_name (attr->type);
if (!name)
return;
g_string_append_printf (str, "%u %u %s", attr->start_index, attr->end_index, name);
- switch (PANGO_ATTR_VALUE_TYPE (attr))
+ switch (PANGO2_ATTR_VALUE_TYPE (attr))
{
- case PANGO_ATTR_VALUE_INT:
- if (attr->type == PANGO_ATTR_WEIGHT ||
- attr->type == PANGO_ATTR_STYLE ||
- attr->type == PANGO_ATTR_STRETCH ||
- attr->type == PANGO_ATTR_VARIANT ||
- attr->type == PANGO_ATTR_GRAVITY ||
- attr->type == PANGO_ATTR_GRAVITY_HINT ||
- attr->type == PANGO_ATTR_UNDERLINE ||
- attr->type == PANGO_ATTR_OVERLINE ||
- attr->type == PANGO_ATTR_BASELINE_SHIFT ||
- attr->type == PANGO_ATTR_FONT_SCALE ||
- attr->type == PANGO_ATTR_TEXT_TRANSFORM)
+ case PANGO2_ATTR_VALUE_INT:
+ if (attr->type == PANGO2_ATTR_WEIGHT ||
+ attr->type == PANGO2_ATTR_STYLE ||
+ attr->type == PANGO2_ATTR_STRETCH ||
+ attr->type == PANGO2_ATTR_VARIANT ||
+ attr->type == PANGO2_ATTR_GRAVITY ||
+ attr->type == PANGO2_ATTR_GRAVITY_HINT ||
+ attr->type == PANGO2_ATTR_UNDERLINE ||
+ attr->type == PANGO2_ATTR_OVERLINE ||
+ attr->type == PANGO2_ATTR_BASELINE_SHIFT ||
+ attr->type == PANGO2_ATTR_FONT_SCALE ||
+ attr->type == PANGO2_ATTR_TEXT_TRANSFORM)
append_enum_value (str, get_attr_value_type (attr->type), attr->int_value);
else
g_string_append_printf (str, " %d", attr->int_value);
break;
- case PANGO_ATTR_VALUE_BOOLEAN:
+ case PANGO2_ATTR_VALUE_BOOLEAN:
g_string_append (str, attr->int_value ? " true" : " false");
break;
- case PANGO_ATTR_VALUE_STRING:
+ case PANGO2_ATTR_VALUE_STRING:
g_string_append_printf (str, " \"%s\"", attr->str_value);
break;
- case PANGO_ATTR_VALUE_LANGUAGE:
- g_string_append_printf (str, " %s", pango_language_to_string (attr->lang_value));
+ case PANGO2_ATTR_VALUE_LANGUAGE:
+ g_string_append_printf (str, " %s", pango2_language_to_string (attr->lang_value));
break;
- case PANGO_ATTR_VALUE_FLOAT:
+ case PANGO2_ATTR_VALUE_FLOAT:
{
char buf[20];
g_ascii_formatd (buf, 20, "%f", attr->double_value);
@@ -839,25 +839,25 @@ attr_print (GString *str,
}
break;
- case PANGO_ATTR_VALUE_FONT_DESC:
+ case PANGO2_ATTR_VALUE_FONT_DESC:
{
- char *s = pango_font_description_to_string (attr->font_value);
+ char *s = pango2_font_description_to_string (attr->font_value);
g_string_append_printf (str, " \"%s\"", s);
g_free (s);
}
break;
- case PANGO_ATTR_VALUE_COLOR:
+ case PANGO2_ATTR_VALUE_COLOR:
{
- char *s = pango_color_to_string (&attr->color_value);
+ char *s = pango2_color_to_string (&attr->color_value);
g_string_append_printf (str, " %s", s);
g_free (s);
}
break;
- case PANGO_ATTR_VALUE_POINTER:
+ case PANGO2_ATTR_VALUE_POINTER:
{
- char *s = pango_attr_value_serialize (attr);
+ char *s = pango2_attr_value_serialize (attr);
g_string_append_printf (str, " %s", s);
g_free (s);
}
@@ -869,13 +869,13 @@ attr_print (GString *str,
}
/**
- * pango_attr_list_to_string:
- * @list: a `PangoAttrList`
+ * pango2_attr_list_to_string:
+ * @list: a `Pango2AttrList`
*
- * Serializes a `PangoAttrList` to a string.
+ * Serializes a `Pango2AttrList` to a string.
*
* No guarantees are made about the format of the string,
- * it may change between Pango versions.
+ * it may change between Pango2 versions.
*
* The intended use of this function is testing and
* debugging. The format is not meant as a permanent
@@ -884,7 +884,7 @@ attr_print (GString *str,
* Returns: (transfer full): a newly allocated string
*/
char *
-pango_attr_list_to_string (PangoAttrList *list)
+pango2_attr_list_to_string (Pango2AttrList *list)
{
GString *s;
@@ -893,7 +893,7 @@ pango_attr_list_to_string (PangoAttrList *list)
if (list->attributes)
for (int i = 0; i < list->attributes->len; i++)
{
- PangoAttribute *attr = g_ptr_array_index (list->attributes, i);
+ Pango2Attribute *attr = g_ptr_array_index (list->attributes, i);
if (i > 0)
g_string_append (s, "\n");
@@ -903,28 +903,28 @@ pango_attr_list_to_string (PangoAttrList *list)
return g_string_free (s, FALSE);
}
-static PangoAttrType
+static Pango2AttrType
get_attr_type_by_nick (const char *nick,
int len)
{
GEnumClass *enum_class;
- enum_class = g_type_class_ref (pango_attr_type_get_type ());
+ enum_class = g_type_class_ref (pango2_attr_type_get_type ());
for (GEnumValue *ev = enum_class->values; ev->value_name; ev++)
{
if (ev->value_nick && strncmp (ev->value_nick, nick, len) == 0)
{
g_type_class_unref (enum_class);
- return (PangoAttrType) ev->value;
+ return (Pango2AttrType) ev->value;
}
}
g_type_class_unref (enum_class);
- return PANGO_ATTR_INVALID;
+ return PANGO2_ATTR_INVALID;
}
static int
-get_attr_value (PangoAttrType type,
+get_attr_value (Pango2AttrType type,
const char *str,
int len)
{
@@ -957,25 +957,25 @@ is_valid_end_char (char c)
}
/**
- * pango_attr_list_from_string:
+ * pango2_attr_list_from_string:
* @text: a string
*
- * Deserializes a `PangoAttrList` from a string.
+ * Deserializes a `Pango2AttrList` from a string.
*
- * This is the counterpart to [method@Pango.AttrList.to_string].
+ * This is the counterpart to [method@Pango2.AttrList.to_string].
* See that functions for details about the format.
*
- * Returns: (transfer full) (nullable): a new `PangoAttrList`
+ * Returns: (transfer full) (nullable): a new `Pango2AttrList`
*/
-PangoAttrList *
-pango_attr_list_from_string (const char *text)
+Pango2AttrList *
+pango2_attr_list_from_string (const char *text)
{
- PangoAttrList *list;
+ Pango2AttrList *list;
const char *p;
g_return_val_if_fail (text != NULL, NULL);
- list = pango_attr_list_new ();
+ list = pango2_attr_list_new ();
if (*text == '\0')
return list;
@@ -989,12 +989,12 @@ pango_attr_list_from_string (const char *text)
gint64 start_index;
gint64 end_index;
char *str;
- PangoAttrType attr_type;
- PangoAttribute *attr;
- PangoLanguage *lang;
+ Pango2AttrType attr_type;
+ Pango2Attribute *attr;
+ Pango2Language *lang;
gint64 integer;
- PangoFontDescription *desc;
- PangoColor color;
+ Pango2FontDescription *desc;
+ Pango2Color color;
double num;
start_index = g_ascii_strtoll (p, &endp, 10);
@@ -1021,7 +1021,7 @@ pango_attr_list_from_string (const char *text)
#define INT_ATTR(name,type) \
integer = g_ascii_strtoll (p, &endp, 10); \
if (!is_valid_end_char (*endp)) goto fail; \
- attr = pango_attr_##name##_new ((type)integer);
+ attr = pango2_attr_##name##_new ((type)integer);
#define BOOLEAN_ATTR(name,type) \
if (strncmp (p, "true", strlen ("true")) == 0) \
@@ -1037,223 +1037,223 @@ pango_attr_list_from_string (const char *text)
else \
integer = g_ascii_strtoll (p, &endp, 10); \
if (!is_valid_end_char (*endp)) goto fail; \
- attr = pango_attr_##name##_new ((type)integer);
+ attr = pango2_attr_##name##_new ((type)integer);
#define ENUM_ATTR(name, type, min, max) \
endp = (char *)p + strcspn (p, ",\n"); \
integer = get_attr_value (attr_type, p, endp - p); \
- attr = pango_attr_##name##_new ((type) CLAMP (integer, min, max));
+ attr = pango2_attr_##name##_new ((type) CLAMP (integer, min, max));
#define FLOAT_ATTR(name) \
num = g_ascii_strtod (p, &endp); \
if (!is_valid_end_char (*endp)) goto fail; \
- attr = pango_attr_##name##_new ((float)num);
+ attr = pango2_attr_##name##_new ((float)num);
#define COLOR_ATTR(name) \
endp = (char *)p + strcspn (p, ",\n"); \
if (!is_valid_end_char (*endp)) goto fail; \
str = g_strndup (p, endp - p); \
- if (!pango_color_parse (&color, str)) \
+ if (!pango2_color_parse (&color, str)) \
{ \
g_free (str); \
goto fail; \
} \
- attr = pango_attr_##name##_new (&color); \
+ attr = pango2_attr_##name##_new (&color); \
g_free (str);
switch (attr_type)
{
- case PANGO_ATTR_INVALID:
- pango_attr_list_unref (list);
+ case PANGO2_ATTR_INVALID:
+ pango2_attr_list_unref (list);
return NULL;
- case PANGO_ATTR_LANGUAGE:
+ case PANGO2_ATTR_LANGUAGE:
endp = (char *)p + strcspn (p, ",\n");
if (!is_valid_end_char (*endp)) goto fail;
str = g_strndup (p, endp - p);
- lang = pango_language_from_string (str);
- attr = pango_attr_language_new (lang);
+ lang = pango2_language_from_string (str);
+ attr = pango2_attr_language_new (lang);
g_free (str);
break;
- case PANGO_ATTR_FAMILY:
+ case PANGO2_ATTR_FAMILY:
p++;
endp = strchr (p, '"');
if (!endp) goto fail;
str = g_strndup (p, endp - p);
- attr = pango_attr_family_new (str);
+ attr = pango2_attr_family_new (str);
g_free (str);
endp++;
if (!is_valid_end_char (*endp)) goto fail;
break;
- case PANGO_ATTR_STYLE:
- ENUM_ATTR(style, PangoStyle, PANGO_STYLE_NORMAL, PANGO_STYLE_ITALIC);
+ case PANGO2_ATTR_STYLE:
+ ENUM_ATTR(style, Pango2Style, PANGO2_STYLE_NORMAL, PANGO2_STYLE_ITALIC);
break;
- case PANGO_ATTR_WEIGHT:
- ENUM_ATTR(weight, PangoWeight, PANGO_WEIGHT_THIN, PANGO_WEIGHT_ULTRAHEAVY);
+ case PANGO2_ATTR_WEIGHT:
+ ENUM_ATTR(weight, Pango2Weight, PANGO2_WEIGHT_THIN, PANGO2_WEIGHT_ULTRAHEAVY);
break;
- case PANGO_ATTR_VARIANT:
- ENUM_ATTR(variant, PangoVariant, PANGO_VARIANT_NORMAL, PANGO_VARIANT_TITLE_CAPS);
+ case PANGO2_ATTR_VARIANT:
+ ENUM_ATTR(variant, Pango2Variant, PANGO2_VARIANT_NORMAL, PANGO2_VARIANT_TITLE_CAPS);
break;
- case PANGO_ATTR_STRETCH:
- ENUM_ATTR(stretch, PangoStretch, PANGO_STRETCH_ULTRA_CONDENSED, PANGO_STRETCH_ULTRA_EXPANDED);
+ case PANGO2_ATTR_STRETCH:
+ ENUM_ATTR(stretch, Pango2Stretch, PANGO2_STRETCH_ULTRA_CONDENSED, PANGO2_STRETCH_ULTRA_EXPANDED);
break;
- case PANGO_ATTR_SIZE:
+ case PANGO2_ATTR_SIZE:
INT_ATTR(size, int);
break;
- case PANGO_ATTR_FONT_DESC:
+ case PANGO2_ATTR_FONT_DESC:
p++;
endp = strchr (p, '"');
if (!endp) goto fail;
str = g_strndup (p, endp - p);
- desc = pango_font_description_from_string (str);
- attr = pango_attr_font_desc_new (desc);
- pango_font_description_free (desc);
+ desc = pango2_font_description_from_string (str);
+ attr = pango2_attr_font_desc_new (desc);
+ pango2_font_description_free (desc);
g_free (str);
endp++;
if (!is_valid_end_char (*endp)) goto fail;
break;
- case PANGO_ATTR_FOREGROUND:
+ case PANGO2_ATTR_FOREGROUND:
COLOR_ATTR(foreground);
break;
- case PANGO_ATTR_BACKGROUND:
+ case PANGO2_ATTR_BACKGROUND:
COLOR_ATTR(background);
break;
- case PANGO_ATTR_UNDERLINE:
- ENUM_ATTR(underline, PangoLineStyle, PANGO_LINE_STYLE_NONE, PANGO_LINE_STYLE_WAVY);
+ case PANGO2_ATTR_UNDERLINE:
+ ENUM_ATTR(underline, Pango2LineStyle, PANGO2_LINE_STYLE_NONE, PANGO2_LINE_STYLE_WAVY);
break;
- case PANGO_ATTR_UNDERLINE_POSITION:
- ENUM_ATTR(underline_position, PangoUnderlinePosition, PANGO_UNDERLINE_POSITION_NORMAL, PANGO_UNDERLINE_POSITION_UNDER);
+ case PANGO2_ATTR_UNDERLINE_POSITION:
+ ENUM_ATTR(underline_position, Pango2UnderlinePosition, PANGO2_UNDERLINE_POSITION_NORMAL, PANGO2_UNDERLINE_POSITION_UNDER);
break;
- case PANGO_ATTR_STRIKETHROUGH:
- ENUM_ATTR(strikethrough, PangoLineStyle, PANGO_LINE_STYLE_NONE, PANGO_LINE_STYLE_WAVY);
+ case PANGO2_ATTR_STRIKETHROUGH:
+ ENUM_ATTR(strikethrough, Pango2LineStyle, PANGO2_LINE_STYLE_NONE, PANGO2_LINE_STYLE_WAVY);
break;
- case PANGO_ATTR_RISE:
+ case PANGO2_ATTR_RISE:
INT_ATTR(rise, int);
break;
- case PANGO_ATTR_SCALE:
+ case PANGO2_ATTR_SCALE:
FLOAT_ATTR(scale);
break;
- case PANGO_ATTR_FALLBACK:
+ case PANGO2_ATTR_FALLBACK:
BOOLEAN_ATTR(fallback, gboolean);
break;
- case PANGO_ATTR_LETTER_SPACING:
+ case PANGO2_ATTR_LETTER_SPACING:
INT_ATTR(letter_spacing, int);
break;
- case PANGO_ATTR_UNDERLINE_COLOR:
+ case PANGO2_ATTR_UNDERLINE_COLOR:
COLOR_ATTR(underline_color);
break;
- case PANGO_ATTR_STRIKETHROUGH_COLOR:
+ case PANGO2_ATTR_STRIKETHROUGH_COLOR:
COLOR_ATTR(strikethrough_color);
break;
- case PANGO_ATTR_ABSOLUTE_SIZE:
+ case PANGO2_ATTR_ABSOLUTE_SIZE:
integer = g_ascii_strtoll (p, &endp, 10);
if (!is_valid_end_char (*endp)) goto fail;
- attr = pango_attr_size_new_absolute (integer);
+ attr = pango2_attr_size_new_absolute (integer);
break;
- case PANGO_ATTR_GRAVITY:
- ENUM_ATTR(gravity, PangoGravity, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_WEST);
+ case PANGO2_ATTR_GRAVITY:
+ ENUM_ATTR(gravity, Pango2Gravity, PANGO2_GRAVITY_SOUTH, PANGO2_GRAVITY_WEST);
break;
- case PANGO_ATTR_FONT_FEATURES:
+ case PANGO2_ATTR_FONT_FEATURES:
p++;
endp = strchr (p, '"');
if (!endp) goto fail;
str = g_strndup (p, endp - p);
- attr = pango_attr_font_features_new (str);
+ attr = pango2_attr_font_features_new (str);
g_free (str);
endp++;
if (!is_valid_end_char (*endp)) goto fail;
break;
- case PANGO_ATTR_GRAVITY_HINT:
- ENUM_ATTR(gravity_hint, PangoGravityHint, PANGO_GRAVITY_HINT_NATURAL, PANGO_GRAVITY_HINT_LINE);
+ case PANGO2_ATTR_GRAVITY_HINT:
+ ENUM_ATTR(gravity_hint, Pango2GravityHint, PANGO2_GRAVITY_HINT_NATURAL, PANGO2_GRAVITY_HINT_LINE);
break;
- case PANGO_ATTR_ALLOW_BREAKS:
+ case PANGO2_ATTR_ALLOW_BREAKS:
BOOLEAN_ATTR(allow_breaks, gboolean);
break;
- case PANGO_ATTR_SHOW:
- INT_ATTR(show, PangoShowFlags);
+ case PANGO2_ATTR_SHOW:
+ INT_ATTR(show, Pango2ShowFlags);
break;
- case PANGO_ATTR_INSERT_HYPHENS:
+ case PANGO2_ATTR_INSERT_HYPHENS:
BOOLEAN_ATTR(insert_hyphens, gboolean);
break;
- case PANGO_ATTR_OVERLINE:
- ENUM_ATTR(overline, PangoLineStyle, PANGO_LINE_STYLE_NONE, PANGO_LINE_STYLE_WAVY);
+ case PANGO2_ATTR_OVERLINE:
+ ENUM_ATTR(overline, Pango2LineStyle, PANGO2_LINE_STYLE_NONE, PANGO2_LINE_STYLE_WAVY);
break;
- case PANGO_ATTR_OVERLINE_COLOR:
+ case PANGO2_ATTR_OVERLINE_COLOR:
COLOR_ATTR(overline_color);
break;
- case PANGO_ATTR_LINE_HEIGHT:
+ case PANGO2_ATTR_LINE_HEIGHT:
FLOAT_ATTR(line_height);
break;
- case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT:
+ case PANGO2_ATTR_ABSOLUTE_LINE_HEIGHT:
integer = g_ascii_strtoll (p, &endp, 10);
if (!is_valid_end_char (*endp)) goto fail;
- attr = pango_attr_line_height_new_absolute (integer);
+ attr = pango2_attr_line_height_new_absolute (integer);
break;
- case PANGO_ATTR_TEXT_TRANSFORM:
- ENUM_ATTR(text_transform, PangoTextTransform, PANGO_TEXT_TRANSFORM_NONE, PANGO_TEXT_TRANSFORM_CAPITALIZE);
+ case PANGO2_ATTR_TEXT_TRANSFORM:
+ ENUM_ATTR(text_transform, Pango2TextTransform, PANGO2_TEXT_TRANSFORM_NONE, PANGO2_TEXT_TRANSFORM_CAPITALIZE);
break;
- case PANGO_ATTR_WORD:
+ case PANGO2_ATTR_WORD:
integer = g_ascii_strtoll (p, &endp, 10);
if (!is_valid_end_char (*endp)) goto fail;
- attr = pango_attr_word_new ();
+ attr = pango2_attr_word_new ();
break;
- case PANGO_ATTR_SENTENCE:
+ case PANGO2_ATTR_SENTENCE:
integer = g_ascii_strtoll (p, &endp, 10);
if (!is_valid_end_char (*endp)) goto fail;
- attr = pango_attr_sentence_new ();
+ attr = pango2_attr_sentence_new ();
break;
- case PANGO_ATTR_PARAGRAPH:
+ case PANGO2_ATTR_PARAGRAPH:
integer = g_ascii_strtoll (p, &endp, 10);
if (!is_valid_end_char (*endp)) goto fail;
- attr = pango_attr_paragraph_new ();
+ attr = pango2_attr_paragraph_new ();
break;
- case PANGO_ATTR_BASELINE_SHIFT:
- ENUM_ATTR(baseline_shift, PangoBaselineShift, 0, G_MAXINT);
+ case PANGO2_ATTR_BASELINE_SHIFT:
+ ENUM_ATTR(baseline_shift, Pango2BaselineShift, 0, G_MAXINT);
break;
- case PANGO_ATTR_FONT_SCALE:
- ENUM_ATTR(font_scale, PangoFontScale, PANGO_FONT_SCALE_NONE, PANGO_FONT_SCALE_SMALL_CAPS);
+ case PANGO2_ATTR_FONT_SCALE:
+ ENUM_ATTR(font_scale, Pango2FontScale, PANGO2_FONT_SCALE_NONE, PANGO2_FONT_SCALE_SMALL_CAPS);
break;
- case PANGO_ATTR_LINE_SPACING:
+ case PANGO2_ATTR_LINE_SPACING:
INT_ATTR(line_spacing, int);
break;
- case PANGO_ATTR_SHAPE:
+ case PANGO2_ATTR_SHAPE:
default:
g_assert_not_reached ();
}
@@ -1274,7 +1274,7 @@ pango_attr_list_from_string (const char *text)
goto success;
fail:
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
list = NULL;
success:
diff --git a/pango/pango-attr-list.h b/pango/pango-attr-list.h
index 4eac9183..faf0443d 100644
--- a/pango/pango-attr-list.h
+++ b/pango/pango-attr-list.h
@@ -25,57 +25,57 @@
G_BEGIN_DECLS
-typedef struct _PangoAttrList PangoAttrList;
-typedef struct _PangoAttrIterator PangoAttrIterator;
+typedef struct _Pango2AttrList Pango2AttrList;
+typedef struct _Pango2AttrIterator Pango2AttrIterator;
-#define PANGO_TYPE_ATTR_LIST pango_attr_list_get_type ()
+#define PANGO2_TYPE_ATTR_LIST pango2_attr_list_get_type ()
/**
- * PangoAttrList:
+ * Pango2AttrList:
*
- * A `PangoAttrList` represents a list of attributes that apply to a section
+ * A `Pango2AttrList` represents a list of attributes that apply to a section
* of text.
*
- * The attributes in a `PangoAttrList` are, in general, allowed to overlap in
+ * The attributes in a `Pango2AttrList` are, in general, allowed to overlap in
* an arbitrary fashion. However, if the attributes are manipulated only through
- * [method@Pango.AttrList.change], the overlap between properties will meet
+ * [method@Pango2.AttrList.change], the overlap between properties will meet
* stricter criteria.
*/
-PANGO_AVAILABLE_IN_ALL
-GType pango_attr_list_get_type (void) G_GNUC_CONST;
-
-PANGO_AVAILABLE_IN_ALL
-PangoAttrList * pango_attr_list_new (void);
-PANGO_AVAILABLE_IN_ALL
-PangoAttrList * pango_attr_list_ref (PangoAttrList *list);
-PANGO_AVAILABLE_IN_ALL
-void pango_attr_list_unref (PangoAttrList *list);
-PANGO_AVAILABLE_IN_ALL
-PangoAttrList * pango_attr_list_copy (PangoAttrList *list);
-PANGO_AVAILABLE_IN_ALL
-void pango_attr_list_insert (PangoAttrList *list,
- PangoAttribute *attr);
-PANGO_AVAILABLE_IN_ALL
-void pango_attr_list_insert_before (PangoAttrList *list,
- PangoAttribute *attr);
-PANGO_AVAILABLE_IN_ALL
-void pango_attr_list_change (PangoAttrList *list,
- PangoAttribute *attr);
-PANGO_AVAILABLE_IN_ALL
-void pango_attr_list_splice (PangoAttrList *list,
- PangoAttrList *other,
- int pos,
- int len);
-PANGO_AVAILABLE_IN_ALL
-void pango_attr_list_update (PangoAttrList *list,
- int pos,
- int remove,
- int add);
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_attr_list_get_type (void) G_GNUC_CONST;
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2AttrList * pango2_attr_list_new (void);
+PANGO2_AVAILABLE_IN_ALL
+Pango2AttrList * pango2_attr_list_ref (Pango2AttrList *list);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attr_list_unref (Pango2AttrList *list);
+PANGO2_AVAILABLE_IN_ALL
+Pango2AttrList * pango2_attr_list_copy (Pango2AttrList *list);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attr_list_insert (Pango2AttrList *list,
+ Pango2Attribute *attr);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attr_list_insert_before (Pango2AttrList *list,
+ Pango2Attribute *attr);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attr_list_change (Pango2AttrList *list,
+ Pango2Attribute *attr);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attr_list_splice (Pango2AttrList *list,
+ Pango2AttrList *other,
+ int pos,
+ int len);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attr_list_update (Pango2AttrList *list,
+ int pos,
+ int remove,
+ int add);
/**
- * PangoAttrFilterFunc:
- * @attribute: a Pango attribute
+ * Pango2AttrFilterFunc:
+ * @attribute: a Pango2 attribute
* @user_data: user data passed to the function
*
* Callback to filter a list of attributes.
@@ -83,30 +83,30 @@ void pango_attr_list_update (PangoAttrList *
* Return value: `TRUE` if the attribute should be selected for
* filtering, `FALSE` otherwise.
*/
-typedef gboolean (*PangoAttrFilterFunc) (PangoAttribute *attribute,
+typedef gboolean (*Pango2AttrFilterFunc) (Pango2Attribute *attribute,
gpointer user_data);
-PANGO_AVAILABLE_IN_ALL
-PangoAttrList * pango_attr_list_filter (PangoAttrList *list,
- PangoAttrFilterFunc func,
- gpointer data);
+PANGO2_AVAILABLE_IN_ALL
+Pango2AttrList * pango2_attr_list_filter (Pango2AttrList *list,
+ Pango2AttrFilterFunc func,
+ gpointer data);
-PANGO_AVAILABLE_IN_ALL
-GSList * pango_attr_list_get_attributes (PangoAttrList *list);
+PANGO2_AVAILABLE_IN_ALL
+GSList * pango2_attr_list_get_attributes (Pango2AttrList *list);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_attr_list_equal (PangoAttrList *list,
- PangoAttrList *other_list);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_attr_list_equal (Pango2AttrList *list,
+ Pango2AttrList *other_list);
-PANGO_AVAILABLE_IN_ALL
-char * pango_attr_list_to_string (PangoAttrList *list);
-PANGO_AVAILABLE_IN_ALL
-PangoAttrList * pango_attr_list_from_string (const char *text);
+PANGO2_AVAILABLE_IN_ALL
+char * pango2_attr_list_to_string (Pango2AttrList *list);
+PANGO2_AVAILABLE_IN_ALL
+Pango2AttrList * pango2_attr_list_from_string (const char *text);
-PANGO_AVAILABLE_IN_ALL
-PangoAttrIterator * pango_attr_list_get_iterator (PangoAttrList *list);
+PANGO2_AVAILABLE_IN_ALL
+Pango2AttrIterator * pango2_attr_list_get_iterator (Pango2AttrList *list);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttrList, pango_attr_list_unref)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2AttrList, pango2_attr_list_unref)
G_END_DECLS
diff --git a/pango/pango-attr-private.h b/pango/pango-attr-private.h
index 6d93bdd1..9e37ce40 100644
--- a/pango/pango-attr-private.h
+++ b/pango/pango-attr-private.h
@@ -21,7 +21,7 @@
#include <pango/pango-attr.h>
-struct _PangoAttribute
+struct _Pango2Attribute
{
guint type;
guint start_index;
@@ -31,11 +31,11 @@ struct _PangoAttribute
int int_value;
gboolean boolean_value;
double double_value;
- PangoColor color_value;
- PangoLanguage *lang_value;
- PangoFontDescription *font_value;
+ Pango2Color color_value;
+ Pango2Language *lang_value;
+ Pango2FontDescription *font_value;
gpointer pointer_value;
};
};
-char * pango_attr_value_serialize (PangoAttribute *attr);
+char * pango2_attr_value_serialize (Pango2Attribute *attr);
diff --git a/pango/pango-attr.c b/pango/pango-attr.c
index 4f4d8fdf..5f7876d3 100644
--- a/pango/pango-attr.c
+++ b/pango/pango-attr.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-attr.c: Attributed text
*
* Copyright (C) 2000-2002 Red Hat Software
@@ -27,13 +27,13 @@
#include "pango-impl-utils.h"
/**
- * PangoAttribute:
+ * Pango2Attribute:
*
- * A `PangoAttribute` structure associates a named attribute with
+ * A `Pango2Attribute` structure associates a named attribute with
* a certain range of a text.
*
* Attributes can have basic types, such as int, float, boolean
- * `PangoColor`, `PangoFontDescription or `PangoLanguage`. It is
+ * `Pango2Color`, `Pango2FontDescription or `Pango2Language`. It is
* also possible to define new, custom attributes.
*
* By default, an attribute will have an all-inclusive range of
@@ -47,24 +47,24 @@ static GArray *attr_type;
#define MIN_CUSTOM 1000
-typedef struct _PangoAttrClass PangoAttrClass;
+typedef struct _Pango2AttrClass Pango2AttrClass;
-struct _PangoAttrClass {
+struct _Pango2AttrClass {
guint type;
const char *name;
- PangoAttrDataCopyFunc copy;
+ Pango2AttrDataCopyFunc copy;
GDestroyNotify destroy;
GEqualFunc equal;
- PangoAttrDataSerializeFunc serialize;
+ Pango2AttrDataSerializeFunc serialize;
};
static const char *
-get_attr_type_nick (PangoAttrType type)
+get_attr_type_nick (Pango2AttrType type)
{
GEnumClass *enum_class;
GEnumValue *enum_value;
- enum_class = g_type_class_ref (pango_attr_type_get_type ());
+ enum_class = g_type_class_ref (pango2_attr_type_get_type ());
enum_value = g_enum_get_value (enum_class, type);
g_type_class_unref (enum_class);
@@ -76,43 +76,43 @@ is_valid_attr_type (guint type)
{
switch (type)
{
- case PANGO_ATTR_INVALID:
+ case PANGO2_ATTR_INVALID:
return FALSE;
- case PANGO_ATTR_LANGUAGE:
- case PANGO_ATTR_FAMILY:
- case PANGO_ATTR_STYLE:
- case PANGO_ATTR_WEIGHT:
- case PANGO_ATTR_VARIANT:
- case PANGO_ATTR_STRETCH:
- case PANGO_ATTR_SIZE:
- case PANGO_ATTR_FONT_DESC:
- case PANGO_ATTR_FOREGROUND:
- case PANGO_ATTR_BACKGROUND:
- case PANGO_ATTR_UNDERLINE:
- case PANGO_ATTR_STRIKETHROUGH:
- case PANGO_ATTR_RISE:
- case PANGO_ATTR_SCALE:
- case PANGO_ATTR_FALLBACK:
- case PANGO_ATTR_LETTER_SPACING:
- case PANGO_ATTR_UNDERLINE_COLOR:
- case PANGO_ATTR_STRIKETHROUGH_COLOR:
- case PANGO_ATTR_ABSOLUTE_SIZE:
- case PANGO_ATTR_GRAVITY:
- case PANGO_ATTR_GRAVITY_HINT:
- case PANGO_ATTR_FONT_FEATURES:
- case PANGO_ATTR_ALLOW_BREAKS:
- case PANGO_ATTR_SHOW:
- case PANGO_ATTR_INSERT_HYPHENS:
- case PANGO_ATTR_OVERLINE:
- case PANGO_ATTR_OVERLINE_COLOR:
- case PANGO_ATTR_LINE_HEIGHT:
- case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT:
- case PANGO_ATTR_TEXT_TRANSFORM:
- case PANGO_ATTR_WORD:
- case PANGO_ATTR_SENTENCE:
- case PANGO_ATTR_BASELINE_SHIFT:
- case PANGO_ATTR_FONT_SCALE:
- case PANGO_ATTR_SHAPE:
+ case PANGO2_ATTR_LANGUAGE:
+ case PANGO2_ATTR_FAMILY:
+ case PANGO2_ATTR_STYLE:
+ case PANGO2_ATTR_WEIGHT:
+ case PANGO2_ATTR_VARIANT:
+ case PANGO2_ATTR_STRETCH:
+ case PANGO2_ATTR_SIZE:
+ case PANGO2_ATTR_FONT_DESC:
+ case PANGO2_ATTR_FOREGROUND:
+ case PANGO2_ATTR_BACKGROUND:
+ case PANGO2_ATTR_UNDERLINE:
+ case PANGO2_ATTR_STRIKETHROUGH:
+ case PANGO2_ATTR_RISE:
+ case PANGO2_ATTR_SCALE:
+ case PANGO2_ATTR_FALLBACK:
+ case PANGO2_ATTR_LETTER_SPACING:
+ case PANGO2_ATTR_UNDERLINE_COLOR:
+ case PANGO2_ATTR_STRIKETHROUGH_COLOR:
+ case PANGO2_ATTR_ABSOLUTE_SIZE:
+ case PANGO2_ATTR_GRAVITY:
+ case PANGO2_ATTR_GRAVITY_HINT:
+ case PANGO2_ATTR_FONT_FEATURES:
+ case PANGO2_ATTR_ALLOW_BREAKS:
+ case PANGO2_ATTR_SHOW:
+ case PANGO2_ATTR_INSERT_HYPHENS:
+ case PANGO2_ATTR_OVERLINE:
+ case PANGO2_ATTR_OVERLINE_COLOR:
+ case PANGO2_ATTR_LINE_HEIGHT:
+ case PANGO2_ATTR_ABSOLUTE_LINE_HEIGHT:
+ case PANGO2_ATTR_TEXT_TRANSFORM:
+ case PANGO2_ATTR_WORD:
+ case PANGO2_ATTR_SENTENCE:
+ case PANGO2_ATTR_BASELINE_SHIFT:
+ case PANGO2_ATTR_FONT_SCALE:
+ case PANGO2_ATTR_SHAPE:
return TRUE;
default:
if (!attr_type)
@@ -125,7 +125,7 @@ is_valid_attr_type (guint type)
for (int i = 0; i < attr_type->len; i++)
{
- PangoAttrClass *class = &g_array_index (attr_type, PangoAttrClass, i);
+ Pango2AttrClass *class = &g_array_index (attr_type, Pango2AttrClass, i);
if (class->type == type)
{
result = TRUE;
@@ -141,11 +141,11 @@ is_valid_attr_type (guint type)
}
/**
- * pango_attr_type_register:
+ * pango2_attr_type_register:
* @name: (nullable): an identifier for the type
- * @value_type: the `PangoAttrValueType` for the attribute
- * @affects: `PangoAttrAffects` flags for the attribute
- * @merge: `PangoAttrMerge` flags for the attribute
+ * @value_type: the `Pango2AttrValueType` for the attribute
+ * @affects: `Pango2AttrAffects` flags for the attribute
+ * @merge: `Pango2AttrMerge` flags for the attribute
* @copy: (scope forever) (nullable): function to copy the data of an attribute
* of this type
* @destroy: (scope forever) (nullable): function to free the data of an attribute
@@ -158,31 +158,31 @@ is_valid_attr_type (guint type)
* Register a new attribute type.
*
* The attribute type name can be accessed later
- * by using [func@Pango.AttrType.get_name].
+ * by using [func@Pango2.AttrType.get_name].
*
- * The callbacks are only needed if @type is `PANGO_ATTR_VALUE_POINTER`,
- * Pango knows how to handle other value types and will only use the
+ * The callbacks are only needed if @type is `PANGO2_ATTR_VALUE_POINTER`,
+ * Pango2 knows how to handle other value types and will only use the
* callbacks for generic pointer values.
*
* If @name and @serialize are provided, they will be used
* to serialize attributes of this type.
*
- * To create attributes with the new type, use [ctor@PangoAttribute.new].
+ * To create attributes with the new type, use [ctor@Pango2.Attribute.new].
*
* Return value: the attribute type ID
*/
guint
-pango_attr_type_register (const char *name,
- PangoAttrValueType value_type,
- PangoAttrAffects affects,
- PangoAttrMerge merge,
- PangoAttrDataCopyFunc copy,
- GDestroyNotify destroy,
- GEqualFunc equal,
- PangoAttrDataSerializeFunc serialize)
+pango2_attr_type_register (const char *name,
+ Pango2AttrValueType value_type,
+ Pango2AttrAffects affects,
+ Pango2AttrMerge merge,
+ Pango2AttrDataCopyFunc copy,
+ GDestroyNotify destroy,
+ GEqualFunc equal,
+ Pango2AttrDataSerializeFunc serialize)
{
static guint current_id = MIN_CUSTOM; /* MT-safe */
- PangoAttrClass class;
+ Pango2AttrClass class;
G_LOCK (attr_type);
@@ -198,7 +198,7 @@ pango_attr_type_register (const char *name,
class.name = g_intern_string (name);
if (attr_type == NULL)
- attr_type = g_array_new (FALSE, FALSE, sizeof (PangoAttrClass));
+ attr_type = g_array_new (FALSE, FALSE, sizeof (Pango2AttrClass));
g_array_append_val (attr_type, class);
@@ -208,25 +208,25 @@ pango_attr_type_register (const char *name,
}
/**
- * pango_attr_type_get_name:
+ * pango2_attr_type_get_name:
* @type: an attribute type ID to fetch the name for
*
* Fetches the attribute type name.
*
* The attribute type name is the string passed in
* when registering the type using
- * [func@Pango.AttrType.register].
+ * [func@Pango2.AttrType.register].
*
* The returned value is an interned string (see
* [func@GLib.intern_string] for what that means) that should
* not be modified or freed.
*
* Return value: (nullable): the type ID name (which
- * may be %NULL), or %NULL if @type is a built-in Pango
+ * may be %NULL), or %NULL if @type is a built-in Pango2
* attribute type or invalid.
*/
const char *
-pango_attr_type_get_name (guint type)
+pango2_attr_type_get_name (guint type)
{
const char *result = NULL;
@@ -237,7 +237,7 @@ pango_attr_type_get_name (guint type)
for (int i = 0; i < attr_type->len; i++)
{
- PangoAttrClass *class = &g_array_index (attr_type, PangoAttrClass, i);
+ Pango2AttrClass *class = &g_array_index (attr_type, Pango2AttrClass, i);
if (class->type == type)
{
result = class->name;
@@ -251,36 +251,36 @@ pango_attr_type_get_name (guint type)
}
/**
- * pango_attribute_copy:
- * @attr: a `PangoAttribute`
+ * pango2_attribute_copy:
+ * @attr: a `Pango2Attribute`
*
* Make a copy of an attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy].
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy].
*/
-PangoAttribute *
-pango_attribute_copy (const PangoAttribute *attr)
+Pango2Attribute *
+pango2_attribute_copy (const Pango2Attribute *attr)
{
- PangoAttribute *result;
+ Pango2Attribute *result;
g_return_val_if_fail (attr != NULL, NULL);
- result = g_slice_dup (PangoAttribute, attr);
+ result = g_slice_dup (Pango2Attribute, attr);
- switch (PANGO_ATTR_VALUE_TYPE (attr))
+ switch (PANGO2_ATTR_VALUE_TYPE (attr))
{
- case PANGO_ATTR_VALUE_STRING:
+ case PANGO2_ATTR_VALUE_STRING:
result->str_value = g_strdup (attr->str_value);
break;
- case PANGO_ATTR_VALUE_FONT_DESC:
- result->font_value = pango_font_description_copy (attr->font_value);
+ case PANGO2_ATTR_VALUE_FONT_DESC:
+ result->font_value = pango2_font_description_copy (attr->font_value);
break;
- case PANGO_ATTR_VALUE_POINTER:
- if (attr->type == PANGO_ATTR_SHAPE)
+ case PANGO2_ATTR_VALUE_POINTER:
+ if (attr->type == PANGO2_ATTR_SHAPE)
{
ShapeData *shape_data;
@@ -292,7 +292,7 @@ pango_attribute_copy (const PangoAttribute *attr)
}
else
{
- PangoAttrDataCopyFunc copy = NULL;
+ Pango2AttrDataCopyFunc copy = NULL;
G_LOCK (attr_type);
@@ -300,7 +300,7 @@ pango_attribute_copy (const PangoAttribute *attr)
for (int i = 0; i < attr_type->len; i++)
{
- PangoAttrClass *class = &g_array_index (attr_type, PangoAttrClass, i);
+ Pango2AttrClass *class = &g_array_index (attr_type, Pango2AttrClass, i);
if (class->type == attr->type)
{
copy = class->copy;
@@ -315,11 +315,11 @@ pango_attribute_copy (const PangoAttribute *attr)
}
break;
- case PANGO_ATTR_VALUE_INT:
- case PANGO_ATTR_VALUE_BOOLEAN:
- case PANGO_ATTR_VALUE_FLOAT:
- case PANGO_ATTR_VALUE_COLOR:
- case PANGO_ATTR_VALUE_LANGUAGE:
+ case PANGO2_ATTR_VALUE_INT:
+ case PANGO2_ATTR_VALUE_BOOLEAN:
+ case PANGO2_ATTR_VALUE_FLOAT:
+ case PANGO2_ATTR_VALUE_COLOR:
+ case PANGO2_ATTR_VALUE_LANGUAGE:
default: ;
}
@@ -327,28 +327,28 @@ pango_attribute_copy (const PangoAttribute *attr)
}
/**
- * pango_attribute_destroy:
- * @attr: a `PangoAttribute`.
+ * pango2_attribute_destroy:
+ * @attr: a `Pango2Attribute`.
*
- * Destroy a `PangoAttribute` and free all associated memory.
+ * Destroy a `Pango2Attribute` and free all associated memory.
*/
void
-pango_attribute_destroy (PangoAttribute *attr)
+pango2_attribute_destroy (Pango2Attribute *attr)
{
g_return_if_fail (attr != NULL);
- switch (PANGO_ATTR_VALUE_TYPE (attr))
+ switch (PANGO2_ATTR_VALUE_TYPE (attr))
{
- case PANGO_ATTR_VALUE_STRING:
+ case PANGO2_ATTR_VALUE_STRING:
g_free (attr->str_value);
break;
- case PANGO_ATTR_VALUE_FONT_DESC:
- pango_font_description_free (attr->font_value);
+ case PANGO2_ATTR_VALUE_FONT_DESC:
+ pango2_font_description_free (attr->font_value);
break;
- case PANGO_ATTR_VALUE_POINTER:
- if (attr->type == PANGO_ATTR_SHAPE)
+ case PANGO2_ATTR_VALUE_POINTER:
+ if (attr->type == PANGO2_ATTR_SHAPE)
{
ShapeData *shape_data = attr->pointer_value;
@@ -367,7 +367,7 @@ pango_attribute_destroy (PangoAttribute *attr)
for (int i = 0; i < attr_type->len; i++)
{
- PangoAttrClass *class = &g_array_index (attr_type, PangoAttrClass, i);
+ Pango2AttrClass *class = &g_array_index (attr_type, Pango2AttrClass, i);
if (class->type == attr->type)
{
destroy = class->destroy;
@@ -382,25 +382,25 @@ pango_attribute_destroy (PangoAttribute *attr)
}
break;
- case PANGO_ATTR_VALUE_INT:
- case PANGO_ATTR_VALUE_BOOLEAN:
- case PANGO_ATTR_VALUE_FLOAT:
- case PANGO_ATTR_VALUE_COLOR:
- case PANGO_ATTR_VALUE_LANGUAGE:
+ case PANGO2_ATTR_VALUE_INT:
+ case PANGO2_ATTR_VALUE_BOOLEAN:
+ case PANGO2_ATTR_VALUE_FLOAT:
+ case PANGO2_ATTR_VALUE_COLOR:
+ case PANGO2_ATTR_VALUE_LANGUAGE:
default: ;
}
- g_slice_free (PangoAttribute, attr);
+ g_slice_free (Pango2Attribute, attr);
}
-G_DEFINE_BOXED_TYPE (PangoAttribute, pango_attribute,
- pango_attribute_copy,
- pango_attribute_destroy);
+G_DEFINE_BOXED_TYPE (Pango2Attribute, pango2_attribute,
+ pango2_attribute_copy,
+ pango2_attribute_destroy);
/**
- * pango_attribute_equal:
- * @attr1: a `PangoAttribute`
- * @attr2: another `PangoAttribute`
+ * pango2_attribute_equal:
+ * @attr1: a `Pango2Attribute`
+ * @attr2: another `Pango2Attribute`
*
* Compare two attributes for equality.
*
@@ -411,8 +411,8 @@ G_DEFINE_BOXED_TYPE (PangoAttribute, pango_attribute,
* Return value: %TRUE if the two attributes have the same value
*/
gboolean
-pango_attribute_equal (const PangoAttribute *attr1,
- const PangoAttribute *attr2)
+pango2_attribute_equal (const Pango2Attribute *attr1,
+ const Pango2Attribute *attr2)
{
g_return_val_if_fail (attr1 != NULL, FALSE);
g_return_val_if_fail (attr2 != NULL, FALSE);
@@ -420,30 +420,30 @@ pango_attribute_equal (const PangoAttribute *attr1,
if (attr1->type != attr2->type)
return FALSE;
- switch (PANGO_ATTR_VALUE_TYPE (attr1))
+ switch (PANGO2_ATTR_VALUE_TYPE (attr1))
{
- case PANGO_ATTR_VALUE_STRING:
+ case PANGO2_ATTR_VALUE_STRING:
return strcmp (attr1->str_value, attr2->str_value) == 0;
- case PANGO_ATTR_VALUE_INT:
+ case PANGO2_ATTR_VALUE_INT:
return attr1->int_value == attr2->int_value;
- case PANGO_ATTR_VALUE_BOOLEAN:
+ case PANGO2_ATTR_VALUE_BOOLEAN:
return attr1->boolean_value == attr2->boolean_value;
- case PANGO_ATTR_VALUE_FLOAT:
+ case PANGO2_ATTR_VALUE_FLOAT:
return attr1->double_value == attr2->double_value;
- case PANGO_ATTR_VALUE_COLOR:
- return memcmp (&attr1->color_value, &attr2->color_value, sizeof (PangoColor)) == 0;
+ case PANGO2_ATTR_VALUE_COLOR:
+ return memcmp (&attr1->color_value, &attr2->color_value, sizeof (Pango2Color)) == 0;
- case PANGO_ATTR_VALUE_LANGUAGE:
+ case PANGO2_ATTR_VALUE_LANGUAGE:
return attr1->lang_value == attr2->lang_value;
- case PANGO_ATTR_VALUE_FONT_DESC:
- return pango_font_description_equal (attr1->font_value, attr2->font_value);
+ case PANGO2_ATTR_VALUE_FONT_DESC:
+ return pango2_font_description_equal (attr1->font_value, attr2->font_value);
- case PANGO_ATTR_VALUE_POINTER:
+ case PANGO2_ATTR_VALUE_POINTER:
{
GEqualFunc equal = NULL;
@@ -453,7 +453,7 @@ pango_attribute_equal (const PangoAttribute *attr1,
for (int i = 0; i < attr_type->len; i++)
{
- PangoAttrClass *class = &g_array_index (attr_type, PangoAttrClass, i);
+ Pango2AttrClass *class = &g_array_index (attr_type, Pango2AttrClass, i);
if (class->type == attr1->type)
{
equal = class->equal;
@@ -475,58 +475,58 @@ pango_attribute_equal (const PangoAttribute *attr1,
}
/**
- * pango_attribute_new:
+ * pango2_attribute_new:
* @type: the attribute type
* @value: pointer to the value to be copied, must be of the right type
*
* Creates a new attribute for the given type.
*
- * The type must be one of the `PangoAttrType` values, or
- * have been registered with [func@Pango.AttrType.register].
+ * The type must be one of the `Pango2AttrType` values, or
+ * have been registered with [func@Pango2.AttrType.register].
*
- * Pango will initialize @start_index and @end_index to an
+ * Pango2 will initialize @start_index and @end_index to an
* all-inclusive range of `[0,G_MAXUINT]`. The value is copied.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attribute_new (guint type,
- gconstpointer value)
+Pango2Attribute *
+pango2_attribute_new (guint type,
+ gconstpointer value)
{
- PangoAttribute attr;
+ Pango2Attribute attr;
g_return_val_if_fail (is_valid_attr_type (type), NULL);
attr.type = type;
- attr.start_index = PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING;
- attr.end_index = PANGO_ATTR_INDEX_TO_TEXT_END;
+ attr.start_index = PANGO2_ATTR_INDEX_FROM_TEXT_BEGINNING;
+ attr.end_index = PANGO2_ATTR_INDEX_TO_TEXT_END;
- switch (PANGO_ATTR_TYPE_VALUE_TYPE (type))
+ switch (PANGO2_ATTR_TYPE_VALUE_TYPE (type))
{
- case PANGO_ATTR_VALUE_STRING:
+ case PANGO2_ATTR_VALUE_STRING:
attr.str_value = (char *)value;
break;
- case PANGO_ATTR_VALUE_INT:
+ case PANGO2_ATTR_VALUE_INT:
attr.int_value = *(int *)value;
break;
- case PANGO_ATTR_VALUE_BOOLEAN:
+ case PANGO2_ATTR_VALUE_BOOLEAN:
attr.boolean_value = *(gboolean *)value;
break;
- case PANGO_ATTR_VALUE_FLOAT:
+ case PANGO2_ATTR_VALUE_FLOAT:
attr.double_value = *(double *)value;
break;
- case PANGO_ATTR_VALUE_COLOR:
- attr.color_value = *(PangoColor *)value;
+ case PANGO2_ATTR_VALUE_COLOR:
+ attr.color_value = *(Pango2Color *)value;
break;
- case PANGO_ATTR_VALUE_LANGUAGE:
- attr.lang_value = (PangoLanguage *)value;
+ case PANGO2_ATTR_VALUE_LANGUAGE:
+ attr.lang_value = (Pango2Language *)value;
break;
- case PANGO_ATTR_VALUE_FONT_DESC:
- attr.font_value = (PangoFontDescription *)value;
+ case PANGO2_ATTR_VALUE_FONT_DESC:
+ attr.font_value = (Pango2FontDescription *)value;
break;
- case PANGO_ATTR_VALUE_POINTER:
+ case PANGO2_ATTR_VALUE_POINTER:
attr.pointer_value = (gpointer)value;
break;
default:
@@ -534,32 +534,32 @@ pango_attribute_new (guint type,
}
/* Copy the value */
- return pango_attribute_copy (&attr);
+ return pango2_attribute_copy (&attr);
}
/**
- * pango_attribute_type:
- * @attribute: a `PangoAttribute`
+ * pango2_attribute_type:
+ * @attribute: a `Pango2Attribute`
*
* Returns the type of @attribute, either a
- * value from the [enum@Pango.AttrType] enumeration
+ * value from the [enum@Pango2.AttrType] enumeration
* or a registered custom type.
*
- * Return value: the type of `PangoAttribute`
+ * Return value: the type of `Pango2Attribute`
*/
guint
-pango_attribute_type (const PangoAttribute *attribute)
+pango2_attribute_type (const Pango2Attribute *attribute)
{
return attribute->type;
}
/* }}} */
-/* {{{ Private API */
+ /* {{{ Private API */
char *
-pango_attr_value_serialize (PangoAttribute *attr)
+pango2_attr_value_serialize (Pango2Attribute *attr)
{
- PangoAttrDataSerializeFunc serialize = NULL;
+ Pango2AttrDataSerializeFunc serialize = NULL;
G_LOCK (attr_type);
@@ -567,7 +567,7 @@ pango_attr_value_serialize (PangoAttribute *attr)
for (int i = 0; i < attr_type->len; i++)
{
- PangoAttrClass *class = &g_array_index (attr_type, PangoAttrClass, i);
+ Pango2AttrClass *class = &g_array_index (attr_type, Pango2AttrClass, i);
if (class->type == attr->type)
{
serialize = class->serialize;
@@ -587,170 +587,170 @@ pango_attr_value_serialize (PangoAttribute *attr)
/* {{{ Binding Helpers */
/**
- * pango_attribute_set_range:
- * @attribute: a `PangoAttribute`
+ * pango2_attribute_set_range:
+ * @attribute: a `Pango2Attribute`
* @start_index: start index
* @end_index: end index
*
* Sets the range of the attribute.
*/
void
-pango_attribute_set_range (PangoAttribute *attribute,
- guint start_index,
- guint end_index)
+pango2_attribute_set_range (Pango2Attribute *attribute,
+ guint start_index,
+ guint end_index)
{
attribute->start_index = start_index;
attribute->end_index = end_index;
}
/**
- * pango_attribute_get_range:
- * @attribute: a `PangoAttribute`
+ * pango2_attribute_get_range:
+ * @attribute: a `Pango2Attribute`
* @start_index: (out caller-allocates): return location for start index
* @end_index: (out caller-allocates): return location for end index
*
* Gets the range of the attribute.
*/
void
-pango_attribute_get_range (PangoAttribute *attribute,
- guint *start_index,
- guint *end_index)
+pango2_attribute_get_range (Pango2Attribute *attribute,
+ guint *start_index,
+ guint *end_index)
{
*start_index = attribute->start_index;
*end_index = attribute->end_index;
}
/**
- * pango_attribute_get_string:
- * @attribute: a `PangoAttribute`
+ * pango2_attribute_get_string:
+ * @attribute: a `Pango2Attribute`
*
* Gets the value of an attribute whose value type is string.
*
* Returns: (nullable): the string value
*/
const char *
-pango_attribute_get_string (PangoAttribute *attribute)
+pango2_attribute_get_string (Pango2Attribute *attribute)
{
- if (PANGO_ATTR_VALUE_TYPE (attribute) != PANGO_ATTR_VALUE_STRING)
+ if (PANGO2_ATTR_VALUE_TYPE (attribute) != PANGO2_ATTR_VALUE_STRING)
return NULL;
return attribute->str_value;
}
/**
- * pango_attribute_get_language:
- * @attribute: a `PangoAttribute`
+ * pango2_attribute_get_language:
+ * @attribute: a `Pango2Attribute`
*
- * Gets the value of an attribute whose value type is `PangoLanguage`.
+ * Gets the value of an attribute whose value type is `Pango2Language`.
*
* Returns: (nullable): the language value
*/
-PangoLanguage *
-pango_attribute_get_language (PangoAttribute *attribute)
+Pango2Language *
+pango2_attribute_get_language (Pango2Attribute *attribute)
{
- if (PANGO_ATTR_VALUE_TYPE (attribute) != PANGO_ATTR_VALUE_LANGUAGE)
+ if (PANGO2_ATTR_VALUE_TYPE (attribute) != PANGO2_ATTR_VALUE_LANGUAGE)
return NULL;
return attribute->lang_value;
}
/**
- * pango_attribute_get_int:
- * @attribute: a `PangoAttribute`
+ * pango2_attribute_get_int:
+ * @attribute: a `Pango2Attribute`
*
* Gets the value of an attribute whose value type is `int`.
*
* Returns: the integer value, or 0
*/
int
-pango_attribute_get_int (PangoAttribute *attribute)
+pango2_attribute_get_int (Pango2Attribute *attribute)
{
- if (PANGO_ATTR_VALUE_TYPE (attribute) != PANGO_ATTR_VALUE_INT)
+ if (PANGO2_ATTR_VALUE_TYPE (attribute) != PANGO2_ATTR_VALUE_INT)
return 0;
return attribute->int_value;
}
/**
- * pango_attribute_get_boolean:
- * @attribute: a `PangoAttribute`
+ * pango2_attribute_get_boolean:
+ * @attribute: a `Pango2Attribute`
*
* Gets the value of an attribute whose value type is `gboolean`.
*
* Returns: the boolean value, or `FALSE`
*/
gboolean
-pango_attribute_get_boolean (PangoAttribute *attribute)
+pango2_attribute_get_boolean (Pango2Attribute *attribute)
{
- if (PANGO_ATTR_VALUE_TYPE (attribute) != PANGO_ATTR_VALUE_BOOLEAN)
+ if (PANGO2_ATTR_VALUE_TYPE (attribute) != PANGO2_ATTR_VALUE_BOOLEAN)
return FALSE;
return attribute->boolean_value;
}
/**
- * pango_attribute_get_float:
- * @attribute: a `PangoAttribute`
+ * pango2_attribute_get_float:
+ * @attribute: a `Pango2Attribute`
*
* Gets the value of an attribute whose value type is `double`.
*
* Returns: the float value, or 0
*/
double
-pango_attribute_get_float (PangoAttribute *attribute)
+pango2_attribute_get_float (Pango2Attribute *attribute)
{
- if (PANGO_ATTR_VALUE_TYPE (attribute) != PANGO_ATTR_VALUE_FLOAT)
+ if (PANGO2_ATTR_VALUE_TYPE (attribute) != PANGO2_ATTR_VALUE_FLOAT)
return 0.;
return attribute->double_value;
}
/**
- * pango_attribute_get_color:
- * @attribute: a `PangoAttribute`
+ * pango2_attribute_get_color:
+ * @attribute: a `Pango2Attribute`
*
- * Gets the value of an attribute whose value type is `PangoColor`.
+ * Gets the value of an attribute whose value type is `Pango2Color`.
*
* Returns: (nullable): pointer to the color value
*/
-PangoColor *
-pango_attribute_get_color (PangoAttribute *attribute)
+Pango2Color *
+pango2_attribute_get_color (Pango2Attribute *attribute)
{
- if (PANGO_ATTR_VALUE_TYPE (attribute) != PANGO_ATTR_VALUE_COLOR)
+ if (PANGO2_ATTR_VALUE_TYPE (attribute) != PANGO2_ATTR_VALUE_COLOR)
return NULL;
return &attribute->color_value;
}
/**
- * pango_attribute_get_font_desc:
- * @attribute: a `PangoAttribute`
+ * pango2_attribute_get_font_desc:
+ * @attribute: a `Pango2Attribute`
*
- * Gets the value of an attribute whose value type is `PangoFontDescription`.
+ * Gets the value of an attribute whose value type is `Pango2FontDescription`.
*
* Returns: (nullable): the font description
*/
-PangoFontDescription *
-pango_attribute_get_font_desc (PangoAttribute *attribute)
+Pango2FontDescription *
+pango2_attribute_get_font_desc (Pango2Attribute *attribute)
{
- if (PANGO_ATTR_VALUE_TYPE (attribute) != PANGO_ATTR_VALUE_FONT_DESC)
+ if (PANGO2_ATTR_VALUE_TYPE (attribute) != PANGO2_ATTR_VALUE_FONT_DESC)
return NULL;
return attribute->font_value;
}
/**
- * pango_attribute_get_pointer:
- * @attribute: a `PangoAttribute`
+ * pango2_attribute_get_pointer:
+ * @attribute: a `Pango2Attribute`
*
* Gets the value of an attribute whose value type is `gpointer`.
*
* Returns: (nullable): the pointer value
*/
gpointer
-pango_attribute_get_pointer (PangoAttribute *attribute)
+pango2_attribute_get_pointer (Pango2Attribute *attribute)
{
- if (PANGO_ATTR_VALUE_TYPE (attribute) != PANGO_ATTR_VALUE_POINTER)
+ if (PANGO2_ATTR_VALUE_TYPE (attribute) != PANGO2_ATTR_VALUE_POINTER)
return NULL;
return attribute->pointer_value;
diff --git a/pango/pango-attr.h b/pango/pango-attr.h
index 0617c4cf..08fb932b 100644
--- a/pango/pango-attr.h
+++ b/pango/pango-attr.h
@@ -26,220 +26,220 @@
G_BEGIN_DECLS
-typedef struct _PangoAttribute PangoAttribute;
+typedef struct _Pango2Attribute Pango2Attribute;
/**
- * PangoAttrValueType:
- * @PANGO_ATTR_VALUE_STRING: A string
- * @PANGO_ATTR_VALUE_INT: An integer
- * @PANGO_ATTR_VALUE_BOOLEAN: A boolean
- * @PANGO_ATTR_VALUE_FLOAT: A floating point number
- * @PANGO_ATTR_VALUE_COLOR: A `PangoColor`
- * @PANGO_ATTR_VALUE_LANGUAGE: A `PangoLanguage`
- * @PANGO_ATTR_VALUE_FONT_DESC: A `PangoFontDescription`
- * @PANGO_ATTR_VALUE_POINTER: A generic pointer
- *
- * `PangoAttrValueType` enumerates the types of values
- * that a `PangoAttribute` can contain.
- *
- * The `PangoAttrValueType` of a `PangoAttribute` is part
- * of its type, and can be obtained with `PANGO_ATTR_VALUE_TYPE()`.
+ * Pango2AttrValueType:
+ * @PANGO2_ATTR_VALUE_STRING: A string
+ * @PANGO2_ATTR_VALUE_INT: An integer
+ * @PANGO2_ATTR_VALUE_BOOLEAN: A boolean
+ * @PANGO2_ATTR_VALUE_FLOAT: A floating point number
+ * @PANGO2_ATTR_VALUE_COLOR: A `Pango2Color`
+ * @PANGO2_ATTR_VALUE_LANGUAGE: A `Pango2Language`
+ * @PANGO2_ATTR_VALUE_FONT_DESC: A `Pango2FontDescription`
+ * @PANGO2_ATTR_VALUE_POINTER: A generic pointer
+ *
+ * `Pango2AttrValueType` enumerates the types of values
+ * that a `Pango2Attribute` can contain.
+ *
+ * The `Pango2AttrValueType` of a `Pango2Attribute` is part
+ * of its type, and can be obtained with `PANGO2_ATTR_VALUE_TYPE()`.
*/
typedef enum
{
- PANGO_ATTR_VALUE_STRING,
- PANGO_ATTR_VALUE_INT,
- PANGO_ATTR_VALUE_BOOLEAN,
- PANGO_ATTR_VALUE_FLOAT,
- PANGO_ATTR_VALUE_COLOR,
- PANGO_ATTR_VALUE_LANGUAGE,
- PANGO_ATTR_VALUE_FONT_DESC,
- PANGO_ATTR_VALUE_POINTER
-} PangoAttrValueType;
+ PANGO2_ATTR_VALUE_STRING,
+ PANGO2_ATTR_VALUE_INT,
+ PANGO2_ATTR_VALUE_BOOLEAN,
+ PANGO2_ATTR_VALUE_FLOAT,
+ PANGO2_ATTR_VALUE_COLOR,
+ PANGO2_ATTR_VALUE_LANGUAGE,
+ PANGO2_ATTR_VALUE_FONT_DESC,
+ PANGO2_ATTR_VALUE_POINTER
+} Pango2AttrValueType;
/**
- * PangoAttrAffects:
- * @PANGO_ATTR_AFFECTS_NONE: The attribute does not affect rendering
- * @PANGO_ATTR_AFFECTS_ITEMIZATION: The attribute affecs itemization
- * @PANGO_ATTR_AFFECTS_BREAKING: The attribute affects `PangoLogAttr` determination
- * @PANGO_ATTR_AFFECTS_SHAPING: The attribute affects shaping
- * @PANGO_ATTR_AFFECTS_RENDERING: The attribute affects rendering
- *
- * A `PangoAttrAffects` value indicates what part of Pango's processing
+ * Pango2AttrAffects:
+ * @PANGO2_ATTR_AFFECTS_NONE: The attribute does not affect rendering
+ * @PANGO2_ATTR_AFFECTS_ITEMIZATION: The attribute affecs itemization
+ * @PANGO2_ATTR_AFFECTS_BREAKING: The attribute affects `Pango2LogAttr` determination
+ * @PANGO2_ATTR_AFFECTS_SHAPING: The attribute affects shaping
+ * @PANGO2_ATTR_AFFECTS_RENDERING: The attribute affects rendering
+ *
+ * A `Pango2AttrAffects` value indicates what part of Pango2's processing
* pipeline is affected by an attribute.
*
- * Marking an attribute with `PANGO_ATTR_AFFECTS_ITEMIZATION` ensures
+ * Marking an attribute with `PANGO2_ATTR_AFFECTS_ITEMIZATION` ensures
* that the attribute values are constant across items.
*/
typedef enum
{
- PANGO_ATTR_AFFECTS_NONE = 0,
- PANGO_ATTR_AFFECTS_ITEMIZATION = 1 << 0,
- PANGO_ATTR_AFFECTS_BREAKING = 1 << 1,
- PANGO_ATTR_AFFECTS_SHAPING = 1 << 2,
- PANGO_ATTR_AFFECTS_RENDERING = 1 << 3
-} PangoAttrAffects;
+ PANGO2_ATTR_AFFECTS_NONE = 0,
+ PANGO2_ATTR_AFFECTS_ITEMIZATION = 1 << 0,
+ PANGO2_ATTR_AFFECTS_BREAKING = 1 << 1,
+ PANGO2_ATTR_AFFECTS_SHAPING = 1 << 2,
+ PANGO2_ATTR_AFFECTS_RENDERING = 1 << 3
+} Pango2AttrAffects;
/**
- * PangoAttrMerge:
- * @PANGO_ATTR_MERGE_OVERRIDES: Only the attribute with the narrowest range is used
- * @PANGO_ATTR_MERGE_ACCUMULATES: All attributes with overlapping range are kept
+ * Pango2AttrMerge:
+ * @PANGO2_ATTR_MERGE_OVERRIDES: Only the attribute with the narrowest range is used
+ * @PANGO2_ATTR_MERGE_ACCUMULATES: All attributes with overlapping range are kept
*
- * A `PangoAttrMerge` value indicates how overlapping attribute values
+ * A `Pango2AttrMerge` value indicates how overlapping attribute values
* should be reconciled to determine the effective attribute value.
*
* These options influence the @extra_attrs returned by
- * [method@Pango.AttrIterator.get_font].
+ * [method@Pango2.AttrIterator.get_font].
*/
typedef enum
{
- PANGO_ATTR_MERGE_OVERRIDES,
- PANGO_ATTR_MERGE_ACCUMULATES
-} PangoAttrMerge;
+ PANGO2_ATTR_MERGE_OVERRIDES,
+ PANGO2_ATTR_MERGE_ACCUMULATES
+} Pango2AttrMerge;
/**
- * PANGO_ATTR_TYPE_VALUE_TYPE:
+ * PANGO2_ATTR_TYPE_VALUE_TYPE:
* @type: an attribute type
*
- * Extracts the `PangoAttrValueType` from an attribute type.
+ * Extracts the `Pango2AttrValueType` from an attribute type.
*/
-#define PANGO_ATTR_TYPE_VALUE_TYPE(type) ((PangoAttrValueType)((type) & 0xff))
+#define PANGO2_ATTR_TYPE_VALUE_TYPE(type) ((Pango2AttrValueType)((type) & 0xff))
/**
- * PANGO_ATTR_TYPE_AFFECTS:
+ * PANGO2_ATTR_TYPE_AFFECTS:
* @type: an attribute type
*
- * Extracts the `PangoAttrAffects` flags from an attribute type.
+ * Extracts the `Pango2AttrAffects` flags from an attribute type.
*/
-#define PANGO_ATTR_TYPE_AFFECTS(type) ((PangoAttrAffects)(((type) >> 8) & 0xf))
+#define PANGO2_ATTR_TYPE_AFFECTS(type) ((Pango2AttrAffects)(((type) >> 8) & 0xf))
/**
- * PANGO_ATTR_TYPE_MERGE:
+ * PANGO2_ATTR_TYPE_MERGE:
* @type: an attribute type
*
- * Extracts the `PangoAttrMerge` flags from an attribute type.
+ * Extracts the `Pango2AttrMerge` flags from an attribute type.
*/
-#define PANGO_ATTR_TYPE_MERGE(type) ((PangoAttrMerge)(((type) >> 12) & 0xf))
+#define PANGO2_ATTR_TYPE_MERGE(type) ((Pango2AttrMerge)(((type) >> 12) & 0xf))
/**
- * PANGO_ATTR_VALUE_TYPE:
- * @attr: a `PangoAttribute`
+ * PANGO2_ATTR_VALUE_TYPE:
+ * @attr: a `Pango2Attribute`
*
- * Obtains the `PangoAttrValueType of a `PangoAttribute`.
+ * Obtains the `Pango2AttrValueType of a `Pango2Attribute`.
*/
-#define PANGO_ATTR_VALUE_TYPE(attr) PANGO_ATTR_TYPE_VALUE_TYPE (pango_attribute_type (attr))
+#define PANGO2_ATTR_VALUE_TYPE(attr) PANGO2_ATTR_TYPE_VALUE_TYPE (pango2_attribute_type (attr))
/**
- * PANGO_ATTR_AFFECTS:
- * @attr: a `PangoAttribute`
+ * PANGO2_ATTR_AFFECTS:
+ * @attr: a `Pango2Attribute`
*
- * Obtains the `PangoAttrAffects` flags of a `PangoAttribute`.
+ * Obtains the `Pango2AttrAffects` flags of a `Pango2Attribute`.
*/
-#define PANGO_ATTR_AFFECTS(attr) PANGO_ATTR_TYPE_AFFECTS (pango_attribute_type (attr))
+#define PANGO2_ATTR_AFFECTS(attr) PANGO2_ATTR_TYPE_AFFECTS (pango2_attribute_type (attr))
/**
- * PANGO_ATTR_MERGE:
- * @attr: a `PangoAttribute`
+ * PANGO2_ATTR_MERGE:
+ * @attr: a `Pango2Attribute`
*
- * Obtains the `PangoAttrMerge` flags of a `PangoAttribute`.
+ * Obtains the `Pango2AttrMerge` flags of a `Pango2Attribute`.
*/
-#define PANGO_ATTR_MERGE(attr) PANGO_ATTR_TYPE_MERGE (pango_attribute_type (attr))
+#define PANGO2_ATTR_MERGE(attr) PANGO2_ATTR_TYPE_MERGE (pango2_attribute_type (attr))
/**
- * PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING:
+ * PANGO2_ATTR_INDEX_FROM_TEXT_BEGINNING:
*
- * Value for @start_index in `PangoAttribute` that indicates
+ * Value for @start_index in `Pango2Attribute` that indicates
* the beginning of the text.
*/
-#define PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING ((guint)0)
+#define PANGO2_ATTR_INDEX_FROM_TEXT_BEGINNING ((guint)0)
/**
- * PANGO_ATTR_INDEX_TO_TEXT_END: (value 4294967295)
+ * PANGO2_ATTR_INDEX_TO_TEXT_END: (value 4294967295)
*
- * Value for @end_index in `PangoAttribute` that indicates
+ * Value for @end_index in `Pango2Attribute` that indicates
* the end of the text.
*/
-#define PANGO_ATTR_INDEX_TO_TEXT_END ((guint)(G_MAXUINT + 0))
+#define PANGO2_ATTR_INDEX_TO_TEXT_END ((guint)(G_MAXUINT + 0))
/**
- * PangoAttrDataCopyFunc:
+ * Pango2AttrDataCopyFunc:
* @value: value to copy
*
* Callback to duplicate the value of an attribute.
*
* Return value: new copy of @value.
**/
-typedef gpointer (*PangoAttrDataCopyFunc) (gconstpointer value);
+typedef gpointer (*Pango2AttrDataCopyFunc) (gconstpointer value);
/**
- * PangoAttrDataSerializeFunc:
+ * Pango2AttrDataSerializeFunc:
* @value: value to serialize
*
* Callback to serialize the value of an attribute.
*
* Return value: a newly allocated string holding the serialization of @value
*/
-typedef char * (*PangoAttrDataSerializeFunc) (gconstpointer value);
-
-PANGO_AVAILABLE_IN_ALL
-GType pango_attribute_get_type (void) G_GNUC_CONST;
-
-PANGO_AVAILABLE_IN_ALL
-guint pango_attr_type_register (const char *name,
- PangoAttrValueType value_type,
- PangoAttrAffects affects,
- PangoAttrMerge merge,
- PangoAttrDataCopyFunc copy,
- GDestroyNotify destroy,
- GEqualFunc equal,
- PangoAttrDataSerializeFunc serialize);
-
-PANGO_AVAILABLE_IN_ALL
-const char * pango_attr_type_get_name (guint type) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attribute_copy (const PangoAttribute *attr);
-PANGO_AVAILABLE_IN_ALL
-void pango_attribute_destroy (PangoAttribute *attr);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_attribute_equal (const PangoAttribute *attr1,
- const PangoAttribute *attr2) G_GNUC_PURE;
-
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attribute_new (guint type,
- gconstpointer value);
-
-PANGO_AVAILABLE_IN_ALL
-guint pango_attribute_type (const PangoAttribute *attribute);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_attribute_set_range (PangoAttribute *attribute,
- guint start_index,
- guint end_index);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_attribute_get_range (PangoAttribute *attribute,
- guint *start_index,
- guint *end_index);
-
-PANGO_AVAILABLE_IN_ALL
-const char * pango_attribute_get_string (PangoAttribute *attribute);
-PANGO_AVAILABLE_IN_ALL
-PangoLanguage * pango_attribute_get_language (PangoAttribute *attribute);
-PANGO_AVAILABLE_IN_ALL
-int pango_attribute_get_int (PangoAttribute *attribute);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_attribute_get_boolean (PangoAttribute *attribute);
-PANGO_AVAILABLE_IN_ALL
-double pango_attribute_get_float (PangoAttribute *attribute);
-PANGO_AVAILABLE_IN_ALL
-PangoColor * pango_attribute_get_color (PangoAttribute *attribute);
-PANGO_AVAILABLE_IN_ALL
-PangoFontDescription * pango_attribute_get_font_desc (PangoAttribute *attribute);
-
-PANGO_AVAILABLE_IN_ALL
-gpointer pango_attribute_get_pointer (PangoAttribute *attribute);
-
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoAttribute, pango_attribute_destroy)
+typedef char * (*Pango2AttrDataSerializeFunc) (gconstpointer value);
+
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_attribute_get_type (void) G_GNUC_CONST;
+
+PANGO2_AVAILABLE_IN_ALL
+guint pango2_attr_type_register (const char *name,
+ Pango2AttrValueType value_type,
+ Pango2AttrAffects affects,
+ Pango2AttrMerge merge,
+ Pango2AttrDataCopyFunc copy,
+ GDestroyNotify destroy,
+ GEqualFunc equal,
+ Pango2AttrDataSerializeFunc serialize);
+
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_attr_type_get_name (guint type) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attribute_copy (const Pango2Attribute *attr);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attribute_destroy (Pango2Attribute *attr);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_attribute_equal (const Pango2Attribute *attr1,
+ const Pango2Attribute *attr2) G_GNUC_PURE;
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attribute_new (guint type,
+ gconstpointer value);
+
+PANGO2_AVAILABLE_IN_ALL
+guint pango2_attribute_type (const Pango2Attribute *attribute);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attribute_set_range (Pango2Attribute *attribute,
+ guint start_index,
+ guint end_index);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attribute_get_range (Pango2Attribute *attribute,
+ guint *start_index,
+ guint *end_index);
+
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_attribute_get_string (Pango2Attribute *attribute);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Language * pango2_attribute_get_language (Pango2Attribute *attribute);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_attribute_get_int (Pango2Attribute *attribute);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_attribute_get_boolean (Pango2Attribute *attribute);
+PANGO2_AVAILABLE_IN_ALL
+double pango2_attribute_get_float (Pango2Attribute *attribute);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Color * pango2_attribute_get_color (Pango2Attribute *attribute);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontDescription * pango2_attribute_get_font_desc (Pango2Attribute *attribute);
+
+PANGO2_AVAILABLE_IN_ALL
+gpointer pango2_attribute_get_pointer (Pango2Attribute *attribute);
+
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2Attribute, pango2_attribute_destroy)
G_END_DECLS
diff --git a/pango/pango-attributes-private.h b/pango/pango-attributes-private.h
index 181fe98d..ef1ab2c3 100644
--- a/pango/pango-attributes-private.h
+++ b/pango/pango-attributes-private.h
@@ -21,16 +21,16 @@
#include "pango-attributes.h"
-gboolean pango_attribute_affects_itemization (PangoAttribute *attr,
- gpointer data);
-gboolean pango_attribute_affects_break_or_shape (PangoAttribute *attr,
- gpointer data);
+gboolean pango2_attribute_affects_itemization (Pango2Attribute *attr,
+ gpointer data);
+gboolean pango2_attribute_affects_break_or_shape (Pango2Attribute *attr,
+ gpointer data);
typedef struct {
- PangoRectangle ink_rect;
- PangoRectangle logical_rect;
+ Pango2Rectangle ink_rect;
+ Pango2Rectangle logical_rect;
gpointer data;
- PangoAttrDataCopyFunc copy;
+ Pango2AttrDataCopyFunc copy;
GDestroyNotify destroy;
} ShapeData;
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index c1dc26d2..ea782a07 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-attributes.c: Attributed text
*
* Copyright (C) 2000-2002 Red Hat Software
@@ -28,113 +28,113 @@
/* {{{ Attribute value types */
-static inline PangoAttribute *
-pango_attr_init (PangoAttrType type)
+static inline Pango2Attribute *
+pango2_attr_init (Pango2AttrType type)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- attr = g_slice_new (PangoAttribute);
+ attr = g_slice_new (Pango2Attribute);
attr->type = type;
- attr->start_index = PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING;
- attr->end_index = PANGO_ATTR_INDEX_TO_TEXT_END;
+ attr->start_index = PANGO2_ATTR_INDEX_FROM_TEXT_BEGINNING;
+ attr->end_index = PANGO2_ATTR_INDEX_TO_TEXT_END;
return attr;
}
-static inline PangoAttribute *
-pango_attr_string_new (PangoAttrType type,
- const char *value)
+static inline Pango2Attribute *
+pango2_attr_string_new (Pango2AttrType type,
+ const char *value)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- g_return_val_if_fail (PANGO_ATTR_TYPE_VALUE_TYPE (type) == PANGO_ATTR_VALUE_STRING, NULL);
+ g_return_val_if_fail (PANGO2_ATTR_TYPE_VALUE_TYPE (type) == PANGO2_ATTR_VALUE_STRING, NULL);
- attr = pango_attr_init (type);
+ attr = pango2_attr_init (type);
attr->str_value = g_strdup (value);
return attr;
}
-static inline PangoAttribute *
-pango_attr_int_new (PangoAttrType type,
- int value)
+static inline Pango2Attribute *
+pango2_attr_int_new (Pango2AttrType type,
+ int value)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- g_return_val_if_fail (PANGO_ATTR_TYPE_VALUE_TYPE (type) == PANGO_ATTR_VALUE_INT, NULL);
+ g_return_val_if_fail (PANGO2_ATTR_TYPE_VALUE_TYPE (type) == PANGO2_ATTR_VALUE_INT, NULL);
- attr = pango_attr_init (type);
+ attr = pango2_attr_init (type);
attr->int_value = value;
return attr;
}
-static inline PangoAttribute *
-pango_attr_boolean_new (PangoAttrType type,
- gboolean value)
+static inline Pango2Attribute *
+pango2_attr_boolean_new (Pango2AttrType type,
+ gboolean value)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- g_return_val_if_fail (PANGO_ATTR_TYPE_VALUE_TYPE (type) == PANGO_ATTR_VALUE_BOOLEAN, NULL);
+ g_return_val_if_fail (PANGO2_ATTR_TYPE_VALUE_TYPE (type) == PANGO2_ATTR_VALUE_BOOLEAN, NULL);
- attr = pango_attr_init (type);
+ attr = pango2_attr_init (type);
attr->boolean_value = value;
return attr;
}
-static inline PangoAttribute *
-pango_attr_float_new (PangoAttrType type,
- double value)
+static inline Pango2Attribute *
+pango2_attr_float_new (Pango2AttrType type,
+ double value)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- g_return_val_if_fail (PANGO_ATTR_TYPE_VALUE_TYPE (type) == PANGO_ATTR_VALUE_FLOAT, NULL);
+ g_return_val_if_fail (PANGO2_ATTR_TYPE_VALUE_TYPE (type) == PANGO2_ATTR_VALUE_FLOAT, NULL);
- attr = pango_attr_init (type);
+ attr = pango2_attr_init (type);
attr->double_value = value;
return attr;
}
-static inline PangoAttribute *
-pango_attr_color_new (PangoAttrType type,
- PangoColor *color)
+static inline Pango2Attribute *
+pango2_attr_color_new (Pango2AttrType type,
+ Pango2Color *color)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- g_return_val_if_fail (PANGO_ATTR_TYPE_VALUE_TYPE (type) == PANGO_ATTR_VALUE_COLOR, NULL);
+ g_return_val_if_fail (PANGO2_ATTR_TYPE_VALUE_TYPE (type) == PANGO2_ATTR_VALUE_COLOR, NULL);
- attr = pango_attr_init (type);
+ attr = pango2_attr_init (type);
attr->color_value = *color;
return attr;
}
-static inline PangoAttribute *
-pango_attr_lang_new (PangoAttrType type,
- PangoLanguage *value)
+static inline Pango2Attribute *
+pango2_attr_lang_new (Pango2AttrType type,
+ Pango2Language *value)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- g_return_val_if_fail (PANGO_ATTR_TYPE_VALUE_TYPE (type) == PANGO_ATTR_VALUE_LANGUAGE, NULL);
+ g_return_val_if_fail (PANGO2_ATTR_TYPE_VALUE_TYPE (type) == PANGO2_ATTR_VALUE_LANGUAGE, NULL);
- attr = pango_attr_init (type);
+ attr = pango2_attr_init (type);
attr->lang_value = value;
return attr;
}
-static inline PangoAttribute *
-pango_attr_font_description_new (PangoAttrType type,
- const PangoFontDescription *value)
+static inline Pango2Attribute *
+pango2_attr_font_description_new (Pango2AttrType type,
+ const Pango2FontDescription *value)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- g_return_val_if_fail (PANGO_ATTR_TYPE_VALUE_TYPE (type) == PANGO_ATTR_VALUE_FONT_DESC, NULL);
+ g_return_val_if_fail (PANGO2_ATTR_TYPE_VALUE_TYPE (type) == PANGO2_ATTR_VALUE_FONT_DESC, NULL);
- attr = pango_attr_init (type);
- attr->font_value = pango_font_description_copy (value);
+ attr = pango2_attr_init (type);
+ attr->font_value = pango2_font_description_copy (value);
return attr;
}
@@ -143,167 +143,167 @@ pango_attr_font_description_new (PangoAttrType type,
/* {{{ Attribute types */
/**
- * pango_attr_family_new:
+ * pango2_attr_family_new:
* @family: the family or comma-separated list of families
*
* Create a new font family attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_family_new (const char *family)
+Pango2Attribute *
+pango2_attr_family_new (const char *family)
{
- return pango_attr_string_new (PANGO_ATTR_FAMILY, family);
+ return pango2_attr_string_new (PANGO2_ATTR_FAMILY, family);
}
/**
- * pango_attr_language_new:
+ * pango2_attr_language_new:
* @language: language tag
*
* Create a new language tag attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_language_new (PangoLanguage *language)
+Pango2Attribute *
+pango2_attr_language_new (Pango2Language *language)
{
- return pango_attr_lang_new (PANGO_ATTR_LANGUAGE, language);
+ return pango2_attr_lang_new (PANGO2_ATTR_LANGUAGE, language);
}
/**
- * pango_attr_foreground_new:
+ * pango2_attr_foreground_new:
* @color: the color
*
* Create a new foreground color attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_foreground_new (PangoColor *color)
+Pango2Attribute *
+pango2_attr_foreground_new (Pango2Color *color)
{
- return pango_attr_color_new (PANGO_ATTR_FOREGROUND, color);
+ return pango2_attr_color_new (PANGO2_ATTR_FOREGROUND, color);
}
/**
- * pango_attr_background_new:
+ * pango2_attr_background_new:
* @color: the color
*
* Create a new background color attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_background_new (PangoColor *color)
+Pango2Attribute *
+pango2_attr_background_new (Pango2Color *color)
{
- return pango_attr_color_new (PANGO_ATTR_BACKGROUND, color);
+ return pango2_attr_color_new (PANGO2_ATTR_BACKGROUND, color);
}
/**
- * pango_attr_size_new:
- * @size: the font size, in %PANGO_SCALE-ths of a point
+ * pango2_attr_size_new:
+ * @size: the font size, in %PANGO2_SCALE-ths of a point
*
* Create a new font-size attribute in fractional points.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_size_new (int value)
+Pango2Attribute *
+pango2_attr_size_new (int value)
{
- return pango_attr_int_new (PANGO_ATTR_SIZE, value);
+ return pango2_attr_int_new (PANGO2_ATTR_SIZE, value);
}
/**
- * pango_attr_size_new_absolute:
- * @size: the font size, in %PANGO_SCALE-ths of a device unit
+ * pango2_attr_size_new_absolute:
+ * @size: the font size, in %PANGO2_SCALE-ths of a device unit
*
* Create a new font-size attribute in device units.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_size_new_absolute (int size)
+Pango2Attribute *
+pango2_attr_size_new_absolute (int size)
{
- return pango_attr_int_new (PANGO_ATTR_ABSOLUTE_SIZE, size);
+ return pango2_attr_int_new (PANGO2_ATTR_ABSOLUTE_SIZE, size);
}
/**
- * pango_attr_style_new:
+ * pango2_attr_style_new:
* @style: the slant style
*
* Create a new font slant style attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_style_new (PangoStyle style)
+Pango2Attribute *
+pango2_attr_style_new (Pango2Style style)
{
- return pango_attr_int_new (PANGO_ATTR_STYLE, (int)style);
+ return pango2_attr_int_new (PANGO2_ATTR_STYLE, (int)style);
}
/**
- * pango_attr_weight_new:
+ * pango2_attr_weight_new:
* @weight: the weight
*
* Create a new font weight attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_weight_new (PangoWeight weight)
+Pango2Attribute *
+pango2_attr_weight_new (Pango2Weight weight)
{
- return pango_attr_int_new (PANGO_ATTR_WEIGHT, (int)weight);
+ return pango2_attr_int_new (PANGO2_ATTR_WEIGHT, (int)weight);
}
/**
- * pango_attr_variant_new:
+ * pango2_attr_variant_new:
* @variant: the variant
*
* Create a new font variant attribute (normal or small caps).
*
- * Return value: (transfer full): the newly allocated `PangoAttribute`,
- * which should be freed with [method@Pango.Attribute.destroy].
+ * Return value: (transfer full): the newly allocated `Pango2Attribute`,
+ * which should be freed with [method@Pango2.Attribute.destroy].
*/
-PangoAttribute *
-pango_attr_variant_new (PangoVariant variant)
+Pango2Attribute *
+pango2_attr_variant_new (Pango2Variant variant)
{
- return pango_attr_int_new (PANGO_ATTR_VARIANT, (int)variant);
+ return pango2_attr_int_new (PANGO2_ATTR_VARIANT, (int)variant);
}
/**
- * pango_attr_stretch_new:
+ * pango2_attr_stretch_new:
* @stretch: the stretch
*
* Create a new font stretch attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_stretch_new (PangoStretch stretch)
+Pango2Attribute *
+pango2_attr_stretch_new (Pango2Stretch stretch)
{
- return pango_attr_int_new (PANGO_ATTR_STRETCH, (int)stretch);
+ return pango2_attr_int_new (PANGO2_ATTR_STRETCH, (int)stretch);
}
/**
- * pango_attr_font_desc_new:
+ * pango2_attr_font_desc_new:
* @desc: the font description
*
* Create a new font description attribute.
@@ -312,33 +312,33 @@ pango_attr_stretch_new (PangoStretch stretch)
* stretch, and size simultaneously.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_font_desc_new (const PangoFontDescription *desc)
+Pango2Attribute *
+pango2_attr_font_desc_new (const Pango2FontDescription *desc)
{
- return pango_attr_font_description_new (PANGO_ATTR_FONT_DESC, desc);
+ return pango2_attr_font_description_new (PANGO2_ATTR_FONT_DESC, desc);
}
/**
- * pango_attr_underline_new:
+ * pango2_attr_underline_new:
* @style: the line style
*
* Create a new underline attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_underline_new (PangoLineStyle style)
+Pango2Attribute *
+pango2_attr_underline_new (Pango2LineStyle style)
{
- return pango_attr_int_new (PANGO_ATTR_UNDERLINE, (int)style);
+ return pango2_attr_int_new (PANGO2_ATTR_UNDERLINE, (int)style);
}
/**
- * pango_attr_underline_color_new:
+ * pango2_attr_underline_color_new:
* @color: the color
*
* Create a new underline color attribute.
@@ -347,48 +347,48 @@ pango_attr_underline_new (PangoLineStyle style)
* If not set, underlines will use the foreground color.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_underline_color_new (PangoColor *color)
+Pango2Attribute *
+pango2_attr_underline_color_new (Pango2Color *color)
{
- return pango_attr_color_new (PANGO_ATTR_UNDERLINE_COLOR, color);
+ return pango2_attr_color_new (PANGO2_ATTR_UNDERLINE_COLOR, color);
}
/**
- * pango_attr_underline_position_new:
+ * pango2_attr_underline_position_new:
* @position: the underline position
*
* Create a new underline position attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_underline_position_new (PangoUnderlinePosition position)
+Pango2Attribute *
+pango2_attr_underline_position_new (Pango2UnderlinePosition position)
{
- return pango_attr_int_new (PANGO_ATTR_UNDERLINE_POSITION, (int)position);
+ return pango2_attr_int_new (PANGO2_ATTR_UNDERLINE_POSITION, (int)position);
}
/**
- * pango_attr_strikethrough_new:
+ * pango2_attr_strikethrough_new:
* @style: the line style
*
* Create a new strike-through attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_strikethrough_new (PangoLineStyle style)
+Pango2Attribute *
+pango2_attr_strikethrough_new (Pango2LineStyle style)
{
- return pango_attr_int_new (PANGO_ATTR_STRIKETHROUGH, (int)style);
+ return pango2_attr_int_new (PANGO2_ATTR_STRIKETHROUGH, (int)style);
}
/**
- * pango_attr_strikethrough_color_new:
+ * pango2_attr_strikethrough_color_new:
* @color: the color
*
* Create a new strikethrough color attribute.
@@ -397,36 +397,36 @@ pango_attr_strikethrough_new (PangoLineStyle style)
* If not set, strikethrough lines will use the foreground color.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_strikethrough_color_new (PangoColor *color)
+Pango2Attribute *
+pango2_attr_strikethrough_color_new (Pango2Color *color)
{
- return pango_attr_color_new (PANGO_ATTR_STRIKETHROUGH_COLOR, color);
+ return pango2_attr_color_new (PANGO2_ATTR_STRIKETHROUGH_COLOR, color);
}
/**
- * pango_attr_rise_new:
+ * pango2_attr_rise_new:
* @rise: the amount that the text should be displaced vertically,
- * in Pango units. Positive values displace the text upwards.
+ * in Pango2 units. Positive values displace the text upwards.
*
* Create a new baseline displacement attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_rise_new (int rise)
+Pango2Attribute *
+pango2_attr_rise_new (int rise)
{
- return pango_attr_int_new (PANGO_ATTR_RISE, (int)rise);
+ return pango2_attr_int_new (PANGO2_ATTR_RISE, (int)rise);
}
/**
- * pango_attr_baseline_shift_new:
- * @shift: either a `PangoBaselineShift` enumeration value or an absolute value (> 1024)
- * in Pango units, relative to the baseline of the previous run.
+ * pango2_attr_baseline_shift_new:
+ * @shift: either a `Pango2BaselineShift` enumeration value or an absolute value (> 1024)
+ * in Pango2 units, relative to the baseline of the previous run.
* Positive values displace the text upwards.
*
* Create a new baseline displacement attribute.
@@ -440,18 +440,18 @@ pango_attr_rise_new (int rise)
* </picture>
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_baseline_shift_new (int rise)
+Pango2Attribute *
+pango2_attr_baseline_shift_new (int rise)
{
- return pango_attr_int_new (PANGO_ATTR_BASELINE_SHIFT, (int)rise);
+ return pango2_attr_int_new (PANGO2_ATTR_BASELINE_SHIFT, (int)rise);
}
/**
- * pango_attr_font_scale_new:
- * @scale: a `PangoFontScale` value, which indicates font size change relative
+ * pango2_attr_font_scale_new:
+ * @scale: a `Pango2FontScale` value, which indicates font size change relative
* to the size of the previous run.
*
* Create a new font scale attribute.
@@ -460,17 +460,17 @@ pango_attr_baseline_shift_new (int rise)
* relative to the size of preceding run.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_font_scale_new (PangoFontScale scale)
+Pango2Attribute *
+pango2_attr_font_scale_new (Pango2FontScale scale)
{
- return pango_attr_int_new (PANGO_ATTR_FONT_SCALE, (int)scale);
+ return pango2_attr_int_new (PANGO2_ATTR_FONT_SCALE, (int)scale);
}
/**
- * pango_attr_scale_new:
+ * pango2_attr_scale_new:
* @scale_factor: factor to scale the font
*
* Create a new font size scale attribute.
@@ -479,17 +479,17 @@ pango_attr_font_scale_new (PangoFontScale scale)
* its size multiplied by @scale_factor.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute*
-pango_attr_scale_new (double scale_factor)
+Pango2Attribute*
+pango2_attr_scale_new (double scale_factor)
{
- return pango_attr_float_new (PANGO_ATTR_SCALE, scale_factor);
+ return pango2_attr_float_new (PANGO2_ATTR_SCALE, scale_factor);
}
/**
- * pango_attr_fallback_new:
+ * pango2_attr_fallback_new:
* @enable_fallback: %TRUE if we should fall back on other fonts
* for characters the active font is missing
*
@@ -501,68 +501,68 @@ pango_attr_scale_new (double scale_factor)
* that might contain the characters in the text.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_fallback_new (gboolean enable_fallback)
+Pango2Attribute *
+pango2_attr_fallback_new (gboolean enable_fallback)
{
- return pango_attr_boolean_new (PANGO_ATTR_FALLBACK, enable_fallback);
+ return pango2_attr_boolean_new (PANGO2_ATTR_FALLBACK, enable_fallback);
}
/**
- * pango_attr_letter_spacing_new:
+ * pango2_attr_letter_spacing_new:
* @letter_spacing: amount of extra space to add between
- * graphemes of the text, in Pango units
+ * graphemes of the text, in Pango2 units
*
* Create a new letter-spacing attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_letter_spacing_new (int letter_spacing)
+Pango2Attribute *
+pango2_attr_letter_spacing_new (int letter_spacing)
{
- return pango_attr_int_new (PANGO_ATTR_LETTER_SPACING, letter_spacing);
+ return pango2_attr_int_new (PANGO2_ATTR_LETTER_SPACING, letter_spacing);
}
/**
- * pango_attr_gravity_new:
- * @gravity: the gravity value; should not be %PANGO_GRAVITY_AUTO
+ * pango2_attr_gravity_new:
+ * @gravity: the gravity value; should not be %PANGO2_GRAVITY_AUTO
*
* Create a new gravity attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_gravity_new (PangoGravity gravity)
+Pango2Attribute *
+pango2_attr_gravity_new (Pango2Gravity gravity)
{
- g_return_val_if_fail (gravity != PANGO_GRAVITY_AUTO, NULL);
+ g_return_val_if_fail (gravity != PANGO2_GRAVITY_AUTO, NULL);
- return pango_attr_int_new (PANGO_ATTR_GRAVITY, (int)gravity);
+ return pango2_attr_int_new (PANGO2_ATTR_GRAVITY, (int)gravity);
}
/**
- * pango_attr_gravity_hint_new:
+ * pango2_attr_gravity_hint_new:
* @hint: the gravity hint value
*
* Create a new gravity hint attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_gravity_hint_new (PangoGravityHint hint)
+Pango2Attribute *
+pango2_attr_gravity_hint_new (Pango2GravityHint hint)
{
- return pango_attr_int_new (PANGO_ATTR_GRAVITY_HINT, (int)hint);
+ return pango2_attr_int_new (PANGO2_ATTR_GRAVITY_HINT, (int)hint);
}
/**
- * pango_attr_font_features_new:
+ * pango2_attr_font_features_new:
* @features: a string with OpenType font features, with the syntax of the [CSS
* font-feature-settings property](https://www.w3.org/TR/css-fonts-4/#font-rend-desc)
*
@@ -572,19 +572,19 @@ pango_attr_gravity_hint_new (PangoGravityHint hint)
* alternative glyphs, ligatures, etc. for fonts that support them.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_font_features_new (const char *features)
+Pango2Attribute *
+pango2_attr_font_features_new (const char *features)
{
g_return_val_if_fail (features != NULL, NULL);
- return pango_attr_string_new (PANGO_ATTR_FONT_FEATURES, features);
+ return pango2_attr_string_new (PANGO2_ATTR_FONT_FEATURES, features);
}
/**
- * pango_attr_allow_breaks_new:
+ * pango2_attr_allow_breaks_new:
* @allow_breaks: %TRUE if we line breaks are allowed
*
* Create a new allow-breaks attribute.
@@ -593,54 +593,54 @@ pango_attr_font_features_new (const char *features)
* single run, as far as possible.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_allow_breaks_new (gboolean allow_breaks)
+Pango2Attribute *
+pango2_attr_allow_breaks_new (gboolean allow_breaks)
{
- return pango_attr_boolean_new (PANGO_ATTR_ALLOW_BREAKS, allow_breaks);
+ return pango2_attr_boolean_new (PANGO2_ATTR_ALLOW_BREAKS, allow_breaks);
}
/**
- * pango_attr_insert_hyphens_new:
+ * pango2_attr_insert_hyphens_new:
* @insert_hyphens: %TRUE if hyphens should be inserted
*
* Create a new insert-hyphens attribute.
*
- * Pango will insert hyphens when breaking lines in
+ * Pango2 will insert hyphens when breaking lines in
* the middle of a word. This attribute can be used
* to suppress the hyphen.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_insert_hyphens_new (gboolean insert_hyphens)
+Pango2Attribute *
+pango2_attr_insert_hyphens_new (gboolean insert_hyphens)
{
- return pango_attr_boolean_new (PANGO_ATTR_INSERT_HYPHENS, insert_hyphens);
+ return pango2_attr_boolean_new (PANGO2_ATTR_INSERT_HYPHENS, insert_hyphens);
}
/**
- * pango_attr_show_new:
- * @flags: `PangoShowFlags` to apply
+ * pango2_attr_show_new:
+ * @flags: `Pango2ShowFlags` to apply
*
* Create a new attribute that influences how invisible
* characters are rendered.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
**/
-PangoAttribute *
-pango_attr_show_new (PangoShowFlags flags)
+Pango2Attribute *
+pango2_attr_show_new (Pango2ShowFlags flags)
{
- return pango_attr_int_new (PANGO_ATTR_SHOW, (int)flags);
+ return pango2_attr_int_new (PANGO2_ATTR_SHOW, (int)flags);
}
/**
- * pango_attr_word_new:
+ * pango2_attr_word_new:
*
* Create a new attribute that marks its range
* as a single word.
@@ -649,17 +649,17 @@ pango_attr_show_new (PangoShowFlags flags)
* sentence classification around the range.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_word_new (void)
+Pango2Attribute *
+pango2_attr_word_new (void)
{
- return pango_attr_boolean_new (PANGO_ATTR_WORD, TRUE);
+ return pango2_attr_boolean_new (PANGO2_ATTR_WORD, TRUE);
}
/**
- * pango_attr_sentence_new:
+ * pango2_attr_sentence_new:
*
* Create a new attribute that marks its range
* as a single sentence.
@@ -668,17 +668,17 @@ pango_attr_word_new (void)
* sentence classification around the range.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_sentence_new (void)
+Pango2Attribute *
+pango2_attr_sentence_new (void)
{
- return pango_attr_boolean_new (PANGO_ATTR_SENTENCE, TRUE);
+ return pango2_attr_boolean_new (PANGO2_ATTR_SENTENCE, TRUE);
}
/**
- * pango_attr_paragraph_new:
+ * pango2_attr_paragraph_new:
*
* Create a new attribute that marks its range as a single paragraph.
*
@@ -686,33 +686,33 @@ pango_attr_sentence_new (void)
* will not be treated as paragraph separators.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_paragraph_new (void)
+Pango2Attribute *
+pango2_attr_paragraph_new (void)
{
- return pango_attr_boolean_new (PANGO_ATTR_SENTENCE, TRUE);
+ return pango2_attr_boolean_new (PANGO2_ATTR_SENTENCE, TRUE);
}
/**
- * pango_attr_overline_new:
+ * pango2_attr_overline_new:
* @style: the line style
*
* Create a new overline-style attribute.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_overline_new (PangoLineStyle style)
+Pango2Attribute *
+pango2_attr_overline_new (Pango2LineStyle style)
{
- return pango_attr_int_new (PANGO_ATTR_OVERLINE, (int)style);
+ return pango2_attr_int_new (PANGO2_ATTR_OVERLINE, (int)style);
}
/**
- * pango_attr_overline_color_new:
+ * pango2_attr_overline_color_new:
* @color: the color
*
* Create a new overline color attribute.
@@ -721,86 +721,86 @@ pango_attr_overline_new (PangoLineStyle style)
* If not set, overlines will use the foreground color.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_overline_color_new (PangoColor *color)
+Pango2Attribute *
+pango2_attr_overline_color_new (Pango2Color *color)
{
- return pango_attr_color_new (PANGO_ATTR_OVERLINE_COLOR, color);
+ return pango2_attr_color_new (PANGO2_ATTR_OVERLINE_COLOR, color);
}
/**
- * pango_attr_line_height_new:
+ * pango2_attr_line_height_new:
* @factor: the scaling factor to apply to the logical height
*
* Create a new attribute that modifies the height
* of logical line extents by a factor.
*
* This affects the values returned by
- * [method@Pango.Line.get_extents] and
- * [method@Pango.LineIter.get_line_extents].
+ * [method@Pango2.Line.get_extents] and
+ * [method@Pango2.LineIter.get_line_extents].
*/
-PangoAttribute *
-pango_attr_line_height_new (double factor)
+Pango2Attribute *
+pango2_attr_line_height_new (double factor)
{
- return pango_attr_float_new (PANGO_ATTR_LINE_HEIGHT, factor);
+ return pango2_attr_float_new (PANGO2_ATTR_LINE_HEIGHT, factor);
}
/**
- * pango_attr_line_height_new_absolute:
- * @height: the line height, in %PANGO_SCALE-ths of a point
+ * pango2_attr_line_height_new_absolute:
+ * @height: the line height, in %PANGO2_SCALE-ths of a point
*
* Create a new attribute that overrides the height
* of logical line extents to be @height.
*
* This affects the values returned by
- * [method@Pango.Line.get_extents],
- * [method@Pango.LineIter.get_line_extents].
+ * [method@Pango2.Line.get_extents],
+ * [method@Pango2.LineIter.get_line_extents].
*/
-PangoAttribute *
-pango_attr_line_height_new_absolute (int height)
+Pango2Attribute *
+pango2_attr_line_height_new_absolute (int height)
{
- return pango_attr_int_new (PANGO_ATTR_ABSOLUTE_LINE_HEIGHT, height);
+ return pango2_attr_int_new (PANGO2_ATTR_ABSOLUTE_LINE_HEIGHT, height);
}
/**
- * pango_attr_line_spacing_new:
- * @spacing: the line spacing, in %PANGO_SCALE-ths of a point
+ * pango2_attr_line_spacing_new:
+ * @spacing: the line spacing, in %PANGO2_SCALE-ths of a point
*
* Create a new attribute that adds space to the
* leading from font metrics, if not overridden
* by line spacing attributes.
*
* This affects the values returned by
- * [method@Pango.Line.get_extents],
- * [method@Pango.LineIter.get_line_extents].
+ * [method@Pango2.Line.get_extents],
+ * [method@Pango2.LineIter.get_line_extents].
*/
-PangoAttribute *
-pango_attr_line_spacing_new (int spacing)
+Pango2Attribute *
+pango2_attr_line_spacing_new (int spacing)
{
- return pango_attr_int_new (PANGO_ATTR_LINE_SPACING, spacing);
+ return pango2_attr_int_new (PANGO2_ATTR_LINE_SPACING, spacing);
}
/**
- * pango_attr_text_transform_new:
- * @transform: `PangoTextTransform` to apply
+ * pango2_attr_text_transform_new:
+ * @transform: `Pango2TextTransform` to apply
*
* Create a new attribute that influences how characters
* are transformed during shaping.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_text_transform_new (PangoTextTransform transform)
+Pango2Attribute *
+pango2_attr_text_transform_new (Pango2TextTransform transform)
{
- return pango_attr_int_new (PANGO_ATTR_TEXT_TRANSFORM, transform);
+ return pango2_attr_int_new (PANGO2_ATTR_TEXT_TRANSFORM, transform);
}
/**
- * pango_attr_shape_new:
+ * pango2_attr_shape_new:
* @ink_rect: ink rectangle to use for each character
* @logical_rect: logical rectangle to use for each character
* @data: user data
@@ -812,22 +812,22 @@ pango_attr_text_transform_new (PangoTextTransform transform)
* Creates a new shape attribute.
*
* Shape attributes override the extents for a glyph and can
- * trigger custom rendering in a `PangoRenderer`. This might
+ * trigger custom rendering in a `Pango2Renderer`. This might
* be used, for instance, for embedding a picture or a widget
- * inside a `PangoLayout`.
+ * inside a `Pango2Layout`.
*
* Return value: (transfer full): the newly allocated
- * `PangoAttribute`, which should be freed with
- * [method@Pango.Attribute.destroy]
+ * `Pango2Attribute`, which should be freed with
+ * [method@Pango2.Attribute.destroy]
*/
-PangoAttribute *
-pango_attr_shape_new (PangoRectangle *ink_rect,
- PangoRectangle *logical_rect,
- gpointer data,
- PangoAttrDataCopyFunc copy,
- GDestroyNotify destroy)
+Pango2Attribute *
+pango2_attr_shape_new (Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect,
+ gpointer data,
+ Pango2AttrDataCopyFunc copy,
+ GDestroyNotify destroy)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
ShapeData *shape_data;
shape_data = g_new0 (ShapeData, 1);
@@ -837,7 +837,7 @@ pango_attr_shape_new (PangoRectangle *ink_rect,
shape_data->copy = copy;
shape_data->destroy = destroy;
- attr = pango_attr_init (PANGO_ATTR_SHAPE);
+ attr = pango2_attr_init (PANGO2_ATTR_SHAPE);
attr->pointer_value = shape_data;
return attr;
@@ -847,18 +847,18 @@ pango_attr_shape_new (PangoRectangle *ink_rect,
/* {{{ Private API */
gboolean
-pango_attribute_affects_itemization (PangoAttribute *attr,
- gpointer data)
+pango2_attribute_affects_itemization (Pango2Attribute *attr,
+ gpointer data)
{
- return (PANGO_ATTR_AFFECTS (attr) & PANGO_ATTR_AFFECTS_ITEMIZATION) != 0;
+ return (PANGO2_ATTR_AFFECTS (attr) & PANGO2_ATTR_AFFECTS_ITEMIZATION) != 0;
}
gboolean
-pango_attribute_affects_break_or_shape (PangoAttribute *attr,
- gpointer data)
+pango2_attribute_affects_break_or_shape (Pango2Attribute *attr,
+ gpointer data)
{
- return (PANGO_ATTR_AFFECTS (attr) & (PANGO_ATTR_AFFECTS_BREAKING |
- PANGO_ATTR_AFFECTS_SHAPING)) != 0;
+ return (PANGO2_ATTR_AFFECTS (attr) & (PANGO2_ATTR_AFFECTS_BREAKING |
+ PANGO2_ATTR_AFFECTS_SHAPING)) != 0;
}
/* }}} */
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index e97db134..744e1b36 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -27,53 +27,53 @@ G_BEGIN_DECLS
#ifndef __GI_SCANNER__
-#define PANGO_ATTR_TYPE(value, affects, merge) (PANGO_ATTR_VALUE_##value | (PANGO_ATTR_AFFECTS_##affects << 8) | (PANGO_ATTR_MERGE_##merge << 12) | (__COUNTER__ << 16))
+#define PANGO2_ATTR_TYPE(value, affects, merge) (PANGO2_ATTR_VALUE_##value | (PANGO2_ATTR_AFFECTS_##affects << 8) | (PANGO2_ATTR_MERGE_##merge << 12) | (__COUNTER__ << 16))
#endif
/**
- * PangoAttrType:
- * @PANGO_ATTR_INVALID: does not happen
- * @PANGO_ATTR_LANGUAGE: language
- * @PANGO_ATTR_FAMILY: font family name
- * @PANGO_ATTR_STYLE: font style
- * @PANGO_ATTR_WEIGHT: font weight
- * @PANGO_ATTR_VARIANT: font variant
- * @PANGO_ATTR_STRETCH: font stretch
- * @PANGO_ATTR_SIZE: font size in points scaled by `PANGO_SCALE`
- * @PANGO_ATTR_FONT_DESC: font description
- * @PANGO_ATTR_FOREGROUND: foreground color
- * @PANGO_ATTR_BACKGROUND: background color
- * @PANGO_ATTR_UNDERLINE: underline style
- * @PANGO_ATTR_UNDERLINE_POSITION: underline position
- * @PANGO_ATTR_STRIKETHROUGH: whether the text is struck-through
- * @PANGO_ATTR_RISE: baseline displacement
- * @PANGO_ATTR_SCALE: font size scale factor
- * @PANGO_ATTR_FALLBACK: whether font fallback is enabled
- * @PANGO_ATTR_LETTER_SPACING: letter spacing in Pango units
- * @PANGO_ATTR_UNDERLINE_COLOR: underline color
- * @PANGO_ATTR_STRIKETHROUGH_COLOR: strikethrough color
- * @PANGO_ATTR_ABSOLUTE_SIZE: font size in pixels scaled by `PANGO_SCALE`
- * @PANGO_ATTR_GRAVITY: base text gravity
- * @PANGO_ATTR_GRAVITY_HINT: gravity hint
- * @PANGO_ATTR_FONT_FEATURES: OpenType font features
- * @PANGO_ATTR_ALLOW_BREAKS: whether line breaks are allowed
- * @PANGO_ATTR_SHOW: how to render invisible characters
- * @PANGO_ATTR_INSERT_HYPHENS: whether to insert hyphens at intra-word line breaks
- * @PANGO_ATTR_OVERLINE: whether the text has an overline
- * @PANGO_ATTR_OVERLINE_COLOR: overline color
- * @PANGO_ATTR_LINE_HEIGHT: line height factor
- * @PANGO_ATTR_ABSOLUTE_LINE_HEIGHT: line height in Pango units
- * @PANGO_ATTR_WORD: mark the range of the attribute as a single word
- * @PANGO_ATTR_SENTENCE: mark the range of the attribute as a single sentence
- * @PANGO_ATTR_PARAGRAPH: mark the range of the attribute as a single paragraph
- * @PANGO_ATTR_BASELINE_SHIFT: baseline displacement
- * @PANGO_ATTR_FONT_SCALE: font-relative size change
- * @PANGO_ATTR_LINE_SPACING: space to add to the leading from the
+ * Pango2AttrType:
+ * @PANGO2_ATTR_INVALID: does not happen
+ * @PANGO2_ATTR_LANGUAGE: language
+ * @PANGO2_ATTR_FAMILY: font family name
+ * @PANGO2_ATTR_STYLE: font style
+ * @PANGO2_ATTR_WEIGHT: font weight
+ * @PANGO2_ATTR_VARIANT: font variant
+ * @PANGO2_ATTR_STRETCH: font stretch
+ * @PANGO2_ATTR_SIZE: font size in points scaled by `PANGO2_SCALE`
+ * @PANGO2_ATTR_FONT_DESC: font description
+ * @PANGO2_ATTR_FOREGROUND: foreground color
+ * @PANGO2_ATTR_BACKGROUND: background color
+ * @PANGO2_ATTR_UNDERLINE: underline style
+ * @PANGO2_ATTR_UNDERLINE_POSITION: underline position
+ * @PANGO2_ATTR_STRIKETHROUGH: whether the text is struck-through
+ * @PANGO2_ATTR_RISE: baseline displacement
+ * @PANGO2_ATTR_SCALE: font size scale factor
+ * @PANGO2_ATTR_FALLBACK: whether font fallback is enabled
+ * @PANGO2_ATTR_LETTER_SPACING: letter spacing in Pango2 units
+ * @PANGO2_ATTR_UNDERLINE_COLOR: underline color
+ * @PANGO2_ATTR_STRIKETHROUGH_COLOR: strikethrough color
+ * @PANGO2_ATTR_ABSOLUTE_SIZE: font size in pixels scaled by `PANGO2_SCALE`
+ * @PANGO2_ATTR_GRAVITY: base text gravity
+ * @PANGO2_ATTR_GRAVITY_HINT: gravity hint
+ * @PANGO2_ATTR_FONT_FEATURES: OpenType font features
+ * @PANGO2_ATTR_ALLOW_BREAKS: whether line breaks are allowed
+ * @PANGO2_ATTR_SHOW: how to render invisible characters
+ * @PANGO2_ATTR_INSERT_HYPHENS: whether to insert hyphens at intra-word line breaks
+ * @PANGO2_ATTR_OVERLINE: whether the text has an overline
+ * @PANGO2_ATTR_OVERLINE_COLOR: overline color
+ * @PANGO2_ATTR_LINE_HEIGHT: line height factor
+ * @PANGO2_ATTR_ABSOLUTE_LINE_HEIGHT: line height in Pango2 units
+ * @PANGO2_ATTR_WORD: mark the range of the attribute as a single word
+ * @PANGO2_ATTR_SENTENCE: mark the range of the attribute as a single sentence
+ * @PANGO2_ATTR_PARAGRAPH: mark the range of the attribute as a single paragraph
+ * @PANGO2_ATTR_BASELINE_SHIFT: baseline displacement
+ * @PANGO2_ATTR_FONT_SCALE: font-relative size change
+ * @PANGO2_ATTR_LINE_SPACING: space to add to the leading from the
* font metrics (if not overridden by a line height attribute)
- * @PANGO_ATTR_SHAPE: override glyph shapes (requires renderer support)
+ * @PANGO2_ATTR_SHAPE: override glyph shapes (requires renderer support)
*
- * `PangoAttrType` contains predefined attribute types.
+ * `Pango2AttrType` contains predefined attribute types.
*
* Along with the predefined values, it is possible to allocate additional
* values for custom attributes using [func@AttrType.register]. The predefined
@@ -81,238 +81,238 @@ G_BEGIN_DECLS
*/
typedef enum
{
- PANGO_ATTR_INVALID,
- PANGO_ATTR_LANGUAGE = PANGO_ATTR_TYPE (LANGUAGE, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_FAMILY = PANGO_ATTR_TYPE (STRING, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_STYLE = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_WEIGHT = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_VARIANT = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_STRETCH = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_SIZE = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_FONT_DESC = PANGO_ATTR_TYPE (FONT_DESC, ITEMIZATION, ACCUMULATES),
- PANGO_ATTR_FOREGROUND = PANGO_ATTR_TYPE (COLOR, RENDERING, OVERRIDES),
- PANGO_ATTR_BACKGROUND = PANGO_ATTR_TYPE (COLOR, RENDERING, OVERRIDES),
- PANGO_ATTR_UNDERLINE = PANGO_ATTR_TYPE (INT, RENDERING, OVERRIDES),
- PANGO_ATTR_UNDERLINE_POSITION = PANGO_ATTR_TYPE (INT, RENDERING, OVERRIDES),
- PANGO_ATTR_STRIKETHROUGH = PANGO_ATTR_TYPE (INT, RENDERING, OVERRIDES),
- PANGO_ATTR_RISE = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_SCALE = PANGO_ATTR_TYPE (FLOAT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_FALLBACK = PANGO_ATTR_TYPE (BOOLEAN, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_LETTER_SPACING = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_UNDERLINE_COLOR = PANGO_ATTR_TYPE (COLOR, RENDERING, OVERRIDES),
- PANGO_ATTR_STRIKETHROUGH_COLOR = PANGO_ATTR_TYPE (COLOR, RENDERING, OVERRIDES),
- PANGO_ATTR_ABSOLUTE_SIZE = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_GRAVITY = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_GRAVITY_HINT = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_FONT_FEATURES = PANGO_ATTR_TYPE (STRING, SHAPING, ACCUMULATES),
- PANGO_ATTR_ALLOW_BREAKS = PANGO_ATTR_TYPE (BOOLEAN, BREAKING, OVERRIDES),
- PANGO_ATTR_SHOW = PANGO_ATTR_TYPE (INT, SHAPING, OVERRIDES),
- PANGO_ATTR_INSERT_HYPHENS = PANGO_ATTR_TYPE (BOOLEAN, SHAPING, OVERRIDES),
- PANGO_ATTR_OVERLINE = PANGO_ATTR_TYPE (INT, RENDERING, OVERRIDES),
- PANGO_ATTR_OVERLINE_COLOR = PANGO_ATTR_TYPE (COLOR, RENDERING, OVERRIDES),
- PANGO_ATTR_LINE_HEIGHT = PANGO_ATTR_TYPE (FLOAT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_ABSOLUTE_LINE_HEIGHT = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_TEXT_TRANSFORM = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_WORD = PANGO_ATTR_TYPE (BOOLEAN, BREAKING, OVERRIDES),
- PANGO_ATTR_SENTENCE = PANGO_ATTR_TYPE (BOOLEAN, BREAKING, OVERRIDES),
- PANGO_ATTR_PARAGRAPH = PANGO_ATTR_TYPE (BOOLEAN, BREAKING, OVERRIDES),
- PANGO_ATTR_BASELINE_SHIFT = PANGO_ATTR_TYPE (INT, ITEMIZATION, ACCUMULATES),
- PANGO_ATTR_FONT_SCALE = PANGO_ATTR_TYPE (INT, ITEMIZATION, ACCUMULATES),
- PANGO_ATTR_LINE_SPACING = PANGO_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
- PANGO_ATTR_SHAPE = PANGO_ATTR_TYPE (POINTER, ITEMIZATION, OVERRIDES),
-} PangoAttrType;
+ PANGO2_ATTR_INVALID,
+ PANGO2_ATTR_LANGUAGE = PANGO2_ATTR_TYPE (LANGUAGE, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_FAMILY = PANGO2_ATTR_TYPE (STRING, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_STYLE = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_WEIGHT = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_VARIANT = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_STRETCH = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_SIZE = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_FONT_DESC = PANGO2_ATTR_TYPE (FONT_DESC, ITEMIZATION, ACCUMULATES),
+ PANGO2_ATTR_FOREGROUND = PANGO2_ATTR_TYPE (COLOR, RENDERING, OVERRIDES),
+ PANGO2_ATTR_BACKGROUND = PANGO2_ATTR_TYPE (COLOR, RENDERING, OVERRIDES),
+ PANGO2_ATTR_UNDERLINE = PANGO2_ATTR_TYPE (INT, RENDERING, OVERRIDES),
+ PANGO2_ATTR_UNDERLINE_POSITION = PANGO2_ATTR_TYPE (INT, RENDERING, OVERRIDES),
+ PANGO2_ATTR_STRIKETHROUGH = PANGO2_ATTR_TYPE (INT, RENDERING, OVERRIDES),
+ PANGO2_ATTR_RISE = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_SCALE = PANGO2_ATTR_TYPE (FLOAT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_FALLBACK = PANGO2_ATTR_TYPE (BOOLEAN, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_LETTER_SPACING = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_UNDERLINE_COLOR = PANGO2_ATTR_TYPE (COLOR, RENDERING, OVERRIDES),
+ PANGO2_ATTR_STRIKETHROUGH_COLOR = PANGO2_ATTR_TYPE (COLOR, RENDERING, OVERRIDES),
+ PANGO2_ATTR_ABSOLUTE_SIZE = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_GRAVITY = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_GRAVITY_HINT = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_FONT_FEATURES = PANGO2_ATTR_TYPE (STRING, SHAPING, ACCUMULATES),
+ PANGO2_ATTR_ALLOW_BREAKS = PANGO2_ATTR_TYPE (BOOLEAN, BREAKING, OVERRIDES),
+ PANGO2_ATTR_SHOW = PANGO2_ATTR_TYPE (INT, SHAPING, OVERRIDES),
+ PANGO2_ATTR_INSERT_HYPHENS = PANGO2_ATTR_TYPE (BOOLEAN, SHAPING, OVERRIDES),
+ PANGO2_ATTR_OVERLINE = PANGO2_ATTR_TYPE (INT, RENDERING, OVERRIDES),
+ PANGO2_ATTR_OVERLINE_COLOR = PANGO2_ATTR_TYPE (COLOR, RENDERING, OVERRIDES),
+ PANGO2_ATTR_LINE_HEIGHT = PANGO2_ATTR_TYPE (FLOAT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_ABSOLUTE_LINE_HEIGHT = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_TEXT_TRANSFORM = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_WORD = PANGO2_ATTR_TYPE (BOOLEAN, BREAKING, OVERRIDES),
+ PANGO2_ATTR_SENTENCE = PANGO2_ATTR_TYPE (BOOLEAN, BREAKING, OVERRIDES),
+ PANGO2_ATTR_PARAGRAPH = PANGO2_ATTR_TYPE (BOOLEAN, BREAKING, OVERRIDES),
+ PANGO2_ATTR_BASELINE_SHIFT = PANGO2_ATTR_TYPE (INT, ITEMIZATION, ACCUMULATES),
+ PANGO2_ATTR_FONT_SCALE = PANGO2_ATTR_TYPE (INT, ITEMIZATION, ACCUMULATES),
+ PANGO2_ATTR_LINE_SPACING = PANGO2_ATTR_TYPE (INT, ITEMIZATION, OVERRIDES),
+ PANGO2_ATTR_SHAPE = PANGO2_ATTR_TYPE (POINTER, ITEMIZATION, OVERRIDES),
+} Pango2AttrType;
-#undef PANGO_ATTR_TYPE
+#undef PANGO2_ATTR_TYPE
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_language_new (PangoLanguage *language);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_family_new (const char *family);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_foreground_new (PangoColor *color);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_background_new (PangoColor *color);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_size_new (int size);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_size_new_absolute (int size);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_style_new (PangoStyle style);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_weight_new (PangoWeight weight);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_variant_new (PangoVariant variant);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_stretch_new (PangoStretch stretch);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_font_desc_new (const PangoFontDescription *desc);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_language_new (Pango2Language *language);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_family_new (const char *family);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_foreground_new (Pango2Color *color);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_background_new (Pango2Color *color);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_size_new (int size);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_size_new_absolute (int size);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_style_new (Pango2Style style);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_weight_new (Pango2Weight weight);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_variant_new (Pango2Variant variant);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_stretch_new (Pango2Stretch stretch);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_font_desc_new (const Pango2FontDescription *desc);
/**
- * PangoLineStyle:
- * @PANGO_LINE_STYLE_NONE: No visible line
- * @PANGO_LINE_STYLE_SOLID: A single line
- * @PANGO_LINE_STYLE_DOUBLE: A double line
- * @PANGO_LINE_STYLE_DASHED: A dashed line
- * @PANGO_LINE_STYLE_DOTTED: A dotted line
- * @PANGO_LINE_STYLE_WAVY: A wavy line
+ * Pango2LineStyle:
+ * @PANGO2_LINE_STYLE_NONE: No visible line
+ * @PANGO2_LINE_STYLE_SOLID: A single line
+ * @PANGO2_LINE_STYLE_DOUBLE: A double line
+ * @PANGO2_LINE_STYLE_DASHED: A dashed line
+ * @PANGO2_LINE_STYLE_DOTTED: A dotted line
+ * @PANGO2_LINE_STYLE_WAVY: A wavy line
*
- * `PangoLineStyle specifies how lines should be drawn.
+ * `Pango2LineStyle specifies how lines should be drawn.
*/
typedef enum {
- PANGO_LINE_STYLE_NONE,
- PANGO_LINE_STYLE_SOLID,
- PANGO_LINE_STYLE_DOUBLE,
- PANGO_LINE_STYLE_DASHED,
- PANGO_LINE_STYLE_DOTTED,
- PANGO_LINE_STYLE_WAVY,
-} PangoLineStyle;
+ PANGO2_LINE_STYLE_NONE,
+ PANGO2_LINE_STYLE_SOLID,
+ PANGO2_LINE_STYLE_DOUBLE,
+ PANGO2_LINE_STYLE_DASHED,
+ PANGO2_LINE_STYLE_DOTTED,
+ PANGO2_LINE_STYLE_WAVY,
+} Pango2LineStyle;
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_underline_new (PangoLineStyle style);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_underline_new (Pango2LineStyle style);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_underline_color_new (PangoColor *color);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_underline_color_new (Pango2Color *color);
/**
- * PangoUnderlinePosition:
- * @PANGO_UNDERLINE_POSITION_NORMAL: As specified by font metrics
- * @PANGO_UNDERLINE_POSITION_UNDER: Below the ink extents of the run
+ * Pango2UnderlinePosition:
+ * @PANGO2_UNDERLINE_POSITION_NORMAL: As specified by font metrics
+ * @PANGO2_UNDERLINE_POSITION_UNDER: Below the ink extents of the run
*
- * `PangoUnderlinePosition` specifies where underlines should be drawn.
+ * `Pango2UnderlinePosition` specifies where underlines should be drawn.
*/
typedef enum {
- PANGO_UNDERLINE_POSITION_NORMAL,
- PANGO_UNDERLINE_POSITION_UNDER
-} PangoUnderlinePosition;
+ PANGO2_UNDERLINE_POSITION_NORMAL,
+ PANGO2_UNDERLINE_POSITION_UNDER
+} Pango2UnderlinePosition;
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_underline_position_new (PangoUnderlinePosition position);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_underline_position_new (Pango2UnderlinePosition position);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_strikethrough_new (PangoLineStyle style);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_strikethrough_color_new (PangoColor *color);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_rise_new (int rise);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_strikethrough_new (Pango2LineStyle style);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_strikethrough_color_new (Pango2Color *color);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_rise_new (int rise);
/**
- * PangoBaselineShift:
- * @PANGO_BASELINE_SHIFT_NONE: Leave the baseline unchanged
- * @PANGO_BASELINE_SHIFT_SUPERSCRIPT: Shift the baseline to the superscript position,
+ * Pango2BaselineShift:
+ * @PANGO2_BASELINE_SHIFT_NONE: Leave the baseline unchanged
+ * @PANGO2_BASELINE_SHIFT_SUPERSCRIPT: Shift the baseline to the superscript position,
* relative to the previous run
- * @PANGO_BASELINE_SHIFT_SUBSCRIPT: Shift the baseline to the subscript position,
+ * @PANGO2_BASELINE_SHIFT_SUBSCRIPT: Shift the baseline to the subscript position,
* relative to the previous run
*
- * `PangoBaselineShift` influences how baselines are changed between runs.
+ * `Pango2BaselineShift` influences how baselines are changed between runs.
*/
typedef enum {
- PANGO_BASELINE_SHIFT_NONE,
- PANGO_BASELINE_SHIFT_SUPERSCRIPT,
- PANGO_BASELINE_SHIFT_SUBSCRIPT,
-} PangoBaselineShift;
+ PANGO2_BASELINE_SHIFT_NONE,
+ PANGO2_BASELINE_SHIFT_SUPERSCRIPT,
+ PANGO2_BASELINE_SHIFT_SUBSCRIPT,
+} Pango2BaselineShift;
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_baseline_shift_new (int shift);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_baseline_shift_new (int shift);
/**
- * PangoFontScale:
- * @PANGO_FONT_SCALE_NONE: Leave the font size unchanged
- * @PANGO_FONT_SCALE_SUPERSCRIPT: Change the font to a size suitable for superscripts
- * @PANGO_FONT_SCALE_SUBSCRIPT: Change the font to a size suitable for subscripts
- * @PANGO_FONT_SCALE_SMALL_CAPS: Change the font to a size suitable for Small Caps
+ * Pango2FontScale:
+ * @PANGO2_FONT_SCALE_NONE: Leave the font size unchanged
+ * @PANGO2_FONT_SCALE_SUPERSCRIPT: Change the font to a size suitable for superscripts
+ * @PANGO2_FONT_SCALE_SUBSCRIPT: Change the font to a size suitable for subscripts
+ * @PANGO2_FONT_SCALE_SMALL_CAPS: Change the font to a size suitable for Small Caps
*
- * `PangoFontScale` influences the font size of a run.
+ * `Pango2FontScale` influences the font size of a run.
*/
typedef enum {
- PANGO_FONT_SCALE_NONE,
- PANGO_FONT_SCALE_SUPERSCRIPT,
- PANGO_FONT_SCALE_SUBSCRIPT,
- PANGO_FONT_SCALE_SMALL_CAPS,
-} PangoFontScale;
+ PANGO2_FONT_SCALE_NONE,
+ PANGO2_FONT_SCALE_SUPERSCRIPT,
+ PANGO2_FONT_SCALE_SUBSCRIPT,
+ PANGO2_FONT_SCALE_SMALL_CAPS,
+} Pango2FontScale;
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_font_scale_new (PangoFontScale scale);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_scale_new (double scale_factor);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_fallback_new (gboolean enable_fallback);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_letter_spacing_new (int letter_spacing);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_gravity_new (PangoGravity gravity);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_gravity_hint_new (PangoGravityHint hint);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_font_features_new (const char *features);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_allow_breaks_new (gboolean allow_breaks);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_word_new (void);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_sentence_new (void);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_paragraph_new (void);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_font_scale_new (Pango2FontScale scale);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_scale_new (double scale_factor);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_fallback_new (gboolean enable_fallback);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_letter_spacing_new (int letter_spacing);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_gravity_new (Pango2Gravity gravity);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_gravity_hint_new (Pango2GravityHint hint);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_font_features_new (const char *features);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_allow_breaks_new (gboolean allow_breaks);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_word_new (void);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_sentence_new (void);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_paragraph_new (void);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_insert_hyphens_new (gboolean insert_hyphens);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_overline_new (PangoLineStyle style);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_overline_color_new (PangoColor *color);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_insert_hyphens_new (gboolean insert_hyphens);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_overline_new (Pango2LineStyle style);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_overline_color_new (Pango2Color *color);
/**
- * PangoShowFlags:
- * @PANGO_SHOW_NONE: No special treatment for invisible characters
- * @PANGO_SHOW_SPACES: Render spaces, tabs and newlines visibly
- * @PANGO_SHOW_LINE_BREAKS: Render line breaks visibly
- * @PANGO_SHOW_IGNORABLES: Render default-ignorable Unicode
+ * Pango2ShowFlags:
+ * @PANGO2_SHOW_NONE: No special treatment for invisible characters
+ * @PANGO2_SHOW_SPACES: Render spaces, tabs and newlines visibly
+ * @PANGO2_SHOW_LINE_BREAKS: Render line breaks visibly
+ * @PANGO2_SHOW_IGNORABLES: Render default-ignorable Unicode
* characters visibly
*
- * `PangoShowFlags` affect how Pango treats characters that are normally
+ * `Pango2ShowFlags` affect how Pango2 treats characters that are normally
* not visible in the output.
*/
typedef enum {
- PANGO_SHOW_NONE = 0,
- PANGO_SHOW_SPACES = 1 << 0,
- PANGO_SHOW_LINE_BREAKS = 1 << 1,
- PANGO_SHOW_IGNORABLES = 1 << 2
-} PangoShowFlags;
+ PANGO2_SHOW_NONE = 0,
+ PANGO2_SHOW_SPACES = 1 << 0,
+ PANGO2_SHOW_LINE_BREAKS = 1 << 1,
+ PANGO2_SHOW_IGNORABLES = 1 << 2
+} Pango2ShowFlags;
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_show_new (PangoShowFlags flags);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_line_height_new (double factor);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_line_height_new_absolute (int height);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_line_spacing_new (int spacing);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_show_new (Pango2ShowFlags flags);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_line_height_new (double factor);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_line_height_new_absolute (int height);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_line_spacing_new (int spacing);
/**
- * PangoTextTransform:
- * @PANGO_TEXT_TRANSFORM_NONE: Leave text unchanged
- * @PANGO_TEXT_TRANSFORM_LOWERCASE: Display letters and numbers as lowercase
- * @PANGO_TEXT_TRANSFORM_UPPERCASE: Display letters and numbers as uppercase
- * @PANGO_TEXT_TRANSFORM_CAPITALIZE: Display the first character of a word
+ * Pango2TextTransform:
+ * @PANGO2_TEXT_TRANSFORM_NONE: Leave text unchanged
+ * @PANGO2_TEXT_TRANSFORM_LOWERCASE: Display letters and numbers as lowercase
+ * @PANGO2_TEXT_TRANSFORM_UPPERCASE: Display letters and numbers as uppercase
+ * @PANGO2_TEXT_TRANSFORM_CAPITALIZE: Display the first character of a word
* in titlecase
*
- * `PangoTextTransform` determines if Pango changes the case of characters
+ * `Pango2TextTransform` determines if Pango2 changes the case of characters
* during shaping.
*/
typedef enum {
- PANGO_TEXT_TRANSFORM_NONE,
- PANGO_TEXT_TRANSFORM_LOWERCASE,
- PANGO_TEXT_TRANSFORM_UPPERCASE,
- PANGO_TEXT_TRANSFORM_CAPITALIZE,
-} PangoTextTransform;
+ PANGO2_TEXT_TRANSFORM_NONE,
+ PANGO2_TEXT_TRANSFORM_LOWERCASE,
+ PANGO2_TEXT_TRANSFORM_UPPERCASE,
+ PANGO2_TEXT_TRANSFORM_CAPITALIZE,
+} Pango2TextTransform;
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_text_transform_new (PangoTextTransform transform);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_text_transform_new (Pango2TextTransform transform);
-PANGO_AVAILABLE_IN_ALL
-PangoAttribute * pango_attr_shape_new (PangoRectangle *ink_rect,
- PangoRectangle *logical_rect,
- gpointer data,
- PangoAttrDataCopyFunc copy,
- GDestroyNotify destroy);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Attribute * pango2_attr_shape_new (Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect,
+ gpointer data,
+ Pango2AttrDataCopyFunc copy,
+ GDestroyNotify destroy);
G_END_DECLS
diff --git a/pango/pango-bidi-private.h b/pango/pango-bidi-private.h
index 014d9bb8..584678bd 100644
--- a/pango/pango-bidi-private.h
+++ b/pango/pango-bidi-private.h
@@ -24,9 +24,9 @@
#include <pango/pango-font.h>
#include <pango/pango-direction.h>
-guint8 * pango_log2vis_get_embedding_levels (const char *text,
- int length,
- PangoDirection *pbase_dir);
+guint8 * pango2_log2vis_get_embedding_levels (const char *text,
+ int length,
+ Pango2Direction *pbase_dir);
-PangoDirection pango_find_base_dir (const char *text,
- int length);
+Pango2Direction pango2_find_base_dir (const char *text,
+ int length);
diff --git a/pango/pango-bidi.c b/pango/pango-bidi.c
index 854721b2..1bf1a436 100644
--- a/pango/pango-bidi.c
+++ b/pango/pango-bidi.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-bidi-type.c: Bidirectional Character Types
*
* Copyright (C) 2008 Jürg Billeter <j@bitron.ch>
@@ -31,7 +31,7 @@
/* Some bidi-related functions */
/*< private >
- * pango_log2vis_get_embedding_levels:
+ * pango2_log2vis_get_embedding_levels:
* @text: the text to itemize.
* @length: the number of bytes (not characters) to process, or -1
* if @text is nul-terminated and the length should be calculated.
@@ -49,9 +49,9 @@
* character (not byte), that should be freed using [func@GLib.free].
*/
guint8 *
-pango_log2vis_get_embedding_levels (const char *text,
- int length,
- PangoDirection *pbase_dir)
+pango2_log2vis_get_embedding_levels (const char *text,
+ int length,
+ Pango2Direction *pbase_dir)
{
glong n_chars, i;
guint8 *embedding_levels_list;
@@ -68,17 +68,17 @@ pango_log2vis_get_embedding_levels (const char *text,
switch (*pbase_dir)
{
- case PANGO_DIRECTION_LTR:
+ case PANGO2_DIRECTION_LTR:
fribidi_base_dir = FRIBIDI_PAR_LTR;
break;
- case PANGO_DIRECTION_RTL:
+ case PANGO2_DIRECTION_RTL:
fribidi_base_dir = FRIBIDI_PAR_RTL;
break;
- case PANGO_DIRECTION_WEAK_RTL:
+ case PANGO2_DIRECTION_WEAK_RTL:
fribidi_base_dir = FRIBIDI_PAR_WRTL;
break;
- case PANGO_DIRECTION_WEAK_LTR:
- case PANGO_DIRECTION_NEUTRAL:
+ case PANGO2_DIRECTION_WEAK_LTR:
+ case PANGO2_DIRECTION_NEUTRAL:
default:
fribidi_base_dir = FRIBIDI_PAR_WLTR;
break;
@@ -174,13 +174,13 @@ resolved:
g_free (bidi_types);
g_free (bracket_types);
- *pbase_dir = (fribidi_base_dir == FRIBIDI_PAR_LTR) ? PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL;
+ *pbase_dir = (fribidi_base_dir == FRIBIDI_PAR_LTR) ? PANGO2_DIRECTION_LTR : PANGO2_DIRECTION_RTL;
return embedding_levels_list;
}
-static PangoDirection
-pango_unichar_direction (gunichar ch)
+static Pango2Direction
+pango2_unichar_direction (gunichar ch)
{
FriBidiCharType fribidi_ch_type;
@@ -189,21 +189,21 @@ pango_unichar_direction (gunichar ch)
fribidi_ch_type = fribidi_get_bidi_type (ch);
if (!FRIBIDI_IS_STRONG (fribidi_ch_type))
- return PANGO_DIRECTION_NEUTRAL;
+ return PANGO2_DIRECTION_NEUTRAL;
else if (FRIBIDI_IS_RTL (fribidi_ch_type))
- return PANGO_DIRECTION_RTL;
+ return PANGO2_DIRECTION_RTL;
else
- return PANGO_DIRECTION_LTR;
+ return PANGO2_DIRECTION_LTR;
}
-PangoDirection
-pango_find_base_dir (const char *text,
+Pango2Direction
+pango2_find_base_dir (const char *text,
int length)
{
- PangoDirection dir = PANGO_DIRECTION_NEUTRAL;
+ Pango2Direction dir = PANGO2_DIRECTION_NEUTRAL;
const char *p;
- g_return_val_if_fail (text != NULL || length == 0, PANGO_DIRECTION_NEUTRAL);
+ g_return_val_if_fail (text != NULL || length == 0, PANGO2_DIRECTION_NEUTRAL);
p = text;
while ((length < 0 || p < text + length) && *p)
@@ -211,9 +211,9 @@ pango_find_base_dir (const char *text,
gunichar wc = g_utf8_get_char (p);
- dir = pango_unichar_direction (wc);
+ dir = pango2_unichar_direction (wc);
- if (dir != PANGO_DIRECTION_NEUTRAL)
+ if (dir != PANGO2_DIRECTION_NEUTRAL)
break;
p = g_utf8_next_char (p);
diff --git a/pango/pango-break-table.h b/pango/pango-break-table.h
index c5430b39..0ee37cdf 100644
--- a/pango/pango-break-table.h
+++ b/pango/pango-break-table.h
@@ -110,14 +110,14 @@
* # @missing: 0000..10FFFF; N
*/
-#ifndef PANGO_BREAK_TABLE_H
-#define PANGO_BREAK_TABLE_H
+#ifndef PANGO2_BREAK_TABLE_H
+#define PANGO2_BREAK_TABLE_H
#include <glib.h>
static inline gboolean
-_pango_is_STerm (gunichar wc)
+_pango2_is_STerm (gunichar wc)
{
if ((wc >= 0x0021 && wc <= 0x1945))
{
@@ -269,7 +269,7 @@ _pango_is_STerm (gunichar wc)
}
static inline gboolean
-_pango_is_Virama (gunichar wc)
+_pango2_is_Virama (gunichar wc)
{
if ((wc >= 0x094D && wc <= 0x0BCD))
{
@@ -323,7 +323,7 @@ _pango_is_Virama (gunichar wc)
}
static inline gboolean
-_pango_is_Vowel_Dependent (gunichar wc)
+_pango2_is_Vowel_Dependent (gunichar wc)
{
if ((wc >= 0x093A && wc <= 0x0CC8))
{
@@ -588,7 +588,7 @@ _pango_is_Vowel_Dependent (gunichar wc)
}
static inline gboolean
-_pango_is_Consonant_Prefixed (gunichar wc)
+_pango2_is_Consonant_Prefixed (gunichar wc)
{
if ((wc >= 0x111C2 && wc <= 0x111C3) ||
wc == 0x1193F || wc == 0x11A3A || (wc >= 0x11A84 && wc <= 0x11A89))
@@ -597,7 +597,7 @@ _pango_is_Consonant_Prefixed (gunichar wc)
}
static inline gboolean
-_pango_is_Consonant_Preceding_Repha (gunichar wc)
+_pango2_is_Consonant_Preceding_Repha (gunichar wc)
{
if (wc == 0x0D4E || wc == 0x11941 || wc == 0x11D46)
return TRUE;
@@ -605,7 +605,7 @@ _pango_is_Consonant_Preceding_Repha (gunichar wc)
}
static inline gboolean
-_pango_is_EastAsianWide (gunichar wc)
+_pango2_is_EastAsianWide (gunichar wc)
{
if ((wc >= 0x1100 && wc <= 0x27B0))
{
@@ -859,6 +859,6 @@ _pango_is_EastAsianWide (gunichar wc)
return FALSE;
}
-#endif /* PANGO_BREAK_TABLE_H */
+#endif /* PANGO2_BREAK_TABLE_H */
/* == End of generated table == */
diff --git a/pango/pango-break.h b/pango/pango-break.h
index 05f13ebe..ae1e7185 100644
--- a/pango/pango-break.h
+++ b/pango/pango-break.h
@@ -28,7 +28,7 @@ G_BEGIN_DECLS
/* Logical attributes of a character.
*/
/**
- * PangoLogAttr:
+ * Pango2LogAttr:
* @is_line_break: if set, can break line in front of character
* @is_mandatory_break: if set, must break line in front of character
* @is_char_break: if set, can break here when doing character wrapping
@@ -73,10 +73,10 @@ G_BEGIN_DECLS
* @break_removes_preceding: when breaking lines before this char, remove the
* preceding char.
*
- * The `PangoLogAttr` structure stores information about the attributes of a
+ * The `Pango2LogAttr` structure stores information about the attributes of a
* single character.
*/
-struct _PangoLogAttr
+struct _Pango2LogAttr
{
guint is_line_break : 1;
guint is_mandatory_break : 1;
@@ -97,35 +97,35 @@ struct _PangoLogAttr
guint reserved : 17;
};
-PANGO_AVAILABLE_IN_ALL
-void pango_get_log_attrs (const char *text,
- int length,
- PangoAttrList *attr_list,
- int level,
- PangoLanguage *language,
- PangoLogAttr *attrs,
- int attrs_len);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_get_log_attrs (const char *text,
+ int length,
+ Pango2AttrList *attr_list,
+ int level,
+ Pango2Language *language,
+ Pango2LogAttr *attrs,
+ int attrs_len);
-PANGO_AVAILABLE_IN_ALL
-void pango_default_break (const char *text,
- int length,
- PangoLogAttr *attrs,
- int attrs_len);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_default_break (const char *text,
+ int length,
+ Pango2LogAttr *attrs,
+ int attrs_len);
-PANGO_AVAILABLE_IN_ALL
-void pango_tailor_break (const char *text,
- int length,
- PangoAnalysis *analysis,
- int offset,
- PangoLogAttr *attrs,
- int attrs_len);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_tailor_break (const char *text,
+ int length,
+ Pango2Analysis *analysis,
+ int offset,
+ Pango2LogAttr *attrs,
+ int attrs_len);
-PANGO_AVAILABLE_IN_ALL
-void pango_attr_break (const char *text,
- int length,
- PangoAttrList *attr_list,
- int offset,
- PangoLogAttr *attrs,
- int attrs_len);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_attr_break (const char *text,
+ int length,
+ Pango2AttrList *attr_list,
+ int offset,
+ Pango2LogAttr *attrs,
+ int attrs_len);
G_END_DECLS
diff --git a/pango/pango-color.c b/pango/pango-color.c
index a95f27b4..adc9a0d1 100644
--- a/pango/pango-color.c
+++ b/pango/pango-color.c
@@ -28,33 +28,33 @@
#include "pango-impl-utils.h"
-G_DEFINE_BOXED_TYPE (PangoColor, pango_color,
- pango_color_copy,
- pango_color_free);
+G_DEFINE_BOXED_TYPE (Pango2Color, pango2_color,
+ pango2_color_copy,
+ pango2_color_free);
/**
- * pango_color_copy:
+ * pango2_color_copy:
* @src: (nullable): color to copy
*
* Creates a copy of @src.
*
- * The copy should be freed with [method@Pango.Color.free].
+ * The copy should be freed with [method@Pango2.Color.free].
* Primarily used by language bindings, not that useful
* otherwise (since colors can just be copied by assignment
* in C).
*
- * Return value: (nullable): the newly allocated `PangoColor`,
- * which should be freed with [method@Pango.Color.free]
+ * Return value: (nullable): the newly allocated `Pango2Color`,
+ * which should be freed with [method@Pango2.Color.free]
*/
-PangoColor*
-pango_color_copy (const PangoColor *src)
+Pango2Color*
+pango2_color_copy (const Pango2Color *src)
{
- PangoColor *ret;
+ Pango2Color *ret;
if (src == NULL)
return NULL;
- ret = g_slice_new (PangoColor);
+ ret = g_slice_new (Pango2Color);
*ret = *src;
@@ -62,32 +62,32 @@ pango_color_copy (const PangoColor *src)
}
/**
- * pango_color_free:
- * @color: (nullable): an allocated `PangoColor`
+ * pango2_color_free:
+ * @color: (nullable): an allocated `Pango2Color`
*
- * Frees a color allocated by [method@Pango.Color.copy].
+ * Frees a color allocated by [method@Pango2.Color.copy].
*/
void
-pango_color_free (PangoColor *color)
+pango2_color_free (Pango2Color *color)
{
if (color == NULL)
return;
- g_slice_free (PangoColor, color);
+ g_slice_free (Pango2Color, color);
}
/**
- * pango_color_equal:
- * @color1: (nullable): a `PangoColor`
- * @color2: (nullable): another `PangoColor`
+ * pango2_color_equal:
+ * @color1: (nullable): a `Pango2Color`
+ * @color2: (nullable): another `Pango2Color`
*
* Compares two colors for quality.
*
* Returns: `TRUE` if the colors are equal
*/
gboolean
-pango_color_equal (const PangoColor *color1,
- const PangoColor *color2)
+pango2_color_equal (const Pango2Color *color1,
+ const Pango2Color *color2)
{
return color1 == color2 ||
(color1 && color2 &&
@@ -98,8 +98,8 @@ pango_color_equal (const PangoColor *color1,
}
/**
- * pango_color_to_string:
- * @color: a `PangoColor`
+ * pango2_color_to_string:
+ * @color: a `Pango2Color`
*
* Returns a textual specification of @color.
*
@@ -111,7 +111,7 @@ pango_color_equal (const PangoColor *color1,
* be freed with [GLib.free]
*/
char *
-pango_color_to_string (const PangoColor *color)
+pango2_color_to_string (const Pango2Color *color)
{
g_return_val_if_fail (color != NULL, NULL);
@@ -197,7 +197,7 @@ compare_xcolor_entries (const void *a, const void *b)
static gboolean
find_color(const char *name,
- PangoColor *color)
+ Pango2Color *color)
{
ColorEntry *found;
@@ -218,9 +218,9 @@ find_color(const char *name,
}
static gboolean
-hex (const char *spec,
- int len,
- unsigned int *c)
+hex (const char *spec,
+ int len,
+ unsigned int *c)
{
const char *end;
*c = 0;
@@ -234,8 +234,8 @@ hex (const char *spec,
/**
- * pango_color_parse:
- * @color: a `PangoColor` structure in which to store the result
+ * pango2_color_parse:
+ * @color: a `Pango2Color` structure in which to store the result
* @spec: a string specifying the new color
*
* Fill in the fields of a color from a string specification.
@@ -258,8 +258,8 @@ hex (const char *spec,
* otherwise %FALSE
*/
gboolean
-pango_color_parse (PangoColor *color,
- const char *spec)
+pango2_color_parse (Pango2Color *color,
+ const char *spec)
{
g_return_val_if_fail (spec != NULL, FALSE);
diff --git a/pango/pango-color.h b/pango/pango-color.h
index abf4b643..0e9af474 100644
--- a/pango/pango-color.h
+++ b/pango/pango-color.h
@@ -25,19 +25,19 @@
G_BEGIN_DECLS
-typedef struct _PangoColor PangoColor;
+typedef struct _Pango2Color Pango2Color;
/**
- * PangoColor:
+ * Pango2Color:
* @red: value of the red component
* @green: value of the green component
* @blue: value of the blue component
* @alpha: value of the alpha component
*
- * The `PangoColor` structure is used to
+ * The `Pango2Color` structure is used to
* represent a color in an uncalibrated RGB color-space.
*/
-struct _PangoColor
+struct _Pango2Color
{
guint16 red;
guint16 green;
@@ -45,27 +45,27 @@ struct _PangoColor
guint16 alpha;
};
-#define PANGO_TYPE_COLOR (pango_color_get_type ())
+#define PANGO2_TYPE_COLOR (pango2_color_get_type ())
-PANGO_AVAILABLE_IN_ALL
-GType pango_color_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_color_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoColor *pango_color_copy (const PangoColor *src);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Color *pango2_color_copy (const Pango2Color *src);
-PANGO_AVAILABLE_IN_ALL
-void pango_color_free (PangoColor *color);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_color_free (Pango2Color *color);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_color_equal (const PangoColor *color1,
- const PangoColor *color2);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_color_parse (PangoColor *color,
- const char *spec);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_color_equal (const Pango2Color *color1,
+ const Pango2Color *color2);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_color_parse (Pango2Color *color,
+ const char *spec);
-PANGO_AVAILABLE_IN_ALL
-char *pango_color_to_string (const PangoColor *color);
+PANGO2_AVAILABLE_IN_ALL
+char * pango2_color_to_string (const Pango2Color *color);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoColor, pango_color_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2Color, pango2_color_free)
G_END_DECLS
diff --git a/pango/pango-context-private.h b/pango/pango-context-private.h
index d9d07712..32c1e984 100644
--- a/pango/pango-context-private.h
+++ b/pango/pango-context-private.h
@@ -25,26 +25,26 @@
#include <cairo.h>
#endif
-struct _PangoContext
+struct _Pango2Context
{
GObject parent_instance;
guint serial;
guint fontmap_serial;
- PangoLanguage *set_language;
- PangoLanguage *language;
- PangoDirection base_dir;
- PangoGravity base_gravity;
- PangoGravity resolved_gravity;
- PangoGravityHint gravity_hint;
+ Pango2Language *set_language;
+ Pango2Language *language;
+ Pango2Direction base_dir;
+ Pango2Gravity base_gravity;
+ Pango2Gravity resolved_gravity;
+ Pango2GravityHint gravity_hint;
- PangoFontDescription *font_desc;
+ Pango2FontDescription *font_desc;
- PangoMatrix *matrix;
+ Pango2Matrix *matrix;
- PangoFontMap *font_map;
+ Pango2FontMap *font_map;
- PangoFontMetrics *metrics;
+ Pango2FontMetrics *metrics;
gboolean round_glyph_positions;
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 915dd032..58f2719a 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-context.c: Contexts for itemization and shaping
*
* Copyright (C) 2000, 2006 Red Hat Software
@@ -38,27 +38,27 @@
#include "pango-emoji-private.h"
/**
- * PangoContext:
+ * Pango2Context:
*
- * A `PangoContext` stores global information used to control the
+ * A `Pango2Context` stores global information used to control the
* itemization process.
*
- * The information stored by `PangoContext` includes the fontmap used
+ * The information stored by `Pango2Context` includes the fontmap used
* to look up fonts, and default values such as the default language,
* default gravity, or default font.
*
- * To obtain a `PangoContext`, use [ctor@Pango.Context.new]
- * or [func@Pango.cairo_create_context].
+ * To obtain a `Pango2Context`, use [ctor@Pango2.Context.new]
+ * or [func@Pango2.cairo_create_context].
*/
-struct _PangoContextClass
+struct _Pango2ContextClass
{
GObjectClass parent_class;
};
-static void pango_context_finalize (GObject *object);
-static void context_changed (PangoContext *context);
+static void pango2_context_finalize (GObject *object);
+static void context_changed (Pango2Context *context);
enum {
PROP_FONT_MAP = 1,
@@ -74,32 +74,32 @@ enum {
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
-G_DEFINE_FINAL_TYPE (PangoContext, pango_context, G_TYPE_OBJECT)
+G_DEFINE_FINAL_TYPE (Pango2Context, pango2_context, G_TYPE_OBJECT)
static void
-pango_context_init (PangoContext *context)
+pango2_context_init (Pango2Context *context)
{
- context->base_dir = PANGO_DIRECTION_WEAK_LTR;
- context->resolved_gravity = context->base_gravity = PANGO_GRAVITY_SOUTH;
- context->gravity_hint = PANGO_GRAVITY_HINT_NATURAL;
+ context->base_dir = PANGO2_DIRECTION_WEAK_LTR;
+ context->resolved_gravity = context->base_gravity = PANGO2_GRAVITY_SOUTH;
+ context->gravity_hint = PANGO2_GRAVITY_HINT_NATURAL;
context->serial = 1;
context->set_language = NULL;
- context->language = pango_language_get_default ();
+ context->language = pango2_language_get_default ();
context->font_map = NULL;
context->round_glyph_positions = TRUE;
- context->font_desc = pango_font_description_new ();
- pango_font_description_set_family_static (context->font_desc, "serif");
- pango_font_description_set_style (context->font_desc, PANGO_STYLE_NORMAL);
- pango_font_description_set_variant (context->font_desc, PANGO_VARIANT_NORMAL);
- pango_font_description_set_weight (context->font_desc, PANGO_WEIGHT_NORMAL);
- pango_font_description_set_stretch (context->font_desc, PANGO_STRETCH_NORMAL);
- pango_font_description_set_size (context->font_desc, 12 * PANGO_SCALE);
+ context->font_desc = pango2_font_description_new ();
+ pango2_font_description_set_family_static (context->font_desc, "serif");
+ pango2_font_description_set_style (context->font_desc, PANGO2_STYLE_NORMAL);
+ pango2_font_description_set_variant (context->font_desc, PANGO2_VARIANT_NORMAL);
+ pango2_font_description_set_weight (context->font_desc, PANGO2_WEIGHT_NORMAL);
+ pango2_font_description_set_stretch (context->font_desc, PANGO2_STRETCH_NORMAL);
+ pango2_font_description_set_size (context->font_desc, 12 * PANGO2_SCALE);
}
static gboolean
-pango_has_mixed_deps (void)
+pango2_has_mixed_deps (void)
{
GModule *module;
gpointer func;
@@ -107,7 +107,7 @@ pango_has_mixed_deps (void)
module = g_module_open (NULL, 0);
- if (g_module_symbol (module, "pango_ot_info_find_script", &func))
+ if (g_module_symbol (module, "pango2_ot_info_find_script", &func))
result = TRUE;
g_module_close (module);
@@ -116,45 +116,45 @@ pango_has_mixed_deps (void)
}
static void
-pango_context_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+pango2_context_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- PangoContext *context = PANGO_CONTEXT (object);
+ Pango2Context *context = PANGO2_CONTEXT (object);
switch (property_id)
{
case PROP_FONT_MAP:
- pango_context_set_font_map (context, g_value_get_object (value));
+ pango2_context_set_font_map (context, g_value_get_object (value));
break;
case PROP_FONT_DESCRIPTION:
- pango_context_set_font_description (context, g_value_get_boxed (value));
+ pango2_context_set_font_description (context, g_value_get_boxed (value));
break;
case PROP_LANGUAGE:
- pango_context_set_language (context, g_value_get_boxed (value));
+ pango2_context_set_language (context, g_value_get_boxed (value));
break;
case PROP_BASE_DIR:
- pango_context_set_base_dir (context, g_value_get_enum (value));
+ pango2_context_set_base_dir (context, g_value_get_enum (value));
break;
case PROP_BASE_GRAVITY:
- pango_context_set_base_gravity (context, g_value_get_enum (value));
+ pango2_context_set_base_gravity (context, g_value_get_enum (value));
break;
case PROP_GRAVITY_HINT:
- pango_context_set_gravity_hint (context, g_value_get_enum (value));
+ pango2_context_set_gravity_hint (context, g_value_get_enum (value));
break;
case PROP_MATRIX:
- pango_context_set_matrix (context, g_value_get_boxed (value));
+ pango2_context_set_matrix (context, g_value_get_boxed (value));
break;
case PROP_ROUND_GLYPH_POSITIONS:
- pango_context_set_round_glyph_positions (context, g_value_get_boolean (value));
+ pango2_context_set_round_glyph_positions (context, g_value_get_boolean (value));
break;
default:
@@ -163,45 +163,45 @@ pango_context_set_property (GObject *object,
}
static void
-pango_context_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+pango2_context_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- PangoContext *context = PANGO_CONTEXT (object);
+ Pango2Context *context = PANGO2_CONTEXT (object);
switch (property_id)
{
case PROP_FONT_MAP:
- g_value_set_object (value, pango_context_get_font_map (context));
+ g_value_set_object (value, pango2_context_get_font_map (context));
break;
case PROP_FONT_DESCRIPTION:
- g_value_set_boxed (value, pango_context_get_font_description (context));
+ g_value_set_boxed (value, pango2_context_get_font_description (context));
break;
case PROP_LANGUAGE:
- g_value_set_boxed (value, pango_context_get_language (context));
+ g_value_set_boxed (value, pango2_context_get_language (context));
break;
case PROP_BASE_DIR:
- g_value_set_enum (value, pango_context_get_base_dir (context));
+ g_value_set_enum (value, pango2_context_get_base_dir (context));
break;
case PROP_BASE_GRAVITY:
- g_value_set_enum (value, pango_context_get_base_gravity (context));
+ g_value_set_enum (value, pango2_context_get_base_gravity (context));
break;
case PROP_GRAVITY_HINT:
- g_value_set_enum (value, pango_context_get_gravity_hint (context));
+ g_value_set_enum (value, pango2_context_get_gravity_hint (context));
break;
case PROP_MATRIX:
- g_value_set_boxed (value, pango_context_get_matrix (context));
+ g_value_set_boxed (value, pango2_context_get_matrix (context));
break;
case PROP_ROUND_GLYPH_POSITIONS:
- g_value_set_boolean (value, pango_context_get_round_glyph_positions (context));
+ g_value_set_boolean (value, pango2_context_get_round_glyph_positions (context));
break;
default:
@@ -210,93 +210,93 @@ pango_context_get_property (GObject *object,
}
static void
-pango_context_class_init (PangoContextClass *klass)
+pango2_context_class_init (Pango2ContextClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
/* Put the check for mixed linkage here, for lack of a better place */
- if (pango_has_mixed_deps ())
- g_error ("Pango 1.x symbols detected.\n"
- "Using Pango 1.x and 2 in the same process is not supported.");
+ if (pango2_has_mixed_deps ())
+ g_error ("Pango2 1.x symbols detected.\n"
+ "Using Pango2 1.x and 2 in the same process is not supported.");
- object_class->finalize = pango_context_finalize;
- object_class->set_property = pango_context_set_property;
- object_class->get_property = pango_context_get_property;
+ object_class->finalize = pango2_context_finalize;
+ object_class->set_property = pango2_context_set_property;
+ object_class->get_property = pango2_context_get_property;
/**
- * PangoContext:font-map: (attributes org.gtk.Property.get=pango_context_get_font_map org.gtk.Property.set=pango_context_set_font_map)
+ * Pango2Context:font-map: (attributes org.gtk.Property.get=pango2_context_get_font_map org.gtk.Property.set=pango2_context_set_font_map)
*
* The font map to be searched when fonts are looked up
* in this context.
*/
properties[PROP_FONT_MAP] =
- g_param_spec_object ("font-map", NULL, NULL, PANGO_TYPE_FONT_MAP,
+ g_param_spec_object ("font-map", NULL, NULL, PANGO2_TYPE_FONT_MAP,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
- * PangoContext:font-description: (attributes org.gtk.Property.get=pango_context_get_font_description org.gtk.Property.set=pango_context_set_font_description)
+ * Pango2Context:font-description: (attributes org.gtk.Property.get=pango2_context_get_font_description org.gtk.Property.set=pango2_context_set_font_description)
*
* The default font description for the context.
*/
properties[PROP_FONT_DESCRIPTION] =
- g_param_spec_boxed ("font-description", NULL, NULL, PANGO_TYPE_FONT_DESCRIPTION,
+ g_param_spec_boxed ("font-description", NULL, NULL, PANGO2_TYPE_FONT_DESCRIPTION,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
- * PangoContext:language: (attributes org.gtk.Property.get=pango_context_get_language org.gtk.Property.set=pango_context_set_language)
+ * Pango2Context:language: (attributes org.gtk.Property.get=pango2_context_get_language org.gtk.Property.set=pango2_context_set_language)
*
* The global language for the context.
*/
properties[PROP_LANGUAGE] =
- g_param_spec_boxed ("language", NULL, NULL, PANGO_TYPE_LANGUAGE,
+ g_param_spec_boxed ("language", NULL, NULL, PANGO2_TYPE_LANGUAGE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
- * PangoContext:base-direction: (attributes org.gtk.Property.get=pango_context_get_base_dir org.gtk.Property.set=pango_context_set_base_dir)
+ * Pango2Context:base-direction: (attributes org.gtk.Property.get=pango2_context_get_base_dir org.gtk.Property.set=pango2_context_set_base_dir)
*
* The base direction for the context.
*
* The base direction is used in applying the Unicode bidirectional
- * algorithm; if the @direction is `PANGO_DIRECTION_LTR` or
- * `PANGO_DIRECTION_RTL`, then the value will be used as the paragraph
+ * algorithm; if the @direction is `PANGO2_DIRECTION_LTR` or
+ * `PANGO2_DIRECTION_RTL`, then the value will be used as the paragraph
* direction in the Unicode bidirectional algorithm. A value of
- * `PANGO_DIRECTION_WEAK_LTR` or `PANGO_DIRECTION_WEAK_RTL` is used only
+ * `PANGO2_DIRECTION_WEAK_LTR` or `PANGO2_DIRECTION_WEAK_RTL` is used only
* for paragraphs that do not contain any strong characters themselves.
*/
properties[PROP_BASE_DIR] =
- g_param_spec_enum ("base-direction", NULL, NULL, PANGO_TYPE_DIRECTION,
- PANGO_DIRECTION_LTR,
+ g_param_spec_enum ("base-direction", NULL, NULL, PANGO2_TYPE_DIRECTION,
+ PANGO2_DIRECTION_LTR,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
- * PangoContext:base-gravity: (attributes org.gtk.Property.get=pango_context_get_base_gravity org.gtk.Property.set=pango_context_set_base_gravity)
+ * Pango2Context:base-gravity: (attributes org.gtk.Property.get=pango2_context_get_base_gravity org.gtk.Property.set=pango2_context_set_base_gravity)
*
* The base gravity for the context.
*
* The base gravity is used in laying vertical text out.
*/
properties[PROP_BASE_GRAVITY] =
- g_param_spec_enum ("base-gravity", NULL, NULL, PANGO_TYPE_GRAVITY,
- PANGO_GRAVITY_SOUTH,
+ g_param_spec_enum ("base-gravity", NULL, NULL, PANGO2_TYPE_GRAVITY,
+ PANGO2_GRAVITY_SOUTH,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
- * PangoContext:gravity-hint: (attributes org.gtk.Property.get=pango_context_get_gravity_hint org.gtk.Property.set=pango_context_set_gravity_hint)
+ * Pango2Context:gravity-hint: (attributes org.gtk.Property.get=pango2_context_get_gravity_hint org.gtk.Property.set=pango2_context_set_gravity_hint)
*
* The gravity hint for the context.
*
* The gravity hint is used in laying vertical text out, and
* is only relevant if gravity of the context as returned by
- * [method@Pango.Context.get_gravity] is set to `PANGO_GRAVITY_EAST`
- * or `PANGO_GRAVITY_WEST`.
+ * [method@Pango2.Context.get_gravity] is set to `PANGO2_GRAVITY_EAST`
+ * or `PANGO2_GRAVITY_WEST`.
*/
properties[PROP_GRAVITY_HINT] =
- g_param_spec_enum ("gravity-hint", NULL, NULL, PANGO_TYPE_GRAVITY_HINT,
- PANGO_GRAVITY_HINT_NATURAL,
+ g_param_spec_enum ("gravity-hint", NULL, NULL, PANGO2_TYPE_GRAVITY_HINT,
+ PANGO2_GRAVITY_HINT_NATURAL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
- * PangoContext:matrix: (attributes org.gtk.Property.get=pango_context_get_matrix org.gtk.Property.set=pango_context_set_matrix)
+ * Pango2Context:matrix: (attributes org.gtk.Property.get=pango2_context_get_matrix org.gtk.Property.set=pango2_context_set_matrix)
*
* The 'user to device' transformation that will be applied when rendering
* with this context.
@@ -308,11 +308,11 @@ pango_context_class_init (PangoContextClass *klass)
* the pixel grid.
*/
properties[PROP_MATRIX] =
- g_param_spec_boxed ("matrix", NULL, NULL, PANGO_TYPE_MATRIX,
+ g_param_spec_boxed ("matrix", NULL, NULL, PANGO2_TYPE_MATRIX,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
- * PangoContext:round-glyph-positions: (attributes org.gtk.Property.get=pango_context_get_round_glyph_positions org.gtk.Property.set=pango_context_set_round_glyph_positions)
+ * Pango2Context:round-glyph-positions: (attributes org.gtk.Property.get=pango2_context_get_round_glyph_positions org.gtk.Property.set=pango2_context_set_round_glyph_positions)
*
* Determines whether font rendering with this context should
* round glyph positions and widths to integral positions,
@@ -329,85 +329,85 @@ pango_context_class_init (PangoContextClass *klass)
}
static void
-pango_context_finalize (GObject *object)
+pango2_context_finalize (GObject *object)
{
- PangoContext *context;
+ Pango2Context *context;
- context = PANGO_CONTEXT (object);
+ context = PANGO2_CONTEXT (object);
if (context->font_map)
g_object_unref (context->font_map);
- pango_font_description_free (context->font_desc);
+ pango2_font_description_free (context->font_desc);
if (context->matrix)
- pango_matrix_free (context->matrix);
+ pango2_matrix_free (context->matrix);
if (context->metrics)
- pango_font_metrics_free (context->metrics);
+ pango2_font_metrics_free (context->metrics);
- G_OBJECT_CLASS (pango_context_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_context_parent_class)->finalize (object);
}
/**
- * pango_context_new:
+ * pango2_context_new:
*
- * Creates a new `PangoContext` initialized to default values.
+ * Creates a new `Pango2Context` initialized to default values.
*
- * If you want to use a specific [class@Pango.FontMap] other than
- * the default one, you should use [ctor@Pango.Context.new_with_font_map]
+ * If you want to use a specific [class@Pango2.FontMap] other than
+ * the default one, you should use [ctor@Pango2.Context.new_with_font_map]
* instead.
*
- * If you are using Pango as part of a higher-level system,
- * that system may have it's own way of create a `PangoContext`.
- * Pango's own cairo support for instance, has [func@Pango.cairo_create_context],
- * and the GTK toolkit has, among others, gtk_widget_get_pango_context().
+ * If you are using Pango2 as part of a higher-level system,
+ * that system may have it's own way of create a `Pango2Context`.
+ * Pango2's own cairo support for instance, has [func@Pango2.cairo_create_context],
+ * and the GTK toolkit has, among others, gtk_widget_get_pango2_context().
* Use those instead.
*
- * Return value: the newly allocated `PangoContext`
+ * Return value: the newly allocated `Pango2Context`
*/
-PangoContext *
-pango_context_new (void)
+Pango2Context *
+pango2_context_new (void)
{
- return g_object_new (PANGO_TYPE_CONTEXT,
- "font-map", pango_font_map_get_default (),
+ return g_object_new (PANGO2_TYPE_CONTEXT,
+ "font-map", pango2_font_map_get_default (),
NULL);
}
/**
- * pango_context_new_with_font_map:
- * @font_map: the `PangoFontMap` to use
+ * pango2_context_new_with_font_map:
+ * @font_map: the `Pango2FontMap` to use
*
- * Creates a new `PangoContext` with the given font map.
+ * Creates a new `Pango2Context` with the given font map.
*
- * If you are using Pango as part of a higher-level system,
- * that system may have it's own way of create a `PangoContext`.
- * Pango's own cairo support for instance, has [func@Pango.cairo_create_context],
- * and the GTK toolkit has, among others, gtk_widget_get_pango_context().
+ * If you are using Pango2 as part of a higher-level system,
+ * that system may have it's own way of create a `Pango2Context`.
+ * Pango2's own cairo support for instance, has [func@Pango2.cairo_create_context],
+ * and the GTK toolkit has, among others, gtk_widget_get_pango2_context().
* Use those instead.
*
- * Return value: the newly allocated `PangoContext`
+ * Return value: the newly allocated `Pango2Context`
*/
-PangoContext *
-pango_context_new_with_font_map (PangoFontMap *font_map)
+Pango2Context *
+pango2_context_new_with_font_map (Pango2FontMap *font_map)
{
- return g_object_new (PANGO_TYPE_CONTEXT,
+ return g_object_new (PANGO2_TYPE_CONTEXT,
"font-map", font_map,
NULL);
}
static void
-update_resolved_gravity (PangoContext *context)
+update_resolved_gravity (Pango2Context *context)
{
- if (context->base_gravity == PANGO_GRAVITY_AUTO)
- context->resolved_gravity = pango_gravity_get_for_matrix (context->matrix);
+ if (context->base_gravity == PANGO2_GRAVITY_AUTO)
+ context->resolved_gravity = pango2_gravity_get_for_matrix (context->matrix);
else
context->resolved_gravity = context->base_gravity;
}
/**
- * pango_context_set_matrix:
- * @context: a `PangoContext`
- * @matrix: (nullable): a `PangoMatrix`, or %NULL to unset any existing
+ * pango2_context_set_matrix:
+ * @context: a `Pango2Context`
+ * @matrix: (nullable): a `Pango2Matrix`, or %NULL to unset any existing
* matrix. (No matrix set is the same as setting the identity matrix.)
*
* Sets the 'user to device' transformation that will be applied when rendering
@@ -426,18 +426,18 @@ update_resolved_gravity (PangoContext *context)
* text is fit to the pixel grid.
*/
void
-pango_context_set_matrix (PangoContext *context,
- const PangoMatrix *matrix)
+pango2_context_set_matrix (Pango2Context *context,
+ const Pango2Matrix *matrix)
{
- g_return_if_fail (PANGO_IS_CONTEXT (context));
+ g_return_if_fail (PANGO2_IS_CONTEXT (context));
if (context->matrix || matrix)
context_changed (context);
if (context->matrix)
- pango_matrix_free (context->matrix);
+ pango2_matrix_free (context->matrix);
if (matrix)
- context->matrix = pango_matrix_copy (matrix);
+ context->matrix = pango2_matrix_copy (matrix);
else
context->matrix = NULL;
@@ -446,44 +446,44 @@ pango_context_set_matrix (PangoContext *context,
}
/**
- * pango_context_get_matrix:
- * @context: a `PangoContext`
+ * pango2_context_get_matrix:
+ * @context: a `Pango2Context`
*
* Gets the transformation matrix that will be applied when
* rendering with this context.
*
- * See [method@Pango.Context.set_matrix].
+ * See [method@Pango2.Context.set_matrix].
*
* Return value: (nullable): the matrix, or %NULL if no matrix has
* been set (which is the same as the identity matrix). The returned
- * matrix is owned by Pango and must not be modified or freed.
+ * matrix is owned by Pango2 and must not be modified or freed.
*/
-const PangoMatrix *
-pango_context_get_matrix (PangoContext *context)
+const Pango2Matrix *
+pango2_context_get_matrix (Pango2Context *context)
{
- g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL);
return context->matrix;
}
/**
- * pango_context_set_font_map:
- * @context: a `PangoContext`
- * @font_map: the `PangoFontMap` to set.
+ * pango2_context_set_font_map:
+ * @context: a `Pango2Context`
+ * @font_map: the `Pango2FontMap` to set.
*
* Sets the font map to be searched when fonts are looked-up
* in this context.
*
- * This is only for internal use by Pango backends, a `PangoContext`
+ * This is only for internal use by Pango2 backends, a `Pango2Context`
* obtained via one of the recommended methods should already have a
* suitable font map.
*/
void
-pango_context_set_font_map (PangoContext *context,
- PangoFontMap *font_map)
+pango2_context_set_font_map (Pango2Context *context,
+ Pango2FontMap *font_map)
{
- g_return_if_fail (PANGO_IS_CONTEXT (context));
- g_return_if_fail (!font_map || PANGO_IS_FONT_MAP (font_map));
+ g_return_if_fail (PANGO2_IS_CONTEXT (context));
+ g_return_if_fail (!font_map || PANGO2_IS_FONT_MAP (font_map));
if (font_map == context->font_map)
return;
@@ -497,108 +497,108 @@ pango_context_set_font_map (PangoContext *context,
g_object_unref (context->font_map);
context->font_map = font_map;
- context->fontmap_serial = pango_font_map_get_serial (font_map);
+ context->fontmap_serial = pango2_font_map_get_serial (font_map);
g_object_notify_by_pspec (G_OBJECT (context), properties[PROP_FONT_MAP]);
}
/**
- * pango_context_get_font_map:
- * @context: a `PangoContext`
+ * pango2_context_get_font_map:
+ * @context: a `Pango2Context`
*
- * Gets the `PangoFontMap` used to look up fonts for this context.
+ * Gets the `Pango2FontMap` used to look up fonts for this context.
*
- * Return value: (transfer none): the font map for the `PangoContext`.
- * This value is owned by Pango and should not be unreferenced.
+ * Return value: (transfer none): the font map for the `Pango2Context`.
+ * This value is owned by Pango2 and should not be unreferenced.
*/
-PangoFontMap *
-pango_context_get_font_map (PangoContext *context)
+Pango2FontMap *
+pango2_context_get_font_map (Pango2Context *context)
{
- g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL);
return context->font_map;
}
/**
- * pango_context_load_font:
- * @context: a `PangoContext`
- * @desc: a `PangoFontDescription` describing the font to load
+ * pango2_context_load_font:
+ * @context: a `Pango2Context`
+ * @desc: a `Pango2FontDescription` describing the font to load
*
* Loads the font in one of the fontmaps in the context
* that is the closest match for @desc.
*
- * Returns: (transfer full) (nullable): the newly allocated `PangoFont`
+ * Returns: (transfer full) (nullable): the newly allocated `Pango2Font`
* that was loaded, or %NULL if no font matched.
*/
-PangoFont *
-pango_context_load_font (PangoContext *context,
- const PangoFontDescription *desc)
+Pango2Font *
+pango2_context_load_font (Pango2Context *context,
+ const Pango2FontDescription *desc)
{
g_return_val_if_fail (context != NULL, NULL);
g_return_val_if_fail (context->font_map != NULL, NULL);
- return pango_font_map_load_font (context->font_map, context, desc);
+ return pango2_font_map_load_font (context->font_map, context, desc);
}
/**
- * pango_context_load_fontset:
- * @context: a `PangoContext`
- * @desc: a `PangoFontDescription` describing the fonts to load
- * @language: a `PangoLanguage` the fonts will be used for
+ * pango2_context_load_fontset:
+ * @context: a `Pango2Context`
+ * @desc: a `Pango2FontDescription` describing the fonts to load
+ * @language: a `Pango2Language` the fonts will be used for
*
* Load a set of fonts in the context that can be used to render
* a font matching @desc.
*
* Returns: (transfer full) (nullable): the newly allocated
- * `PangoFontset` loaded, or %NULL if no font matched.
+ * `Pango2Fontset` loaded, or %NULL if no font matched.
*/
-PangoFontset *
-pango_context_load_fontset (PangoContext *context,
- const PangoFontDescription *desc,
- PangoLanguage *language)
+Pango2Fontset *
+pango2_context_load_fontset (Pango2Context *context,
+ const Pango2FontDescription *desc,
+ Pango2Language *language)
{
g_return_val_if_fail (context != NULL, NULL);
- return pango_font_map_load_fontset (context->font_map, context, desc, language);
+ return pango2_font_map_load_fontset (context->font_map, context, desc, language);
}
/**
- * pango_context_set_font_description:
- * @context: a `PangoContext`
+ * pango2_context_set_font_description:
+ * @context: a `Pango2Context`
* @desc: the new pango font description
*
* Set the default font description for the context
*/
void
-pango_context_set_font_description (PangoContext *context,
- const PangoFontDescription *desc)
+pango2_context_set_font_description (Pango2Context *context,
+ const Pango2FontDescription *desc)
{
g_return_if_fail (context != NULL);
g_return_if_fail (desc != NULL);
if (desc != context->font_desc &&
- (!desc || !context->font_desc || !pango_font_description_equal(desc, context->font_desc)))
+ (!desc || !context->font_desc || !pango2_font_description_equal(desc, context->font_desc)))
{
context_changed (context);
- pango_font_description_free (context->font_desc);
- context->font_desc = pango_font_description_copy (desc);
+ pango2_font_description_free (context->font_desc);
+ context->font_desc = pango2_font_description_copy (desc);
g_object_notify_by_pspec (G_OBJECT (context), properties[PROP_FONT_DESCRIPTION]);
}
}
/**
- * pango_context_get_font_description:
- * @context: a `PangoContext`
+ * pango2_context_get_font_description:
+ * @context: a `Pango2Context`
*
* Retrieve the default font description for the context.
*
* Return value: (transfer none): a pointer to the context's default font
* description. This value must not be modified or freed.
*/
-PangoFontDescription *
-pango_context_get_font_description (PangoContext *context)
+Pango2FontDescription *
+pango2_context_get_font_description (Pango2Context *context)
{
g_return_val_if_fail (context != NULL, NULL);
@@ -606,18 +606,18 @@ pango_context_get_font_description (PangoContext *context)
}
/**
- * pango_context_set_language:
- * @context: a `PangoContext`
+ * pango2_context_set_language:
+ * @context: a `Pango2Context`
* @language: the new language tag.
*
* Sets the global language tag for the context.
*
* The default language for the locale of the running process
- * can be found using [func@Pango.Language.get_default].
+ * can be found using [func@Pango2.Language.get_default].
*/
void
-pango_context_set_language (PangoContext *context,
- PangoLanguage *language)
+pango2_context_set_language (Pango2Context *context,
+ Pango2Language *language)
{
g_return_if_fail (context != NULL);
@@ -628,21 +628,21 @@ pango_context_set_language (PangoContext *context,
if (language)
context->language = language;
else
- context->language = pango_language_get_default ();
+ context->language = pango2_language_get_default ();
g_object_notify_by_pspec (G_OBJECT (context), properties[PROP_LANGUAGE]);
}
/**
- * pango_context_get_language:
- * @context: a `PangoContext`
+ * pango2_context_get_language:
+ * @context: a `Pango2Context`
*
* Retrieves the global language tag for the context.
*
* Return value: the global language tag.
*/
-PangoLanguage *
-pango_context_get_language (PangoContext *context)
+Pango2Language *
+pango2_context_get_language (Pango2Context *context)
{
g_return_val_if_fail (context != NULL, NULL);
@@ -650,22 +650,22 @@ pango_context_get_language (PangoContext *context)
}
/**
- * pango_context_set_base_dir:
- * @context: a `PangoContext`
+ * pango2_context_set_base_dir:
+ * @context: a `Pango2Context`
* @direction: the new base direction
*
* Sets the base direction for the context.
*
* The base direction is used in applying the Unicode bidirectional
- * algorithm; if the @direction is %PANGO_DIRECTION_LTR or
- * %PANGO_DIRECTION_RTL, then the value will be used as the paragraph
+ * algorithm; if the @direction is %PANGO2_DIRECTION_LTR or
+ * %PANGO2_DIRECTION_RTL, then the value will be used as the paragraph
* direction in the Unicode bidirectional algorithm. A value of
- * %PANGO_DIRECTION_WEAK_LTR or %PANGO_DIRECTION_WEAK_RTL is used only
+ * %PANGO2_DIRECTION_WEAK_LTR or %PANGO2_DIRECTION_WEAK_RTL is used only
* for paragraphs that do not contain any strong characters themselves.
*/
void
-pango_context_set_base_dir (PangoContext *context,
- PangoDirection direction)
+pango2_context_set_base_dir (Pango2Context *context,
+ Pango2Direction direction)
{
g_return_if_fail (context != NULL);
@@ -679,26 +679,26 @@ pango_context_set_base_dir (PangoContext *context,
}
/**
- * pango_context_get_base_dir:
- * @context: a `PangoContext`
+ * pango2_context_get_base_dir:
+ * @context: a `Pango2Context`
*
* Retrieves the base direction for the context.
*
- * See [method@Pango.Context.set_base_dir].
+ * See [method@Pango2.Context.set_base_dir].
*
* Return value: the base direction for the context.
*/
-PangoDirection
-pango_context_get_base_dir (PangoContext *context)
+Pango2Direction
+pango2_context_get_base_dir (Pango2Context *context)
{
- g_return_val_if_fail (context != NULL, PANGO_DIRECTION_LTR);
+ g_return_val_if_fail (context != NULL, PANGO2_DIRECTION_LTR);
return context->base_dir;
}
/**
- * pango_context_set_base_gravity:
- * @context: a `PangoContext`
+ * pango2_context_set_base_gravity:
+ * @context: a `Pango2Context`
* @gravity: the new base gravity
*
* Sets the base gravity for the context.
@@ -706,8 +706,8 @@ pango_context_get_base_dir (PangoContext *context)
* The base gravity is used in laying vertical text out.
*/
void
-pango_context_set_base_gravity (PangoContext *context,
- PangoGravity gravity)
+pango2_context_set_base_gravity (Pango2Context *context,
+ Pango2Gravity gravity)
{
g_return_if_fail (context != NULL);
@@ -723,59 +723,59 @@ pango_context_set_base_gravity (PangoContext *context,
}
/**
- * pango_context_get_base_gravity:
- * @context: a `PangoContext`
+ * pango2_context_get_base_gravity:
+ * @context: a `Pango2Context`
*
* Retrieves the base gravity for the context.
*
- * See [method@Pango.Context.set_base_gravity].
+ * See [method@Pango2.Context.set_base_gravity].
*
* Return value: the base gravity for the context.
*/
-PangoGravity
-pango_context_get_base_gravity (PangoContext *context)
+Pango2Gravity
+pango2_context_get_base_gravity (Pango2Context *context)
{
- g_return_val_if_fail (context != NULL, PANGO_GRAVITY_SOUTH);
+ g_return_val_if_fail (context != NULL, PANGO2_GRAVITY_SOUTH);
return context->base_gravity;
}
/**
- * pango_context_get_gravity:
- * @context: a `PangoContext`
+ * pango2_context_get_gravity:
+ * @context: a `Pango2Context`
*
* Retrieves the gravity for the context.
*
- * This is similar to [method@Pango.Context.get_base_gravity],
- * except for when the base gravity is %PANGO_GRAVITY_AUTO for
- * which [func@Pango.Gravity.get_for_matrix] is used to return the
+ * This is similar to [method@Pango2.Context.get_base_gravity],
+ * except for when the base gravity is %PANGO2_GRAVITY_AUTO for
+ * which [func@Pango2.Gravity.get_for_matrix] is used to return the
* gravity from the current context matrix.
*
* Return value: the resolved gravity for the context.
*/
-PangoGravity
-pango_context_get_gravity (PangoContext *context)
+Pango2Gravity
+pango2_context_get_gravity (Pango2Context *context)
{
- g_return_val_if_fail (context != NULL, PANGO_GRAVITY_SOUTH);
+ g_return_val_if_fail (context != NULL, PANGO2_GRAVITY_SOUTH);
return context->resolved_gravity;
}
/**
- * pango_context_set_gravity_hint:
- * @context: a `PangoContext`
+ * pango2_context_set_gravity_hint:
+ * @context: a `Pango2Context`
* @hint: the new gravity hint
*
* Sets the gravity hint for the context.
*
* The gravity hint is used in laying vertical text out, and
* is only relevant if gravity of the context as returned by
- * [method@Pango.Context.get_gravity] is set to %PANGO_GRAVITY_EAST
- * or %PANGO_GRAVITY_WEST.
+ * [method@Pango2.Context.get_gravity] is set to %PANGO2_GRAVITY_EAST
+ * or %PANGO2_GRAVITY_WEST.
*/
void
-pango_context_set_gravity_hint (PangoContext *context,
- PangoGravityHint hint)
+pango2_context_set_gravity_hint (Pango2Context *context,
+ Pango2GravityHint hint)
{
g_return_if_fail (context != NULL);
@@ -789,58 +789,58 @@ pango_context_set_gravity_hint (PangoContext *context,
}
/**
- * pango_context_get_gravity_hint:
- * @context: a `PangoContext`
+ * pango2_context_get_gravity_hint:
+ * @context: a `Pango2Context`
*
* Retrieves the gravity hint for the context.
*
- * See [method@Pango.Context.set_gravity_hint] for details.
+ * See [method@Pango2.Context.set_gravity_hint] for details.
*
* Return value: the gravity hint for the context.
*/
-PangoGravityHint
-pango_context_get_gravity_hint (PangoContext *context)
+Pango2GravityHint
+pango2_context_get_gravity_hint (Pango2Context *context)
{
- g_return_val_if_fail (context != NULL, PANGO_GRAVITY_HINT_NATURAL);
+ g_return_val_if_fail (context != NULL, PANGO2_GRAVITY_HINT_NATURAL);
return context->gravity_hint;
}
static gboolean
-get_first_metrics_foreach (PangoFontset *fontset,
- PangoFont *font,
+get_first_metrics_foreach (Pango2Fontset *fontset,
+ Pango2Font *font,
gpointer data)
{
- PangoFontMetrics **fontset_metrics = data;
- PangoLanguage *language = pango_fontset_get_language (fontset);
+ Pango2FontMetrics **fontset_metrics = data;
+ Pango2Language *language = pango2_fontset_get_language (fontset);
- *fontset_metrics = pango_font_get_metrics (font, language);
+ *fontset_metrics = pango2_font_get_metrics (font, language);
return TRUE; /* Stops iteration */
}
-static PangoFontMetrics *
-get_base_metrics (PangoFontset *fontset)
+static Pango2FontMetrics *
+get_base_metrics (Pango2Fontset *fontset)
{
- PangoFontMetrics *metrics = NULL;
+ Pango2FontMetrics *metrics = NULL;
/* Initialize the metrics from the first font in the fontset */
- pango_fontset_foreach (fontset, get_first_metrics_foreach, &metrics);
+ pango2_fontset_foreach (fontset, get_first_metrics_foreach, &metrics);
return metrics;
}
static void
-update_metrics_from_items (PangoFontMetrics *metrics,
- PangoLanguage *language,
- const char *text,
- unsigned int text_len,
- GList *items)
+update_metrics_from_items (Pango2FontMetrics *metrics,
+ Pango2Language *language,
+ const char *text,
+ unsigned int text_len,
+ GList *items)
{
GHashTable *fonts_seen = g_hash_table_new (NULL, NULL);
- PangoGlyphString *glyphs = pango_glyph_string_new ();
+ Pango2GlyphString *glyphs = pango2_glyph_string_new ();
GList *l;
glong text_width;
@@ -851,46 +851,46 @@ update_metrics_from_items (PangoFontMetrics *metrics,
for (l = items; l; l = l->next)
{
- PangoItem *item = l->data;
- PangoFont *font = item->analysis.font;
+ Pango2Item *item = l->data;
+ Pango2Font *font = item->analysis.font;
if (font != NULL && g_hash_table_lookup (fonts_seen, font) == NULL)
{
- PangoFontMetrics *raw_metrics = pango_font_get_metrics (font, language);
+ Pango2FontMetrics *raw_metrics = pango2_font_get_metrics (font, language);
g_hash_table_insert (fonts_seen, font, font);
/* metrics will already be initialized from the first font in the fontset */
metrics->ascent = MAX (metrics->ascent, raw_metrics->ascent);
metrics->descent = MAX (metrics->descent, raw_metrics->descent);
metrics->height = MAX (metrics->height, raw_metrics->height);
- pango_font_metrics_free (raw_metrics);
+ pango2_font_metrics_free (raw_metrics);
}
- pango_shape (text + item->offset, item->length,
+ pango2_shape (text + item->offset, item->length,
text, text_len,
&item->analysis, glyphs,
- PANGO_SHAPE_NONE);
+ PANGO2_SHAPE_NONE);
- metrics->approximate_char_width += pango_glyph_string_get_width (glyphs);
+ metrics->approximate_char_width += pango2_glyph_string_get_width (glyphs);
}
- pango_glyph_string_free (glyphs);
+ pango2_glyph_string_free (glyphs);
g_hash_table_destroy (fonts_seen);
- text_width = pango_utf8_strwidth (text);
+ text_width = pango2_utf8_strwidth (text);
g_assert (text_width > 0);
metrics->approximate_char_width /= text_width;
}
/**
- * pango_context_get_metrics:
- * @context: a `PangoContext`
- * @desc: (nullable): a `PangoFontDescription` structure. %NULL means that the
+ * pango2_context_get_metrics:
+ * @context: a `Pango2Context`
+ * @desc: (nullable): a `Pango2FontDescription` structure. %NULL means that the
* font description from the context will be used.
* @language: (nullable): language tag used to determine which script to get
* the metrics for. %NULL means that the language tag from the context
* will be used. If no language tag is set on the context, metrics
- * for the default language (as determined by [func@Pango.Language.get_default]
+ * for the default language (as determined by [func@Pango2.Language.get_default]
* will be returned.
*
* Get overall metric information for a particular font description.
@@ -899,27 +899,27 @@ update_metrics_from_items (PangoFontMetrics *metrics,
* a language tag can be provided to indicate that the metrics should be
* retrieved that correspond to the script(s) used by that language.
*
- * The `PangoFontDescription` is interpreted in the same way as by [func@itemize],
+ * The `Pango2FontDescription` is interpreted in the same way as by [func@itemize],
* and the family name may be a comma separated list of names. If characters
* from multiple of these families would be used to render the string, then
* the returned fonts would be a composite of the metrics for the fonts loaded
* for the individual families.
*
- * Return value: a `PangoFontMetrics` object. The caller must call
- * [method@Pango.FontMetrics.free] when finished using the object.
+ * Return value: a `Pango2FontMetrics` object. The caller must call
+ * [method@Pango2.FontMetrics.free] when finished using the object.
*/
-PangoFontMetrics *
-pango_context_get_metrics (PangoContext *context,
- const PangoFontDescription *desc,
- PangoLanguage *language)
+Pango2FontMetrics *
+pango2_context_get_metrics (Pango2Context *context,
+ const Pango2FontDescription *desc,
+ Pango2Language *language)
{
- PangoFontset *current_fonts = NULL;
- PangoFontMetrics *metrics;
+ Pango2Fontset *current_fonts = NULL;
+ Pango2FontMetrics *metrics;
const char *sample_str;
unsigned int text_len;
GList *items;
- g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL);
if (!desc)
desc = context->font_desc;
@@ -930,21 +930,21 @@ pango_context_get_metrics (PangoContext *context,
if (desc == context->font_desc &&
language == context->language &&
context->metrics != NULL)
- return pango_font_metrics_copy (context->metrics);
+ return pango2_font_metrics_copy (context->metrics);
- current_fonts = pango_font_map_load_fontset (context->font_map, context, desc, language);
+ current_fonts = pango2_font_map_load_fontset (context->font_map, context, desc, language);
metrics = get_base_metrics (current_fonts);
- sample_str = pango_language_get_sample_string (language);
+ sample_str = pango2_language_get_sample_string (language);
text_len = strlen (sample_str);
- items = pango_itemize_with_font (context, context->base_dir,
- sample_str, 0, text_len,
- NULL, NULL,
- desc);
+ items = pango2_itemize_with_font (context, context->base_dir,
+ sample_str, 0, text_len,
+ NULL, NULL,
+ desc);
update_metrics_from_items (metrics, language, sample_str, text_len, items);
- g_list_foreach (items, (GFunc)pango_item_free, NULL);
+ g_list_foreach (items, (GFunc)pango2_item_free, NULL);
g_list_free (items);
g_object_unref (current_fonts);
@@ -952,84 +952,84 @@ pango_context_get_metrics (PangoContext *context,
if (desc == context->font_desc &&
language == context->language)
{
- pango_font_metrics_free (context->metrics);
- context->metrics = pango_font_metrics_copy (metrics);
+ pango2_font_metrics_free (context->metrics);
+ context->metrics = pango2_font_metrics_copy (metrics);
}
return metrics;
}
static void
-context_changed (PangoContext *context)
+context_changed (Pango2Context *context)
{
context->serial++;
if (context->serial == 0)
context->serial++;
- g_clear_pointer (&context->metrics, pango_font_metrics_free);
+ g_clear_pointer (&context->metrics, pango2_font_metrics_free);
}
/**
- * pango_context_changed:
- * @context: a `PangoContext`
+ * pango2_context_changed:
+ * @context: a `Pango2Context`
*
- * Forces a change in the context, which will cause any `PangoLayout`
+ * Forces a change in the context, which will cause any `Pango2Layout`
* using this context to re-layout.
*
* This function is only useful when implementing a new backend
- * for Pango, something applications won't do. Backends should
+ * for Pango2, something applications won't do. Backends should
* call this function if they have attached extra data to the context
* and such data is changed.
*/
void
-pango_context_changed (PangoContext *context)
+pango2_context_changed (Pango2Context *context)
{
context_changed (context);
}
static void
-check_fontmap_changed (PangoContext *context)
+check_fontmap_changed (Pango2Context *context)
{
guint old_serial = context->fontmap_serial;
if (!context->font_map)
return;
- context->fontmap_serial = pango_font_map_get_serial (context->font_map);
+ context->fontmap_serial = pango2_font_map_get_serial (context->font_map);
if (old_serial != context->fontmap_serial)
context_changed (context);
}
/**
- * pango_context_get_serial:
- * @context: a `PangoContext`
+ * pango2_context_get_serial:
+ * @context: a `Pango2Context`
*
* Returns the current serial number of @context.
*
* The serial number is initialized to an small number larger than zero
* when a new context is created and is increased whenever the context
- * is changed using any of the setter functions, or the `PangoFontMap` it
+ * is changed using any of the setter functions, or the `Pango2FontMap` it
* uses to find fonts has changed. The serial may wrap, but will never
* have the value 0. Since it can wrap, never compare it with "less than",
* always use "not equals".
*
- * This can be used to automatically detect changes to a `PangoContext`,
+ * This can be used to automatically detect changes to a `Pango2Context`,
* and is only useful when implementing objects that need update when their
- * `PangoContext` changes, like `PangoLayout`.
+ * `Pango2Context` changes, like `Pango2Layout`.
*
* Return value: The current serial number of @context.
*/
guint
-pango_context_get_serial (PangoContext *context)
+pango2_context_get_serial (Pango2Context *context)
{
check_fontmap_changed (context);
return context->serial;
}
/**
- * pango_context_set_round_glyph_positions:
- * @context: a `PangoContext`
+ * pango2_context_set_round_glyph_positions:
+ * @context: a `Pango2Context`
* @round_positions: whether to round glyph positions
*
* Sets whether font rendering with this context should
@@ -1040,11 +1040,11 @@ pango_context_get_serial (PangoContext *context)
* positioning of glyphs.
*
* The default value is to round glyph positions, to remain
- * compatible with previous Pango behavior.
+ * compatible with previous Pango2 behavior.
*/
void
-pango_context_set_round_glyph_positions (PangoContext *context,
- gboolean round_positions)
+pango2_context_set_round_glyph_positions (Pango2Context *context,
+ gboolean round_positions)
{
if (context->round_glyph_positions == round_positions)
return;
@@ -1055,14 +1055,14 @@ pango_context_set_round_glyph_positions (PangoContext *context,
}
/**
- * pango_context_get_round_glyph_positions:
- * @context: a `PangoContext`
+ * pango2_context_get_round_glyph_positions:
+ * @context: a `Pango2Context`
*
* Returns whether font rendering with this context should
* round glyph positions and widths.
*/
gboolean
-pango_context_get_round_glyph_positions (PangoContext *context)
+pango2_context_get_round_glyph_positions (Pango2Context *context)
{
return context->round_glyph_positions;
}
diff --git a/pango/pango-context.h b/pango/pango-context.h
index 99400fef..70bc03c5 100644
--- a/pango/pango-context.h
+++ b/pango/pango-context.h
@@ -27,76 +27,76 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_CONTEXT (pango_context_get_type ())
+#define PANGO2_TYPE_CONTEXT (pango2_context_get_type ())
-PANGO_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (PangoContext, pango_context, PANGO, CONTEXT, GObject);
+PANGO2_AVAILABLE_IN_ALL
+G_DECLARE_FINAL_TYPE (Pango2Context, pango2_context, PANGO2, CONTEXT, GObject);
-PANGO_AVAILABLE_IN_ALL
-PangoContext * pango_context_new (void);
-PANGO_AVAILABLE_IN_ALL
-PangoContext * pango_context_new_with_font_map (PangoFontMap *font_map);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Context * pango2_context_new (void);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Context * pango2_context_new_with_font_map (Pango2FontMap *font_map);
-PANGO_AVAILABLE_IN_ALL
-void pango_context_changed (PangoContext *context);
-PANGO_AVAILABLE_IN_ALL
-void pango_context_set_font_map (PangoContext *context,
- PangoFontMap *font_map);
-PANGO_AVAILABLE_IN_ALL
-PangoFontMap * pango_context_get_font_map (PangoContext *context);
-PANGO_AVAILABLE_IN_ALL
-guint pango_context_get_serial (PangoContext *context);
-PANGO_AVAILABLE_IN_ALL
-PangoFont * pango_context_load_font (PangoContext *context,
- const PangoFontDescription *desc);
-PANGO_AVAILABLE_IN_ALL
-PangoFontset * pango_context_load_fontset (PangoContext *context,
- const PangoFontDescription *desc,
- PangoLanguage *language);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_context_changed (Pango2Context *context);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_context_set_font_map (Pango2Context *context,
+ Pango2FontMap *font_map);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontMap * pango2_context_get_font_map (Pango2Context *context);
+PANGO2_AVAILABLE_IN_ALL
+guint pango2_context_get_serial (Pango2Context *context);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Font * pango2_context_load_font (Pango2Context *context,
+ const Pango2FontDescription *desc);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Fontset * pango2_context_load_fontset (Pango2Context *context,
+ const Pango2FontDescription *desc,
+ Pango2Language *language);
-PANGO_AVAILABLE_IN_ALL
-PangoFontMetrics * pango_context_get_metrics (PangoContext *context,
- const PangoFontDescription *desc,
- PangoLanguage *language);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontMetrics * pango2_context_get_metrics (Pango2Context *context,
+ const Pango2FontDescription *desc,
+ Pango2Language *language);
-PANGO_AVAILABLE_IN_ALL
-void pango_context_set_font_description (PangoContext *context,
- const PangoFontDescription *desc);
-PANGO_AVAILABLE_IN_ALL
-PangoFontDescription * pango_context_get_font_description (PangoContext *context);
-PANGO_AVAILABLE_IN_ALL
-PangoLanguage * pango_context_get_language (PangoContext *context);
-PANGO_AVAILABLE_IN_ALL
-void pango_context_set_language (PangoContext *context,
- PangoLanguage *language);
-PANGO_AVAILABLE_IN_ALL
-void pango_context_set_base_dir (PangoContext *context,
- PangoDirection direction);
-PANGO_AVAILABLE_IN_ALL
-PangoDirection pango_context_get_base_dir (PangoContext *context);
-PANGO_AVAILABLE_IN_ALL
-void pango_context_set_base_gravity (PangoContext *context,
- PangoGravity gravity);
-PANGO_AVAILABLE_IN_ALL
-PangoGravity pango_context_get_base_gravity (PangoContext *context);
-PANGO_AVAILABLE_IN_ALL
-PangoGravity pango_context_get_gravity (PangoContext *context);
-PANGO_AVAILABLE_IN_ALL
-void pango_context_set_gravity_hint (PangoContext *context,
- PangoGravityHint hint);
-PANGO_AVAILABLE_IN_ALL
-PangoGravityHint pango_context_get_gravity_hint (PangoContext *context);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_context_set_font_description (Pango2Context *context,
+ const Pango2FontDescription *desc);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontDescription * pango2_context_get_font_description (Pango2Context *context);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Language * pango2_context_get_language (Pango2Context *context);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_context_set_language (Pango2Context *context,
+ Pango2Language *language);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_context_set_base_dir (Pango2Context *context,
+ Pango2Direction direction);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Direction pango2_context_get_base_dir (Pango2Context *context);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_context_set_base_gravity (Pango2Context *context,
+ Pango2Gravity gravity);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Gravity pango2_context_get_base_gravity (Pango2Context *context);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Gravity pango2_context_get_gravity (Pango2Context *context);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_context_set_gravity_hint (Pango2Context *context,
+ Pango2GravityHint hint);
+PANGO2_AVAILABLE_IN_ALL
+Pango2GravityHint pango2_context_get_gravity_hint (Pango2Context *context);
-PANGO_AVAILABLE_IN_ALL
-void pango_context_set_matrix (PangoContext *context,
- const PangoMatrix *matrix);
-PANGO_AVAILABLE_IN_ALL
-const PangoMatrix * pango_context_get_matrix (PangoContext *context);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_context_set_matrix (Pango2Context *context,
+ const Pango2Matrix *matrix);
+PANGO2_AVAILABLE_IN_ALL
+const Pango2Matrix * pango2_context_get_matrix (Pango2Context *context);
-PANGO_AVAILABLE_IN_ALL
-void pango_context_set_round_glyph_positions (PangoContext *context,
- gboolean round_positions);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_context_get_round_glyph_positions (PangoContext *context);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_context_set_round_glyph_positions (Pango2Context *context,
+ gboolean round_positions);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_context_get_round_glyph_positions (Pango2Context *context);
G_END_DECLS
diff --git a/pango/pango-direction.h b/pango/pango-direction.h
index 48e40276..cf32c48a 100644
--- a/pango/pango-direction.h
+++ b/pango/pango-direction.h
@@ -24,34 +24,34 @@
G_BEGIN_DECLS
/**
- * PangoDirection:
- * @PANGO_DIRECTION_LTR: A strong left-to-right direction
- * @PANGO_DIRECTION_RTL: A strong right-to-left direction
- * @PANGO_DIRECTION_WEAK_LTR: A weak left-to-right direction
- * @PANGO_DIRECTION_WEAK_RTL: A weak right-to-left direction
- * @PANGO_DIRECTION_NEUTRAL: No direction specified
- *
- * `PangoDirection` represents a direction in the Unicode bidirectional
+ * Pango2Direction:
+ * @PANGO2_DIRECTION_LTR: A strong left-to-right direction
+ * @PANGO2_DIRECTION_RTL: A strong right-to-left direction
+ * @PANGO2_DIRECTION_WEAK_LTR: A weak left-to-right direction
+ * @PANGO2_DIRECTION_WEAK_RTL: A weak right-to-left direction
+ * @PANGO2_DIRECTION_NEUTRAL: No direction specified
+ *
+ * `Pango2Direction` represents a direction in the Unicode bidirectional
* algorithm.
*
* Not every value in this enumeration makes sense for every usage of
- * `PangoDirection`; for example, the direction of characters cannot be
- * `PANGO_DIRECTION_WEAK_LTR` or `PANGO_DIRECTION_WEAK_RTL`, since every
+ * `Pango2Direction`; for example, the direction of characters cannot be
+ * `PANGO2_DIRECTION_WEAK_LTR` or `PANGO2_DIRECTION_WEAK_RTL`, since every
* character is either neutral or has a strong direction; on the other hand
- * `PANGO_DIRECTION_NEUTRAL` doesn't make sense to pass to [func@itemize].
+ * `PANGO2_DIRECTION_NEUTRAL` doesn't make sense to pass to [func@itemize].
*
- * See `PangoGravity` for how vertical text is handled in Pango.
+ * See `Pango2Gravity` for how vertical text is handled in Pango2.
*
* If you are interested in text direction, you should really use
- * [fribidi](http://fribidi.org/) directly. `PangoDirection` is only
+ * [fribidi](http://fribidi.org/) directly. `Pango2Direction` is only
* retained because it is used in some public apis.
*/
typedef enum {
- PANGO_DIRECTION_LTR,
- PANGO_DIRECTION_RTL,
- PANGO_DIRECTION_WEAK_LTR,
- PANGO_DIRECTION_WEAK_RTL,
- PANGO_DIRECTION_NEUTRAL
-} PangoDirection;
+ PANGO2_DIRECTION_LTR,
+ PANGO2_DIRECTION_RTL,
+ PANGO2_DIRECTION_WEAK_LTR,
+ PANGO2_DIRECTION_WEAK_RTL,
+ PANGO2_DIRECTION_NEUTRAL
+} Pango2Direction;
G_END_DECLS
diff --git a/pango/pango-emoji-private.h b/pango/pango-emoji-private.h
index fae2939e..f7578bf4 100644
--- a/pango/pango-emoji-private.h
+++ b/pango/pango-emoji-private.h
@@ -22,14 +22,14 @@
#include <glib.h>
gboolean
-_pango_Is_Emoji_Base_Character (gunichar ch);
+_pango2_Is_Emoji_Base_Character (gunichar ch);
gboolean
-_pango_Is_Emoji_Extended_Pictographic (gunichar ch);
+_pango2_Is_Emoji_Extended_Pictographic (gunichar ch);
-typedef struct _PangoEmojiIter PangoEmojiIter;
+typedef struct _Pango2EmojiIter Pango2EmojiIter;
-struct _PangoEmojiIter
+struct _Pango2EmojiIter
{
const char *text_start;
const char *text_end;
@@ -42,13 +42,13 @@ struct _PangoEmojiIter
unsigned int cursor;
};
-PangoEmojiIter *
-_pango_emoji_iter_init (PangoEmojiIter *iter,
- const char *text,
- int length);
+Pango2EmojiIter *
+_pango2_emoji_iter_init (Pango2EmojiIter *iter,
+ const char *text,
+ int length);
gboolean
-_pango_emoji_iter_next (PangoEmojiIter *iter);
+_pango2_emoji_iter_next (Pango2EmojiIter *iter);
void
-_pango_emoji_iter_fini (PangoEmojiIter *iter);
+_pango2_emoji_iter_fini (Pango2EmojiIter *iter);
diff --git a/pango/pango-emoji-table.h b/pango/pango-emoji-table.h
index 84cd9193..00f1dd13 100644
--- a/pango/pango-emoji-table.h
+++ b/pango/pango-emoji-table.h
@@ -18,8 +18,8 @@
* # For documentation and usage, see http://www.unicode.org/reports/tr51
*/
-#ifndef PANGO_EMOJI_TABLE_H
-#define PANGO_EMOJI_TABLE_H
+#ifndef PANGO2_EMOJI_TABLE_H
+#define PANGO2_EMOJI_TABLE_H
#include <glib.h>
@@ -27,7 +27,7 @@ struct Interval {
gunichar start, end;
};
-static const struct Interval _pango_Emoji_table[] =
+static const struct Interval _pango2_Emoji_table[] =
{
{0x0023, 0x0023},
{0x002A, 0x002A},
@@ -184,7 +184,7 @@ static const struct Interval _pango_Emoji_table[] =
{0x1FAF0, 0x1FAF6},
};
-static const struct Interval _pango_Emoji_Presentation_table[] =
+static const struct Interval _pango2_Emoji_Presentation_table[] =
{
{0x231A, 0x231B},
{0x23E9, 0x23EC},
@@ -271,12 +271,12 @@ static const struct Interval _pango_Emoji_Presentation_table[] =
{0x1FAF0, 0x1FAF6},
};
-static const struct Interval _pango_Emoji_Modifier_table[] =
+static const struct Interval _pango2_Emoji_Modifier_table[] =
{
{0x1F3FB, 0x1F3FF},
};
-static const struct Interval _pango_Emoji_Modifier_Base_table[] =
+static const struct Interval _pango2_Emoji_Modifier_Base_table[] =
{
{0x261D, 0x261D},
{0x26F9, 0x26F9},
@@ -320,7 +320,7 @@ static const struct Interval _pango_Emoji_Modifier_Base_table[] =
{0x1FAF0, 0x1FAF6},
};
-static const struct Interval _pango_Extended_Pictographic_table[] =
+static const struct Interval _pango2_Extended_Pictographic_table[] =
{
{0x00A9, 0x00A9},
{0x00AE, 0x00AE},
@@ -402,6 +402,6 @@ static const struct Interval _pango_Extended_Pictographic_table[] =
{0x1FC00, 0x1FFFD},
};
-#endif /* PANGO_EMOJI_TABLE_H */
+#endif /* PANGO2_EMOJI_TABLE_H */
/* == End of generated table == */
diff --git a/pango/pango-emoji.c b/pango/pango-emoji.c
index e1f16dba..aa82e9ec 100644
--- a/pango/pango-emoji.c
+++ b/pango/pango-emoji.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-emoji.c: Emoji handling
*
* Copyright (C) 2017 Google, Inc.
@@ -18,7 +18,7 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * Implementation of pango_emoji_iter is based on Chromium's Ragel-based
+ * Implementation of pango2_emoji_iter is based on Chromium's Ragel-based
* parser:
*
* https://chromium-review.googlesource.com/c/chromium/src/+/1264577
@@ -75,48 +75,48 @@ bsearch_interval (gunichar c,
return FALSE;
}
-#define DEFINE_pango_Is_(name) \
+#define DEFINE_pango2_Is_(name) \
static inline gboolean \
-_pango_Is_##name (gunichar ch) \
+_pango2_Is_##name (gunichar ch) \
{ \
- return ch >= _pango_##name##_table[0].start && \
+ return ch >= _pango2_##name##_table[0].start && \
bsearch_interval (ch, \
- _pango_##name##_table, \
- G_N_ELEMENTS (_pango_##name##_table)); \
+ _pango2_##name##_table, \
+ G_N_ELEMENTS (_pango2_##name##_table)); \
}
-DEFINE_pango_Is_(Emoji)
-DEFINE_pango_Is_(Emoji_Presentation)
-DEFINE_pango_Is_(Emoji_Modifier)
-DEFINE_pango_Is_(Emoji_Modifier_Base)
-DEFINE_pango_Is_(Extended_Pictographic)
+DEFINE_pango2_Is_(Emoji)
+DEFINE_pango2_Is_(Emoji_Presentation)
+DEFINE_pango2_Is_(Emoji_Modifier)
+DEFINE_pango2_Is_(Emoji_Modifier_Base)
+DEFINE_pango2_Is_(Extended_Pictographic)
gboolean
-_pango_Is_Emoji_Base_Character (gunichar ch)
+_pango2_Is_Emoji_Base_Character (gunichar ch)
{
- return _pango_Is_Emoji (ch);
+ return _pango2_Is_Emoji (ch);
}
gboolean
-_pango_Is_Emoji_Extended_Pictographic (gunichar ch)
+_pango2_Is_Emoji_Extended_Pictographic (gunichar ch)
{
- return _pango_Is_Extended_Pictographic (ch);
+ return _pango2_Is_Extended_Pictographic (ch);
}
static inline gboolean
-_pango_Is_Emoji_Emoji_Default (gunichar ch)
+_pango2_Is_Emoji_Emoji_Default (gunichar ch)
{
- return _pango_Is_Emoji_Presentation (ch);
+ return _pango2_Is_Emoji_Presentation (ch);
}
static inline gboolean
-_pango_Is_Emoji_Keycap_Base (gunichar ch)
+_pango2_Is_Emoji_Keycap_Base (gunichar ch)
{
return (ch >= '0' && ch <= '9') || ch == '#' || ch == '*';
}
static inline gboolean
-_pango_Is_Regional_Indicator (gunichar ch)
+_pango2_Is_Regional_Indicator (gunichar ch)
{
return (ch >= 0x1F1E6 && ch <= 0x1F1FF);
}
@@ -128,7 +128,7 @@ _pango_Is_Regional_Indicator (gunichar ch)
#define kVariationSelector16Character 0xFE0F
#define kZeroWidthJoinerCharacter 0x200D
-enum PangoEmojiScannerCategory {
+enum Pango2EmojiScannerCategory {
EMOJI = 0,
EMOJI_TEXT_PRESENTATION = 1,
EMOJI_EMOJI_PRESENTATION = 2,
@@ -149,7 +149,7 @@ enum PangoEmojiScannerCategory {
};
static inline unsigned char
-_pango_EmojiSegmentationCategory (gunichar codepoint)
+_pango2_EmojiSegmentationCategory (gunichar codepoint)
{
/* Specific ones first. */
if (('a' <= codepoint && codepoint <= 'z') ||
@@ -183,17 +183,17 @@ _pango_EmojiSegmentationCategory (gunichar codepoint)
(0xE0061 <= codepoint && codepoint <= 0xE007A))
return TAG_SEQUENCE;
- if (_pango_Is_Emoji_Modifier_Base (codepoint))
+ if (_pango2_Is_Emoji_Modifier_Base (codepoint))
return EMOJI_MODIFIER_BASE;
- if (_pango_Is_Emoji_Modifier (codepoint))
+ if (_pango2_Is_Emoji_Modifier (codepoint))
return EMOJI_MODIFIER;
- if (_pango_Is_Regional_Indicator (codepoint))
+ if (_pango2_Is_Regional_Indicator (codepoint))
return REGIONAL_INDICATOR;
- if (_pango_Is_Emoji_Keycap_Base (codepoint))
+ if (_pango2_Is_Emoji_Keycap_Base (codepoint))
return KEYCAP_BASE;
- if (_pango_Is_Emoji_Emoji_Default (codepoint))
+ if (_pango2_Is_Emoji_Emoji_Default (codepoint))
return EMOJI_EMOJI_PRESENTATION;
- if (_pango_Is_Emoji (codepoint))
+ if (_pango2_Is_Emoji (codepoint))
return EMOJI_TEXT_PRESENTATION;
/* Ragel state machine will interpret unknown category as "any". */
@@ -211,8 +211,8 @@ typedef unsigned char *emoji_text_iter_t;
#pragma GCC diagnostic pop
-PangoEmojiIter *
-_pango_emoji_iter_init (PangoEmojiIter *iter,
+Pango2EmojiIter *
+_pango2_emoji_iter_init (Pango2EmojiIter *iter,
const char *text,
int length)
{
@@ -224,7 +224,7 @@ _pango_emoji_iter_init (PangoEmojiIter *iter,
p = text;
for (i = 0; i < n_chars; i++)
{
- types[i] = _pango_EmojiSegmentationCategory (g_utf8_get_char (p));
+ types[i] = _pango2_EmojiSegmentationCategory (g_utf8_get_char (p));
p = g_utf8_next_char (p);
}
@@ -239,19 +239,19 @@ _pango_emoji_iter_init (PangoEmojiIter *iter,
iter->n_chars = n_chars;
iter->cursor = 0;
- _pango_emoji_iter_next (iter);
+ _pango2_emoji_iter_next (iter);
return iter;
}
void
-_pango_emoji_iter_fini (PangoEmojiIter *iter)
+_pango2_emoji_iter_fini (Pango2EmojiIter *iter)
{
g_free (iter->types);
}
gboolean
-_pango_emoji_iter_next (PangoEmojiIter *iter)
+_pango2_emoji_iter_next (Pango2EmojiIter *iter)
{
unsigned int old_cursor, cursor;
gboolean is_emoji;
diff --git a/pango/pango-enum-types.h.template b/pango/pango-enum-types.h.template
index c26679ea..e511f9c2 100644
--- a/pango/pango-enum-types.h.template
+++ b/pango/pango-enum-types.h.template
@@ -1,6 +1,5 @@
/*** BEGIN file-header ***/
-#ifndef __PANGO_ENUM_TYPES_H__
-#define __PANGO_ENUM_TYPES_H__
+#pragma once
#include <glib-object.h>
@@ -15,7 +14,7 @@ G_BEGIN_DECLS
/*** END file-production ***/
/*** BEGIN value-header ***/
-PANGO_AVAILABLE_IN_ALL
+PANGO2_AVAILABLE_IN_ALL
GType @enum_name@_get_type (void) G_GNUC_CONST;
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
/*** END value-header ***/
@@ -23,5 +22,4 @@ GType @enum_name@_get_type (void) G_GNUC_CONST;
/*** BEGIN file-tail ***/
G_END_DECLS
-#endif /* __PANGO_ENUM_TYPES_H__ */
/*** END file-tail ***/
diff --git a/pango/pango-features.h.meson b/pango/pango-features.h.meson
index d0043ff3..d89f5ad8 100644
--- a/pango/pango-features.h.meson
+++ b/pango/pango-features.h.meson
@@ -1,9 +1,9 @@
#pragma once
-#mesondefine PANGO_VERSION_MAJOR
-#mesondefine PANGO_VERSION_MINOR
-#mesondefine PANGO_VERSION_MICRO
+#mesondefine PANGO2_VERSION_MAJOR
+#mesondefine PANGO2_VERSION_MINOR
+#mesondefine PANGO2_VERSION_MICRO
-#define PANGO_VERSION_STRING "@PANGO_VERSION_MAJOR@.@PANGO_VERSION_MINOR@.@PANGO_VERSION_MICRO@"
+#define PANGO2_VERSION_STRING "@PANGO2_VERSION_MAJOR@.@PANGO2_VERSION_MINOR@.@PANGO2_VERSION_MICRO@"
#
-#mesondefine PANGO_RENDERING_CAIRO
+#mesondefine PANGO2_RENDERING_CAIRO
diff --git a/pango/pango-font-description-private.h b/pango/pango-font-description-private.h
index 353cdd92..11b09d00 100644
--- a/pango/pango-font-description-private.h
+++ b/pango/pango-font-description-private.h
@@ -22,22 +22,22 @@
#include "pango-font-description.h"
-gboolean pango_font_description_is_similar (const PangoFontDescription *a,
- const PangoFontDescription *b);
+gboolean pango2_font_description_is_similar (const Pango2FontDescription *a,
+ const Pango2FontDescription *b);
-int pango_font_description_compute_distance (const PangoFontDescription *a,
- const PangoFontDescription *b);
+int pango2_font_description_compute_distance (const Pango2FontDescription *a,
+ const Pango2FontDescription *b);
-gboolean pango_parse_style (const char *str,
- PangoStyle *style,
- gboolean warn);
-gboolean pango_parse_variant (const char *str,
- PangoVariant *variant,
- gboolean warn);
-gboolean pango_parse_weight (const char *str,
- PangoWeight *weight,
- gboolean warn);
-gboolean pango_parse_stretch (const char *str,
- PangoStretch *stretch,
- gboolean warn);
+gboolean pango2_parse_style (const char *str,
+ Pango2Style *style,
+ gboolean warn);
+gboolean pango2_parse_variant (const char *str,
+ Pango2Variant *variant,
+ gboolean warn);
+gboolean pango2_parse_weight (const char *str,
+ Pango2Weight *weight,
+ gboolean warn);
+gboolean pango2_parse_stretch (const char *str,
+ Pango2Stretch *stretch,
+ gboolean warn);
diff --git a/pango/pango-font-description.c b/pango/pango-font-description.c
index 4f8e0acc..db22853b 100644
--- a/pango/pango-font-description.c
+++ b/pango/pango-font-description.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-font-description.c:
*
* Copyright (C) 1999 Red Hat Software
@@ -24,15 +24,15 @@
#include "pango-font-description-private.h"
-struct _PangoFontDescription
+struct _Pango2FontDescription
{
char *family_name;
- PangoStyle style;
- PangoVariant variant;
- PangoWeight weight;
- PangoStretch stretch;
- PangoGravity gravity;
+ Pango2Style style;
+ Pango2Variant variant;
+ Pango2Weight weight;
+ Pango2Stretch stretch;
+ Pango2Gravity gravity;
int size;
@@ -46,18 +46,18 @@ struct _PangoFontDescription
guint size_is_absolute : 1;
};
-G_DEFINE_BOXED_TYPE (PangoFontDescription, pango_font_description,
- pango_font_description_copy,
- pango_font_description_free);
+G_DEFINE_BOXED_TYPE (Pango2FontDescription, pango2_font_description,
+ pango2_font_description_copy,
+ pango2_font_description_free);
-static const PangoFontDescription pfd_defaults = {
+static const Pango2FontDescription pfd_defaults = {
NULL, /* family_name */
- PANGO_STYLE_NORMAL, /* style */
- PANGO_VARIANT_NORMAL, /* variant */
- PANGO_WEIGHT_NORMAL, /* weight */
- PANGO_STRETCH_NORMAL, /* stretch */
- PANGO_GRAVITY_SOUTH, /* gravity */
+ PANGO2_STYLE_NORMAL, /* style */
+ PANGO2_VARIANT_NORMAL, /* variant */
+ PANGO2_WEIGHT_NORMAL, /* weight */
+ PANGO2_STRETCH_NORMAL, /* stretch */
+ PANGO2_GRAVITY_SOUTH, /* gravity */
0, /* size */
NULL, /* variations */
NULL, /* faceid */
@@ -70,17 +70,17 @@ static const PangoFontDescription pfd_defaults = {
};
/**
- * pango_font_description_new:
+ * pango2_font_description_new:
*
* Creates a new font description structure with all fields unset.
*
- * Return value: the newly allocated `PangoFontDescription`, which
- * should be freed using [method@Pango.FontDescription.free]
+ * Return value: the newly allocated `Pango2FontDescription`, which
+ * should be freed using [method@Pango2.FontDescription.free]
*/
-PangoFontDescription *
-pango_font_description_new (void)
+Pango2FontDescription *
+pango2_font_description_new (void)
{
- PangoFontDescription *desc = g_slice_new (PangoFontDescription);
+ Pango2FontDescription *desc = g_slice_new (Pango2FontDescription);
*desc = pfd_defaults;
@@ -88,45 +88,45 @@ pango_font_description_new (void)
}
/**
- * pango_font_description_set_family:
- * @desc: a `PangoFontDescription`.
+ * pango2_font_description_set_family:
+ * @desc: a `Pango2FontDescription`.
* @family: a string representing the family name.
*
* Sets the family name field of a font description.
*
* The family
* name represents a family of related font styles, and will
- * resolve to a particular `PangoFontFamily`. In some uses of
- * `PangoFontDescription`, it is also possible to use a comma
+ * resolve to a particular `Pango2FontFamily`. In some uses of
+ * `Pango2FontDescription`, it is also possible to use a comma
* separated list of family names for this field.
*/
void
-pango_font_description_set_family (PangoFontDescription *desc,
- const char *family)
+pango2_font_description_set_family (Pango2FontDescription *desc,
+ const char *family)
{
g_return_if_fail (desc != NULL);
- pango_font_description_set_family_static (desc, family ? g_strdup (family) : NULL);
+ pango2_font_description_set_family_static (desc, family ? g_strdup (family) : NULL);
if (family)
desc->static_family = FALSE;
}
/**
- * pango_font_description_set_family_static:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_set_family_static:
+ * @desc: a `Pango2FontDescription`
* @family: a string representing the family name
*
* Sets the family name field of a font description, without copying the string.
*
- * This is like [method@Pango.FontDescription.set_family], except that no
+ * This is like [method@Pango2.FontDescription.set_family], except that no
* copy of @family is made. The caller must make sure that the
* string passed in stays around until @desc has been freed or the
* name is set again. This function can be used if @family is a static
* string such as a C string literal, or if @desc is only needed temporarily.
*/
void
-pango_font_description_set_family_static (PangoFontDescription *desc,
- const char *family)
+pango2_font_description_set_family_static (Pango2FontDescription *desc,
+ const char *family)
{
g_return_if_fail (desc != NULL);
@@ -140,30 +140,30 @@ pango_font_description_set_family_static (PangoFontDescription *desc,
{
desc->family_name = (char *)family;
desc->static_family = TRUE;
- desc->mask |= PANGO_FONT_MASK_FAMILY;
+ desc->mask |= PANGO2_FONT_MASK_FAMILY;
}
else
{
desc->family_name = pfd_defaults.family_name;
desc->static_family = pfd_defaults.static_family;
- desc->mask &= ~PANGO_FONT_MASK_FAMILY;
+ desc->mask &= ~PANGO2_FONT_MASK_FAMILY;
}
}
/**
- * pango_font_description_get_family:
- * @desc: a `PangoFontDescription`.
+ * pango2_font_description_get_family:
+ * @desc: a `Pango2FontDescription`.
*
* Gets the family name field of a font description.
*
- * See [method@Pango.FontDescription.set_family].
+ * See [method@Pango2.FontDescription.set_family].
*
* Return value: (nullable): the family name field for the font
* description, or %NULL if not previously set. This has the same
* life-time as the font description itself and should not be freed.
*/
const char *
-pango_font_description_get_family (const PangoFontDescription *desc)
+pango2_font_description_get_family (const Pango2FontDescription *desc)
{
g_return_val_if_fail (desc != NULL, NULL);
@@ -171,45 +171,45 @@ pango_font_description_get_family (const PangoFontDescription *desc)
}
/**
- * pango_font_description_set_style:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_set_style:
+ * @desc: a `Pango2FontDescription`
* @style: the style for the font description
*
- * Sets the style field of a `PangoFontDescription`.
+ * Sets the style field of a `Pango2FontDescription`.
*
- * The [enum@Pango.Style] enumeration describes whether the font is
+ * The [enum@Pango2.Style] enumeration describes whether the font is
* slanted and the manner in which it is slanted; it can be either
- * %PANGO_STYLE_NORMAL, %PANGO_STYLE_ITALIC, or %PANGO_STYLE_OBLIQUE.
+ * %PANGO2_STYLE_NORMAL, %PANGO2_STYLE_ITALIC, or %PANGO2_STYLE_OBLIQUE.
*
* Most fonts will either have a italic style or an oblique style,
- * but not both, and font matching in Pango will match italic
+ * but not both, and font matching in Pango2 will match italic
* specifications with oblique fonts and vice-versa if an exact
* match is not found.
*/
void
-pango_font_description_set_style (PangoFontDescription *desc,
- PangoStyle style)
+pango2_font_description_set_style (Pango2FontDescription *desc,
+ Pango2Style style)
{
g_return_if_fail (desc != NULL);
desc->style = style;
- desc->mask |= PANGO_FONT_MASK_STYLE;
+ desc->mask |= PANGO2_FONT_MASK_STYLE;
}
/**
- * pango_font_description_get_style:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_get_style:
+ * @desc: a `Pango2FontDescription`
*
- * Gets the style field of a `PangoFontDescription`.
+ * Gets the style field of a `Pango2FontDescription`.
*
- * See [method@Pango.FontDescription.set_style].
+ * See [method@Pango2.FontDescription.set_style].
*
* Return value: the style field for the font description.
- * Use [method@Pango.FontDescription.get_set_fields] to
+ * Use [method@Pango2.FontDescription.get_set_fields] to
* find out if the field was explicitly set or not.
*/
-PangoStyle
-pango_font_description_get_style (const PangoFontDescription *desc)
+Pango2Style
+pango2_font_description_get_style (const Pango2FontDescription *desc)
{
g_return_val_if_fail (desc != NULL, pfd_defaults.style);
@@ -217,39 +217,39 @@ pango_font_description_get_style (const PangoFontDescription *desc)
}
/**
- * pango_font_description_set_variant:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_set_variant:
+ * @desc: a `Pango2FontDescription`
* @variant: the variant type for the font description.
*
* Sets the variant field of a font description.
*
- * The [enum@Pango.Variant] can either be %PANGO_VARIANT_NORMAL
- * or %PANGO_VARIANT_SMALL_CAPS.
+ * The [enum@Pango2.Variant] can either be %PANGO2_VARIANT_NORMAL
+ * or %PANGO2_VARIANT_SMALL_CAPS.
*/
void
-pango_font_description_set_variant (PangoFontDescription *desc,
- PangoVariant variant)
+pango2_font_description_set_variant (Pango2FontDescription *desc,
+ Pango2Variant variant)
{
g_return_if_fail (desc != NULL);
desc->variant = variant;
- desc->mask |= PANGO_FONT_MASK_VARIANT;
+ desc->mask |= PANGO2_FONT_MASK_VARIANT;
}
/**
- * pango_font_description_get_variant:
- * @desc: a `PangoFontDescription`.
+ * pango2_font_description_get_variant:
+ * @desc: a `Pango2FontDescription`.
*
- * Gets the variant field of a `PangoFontDescription`.
+ * Gets the variant field of a `Pango2FontDescription`.
*
- * See [method@Pango.FontDescription.set_variant].
+ * See [method@Pango2.FontDescription.set_variant].
*
* Return value: the variant field for the font description.
- * Use [method@Pango.FontDescription.get_set_fields] to find
+ * Use [method@Pango2.FontDescription.get_set_fields] to find
* out if the field was explicitly set or not.
*/
-PangoVariant
-pango_font_description_get_variant (const PangoFontDescription *desc)
+Pango2Variant
+pango2_font_description_get_variant (const Pango2FontDescription *desc)
{
g_return_val_if_fail (desc != NULL, pfd_defaults.variant);
@@ -257,41 +257,41 @@ pango_font_description_get_variant (const PangoFontDescription *desc)
}
/**
- * pango_font_description_set_weight:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_set_weight:
+ * @desc: a `Pango2FontDescription`
* @weight: the weight for the font description.
*
* Sets the weight field of a font description.
*
* The weight field
* specifies how bold or light the font should be. In addition
- * to the values of the [enum@Pango.Weight] enumeration, other
+ * to the values of the [enum@Pango2.Weight] enumeration, other
* intermediate numeric values are possible.
*/
void
-pango_font_description_set_weight (PangoFontDescription *desc,
- PangoWeight weight)
+pango2_font_description_set_weight (Pango2FontDescription *desc,
+ Pango2Weight weight)
{
g_return_if_fail (desc != NULL);
desc->weight = weight;
- desc->mask |= PANGO_FONT_MASK_WEIGHT;
+ desc->mask |= PANGO2_FONT_MASK_WEIGHT;
}
/**
- * pango_font_description_get_weight:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_get_weight:
+ * @desc: a `Pango2FontDescription`
*
* Gets the weight field of a font description.
*
- * See [method@Pango.FontDescription.set_weight].
+ * See [method@Pango2.FontDescription.set_weight].
*
* Return value: the weight field for the font description.
- * Use [method@Pango.FontDescription.get_set_fields] to find
+ * Use [method@Pango2.FontDescription.get_set_fields] to find
* out if the field was explicitly set or not.
*/
-PangoWeight
-pango_font_description_get_weight (const PangoFontDescription *desc)
+Pango2Weight
+pango2_font_description_get_weight (const Pango2FontDescription *desc)
{
g_return_val_if_fail (desc != NULL, pfd_defaults.weight);
@@ -299,39 +299,39 @@ pango_font_description_get_weight (const PangoFontDescription *desc)
}
/**
- * pango_font_description_set_stretch:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_set_stretch:
+ * @desc: a `Pango2FontDescription`
* @stretch: the stretch for the font description
*
* Sets the stretch field of a font description.
*
- * The [enum@Pango.Stretch] field specifies how narrow or
+ * The [enum@Pango2.Stretch] field specifies how narrow or
* wide the font should be.
*/
void
-pango_font_description_set_stretch (PangoFontDescription *desc,
- PangoStretch stretch)
+pango2_font_description_set_stretch (Pango2FontDescription *desc,
+ Pango2Stretch stretch)
{
g_return_if_fail (desc != NULL);
desc->stretch = stretch;
- desc->mask |= PANGO_FONT_MASK_STRETCH;
+ desc->mask |= PANGO2_FONT_MASK_STRETCH;
}
/**
- * pango_font_description_get_stretch:
- * @desc: a `PangoFontDescription`.
+ * pango2_font_description_get_stretch:
+ * @desc: a `Pango2FontDescription`.
*
* Gets the stretch field of a font description.
*
- * See [method@Pango.FontDescription.set_stretch].
+ * See [method@Pango2.FontDescription.set_stretch].
*
* Return value: the stretch field for the font description.
- * Use [method@Pango.FontDescription.get_set_fields] to find
+ * Use [method@Pango2.FontDescription.get_set_fields] to find
* out if the field was explicitly set or not.
*/
-PangoStretch
-pango_font_description_get_stretch (const PangoFontDescription *desc)
+Pango2Stretch
+pango2_font_description_get_stretch (const Pango2FontDescription *desc)
{
g_return_val_if_fail (desc != NULL, pfd_defaults.stretch);
@@ -339,52 +339,52 @@ pango_font_description_get_stretch (const PangoFontDescription *desc)
}
/**
- * pango_font_description_set_size:
- * @desc: a `PangoFontDescription`
- * @size: the size of the font in points, scaled by %PANGO_SCALE.
- * (That is, a @size value of 10 * PANGO_SCALE is a 10 point font.
+ * pango2_font_description_set_size:
+ * @desc: a `Pango2FontDescription`
+ * @size: the size of the font in points, scaled by %PANGO2_SCALE.
+ * (That is, a @size value of 10 * PANGO2_SCALE is a 10 point font.
* The conversion factor between points and device units depends on
* system configuration and the output device. For screen display, a
* logical DPI of 96 is common, in which case a 10 point font corresponds
* to a 10 * (96 / 72) = 13.3 pixel font.
- * Use [method@Pango.FontDescription.set_absolute_size] if you need
+ * Use [method@Pango2.FontDescription.set_absolute_size] if you need
* a particular size in device units.
*
* Sets the size field of a font description in fractional points.
*
* This is mutually exclusive with
- * [method@Pango.FontDescription.set_absolute_size].
+ * [method@Pango2.FontDescription.set_absolute_size].
*/
void
-pango_font_description_set_size (PangoFontDescription *desc,
- int size)
+pango2_font_description_set_size (Pango2FontDescription *desc,
+ int size)
{
g_return_if_fail (desc != NULL);
g_return_if_fail (size >= 0);
desc->size = size;
desc->size_is_absolute = FALSE;
- desc->mask |= PANGO_FONT_MASK_SIZE;
+ desc->mask |= PANGO2_FONT_MASK_SIZE;
}
/**
- * pango_font_description_get_size:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_get_size:
+ * @desc: a `Pango2FontDescription`
*
* Gets the size field of a font description.
*
- * See [method@Pango.FontDescription.set_size].
+ * See [method@Pango2.FontDescription.set_size].
*
* Return value: the size field for the font description in points
* or device units. You must call
- * [method@Pango.FontDescription.get_size_is_absolute] to find out
+ * [method@Pango2.FontDescription.get_size_is_absolute] to find out
* which is the case. Returns 0 if the size field has not previously
* been set or it has been set to 0 explicitly.
- * Use [method@Pango.FontDescription.get_set_fields] to find out
+ * Use [method@Pango2.FontDescription.get_set_fields] to find out
* if the field was explicitly set or not.
*/
int
-pango_font_description_get_size (const PangoFontDescription *desc)
+pango2_font_description_get_size (const Pango2FontDescription *desc)
{
g_return_val_if_fail (desc != NULL, pfd_defaults.size);
@@ -392,46 +392,46 @@ pango_font_description_get_size (const PangoFontDescription *desc)
}
/**
- * pango_font_description_set_absolute_size:
- * @desc: a `PangoFontDescription`
- * @size: the new size, in Pango units. There are %PANGO_SCALE Pango units
+ * pango2_font_description_set_absolute_size:
+ * @desc: a `Pango2FontDescription`
+ * @size: the new size, in Pango2 units. There are %PANGO2_SCALE Pango2 units
* in one device unit. For an output backend where a device unit is a pixel,
- * a @size value of 10 * PANGO_SCALE gives a 10 pixel font.
+ * a @size value of 10 * PANGO2_SCALE gives a 10 pixel font.
*
* Sets the size field of a font description, in device units.
*
- * This is mutually exclusive with [method@Pango.FontDescription.set_size]
+ * This is mutually exclusive with [method@Pango2.FontDescription.set_size]
* which sets the font size in points.
*/
void
-pango_font_description_set_absolute_size (PangoFontDescription *desc,
- double size)
+pango2_font_description_set_absolute_size (Pango2FontDescription *desc,
+ double size)
{
g_return_if_fail (desc != NULL);
g_return_if_fail (size >= 0);
desc->size = size;
desc->size_is_absolute = TRUE;
- desc->mask |= PANGO_FONT_MASK_SIZE;
+ desc->mask |= PANGO2_FONT_MASK_SIZE;
}
/**
- * pango_font_description_get_size_is_absolute:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_get_size_is_absolute:
+ * @desc: a `Pango2FontDescription`
*
* Determines whether the size of the font is in points (not absolute)
* or device units (absolute).
*
- * See [method@Pango.FontDescription.set_size]
- * and [method@Pango.FontDescription.set_absolute_size].
+ * See [method@Pango2.FontDescription.set_size]
+ * and [method@Pango2.FontDescription.set_absolute_size].
*
* Return value: whether the size for the font description is in
- * points or device units. Use [method@Pango.FontDescription.get_set_fields]
+ * points or device units. Use [method@Pango2.FontDescription.get_set_fields]
* to find out if the size field of the font description was explicitly
* set or not.
*/
gboolean
-pango_font_description_get_size_is_absolute (const PangoFontDescription *desc)
+pango2_font_description_get_size_is_absolute (const Pango2FontDescription *desc)
{
g_return_val_if_fail (desc != NULL, pfd_defaults.size_is_absolute);
@@ -439,50 +439,50 @@ pango_font_description_get_size_is_absolute (const PangoFontDescription *desc)
}
/**
- * pango_font_description_set_gravity:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_set_gravity:
+ * @desc: a `Pango2FontDescription`
* @gravity: the gravity for the font description.
*
* Sets the gravity field of a font description.
*
* The gravity field
* specifies how the glyphs should be rotated. If @gravity is
- * %PANGO_GRAVITY_AUTO, this actually unsets the gravity mask on
+ * %PANGO2_GRAVITY_AUTO, this actually unsets the gravity mask on
* the font description.
*
* This function is seldom useful to the user. Gravity should normally
- * be set on a `PangoContext`.
+ * be set on a `Pango2Context`.
*/
void
-pango_font_description_set_gravity (PangoFontDescription *desc,
- PangoGravity gravity)
+pango2_font_description_set_gravity (Pango2FontDescription *desc,
+ Pango2Gravity gravity)
{
g_return_if_fail (desc != NULL);
- if (gravity == PANGO_GRAVITY_AUTO)
+ if (gravity == PANGO2_GRAVITY_AUTO)
{
- pango_font_description_unset_fields (desc, PANGO_FONT_MASK_GRAVITY);
+ pango2_font_description_unset_fields (desc, PANGO2_FONT_MASK_GRAVITY);
return;
}
desc->gravity = gravity;
- desc->mask |= PANGO_FONT_MASK_GRAVITY;
+ desc->mask |= PANGO2_FONT_MASK_GRAVITY;
}
/**
- * pango_font_description_get_gravity:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_get_gravity:
+ * @desc: a `Pango2FontDescription`
*
* Gets the gravity field of a font description.
*
- * See [method@Pango.FontDescription.set_gravity].
+ * See [method@Pango2.FontDescription.set_gravity].
*
* Return value: the gravity field for the font description.
- * Use [method@Pango.FontDescription.get_set_fields] to find out
+ * Use [method@Pango2.FontDescription.get_set_fields] to find out
* if the field was explicitly set or not.
*/
-PangoGravity
-pango_font_description_get_gravity (const PangoFontDescription *desc)
+Pango2Gravity
+pango2_font_description_get_gravity (const Pango2FontDescription *desc)
{
g_return_val_if_fail (desc != NULL, pfd_defaults.gravity);
@@ -490,13 +490,13 @@ pango_font_description_get_gravity (const PangoFontDescription *desc)
}
/**
- * pango_font_description_set_variations_static:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_set_variations_static:
+ * @desc: a `Pango2FontDescription`
* @variations: a string representing the variations
*
* Sets the variations field of a font description.
*
- * This is like [method@Pango.FontDescription.set_variations], except
+ * This is like [method@Pango2.FontDescription.set_variations], except
* that no copy of @variations is made. The caller must make sure that
* the string passed in stays around until @desc has been freed
* or the name is set again. This function can be used if
@@ -504,8 +504,8 @@ pango_font_description_get_gravity (const PangoFontDescription *desc)
* or if @desc is only needed temporarily.
*/
void
-pango_font_description_set_variations_static (PangoFontDescription *desc,
- const char *variations)
+pango2_font_description_set_variations_static (Pango2FontDescription *desc,
+ const char *variations)
{
g_return_if_fail (desc != NULL);
@@ -519,19 +519,19 @@ pango_font_description_set_variations_static (PangoFontDescription *desc,
{
desc->variations = (char *)variations;
desc->static_variations = TRUE;
- desc->mask |= PANGO_FONT_MASK_VARIATIONS;
+ desc->mask |= PANGO2_FONT_MASK_VARIATIONS;
}
else
{
desc->variations = pfd_defaults.variations;
desc->static_variations = pfd_defaults.static_variations;
- desc->mask &= ~PANGO_FONT_MASK_VARIATIONS;
+ desc->mask &= ~PANGO2_FONT_MASK_VARIATIONS;
}
}
/**
- * pango_font_description_set_variations:
- * @desc: a `PangoFontDescription`.
+ * pango2_font_description_set_variations:
+ * @desc: a `Pango2FontDescription`.
* @variations: (nullable): a string representing the variations
*
* Sets the variations field of a font description.
@@ -547,35 +547,35 @@ pango_font_description_set_variations_static (PangoFontDescription *desc,
* and each VALUE a floating point number. Unknown axes are ignored,
* and values are clamped to their allowed range.
*
- * Pango does not currently have a way to find supported axes of
+ * Pango2 does not currently have a way to find supported axes of
* a font. Both harfbuzz and freetype have API for this. See
* for example [hb_ot_var_get_axis_infos](https://harfbuzz.github.io/harfbuzz-hb-ot-var.html#hb-ot-var-get-axis-infos).
*/
void
-pango_font_description_set_variations (PangoFontDescription *desc,
- const char *variations)
+pango2_font_description_set_variations (Pango2FontDescription *desc,
+ const char *variations)
{
g_return_if_fail (desc != NULL);
- pango_font_description_set_variations_static (desc, g_strdup (variations));
+ pango2_font_description_set_variations_static (desc, g_strdup (variations));
if (variations)
desc->static_variations = FALSE;
}
/**
- * pango_font_description_get_variations:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_get_variations:
+ * @desc: a `Pango2FontDescription`
*
* Gets the variations field of a font description.
*
- * See [method@Pango.FontDescription.set_variations].
+ * See [method@Pango2.FontDescription.set_variations].
*
* Return value: (nullable): the variations field for the font
* description, or %NULL if not previously set. This has the same
* life-time as the font description itself and should not be freed.
*/
const char *
-pango_font_description_get_variations (const PangoFontDescription *desc)
+pango2_font_description_get_variations (const Pango2FontDescription *desc)
{
g_return_val_if_fail (desc != NULL, NULL);
@@ -583,16 +583,16 @@ pango_font_description_get_variations (const PangoFontDescription *desc)
}
/**
- * pango_font_description_get_set_fields:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_get_set_fields:
+ * @desc: a `Pango2FontDescription`
*
* Determines which fields in a font description have been set.
*
* Return value: a bitmask with bits set corresponding to the
* fields in @desc that have been set.
*/
-PangoFontMask
-pango_font_description_get_set_fields (const PangoFontDescription *desc)
+Pango2FontMask
+pango2_font_description_get_set_fields (const Pango2FontDescription *desc)
{
g_return_val_if_fail (desc != NULL, pfd_defaults.mask);
@@ -600,34 +600,34 @@ pango_font_description_get_set_fields (const PangoFontDescription *desc)
}
/**
- * pango_font_description_unset_fields:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_unset_fields:
+ * @desc: a `Pango2FontDescription`
* @to_unset: bitmask of fields in the @desc to unset.
*
- * Unsets some of the fields in a `PangoFontDescription`.
+ * Unsets some of the fields in a `Pango2FontDescription`.
*
* The unset fields will get back to their default values.
*/
void
-pango_font_description_unset_fields (PangoFontDescription *desc,
- PangoFontMask to_unset)
+pango2_font_description_unset_fields (Pango2FontDescription *desc,
+ Pango2FontMask to_unset)
{
- PangoFontDescription unset_desc;
+ Pango2FontDescription unset_desc;
g_return_if_fail (desc != NULL);
unset_desc = pfd_defaults;
unset_desc.mask = to_unset;
- pango_font_description_merge_static (desc, &unset_desc, TRUE);
+ pango2_font_description_merge_static (desc, &unset_desc, TRUE);
desc->mask &= ~to_unset;
}
/**
- * pango_font_description_merge:
- * @desc: a `PangoFontDescription`
- * @desc_to_merge: (nullable): the `PangoFontDescription` to merge from,
+ * pango2_font_description_merge:
+ * @desc: a `Pango2FontDescription`
+ * @desc_to_merge: (nullable): the `Pango2FontDescription` to merge from,
* or %NULL
* @replace_existing: if %TRUE, replace fields in @desc with the
* corresponding values from @desc_to_merge, even if they
@@ -643,9 +643,9 @@ pango_font_description_unset_fields (PangoFontDescription *desc,
* If @desc_to_merge is %NULL, this function performs nothing.
*/
void
-pango_font_description_merge (PangoFontDescription *desc,
- const PangoFontDescription *desc_to_merge,
- gboolean replace_existing)
+pango2_font_description_merge (Pango2FontDescription *desc,
+ const Pango2FontDescription *desc_to_merge,
+ gboolean replace_existing)
{
gboolean family_merged;
gboolean variations_merged;
@@ -660,7 +660,7 @@ pango_font_description_merge (PangoFontDescription *desc,
variations_merged = desc_to_merge->variations && (replace_existing || !desc->variations);
faceid_merged = desc_to_merge->faceid && (replace_existing || !desc->faceid);
- pango_font_description_merge_static (desc, desc_to_merge, replace_existing);
+ pango2_font_description_merge_static (desc, desc_to_merge, replace_existing);
if (family_merged)
{
@@ -682,9 +682,9 @@ pango_font_description_merge (PangoFontDescription *desc,
}
/**
- * pango_font_description_merge_static:
- * @desc: a `PangoFontDescription`
- * @desc_to_merge: the `PangoFontDescription` to merge from
+ * pango2_font_description_merge_static:
+ * @desc: a `Pango2FontDescription`
+ * @desc_to_merge: the `Pango2FontDescription` to merge from
* @replace_existing: if %TRUE, replace fields in @desc with the
* corresponding values from @desc_to_merge, even if they
* are already exist.
@@ -692,17 +692,17 @@ pango_font_description_merge (PangoFontDescription *desc,
* Merges the fields that are set in @desc_to_merge into the fields in
* @desc, without copying allocated fields.
*
- * This is like [method@Pango.FontDescription.merge], but only a shallow copy
+ * This is like [method@Pango2.FontDescription.merge], but only a shallow copy
* is made of the family name and other allocated fields. @desc can only
* be used until @desc_to_merge is modified or freed. This is meant to
* be used when the merged font description is only needed temporarily.
*/
void
-pango_font_description_merge_static (PangoFontDescription *desc,
- const PangoFontDescription *desc_to_merge,
- gboolean replace_existing)
+pango2_font_description_merge_static (Pango2FontDescription *desc,
+ const Pango2FontDescription *desc_to_merge,
+ gboolean replace_existing)
{
- PangoFontMask new_mask;
+ Pango2FontMask new_mask;
g_return_if_fail (desc != NULL);
g_return_if_fail (desc_to_merge != NULL);
@@ -712,50 +712,50 @@ pango_font_description_merge_static (PangoFontDescription *desc,
else
new_mask = desc_to_merge->mask & ~desc->mask;
- if (new_mask & PANGO_FONT_MASK_FAMILY)
- pango_font_description_set_family_static (desc, desc_to_merge->family_name);
- if (new_mask & PANGO_FONT_MASK_STYLE)
+ if (new_mask & PANGO2_FONT_MASK_FAMILY)
+ pango2_font_description_set_family_static (desc, desc_to_merge->family_name);
+ if (new_mask & PANGO2_FONT_MASK_STYLE)
desc->style = desc_to_merge->style;
- if (new_mask & PANGO_FONT_MASK_VARIANT)
+ if (new_mask & PANGO2_FONT_MASK_VARIANT)
desc->variant = desc_to_merge->variant;
- if (new_mask & PANGO_FONT_MASK_WEIGHT)
+ if (new_mask & PANGO2_FONT_MASK_WEIGHT)
desc->weight = desc_to_merge->weight;
- if (new_mask & PANGO_FONT_MASK_STRETCH)
+ if (new_mask & PANGO2_FONT_MASK_STRETCH)
desc->stretch = desc_to_merge->stretch;
- if (new_mask & PANGO_FONT_MASK_SIZE)
+ if (new_mask & PANGO2_FONT_MASK_SIZE)
{
desc->size = desc_to_merge->size;
desc->size_is_absolute = desc_to_merge->size_is_absolute;
}
- if (new_mask & PANGO_FONT_MASK_GRAVITY)
+ if (new_mask & PANGO2_FONT_MASK_GRAVITY)
desc->gravity = desc_to_merge->gravity;
- if (new_mask & PANGO_FONT_MASK_VARIATIONS)
- pango_font_description_set_variations_static (desc, desc_to_merge->variations);
- if (new_mask & PANGO_FONT_MASK_FACEID)
- pango_font_description_set_faceid_static (desc, desc_to_merge->faceid);
+ if (new_mask & PANGO2_FONT_MASK_VARIATIONS)
+ pango2_font_description_set_variations_static (desc, desc_to_merge->variations);
+ if (new_mask & PANGO2_FONT_MASK_FACEID)
+ pango2_font_description_set_faceid_static (desc, desc_to_merge->faceid);
desc->mask |= new_mask;
}
gboolean
-pango_font_description_is_similar (const PangoFontDescription *a,
- const PangoFontDescription *b)
+pango2_font_description_is_similar (const Pango2FontDescription *a,
+ const Pango2FontDescription *b)
{
return a->variant == b->variant &&
a->gravity == b->gravity;
}
int
-pango_font_description_compute_distance (const PangoFontDescription *a,
- const PangoFontDescription *b)
+pango2_font_description_compute_distance (const Pango2FontDescription *a,
+ const Pango2FontDescription *b)
{
if (a->style == b->style)
{
return abs ((int)(a->weight) - (int)(b->weight)) +
abs ((int)(a->stretch) - (int)(b->stretch));
}
- else if (a->style != PANGO_STYLE_NORMAL &&
- b->style != PANGO_STYLE_NORMAL)
+ else if (a->style != PANGO2_STYLE_NORMAL &&
+ b->style != PANGO2_STYLE_NORMAL)
{
/* Equate oblique and italic, but with a big penalty
*/
@@ -767,23 +767,23 @@ pango_font_description_compute_distance (const PangoFontDescription *a,
}
/**
- * pango_font_description_copy:
- * @desc: (nullable): a `PangoFontDescription`, may be %NULL
+ * pango2_font_description_copy:
+ * @desc: (nullable): a `Pango2FontDescription`, may be %NULL
*
- * Make a copy of a `PangoFontDescription`.
+ * Make a copy of a `Pango2FontDescription`.
*
- * Return value: (nullable): the newly allocated `PangoFontDescription`,
- * which should be freed with [method@Pango.FontDescription.free]
+ * Return value: (nullable): the newly allocated `Pango2FontDescription`,
+ * which should be freed with [method@Pango2.FontDescription.free]
*/
-PangoFontDescription *
-pango_font_description_copy (const PangoFontDescription *desc)
+Pango2FontDescription *
+pango2_font_description_copy (const Pango2FontDescription *desc)
{
- PangoFontDescription *result;
+ Pango2FontDescription *result;
if (desc == NULL)
return NULL;
- result = g_slice_new (PangoFontDescription);
+ result = g_slice_new (Pango2FontDescription);
*result = *desc;
@@ -803,29 +803,29 @@ pango_font_description_copy (const PangoFontDescription *desc)
}
/**
- * pango_font_description_copy_static:
- * @desc: (nullable): a `PangoFontDescription`, may be %NULL
+ * pango2_font_description_copy_static:
+ * @desc: (nullable): a `Pango2FontDescription`, may be %NULL
*
- * Make a copy of a `PangoFontDescription`, but don't duplicate
+ * Make a copy of a `Pango2FontDescription`, but don't duplicate
* allocated fields.
*
- * This is like [method@Pango.FontDescription.copy], but only a shallow
+ * This is like [method@Pango2.FontDescription.copy], but only a shallow
* copy is made of the family name and other allocated fields. The result
* can only be used until @desc is modified or freed. This is meant
* to be used when the copy is only needed temporarily.
*
- * Return value: (nullable): the newly allocated `PangoFontDescription`,
- * which should be freed with [method@Pango.FontDescription.free]
+ * Return value: (nullable): the newly allocated `Pango2FontDescription`,
+ * which should be freed with [method@Pango2.FontDescription.free]
*/
-PangoFontDescription *
-pango_font_description_copy_static (const PangoFontDescription *desc)
+Pango2FontDescription *
+pango2_font_description_copy_static (const Pango2FontDescription *desc)
{
- PangoFontDescription *result;
+ Pango2FontDescription *result;
if (desc == NULL)
return NULL;
- result = g_slice_new (PangoFontDescription);
+ result = g_slice_new (Pango2FontDescription);
*result = *desc;
if (result->family_name)
@@ -841,9 +841,9 @@ pango_font_description_copy_static (const PangoFontDescription *desc)
}
/**
- * pango_font_description_equal:
- * @desc1: a `PangoFontDescription`
- * @desc2: another `PangoFontDescription`
+ * pango2_font_description_equal:
+ * @desc1: a `Pango2FontDescription`
+ * @desc2: another `Pango2FontDescription`
*
* Compares two font descriptions for equality.
*
@@ -856,8 +856,8 @@ pango_font_description_copy_static (const PangoFontDescription *desc)
* %FALSE otherwise.
*/
gboolean
-pango_font_description_equal (const PangoFontDescription *desc1,
- const PangoFontDescription *desc2)
+pango2_font_description_equal (const Pango2FontDescription *desc1,
+ const Pango2FontDescription *desc2)
{
g_return_val_if_fail (desc1 != NULL, FALSE);
g_return_val_if_fail (desc2 != NULL, FALSE);
@@ -894,10 +894,10 @@ case_insensitive_hash (const char *key)
}
/**
- * pango_font_description_hash:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_hash:
+ * @desc: a `Pango2FontDescription`
*
- * Computes a hash of a `PangoFontDescription` structure.
+ * Computes a hash of a `Pango2FontDescription` structure.
*
* This is suitable to be used, for example, as an argument
* to [GLib.HashTable.new]. The hash value is independent of @desc->mask.
@@ -905,7 +905,7 @@ case_insensitive_hash (const char *key)
* Return value: the hash value.
*/
guint
-pango_font_description_hash (const PangoFontDescription *desc)
+pango2_font_description_hash (const Pango2FontDescription *desc)
{
guint hash = 0;
@@ -929,13 +929,13 @@ pango_font_description_hash (const PangoFontDescription *desc)
}
/**
- * pango_font_description_free:
- * @desc: (nullable): a `PangoFontDescription`, may be %NULL
+ * pango2_font_description_free:
+ * @desc: (nullable): a `Pango2FontDescription`, may be %NULL
*
* Frees a font description.
*/
void
-pango_font_description_free (PangoFontDescription *desc)
+pango2_font_description_free (Pango2FontDescription *desc)
{
if (desc == NULL)
return;
@@ -949,7 +949,7 @@ pango_font_description_free (PangoFontDescription *desc)
if (desc->faceid && !desc->static_faceid)
g_free (desc->faceid);
- g_slice_free (PangoFontDescription, desc);
+ g_slice_free (Pango2FontDescription, desc);
}
typedef struct
@@ -959,67 +959,67 @@ typedef struct
} FieldMap;
static const FieldMap style_map[] = {
- { PANGO_STYLE_NORMAL, "" },
- { PANGO_STYLE_NORMAL, "Roman" },
- { PANGO_STYLE_OBLIQUE, "Oblique" },
- { PANGO_STYLE_ITALIC, "Italic" }
+ { PANGO2_STYLE_NORMAL, "" },
+ { PANGO2_STYLE_NORMAL, "Roman" },
+ { PANGO2_STYLE_OBLIQUE, "Oblique" },
+ { PANGO2_STYLE_ITALIC, "Italic" }
};
static const FieldMap variant_map[] = {
- { PANGO_VARIANT_NORMAL, "" },
- { PANGO_VARIANT_SMALL_CAPS, "Small-Caps" },
- { PANGO_VARIANT_ALL_SMALL_CAPS, "All-Small-Caps" },
- { PANGO_VARIANT_PETITE_CAPS, "Petite-Caps" },
- { PANGO_VARIANT_ALL_PETITE_CAPS, "All-Petite-Caps" },
- { PANGO_VARIANT_UNICASE, "Unicase" },
- { PANGO_VARIANT_TITLE_CAPS, "Title-Caps" }
+ { PANGO2_VARIANT_NORMAL, "" },
+ { PANGO2_VARIANT_SMALL_CAPS, "Small-Caps" },
+ { PANGO2_VARIANT_ALL_SMALL_CAPS, "All-Small-Caps" },
+ { PANGO2_VARIANT_PETITE_CAPS, "Petite-Caps" },
+ { PANGO2_VARIANT_ALL_PETITE_CAPS, "All-Petite-Caps" },
+ { PANGO2_VARIANT_UNICASE, "Unicase" },
+ { PANGO2_VARIANT_TITLE_CAPS, "Title-Caps" }
};
static const FieldMap weight_map[] = {
- { PANGO_WEIGHT_THIN, "Thin" },
- { PANGO_WEIGHT_ULTRALIGHT, "Ultra-Light" },
- { PANGO_WEIGHT_ULTRALIGHT, "Extra-Light" },
- { PANGO_WEIGHT_LIGHT, "Light" },
- { PANGO_WEIGHT_SEMILIGHT, "Semi-Light" },
- { PANGO_WEIGHT_SEMILIGHT, "Demi-Light" },
- { PANGO_WEIGHT_BOOK, "Book" },
- { PANGO_WEIGHT_NORMAL, "" },
- { PANGO_WEIGHT_NORMAL, "Regular" },
- { PANGO_WEIGHT_MEDIUM, "Medium" },
- { PANGO_WEIGHT_SEMIBOLD, "Semi-Bold" },
- { PANGO_WEIGHT_SEMIBOLD, "Demi-Bold" },
- { PANGO_WEIGHT_BOLD, "Bold" },
- { PANGO_WEIGHT_ULTRABOLD, "Ultra-Bold" },
- { PANGO_WEIGHT_ULTRABOLD, "Extra-Bold" },
- { PANGO_WEIGHT_HEAVY, "Heavy" },
- { PANGO_WEIGHT_HEAVY, "Black" },
- { PANGO_WEIGHT_ULTRAHEAVY, "Ultra-Heavy" },
- { PANGO_WEIGHT_ULTRAHEAVY, "Extra-Heavy" },
- { PANGO_WEIGHT_ULTRAHEAVY, "Ultra-Black" },
- { PANGO_WEIGHT_ULTRAHEAVY, "Extra-Black" }
+ { PANGO2_WEIGHT_THIN, "Thin" },
+ { PANGO2_WEIGHT_ULTRALIGHT, "Ultra-Light" },
+ { PANGO2_WEIGHT_ULTRALIGHT, "Extra-Light" },
+ { PANGO2_WEIGHT_LIGHT, "Light" },
+ { PANGO2_WEIGHT_SEMILIGHT, "Semi-Light" },
+ { PANGO2_WEIGHT_SEMILIGHT, "Demi-Light" },
+ { PANGO2_WEIGHT_BOOK, "Book" },
+ { PANGO2_WEIGHT_NORMAL, "" },
+ { PANGO2_WEIGHT_NORMAL, "Regular" },
+ { PANGO2_WEIGHT_MEDIUM, "Medium" },
+ { PANGO2_WEIGHT_SEMIBOLD, "Semi-Bold" },
+ { PANGO2_WEIGHT_SEMIBOLD, "Demi-Bold" },
+ { PANGO2_WEIGHT_BOLD, "Bold" },
+ { PANGO2_WEIGHT_ULTRABOLD, "Ultra-Bold" },
+ { PANGO2_WEIGHT_ULTRABOLD, "Extra-Bold" },
+ { PANGO2_WEIGHT_HEAVY, "Heavy" },
+ { PANGO2_WEIGHT_HEAVY, "Black" },
+ { PANGO2_WEIGHT_ULTRAHEAVY, "Ultra-Heavy" },
+ { PANGO2_WEIGHT_ULTRAHEAVY, "Extra-Heavy" },
+ { PANGO2_WEIGHT_ULTRAHEAVY, "Ultra-Black" },
+ { PANGO2_WEIGHT_ULTRAHEAVY, "Extra-Black" }
};
static const FieldMap stretch_map[] = {
- { PANGO_STRETCH_ULTRA_CONDENSED, "Ultra-Condensed" },
- { PANGO_STRETCH_EXTRA_CONDENSED, "Extra-Condensed" },
- { PANGO_STRETCH_CONDENSED, "Condensed" },
- { PANGO_STRETCH_SEMI_CONDENSED, "Semi-Condensed" },
- { PANGO_STRETCH_NORMAL, "" },
- { PANGO_STRETCH_SEMI_EXPANDED, "Semi-Expanded" },
- { PANGO_STRETCH_EXPANDED, "Expanded" },
- { PANGO_STRETCH_EXTRA_EXPANDED, "Extra-Expanded" },
- { PANGO_STRETCH_ULTRA_EXPANDED, "Ultra-Expanded" }
+ { PANGO2_STRETCH_ULTRA_CONDENSED, "Ultra-Condensed" },
+ { PANGO2_STRETCH_EXTRA_CONDENSED, "Extra-Condensed" },
+ { PANGO2_STRETCH_CONDENSED, "Condensed" },
+ { PANGO2_STRETCH_SEMI_CONDENSED, "Semi-Condensed" },
+ { PANGO2_STRETCH_NORMAL, "" },
+ { PANGO2_STRETCH_SEMI_EXPANDED, "Semi-Expanded" },
+ { PANGO2_STRETCH_EXPANDED, "Expanded" },
+ { PANGO2_STRETCH_EXTRA_EXPANDED, "Extra-Expanded" },
+ { PANGO2_STRETCH_ULTRA_EXPANDED, "Ultra-Expanded" }
};
static const FieldMap gravity_map[] = {
- { PANGO_GRAVITY_SOUTH, "Not-Rotated" },
- { PANGO_GRAVITY_SOUTH, "South" },
- { PANGO_GRAVITY_NORTH, "Upside-Down" },
- { PANGO_GRAVITY_NORTH, "North" },
- { PANGO_GRAVITY_EAST, "Rotated-Left" },
- { PANGO_GRAVITY_EAST, "East" },
- { PANGO_GRAVITY_WEST, "Rotated-Right" },
- { PANGO_GRAVITY_WEST, "West" }
+ { PANGO2_GRAVITY_SOUTH, "Not-Rotated" },
+ { PANGO2_GRAVITY_SOUTH, "South" },
+ { PANGO2_GRAVITY_NORTH, "Upside-Down" },
+ { PANGO2_GRAVITY_NORTH, "North" },
+ { PANGO2_GRAVITY_EAST, "Rotated-Left" },
+ { PANGO2_GRAVITY_EAST, "East" },
+ { PANGO2_GRAVITY_WEST, "Rotated-Right" },
+ { PANGO2_GRAVITY_WEST, "West" }
};
static gboolean
@@ -1071,12 +1071,12 @@ parse_int (const char *word,
}
static gboolean
-find_field (const char *what,
+find_field (const char *what,
const FieldMap *map,
- int n_elements,
- const char *str,
- int len,
- int *val)
+ int n_elements,
+ const char *str,
+ int len,
+ int *val)
{
int i;
gboolean had_prefix = FALSE;
@@ -1109,7 +1109,9 @@ find_field (const char *what,
}
static gboolean
-find_field_any (const char *str, int len, PangoFontDescription *desc)
+find_field_any (const char *str,
+ int len,
+ Pango2FontDescription *desc)
{
if (field_matches ("Normal", str, len))
return TRUE;
@@ -1125,11 +1127,11 @@ find_field_any (const char *str, int len, PangoFontDescription *desc)
} \
} G_STMT_END
- FIELD (weight, PANGO_FONT_MASK_WEIGHT);
- FIELD (style, PANGO_FONT_MASK_STYLE);
- FIELD (stretch, PANGO_FONT_MASK_STRETCH);
- FIELD (variant, PANGO_FONT_MASK_VARIANT);
- FIELD (gravity, PANGO_FONT_MASK_GRAVITY);
+ FIELD (weight, PANGO2_FONT_MASK_WEIGHT);
+ FIELD (style, PANGO2_FONT_MASK_STYLE);
+ FIELD (stretch, PANGO2_FONT_MASK_STRETCH);
+ FIELD (variant, PANGO2_FONT_MASK_VARIANT);
+ FIELD (gravity, PANGO2_FONT_MASK_GRAVITY);
#undef FIELD
@@ -1137,7 +1139,10 @@ find_field_any (const char *str, int len, PangoFontDescription *desc)
}
static const char *
-getword (const char *str, const char *last, size_t *wordlen, const char *stop)
+getword (const char *str,
+ const char *last,
+ size_t *wordlen,
+ const char *stop)
{
const char *result;
@@ -1156,7 +1161,7 @@ getword (const char *str, const char *last, size_t *wordlen, const char *stop)
static gboolean
parse_size (const char *word,
size_t wordlen,
- int *pango_size,
+ int *pango2_size,
gboolean *size_is_absolute)
{
char *end;
@@ -1167,8 +1172,8 @@ parse_size (const char *word,
(end + 2 == word + wordlen && !strncmp (end, "px", 2))
) && size >= 0 && size <= 1000000) /* word is a valid float */
{
- if (pango_size)
- *pango_size = (int)(size * PANGO_SCALE + 0.5);
+ if (pango2_size)
+ *pango2_size = (int)(size * PANGO2_SCALE + 0.5);
if (size_is_absolute)
*size_is_absolute = end < word + wordlen;
@@ -1197,7 +1202,7 @@ parse_variations (const char *word,
}
static void
-faceid_from_variations (PangoFontDescription *desc)
+faceid_from_variations (Pango2FontDescription *desc)
{
const char *p, *q;
@@ -1217,7 +1222,7 @@ faceid_from_variations (PangoFontDescription *desc)
desc->faceid = g_strdup (p);
p = NULL;
}
- desc->mask |= PANGO_FONT_MASK_FACEID;
+ desc->mask |= PANGO2_FONT_MASK_FACEID;
}
if (p != desc->variations)
@@ -1226,12 +1231,12 @@ faceid_from_variations (PangoFontDescription *desc)
g_free (desc->variations);
desc->variations = variations;
if (variations == NULL || *variations == '\0')
- desc->mask &= ~PANGO_FONT_MASK_VARIATIONS;
+ desc->mask &= ~PANGO2_FONT_MASK_VARIATIONS;
}
}
/**
- * pango_font_description_from_string:
+ * pango2_font_description_from_string:
* @str: string representation of a font description.
*
* Creates a new font description from a string representation.
@@ -1279,23 +1284,23 @@ faceid_from_variations (PangoFontDescription *desc)
*
* "Cantarell Italic Light 15 \@wght=200"
*
- * Return value: a new `PangoFontDescription`.
+ * Return value: a new `Pango2FontDescription`.
*/
-PangoFontDescription *
-pango_font_description_from_string (const char *str)
+Pango2FontDescription *
+pango2_font_description_from_string (const char *str)
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
const char *p, *last;
size_t len, wordlen;
g_return_val_if_fail (str != NULL, NULL);
- desc = pango_font_description_new ();
+ desc = pango2_font_description_new ();
- desc->mask = PANGO_FONT_MASK_STYLE |
- PANGO_FONT_MASK_WEIGHT |
- PANGO_FONT_MASK_VARIANT |
- PANGO_FONT_MASK_STRETCH;
+ desc->mask = PANGO2_FONT_MASK_STYLE |
+ PANGO2_FONT_MASK_WEIGHT |
+ PANGO2_FONT_MASK_VARIANT |
+ PANGO2_FONT_MASK_STRETCH;
len = strlen (str);
last = str + len;
@@ -1305,7 +1310,7 @@ pango_font_description_from_string (const char *str)
{
if (parse_variations (p, wordlen, &desc->variations))
{
- desc->mask |= PANGO_FONT_MASK_VARIATIONS;
+ desc->mask |= PANGO2_FONT_MASK_VARIATIONS;
last = p;
faceid_from_variations (desc);
@@ -1320,7 +1325,7 @@ pango_font_description_from_string (const char *str)
if (parse_size (p, wordlen, &desc->size, &size_is_absolute))
{
desc->size_is_absolute = size_is_absolute;
- desc->mask |= PANGO_FONT_MASK_SIZE;
+ desc->mask |= PANGO2_FONT_MASK_SIZE;
last = p;
}
}
@@ -1373,14 +1378,18 @@ pango_font_description_from_string (const char *str)
desc->family_name = g_strjoinv (",", families);
g_strfreev (families);
- desc->mask |= PANGO_FONT_MASK_FAMILY;
+ desc->mask |= PANGO2_FONT_MASK_FAMILY;
}
return desc;
}
static void
-append_field (GString *str, const char *what, const FieldMap *map, int n_elements, int val)
+append_field (GString *str,
+ const char *what,
+ const FieldMap *map,
+ int n_elements,
+ int val)
{
int i;
for (i=0; i<n_elements; i++)
@@ -1403,12 +1412,12 @@ append_field (GString *str, const char *what, const FieldMap *map, int n_element
}
/**
- * pango_font_description_to_string:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_to_string:
+ * @desc: a `Pango2FontDescription`
*
* Creates a string representation of a font description.
*
- * See [func@Pango.FontDescription.from_string] for a description
+ * See [func@Pango2.FontDescription.from_string] for a description
* of the format of the string representation. The family list in
* the string description will only have a terminating comma if
* the last word of the list is a valid style option.
@@ -1416,7 +1425,7 @@ append_field (GString *str, const char *what, const FieldMap *map, int n_element
* Return value: a newly allocated string
*/
char *
-pango_font_description_to_string (const PangoFontDescription *desc)
+pango2_font_description_to_string (const Pango2FontDescription *desc)
{
GString *result;
gboolean in_variations = FALSE;
@@ -1425,7 +1434,7 @@ pango_font_description_to_string (const PangoFontDescription *desc)
result = g_string_new (NULL);
- if (G_LIKELY (desc->family_name && desc->mask & PANGO_FONT_MASK_FAMILY))
+ if (G_LIKELY (desc->family_name && desc->mask & PANGO2_FONT_MASK_FAMILY))
{
const char *p;
size_t wordlen;
@@ -1440,51 +1449,51 @@ pango_font_description_to_string (const PangoFontDescription *desc)
if (wordlen != 0 &&
(find_field_any (p, wordlen, NULL) ||
(parse_size (p, wordlen, NULL, NULL) &&
- desc->weight == PANGO_WEIGHT_NORMAL &&
- desc->style == PANGO_STYLE_NORMAL &&
- desc->stretch == PANGO_STRETCH_NORMAL &&
- desc->variant == PANGO_VARIANT_NORMAL &&
- (desc->mask & (PANGO_FONT_MASK_GRAVITY | PANGO_FONT_MASK_SIZE)) == 0)))
+ desc->weight == PANGO2_WEIGHT_NORMAL &&
+ desc->style == PANGO2_STYLE_NORMAL &&
+ desc->stretch == PANGO2_STRETCH_NORMAL &&
+ desc->variant == PANGO2_VARIANT_NORMAL &&
+ (desc->mask & (PANGO2_FONT_MASK_GRAVITY | PANGO2_FONT_MASK_SIZE)) == 0)))
g_string_append_c (result, ',');
}
#define FIELD(NAME, MASK) \
append_field (result, G_STRINGIFY (NAME), NAME##_map, G_N_ELEMENTS (NAME##_map), desc->NAME)
- FIELD (weight, PANGO_FONT_MASK_WEIGHT);
- FIELD (style, PANGO_FONT_MASK_STYLE);
- FIELD (stretch, PANGO_FONT_MASK_STRETCH);
- FIELD (variant, PANGO_FONT_MASK_VARIANT);
- if (desc->mask & PANGO_FONT_MASK_GRAVITY)
- FIELD (gravity, PANGO_FONT_MASK_GRAVITY);
+ FIELD (weight, PANGO2_FONT_MASK_WEIGHT);
+ FIELD (style, PANGO2_FONT_MASK_STYLE);
+ FIELD (stretch, PANGO2_FONT_MASK_STRETCH);
+ FIELD (variant, PANGO2_FONT_MASK_VARIANT);
+ if (desc->mask & PANGO2_FONT_MASK_GRAVITY)
+ FIELD (gravity, PANGO2_FONT_MASK_GRAVITY);
#undef FIELD
if (result->len == 0)
g_string_append (result, "Normal");
- if (desc->mask & PANGO_FONT_MASK_SIZE)
+ if (desc->mask & PANGO2_FONT_MASK_SIZE)
{
char buf[G_ASCII_DTOSTR_BUF_SIZE];
if (result->len > 0 || result->str[result->len -1] != ' ')
g_string_append_c (result, ' ');
- g_ascii_dtostr (buf, sizeof (buf), (double)desc->size / PANGO_SCALE);
+ g_ascii_dtostr (buf, sizeof (buf), (double)desc->size / PANGO2_SCALE);
g_string_append (result, buf);
if (desc->size_is_absolute)
g_string_append (result, "px");
}
- if (desc->mask & PANGO_FONT_MASK_FACEID)
+ if (desc->mask & PANGO2_FONT_MASK_FACEID)
{
in_variations = TRUE;
g_string_append (result, " @");
g_string_append_printf (result, "faceid=%s", desc->faceid);
}
- if ((desc->variations && desc->mask & PANGO_FONT_MASK_VARIATIONS) &&
+ if ((desc->variations && desc->mask & PANGO2_FONT_MASK_VARIATIONS) &&
desc->variations[0] != '\0')
{
if (!in_variations)
@@ -1498,12 +1507,12 @@ pango_font_description_to_string (const PangoFontDescription *desc)
}
static gboolean
-parse_field (const char *what,
+parse_field (const char *what,
const FieldMap *map,
- int n_elements,
- const char *str,
- int *val,
- gboolean warn)
+ int n_elements,
+ const char *str,
+ int *val,
+ gboolean warn)
{
gboolean found;
int len = strlen (str);
@@ -1555,9 +1564,9 @@ parse_field (const char *what,
parse_field (G_STRINGIFY (NAME), NAME##_map, G_N_ELEMENTS (NAME##_map), str, (int *)(void *)NAME, warn)
/*< private >
- * pango_parse_style:
+ * pango2_parse_style:
* @str: a string to parse.
- * @style: (out): a `PangoStyle` to store the result in.
+ * @style: (out): a `Pango2Style` to store the result in.
* @warn: if %TRUE, issue a g_warning() on bad input.
*
* Parses a font style.
@@ -1569,17 +1578,17 @@ parse_field (const char *what,
* Return value: %TRUE if @str was successfully parsed.
*/
gboolean
-pango_parse_style (const char *str,
- PangoStyle *style,
- gboolean warn)
+pango2_parse_style (const char *str,
+ Pango2Style *style,
+ gboolean warn)
{
- return FIELD (style, PANGO_FONT_MASK_STYLE);
+ return FIELD (style, PANGO2_FONT_MASK_STYLE);
}
/*< private >
- * pango_parse_variant:
+ * pango2_parse_variant:
* @str: a string to parse.
- * @variant: (out): a `PangoVariant` to store the result in.
+ * @variant: (out): a `Pango2Variant` to store the result in.
* @warn: if %TRUE, issue a g_warning() on bad input.
*
* Parses a font variant.
@@ -1591,17 +1600,17 @@ pango_parse_style (const char *str,
* Return value: %TRUE if @str was successfully parsed.
*/
gboolean
-pango_parse_variant (const char *str,
- PangoVariant *variant,
- gboolean warn)
+pango2_parse_variant (const char *str,
+ Pango2Variant *variant,
+ gboolean warn)
{
- return FIELD (variant, PANGO_FONT_MASK_VARIANT);
+ return FIELD (variant, PANGO2_FONT_MASK_VARIANT);
}
/*< private >
- * pango_parse_weight:
+ * pango2_parse_weight:
* @str: a string to parse.
- * @weight: (out): a `PangoWeight` to store the result in.
+ * @weight: (out): a `Pango2Weight` to store the result in.
* @warn: if %TRUE, issue a g_warning() on bad input.
*
* Parses a font weight.
@@ -1613,17 +1622,17 @@ pango_parse_variant (const char *str,
* Return value: %TRUE if @str was successfully parsed.
*/
gboolean
-pango_parse_weight (const char *str,
- PangoWeight *weight,
- gboolean warn)
+pango2_parse_weight (const char *str,
+ Pango2Weight *weight,
+ gboolean warn)
{
- return FIELD (weight, PANGO_FONT_MASK_WEIGHT);
+ return FIELD (weight, PANGO2_FONT_MASK_WEIGHT);
}
/*< private >
- * pango_parse_stretch:
+ * pango2_parse_stretch:
* @str: a string to parse.
- * @stretch: (out): a `PangoStretch` to store the result in.
+ * @stretch: (out): a `Pango2Stretch` to store the result in.
* @warn: if %TRUE, issue a g_warning() on bad input.
*
* Parses a font stretch.
@@ -1637,21 +1646,21 @@ pango_parse_weight (const char *str,
* Return value: %TRUE if @str was successfully parsed.
*/
gboolean
-pango_parse_stretch (const char *str,
- PangoStretch *stretch,
- gboolean warn)
+pango2_parse_stretch (const char *str,
+ Pango2Stretch *stretch,
+ gboolean warn)
{
- return FIELD (stretch, PANGO_FONT_MASK_STRETCH);
+ return FIELD (stretch, PANGO2_FONT_MASK_STRETCH);
}
/**
- * pango_font_description_set_faceid_static:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_set_faceid_static:
+ * @desc: a `Pango2FontDescription`
* @faceid: the faceid string
*
* Sets the faceid field of a font description.
*
- * This is like [method@Pango.FontDescription.set_faceid], except
+ * This is like [method@Pango2.FontDescription.set_faceid], except
* that no copy of @faceid is made. The caller must make sure that
* the string passed in stays around until @desc has been freed
* or the name is set again. This function can be used if
@@ -1659,8 +1668,8 @@ pango_parse_stretch (const char *str,
* or if @desc is only needed temporarily.
*/
void
-pango_font_description_set_faceid_static (PangoFontDescription *desc,
- const char *faceid)
+pango2_font_description_set_faceid_static (Pango2FontDescription *desc,
+ const char *faceid)
{
g_return_if_fail (desc != NULL);
@@ -1674,59 +1683,59 @@ pango_font_description_set_faceid_static (PangoFontDescription *desc,
{
desc->faceid = (char *)faceid;
desc->static_faceid = TRUE;
- desc->mask |= PANGO_FONT_MASK_FACEID;
+ desc->mask |= PANGO2_FONT_MASK_FACEID;
}
else
{
desc->faceid = pfd_defaults.faceid;
desc->static_faceid = pfd_defaults.static_faceid;
- desc->mask &= ~PANGO_FONT_MASK_FACEID;
+ desc->mask &= ~PANGO2_FONT_MASK_FACEID;
}
}
/**
- * pango_font_description_set_faceid:
- * @desc: a `PangoFontDescription`.
+ * pango2_font_description_set_faceid:
+ * @desc: a `Pango2FontDescription`.
* @faceid: (nullable): the faceid string
*
* Sets the faceid field of a font description.
*
- * The faceid is mainly for internal use by Pango, to ensure
+ * The faceid is mainly for internal use by Pango2, to ensure
* that font -> description -> font roundtrips end up with
* the same font they started with, if possible.
*
- * Font descriptions originating from [method@Pango.FontFace.describe]
- * should ideally include a faceid. Pango takes the faceid
+ * Font descriptions originating from [method@Pango2.FontFace.describe]
+ * should ideally include a faceid. Pango2 takes the faceid
* into account when looking for the best matching face while
* loading a fontset or font.
*
* The format of this string is not guaranteed.
*/
void
-pango_font_description_set_faceid (PangoFontDescription *desc,
- const char *faceid)
+pango2_font_description_set_faceid (Pango2FontDescription *desc,
+ const char *faceid)
{
g_return_if_fail (desc != NULL);
- pango_font_description_set_faceid_static (desc, g_strdup (faceid));
+ pango2_font_description_set_faceid_static (desc, g_strdup (faceid));
if (faceid)
desc->static_faceid = FALSE;
}
/**
- * pango_font_description_get_faceid:
- * @desc: a `PangoFontDescription`
+ * pango2_font_description_get_faceid:
+ * @desc: a `Pango2FontDescription`
*
* Gets the faceid field of a font description.
*
- * See [method@Pango.FontDescription.set_faceid].
+ * See [method@Pango2.FontDescription.set_faceid].
*
* Return value: (nullable): the faceid field for the font
* description, or %NULL if not previously set. This has the same
* life-time as the font description itself and should not be freed.
*/
const char *
-pango_font_description_get_faceid (const PangoFontDescription *desc)
+pango2_font_description_get_faceid (const Pango2FontDescription *desc)
{
g_return_val_if_fail (desc != NULL, NULL);
diff --git a/pango/pango-font-description.h b/pango/pango-font-description.h
index 6643131c..414696b1 100644
--- a/pango/pango-font-description.h
+++ b/pango/pango-font-description.h
@@ -27,298 +27,298 @@
G_BEGIN_DECLS
/**
- * PangoFontDescription:
+ * Pango2FontDescription:
*
- * A `PangoFontDescription` describes a font in an implementation-independent
+ * A `Pango2FontDescription` describes a font in an implementation-independent
* manner.
*
- * `PangoFontDescription` structures are used both to list what fonts are
+ * `Pango2FontDescription` structures are used both to list what fonts are
* available on the system and also for specifying the characteristics of
* a font to load.
*/
/**
- * PangoStyle:
- * @PANGO_STYLE_NORMAL: the font is upright.
- * @PANGO_STYLE_OBLIQUE: the font is slanted, but in a roman style.
- * @PANGO_STYLE_ITALIC: the font is slanted in an italic style.
+ * Pango2Style:
+ * @PANGO2_STYLE_NORMAL: the font is upright.
+ * @PANGO2_STYLE_OBLIQUE: the font is slanted, but in a roman style.
+ * @PANGO2_STYLE_ITALIC: the font is slanted in an italic style.
*
* An enumeration specifying the various slant styles possible for a font.
**/
typedef enum {
- PANGO_STYLE_NORMAL,
- PANGO_STYLE_OBLIQUE,
- PANGO_STYLE_ITALIC
-} PangoStyle;
+ PANGO2_STYLE_NORMAL,
+ PANGO2_STYLE_OBLIQUE,
+ PANGO2_STYLE_ITALIC
+} Pango2Style;
/**
- * PangoVariant:
- * @PANGO_VARIANT_NORMAL: A normal font.
- * @PANGO_VARIANT_SMALL_CAPS: A font with the lower case characters
+ * Pango2Variant:
+ * @PANGO2_VARIANT_NORMAL: A normal font.
+ * @PANGO2_VARIANT_SMALL_CAPS: A font with the lower case characters
* replaced by smaller variants of the capital characters.
- * @PANGO_VARIANT_ALL_SMALL_CAPS: A font with all characters
+ * @PANGO2_VARIANT_ALL_SMALL_CAPS: A font with all characters
* replaced by smaller variants of the capital characters.
- * @PANGO_VARIANT_PETITE_CAPS: A font with the lower case characters
+ * @PANGO2_VARIANT_PETITE_CAPS: A font with the lower case characters
* replaced by smaller variants of the capital characters.
* Petite Caps can be even smaller than Small Caps.
- * @PANGO_VARIANT_ALL_PETITE_CAPS: A font with all characters
+ * @PANGO2_VARIANT_ALL_PETITE_CAPS: A font with all characters
* replaced by smaller variants of the capital characters.
* Petite Caps can be even smaller than Small Caps.
- * @PANGO_VARIANT_UNICASE: A font with the upper case characters
+ * @PANGO2_VARIANT_UNICASE: A font with the upper case characters
* replaced by smaller variants of the capital letters.
- * @PANGO_VARIANT_TITLE_CAPS: A font with capital letters that
+ * @PANGO2_VARIANT_TITLE_CAPS: A font with capital letters that
* are more suitable for all-uppercase titles.
*
* An enumeration specifying capitalization variant of the font.
*/
typedef enum {
- PANGO_VARIANT_NORMAL,
- PANGO_VARIANT_SMALL_CAPS,
- PANGO_VARIANT_ALL_SMALL_CAPS,
- PANGO_VARIANT_PETITE_CAPS,
- PANGO_VARIANT_ALL_PETITE_CAPS,
- PANGO_VARIANT_UNICASE,
- PANGO_VARIANT_TITLE_CAPS
-} PangoVariant;
+ PANGO2_VARIANT_NORMAL,
+ PANGO2_VARIANT_SMALL_CAPS,
+ PANGO2_VARIANT_ALL_SMALL_CAPS,
+ PANGO2_VARIANT_PETITE_CAPS,
+ PANGO2_VARIANT_ALL_PETITE_CAPS,
+ PANGO2_VARIANT_UNICASE,
+ PANGO2_VARIANT_TITLE_CAPS
+} Pango2Variant;
/**
- * PangoWeight:
- * @PANGO_WEIGHT_THIN: the thin weight (= 100)
- * @PANGO_WEIGHT_ULTRALIGHT: the ultralight weight (= 200)
- * @PANGO_WEIGHT_LIGHT: the light weight (= 300)
- * @PANGO_WEIGHT_SEMILIGHT: the semilight weight (= 350)
- * @PANGO_WEIGHT_BOOK: the book weight (= 380)
- * @PANGO_WEIGHT_NORMAL: the default weight (= 400)
- * @PANGO_WEIGHT_MEDIUM: the normal weight (= 500)
- * @PANGO_WEIGHT_SEMIBOLD: the semibold weight (= 600)
- * @PANGO_WEIGHT_BOLD: the bold weight (= 700)
- * @PANGO_WEIGHT_ULTRABOLD: the ultrabold weight (= 800)
- * @PANGO_WEIGHT_HEAVY: the heavy weight (= 900)
- * @PANGO_WEIGHT_ULTRAHEAVY: the ultraheavy weight (= 1000)
+ * Pango2Weight:
+ * @PANGO2_WEIGHT_THIN: the thin weight (= 100)
+ * @PANGO2_WEIGHT_ULTRALIGHT: the ultralight weight (= 200)
+ * @PANGO2_WEIGHT_LIGHT: the light weight (= 300)
+ * @PANGO2_WEIGHT_SEMILIGHT: the semilight weight (= 350)
+ * @PANGO2_WEIGHT_BOOK: the book weight (= 380)
+ * @PANGO2_WEIGHT_NORMAL: the default weight (= 400)
+ * @PANGO2_WEIGHT_MEDIUM: the normal weight (= 500)
+ * @PANGO2_WEIGHT_SEMIBOLD: the semibold weight (= 600)
+ * @PANGO2_WEIGHT_BOLD: the bold weight (= 700)
+ * @PANGO2_WEIGHT_ULTRABOLD: the ultrabold weight (= 800)
+ * @PANGO2_WEIGHT_HEAVY: the heavy weight (= 900)
+ * @PANGO2_WEIGHT_ULTRAHEAVY: the ultraheavy weight (= 1000)
*
- * A `PangoWeight` specifes the weight (boldness) of a font.
+ * A `Pango2Weight` specifes the weight (boldness) of a font.
*
* Weight is specified as a numeric value ranging from 100 to 1000.
* This enumeration simply provides some common, predefined values.
*/
typedef enum {
- PANGO_WEIGHT_THIN = 100,
- PANGO_WEIGHT_ULTRALIGHT = 200,
- PANGO_WEIGHT_LIGHT = 300,
- PANGO_WEIGHT_SEMILIGHT = 350,
- PANGO_WEIGHT_BOOK = 380,
- PANGO_WEIGHT_NORMAL = 400,
- PANGO_WEIGHT_MEDIUM = 500,
- PANGO_WEIGHT_SEMIBOLD = 600,
- PANGO_WEIGHT_BOLD = 700,
- PANGO_WEIGHT_ULTRABOLD = 800,
- PANGO_WEIGHT_HEAVY = 900,
- PANGO_WEIGHT_ULTRAHEAVY = 1000
-} PangoWeight;
+ PANGO2_WEIGHT_THIN = 100,
+ PANGO2_WEIGHT_ULTRALIGHT = 200,
+ PANGO2_WEIGHT_LIGHT = 300,
+ PANGO2_WEIGHT_SEMILIGHT = 350,
+ PANGO2_WEIGHT_BOOK = 380,
+ PANGO2_WEIGHT_NORMAL = 400,
+ PANGO2_WEIGHT_MEDIUM = 500,
+ PANGO2_WEIGHT_SEMIBOLD = 600,
+ PANGO2_WEIGHT_BOLD = 700,
+ PANGO2_WEIGHT_ULTRABOLD = 800,
+ PANGO2_WEIGHT_HEAVY = 900,
+ PANGO2_WEIGHT_ULTRAHEAVY = 1000
+} Pango2Weight;
/**
- * PangoStretch:
- * @PANGO_STRETCH_ULTRA_CONDENSED: ultra-condensed width (= 500)
- * @PANGO_STRETCH_EXTRA_CONDENSED: extra-condensed width (= 625)
- * @PANGO_STRETCH_CONDENSED: condensed width (= 750)
- * @PANGO_STRETCH_SEMI_CONDENSED: semi-condensed width (= 875)
- * @PANGO_STRETCH_NORMAL: the normal width (= 1000)
- * @PANGO_STRETCH_SEMI_EXPANDED: semi-expanded width (= 1125)
- * @PANGO_STRETCH_EXPANDED: expanded width (= 1250)
- * @PANGO_STRETCH_EXTRA_EXPANDED: extra-expanded width (= 1500)
- * @PANGO_STRETCH_ULTRA_EXPANDED: ultra-expanded width (= 2000)
+ * Pango2Stretch:
+ * @PANGO2_STRETCH_ULTRA_CONDENSED: ultra-condensed width (= 500)
+ * @PANGO2_STRETCH_EXTRA_CONDENSED: extra-condensed width (= 625)
+ * @PANGO2_STRETCH_CONDENSED: condensed width (= 750)
+ * @PANGO2_STRETCH_SEMI_CONDENSED: semi-condensed width (= 875)
+ * @PANGO2_STRETCH_NORMAL: the normal width (= 1000)
+ * @PANGO2_STRETCH_SEMI_EXPANDED: semi-expanded width (= 1125)
+ * @PANGO2_STRETCH_EXPANDED: expanded width (= 1250)
+ * @PANGO2_STRETCH_EXTRA_EXPANDED: extra-expanded width (= 1500)
+ * @PANGO2_STRETCH_ULTRA_EXPANDED: ultra-expanded width (= 2000)
*
- * A `PangoStretch` specifes the width of the font relative
+ * A `Pango2Stretch` specifes the width of the font relative
* to other designs within a family.
*
* Stretch is specified as a numeric value ranging from 500 to 2000.
* This enumeration simply provides some common, predefined values.
*/
typedef enum {
- PANGO_STRETCH_ULTRA_CONDENSED = 500,
- PANGO_STRETCH_EXTRA_CONDENSED = 625,
- PANGO_STRETCH_CONDENSED = 750,
- PANGO_STRETCH_SEMI_CONDENSED = 875,
- PANGO_STRETCH_NORMAL = 1000,
- PANGO_STRETCH_SEMI_EXPANDED = 1125,
- PANGO_STRETCH_EXPANDED = 1250,
- PANGO_STRETCH_EXTRA_EXPANDED = 1500,
- PANGO_STRETCH_ULTRA_EXPANDED = 2000
-} PangoStretch;
+ PANGO2_STRETCH_ULTRA_CONDENSED = 500,
+ PANGO2_STRETCH_EXTRA_CONDENSED = 625,
+ PANGO2_STRETCH_CONDENSED = 750,
+ PANGO2_STRETCH_SEMI_CONDENSED = 875,
+ PANGO2_STRETCH_NORMAL = 1000,
+ PANGO2_STRETCH_SEMI_EXPANDED = 1125,
+ PANGO2_STRETCH_EXPANDED = 1250,
+ PANGO2_STRETCH_EXTRA_EXPANDED = 1500,
+ PANGO2_STRETCH_ULTRA_EXPANDED = 2000
+} Pango2Stretch;
/**
- * PangoFontMask:
- * @PANGO_FONT_MASK_FAMILY: the font family is specified.
- * @PANGO_FONT_MASK_STYLE: the font style is specified.
- * @PANGO_FONT_MASK_VARIANT: the font variant is specified.
- * @PANGO_FONT_MASK_WEIGHT: the font weight is specified.
- * @PANGO_FONT_MASK_STRETCH: the font stretch is specified.
- * @PANGO_FONT_MASK_SIZE: the font size is specified.
- * @PANGO_FONT_MASK_GRAVITY: the font gravity is specified
- * @PANGO_FONT_MASK_VARIATIONS: OpenType font variations are specified
- * @PANGO_FONT_MASK_FACEID: the face ID is specified
+ * Pango2FontMask:
+ * @PANGO2_FONT_MASK_FAMILY: the font family is specified.
+ * @PANGO2_FONT_MASK_STYLE: the font style is specified.
+ * @PANGO2_FONT_MASK_VARIANT: the font variant is specified.
+ * @PANGO2_FONT_MASK_WEIGHT: the font weight is specified.
+ * @PANGO2_FONT_MASK_STRETCH: the font stretch is specified.
+ * @PANGO2_FONT_MASK_SIZE: the font size is specified.
+ * @PANGO2_FONT_MASK_GRAVITY: the font gravity is specified
+ * @PANGO2_FONT_MASK_VARIATIONS: OpenType font variations are specified
+ * @PANGO2_FONT_MASK_FACEID: the face ID is specified
*
- * The bits in a `PangoFontMask` correspond to the set fields in a
- * `PangoFontDescription`.
+ * The bits in a `Pango2FontMask` correspond to the set fields in a
+ * `Pango2FontDescription`.
*/
typedef enum {
- PANGO_FONT_MASK_FAMILY = 1 << 0,
- PANGO_FONT_MASK_STYLE = 1 << 1,
- PANGO_FONT_MASK_VARIANT = 1 << 2,
- PANGO_FONT_MASK_WEIGHT = 1 << 3,
- PANGO_FONT_MASK_STRETCH = 1 << 4,
- PANGO_FONT_MASK_SIZE = 1 << 5,
- PANGO_FONT_MASK_GRAVITY = 1 << 6,
- PANGO_FONT_MASK_VARIATIONS = 1 << 7,
- PANGO_FONT_MASK_FACEID = 1 << 8,
-} PangoFontMask;
+ PANGO2_FONT_MASK_FAMILY = 1 << 0,
+ PANGO2_FONT_MASK_STYLE = 1 << 1,
+ PANGO2_FONT_MASK_VARIANT = 1 << 2,
+ PANGO2_FONT_MASK_WEIGHT = 1 << 3,
+ PANGO2_FONT_MASK_STRETCH = 1 << 4,
+ PANGO2_FONT_MASK_SIZE = 1 << 5,
+ PANGO2_FONT_MASK_GRAVITY = 1 << 6,
+ PANGO2_FONT_MASK_VARIATIONS = 1 << 7,
+ PANGO2_FONT_MASK_FACEID = 1 << 8,
+} Pango2FontMask;
/* CSS scale factors (1.2 factor between each size) */
/**
- * PANGO_SCALE_XX_SMALL:
+ * PANGO2_SCALE_XX_SMALL:
*
* The scale factor for three shrinking steps (1 / (1.2 * 1.2 * 1.2)).
*/
/**
- * PANGO_SCALE_X_SMALL:
+ * PANGO2_SCALE_X_SMALL:
*
* The scale factor for two shrinking steps (1 / (1.2 * 1.2)).
*/
/**
- * PANGO_SCALE_SMALL:
+ * PANGO2_SCALE_SMALL:
*
* The scale factor for one shrinking step (1 / 1.2).
*/
/**
- * PANGO_SCALE_MEDIUM:
+ * PANGO2_SCALE_MEDIUM:
*
* The scale factor for normal size (1.0).
*/
/**
- * PANGO_SCALE_LARGE:
+ * PANGO2_SCALE_LARGE:
*
* The scale factor for one magnification step (1.2).
*/
/**
- * PANGO_SCALE_X_LARGE:
+ * PANGO2_SCALE_X_LARGE:
*
* The scale factor for two magnification steps (1.2 * 1.2).
*/
/**
- * PANGO_SCALE_XX_LARGE:
+ * PANGO2_SCALE_XX_LARGE:
*
* The scale factor for three magnification steps (1.2 * 1.2 * 1.2).
*/
-#define PANGO_SCALE_XX_SMALL ((double)0.5787037037037)
-#define PANGO_SCALE_X_SMALL ((double)0.6944444444444)
-#define PANGO_SCALE_SMALL ((double)0.8333333333333)
-#define PANGO_SCALE_MEDIUM ((double)1.0)
-#define PANGO_SCALE_LARGE ((double)1.2)
-#define PANGO_SCALE_X_LARGE ((double)1.44)
-#define PANGO_SCALE_XX_LARGE ((double)1.728)
+#define PANGO2_SCALE_XX_SMALL ((double)0.5787037037037)
+#define PANGO2_SCALE_X_SMALL ((double)0.6944444444444)
+#define PANGO2_SCALE_SMALL ((double)0.8333333333333)
+#define PANGO2_SCALE_MEDIUM ((double)1.0)
+#define PANGO2_SCALE_LARGE ((double)1.2)
+#define PANGO2_SCALE_X_LARGE ((double)1.44)
+#define PANGO2_SCALE_XX_LARGE ((double)1.728)
-#define PANGO_TYPE_FONT_DESCRIPTION (pango_font_description_get_type ())
+#define PANGO2_TYPE_FONT_DESCRIPTION (pango2_font_description_get_type ())
-PANGO_AVAILABLE_IN_ALL
-GType pango_font_description_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoFontDescription * pango_font_description_new (void);
-PANGO_AVAILABLE_IN_ALL
-PangoFontDescription * pango_font_description_copy (const PangoFontDescription *desc);
-PANGO_AVAILABLE_IN_ALL
-PangoFontDescription * pango_font_description_copy_static (const PangoFontDescription *desc);
-PANGO_AVAILABLE_IN_ALL
-guint pango_font_description_hash (const PangoFontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_font_description_equal (const PangoFontDescription *desc1,
- const PangoFontDescription *desc2) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_free (PangoFontDescription *desc);
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_font_description_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontDescription * pango2_font_description_new (void);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontDescription * pango2_font_description_copy (const Pango2FontDescription *desc);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontDescription * pango2_font_description_copy_static (const Pango2FontDescription *desc);
+PANGO2_AVAILABLE_IN_ALL
+guint pango2_font_description_hash (const Pango2FontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_font_description_equal (const Pango2FontDescription *desc1,
+ const Pango2FontDescription *desc2) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_free (Pango2FontDescription *desc);
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_family (PangoFontDescription *desc,
- const char *family);
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_family_static (PangoFontDescription *desc,
- const char *family);
-PANGO_AVAILABLE_IN_ALL
-const char * pango_font_description_get_family (const PangoFontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_style (PangoFontDescription *desc,
- PangoStyle style);
-PANGO_AVAILABLE_IN_ALL
-PangoStyle pango_font_description_get_style (const PangoFontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_variant (PangoFontDescription *desc,
- PangoVariant variant);
-PANGO_AVAILABLE_IN_ALL
-PangoVariant pango_font_description_get_variant (const PangoFontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_weight (PangoFontDescription *desc,
- PangoWeight weight);
-PANGO_AVAILABLE_IN_ALL
-PangoWeight pango_font_description_get_weight (const PangoFontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_stretch (PangoFontDescription *desc,
- PangoStretch stretch);
-PANGO_AVAILABLE_IN_ALL
-PangoStretch pango_font_description_get_stretch (const PangoFontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_size (PangoFontDescription *desc,
- int size);
-PANGO_AVAILABLE_IN_ALL
-int pango_font_description_get_size (const PangoFontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_absolute_size (PangoFontDescription *desc,
- double size);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_font_description_get_size_is_absolute (const PangoFontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_gravity (PangoFontDescription *desc,
- PangoGravity gravity);
-PANGO_AVAILABLE_IN_ALL
-PangoGravity pango_font_description_get_gravity (const PangoFontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_family (Pango2FontDescription *desc,
+ const char *family);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_family_static (Pango2FontDescription *desc,
+ const char *family);
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_font_description_get_family (const Pango2FontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_style (Pango2FontDescription *desc,
+ Pango2Style style);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Style pango2_font_description_get_style (const Pango2FontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_variant (Pango2FontDescription *desc,
+ Pango2Variant variant);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Variant pango2_font_description_get_variant (const Pango2FontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_weight (Pango2FontDescription *desc,
+ Pango2Weight weight);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Weight pango2_font_description_get_weight (const Pango2FontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_stretch (Pango2FontDescription *desc,
+ Pango2Stretch stretch);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Stretch pango2_font_description_get_stretch (const Pango2FontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_size (Pango2FontDescription *desc,
+ int size);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_font_description_get_size (const Pango2FontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_absolute_size (Pango2FontDescription *desc,
+ double size);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_font_description_get_size_is_absolute (const Pango2FontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_gravity (Pango2FontDescription *desc,
+ Pango2Gravity gravity);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Gravity pango2_font_description_get_gravity (const Pango2FontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_variations_static (PangoFontDescription *desc,
- const char *variations);
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_variations (PangoFontDescription *desc,
- const char *variations);
-PANGO_AVAILABLE_IN_ALL
-const char * pango_font_description_get_variations (const PangoFontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_variations_static (Pango2FontDescription *desc,
+ const char *variations);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_variations (Pango2FontDescription *desc,
+ const char *variations);
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_font_description_get_variations (const Pango2FontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_faceid (PangoFontDescription *desc,
- const char *faceid);
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_set_faceid_static (PangoFontDescription *desc,
- const char *faceid);
-PANGO_AVAILABLE_IN_ALL
-const char * pango_font_description_get_faceid (const PangoFontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_faceid (Pango2FontDescription *desc,
+ const char *faceid);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_set_faceid_static (Pango2FontDescription *desc,
+ const char *faceid);
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_font_description_get_faceid (const Pango2FontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-PangoFontMask pango_font_description_get_set_fields (const PangoFontDescription *desc) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_unset_fields (PangoFontDescription *desc,
- PangoFontMask to_unset);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontMask pango2_font_description_get_set_fields (const Pango2FontDescription *desc) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_unset_fields (Pango2FontDescription *desc,
+ Pango2FontMask to_unset);
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_merge (PangoFontDescription *desc,
- const PangoFontDescription *desc_to_merge,
- gboolean replace_existing);
-PANGO_AVAILABLE_IN_ALL
-void pango_font_description_merge_static (PangoFontDescription *desc,
- const PangoFontDescription *desc_to_merge,
- gboolean replace_existing);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_merge (Pango2FontDescription *desc,
+ const Pango2FontDescription *desc_to_merge,
+ gboolean replace_existing);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_description_merge_static (Pango2FontDescription *desc,
+ const Pango2FontDescription *desc_to_merge,
+ gboolean replace_existing);
-PANGO_AVAILABLE_IN_ALL
-PangoFontDescription * pango_font_description_from_string (const char *str);
-PANGO_AVAILABLE_IN_ALL
-char * pango_font_description_to_string (const PangoFontDescription *desc);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontDescription * pango2_font_description_from_string (const char *str);
+PANGO2_AVAILABLE_IN_ALL
+char * pango2_font_description_to_string (const Pango2FontDescription *desc);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontDescription, pango_font_description_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2FontDescription, pango2_font_description_free)
G_END_DECLS
diff --git a/pango/pango-font-face-private.h b/pango/pango-font-face-private.h
index c184d552..6c0172a5 100644
--- a/pango/pango-font-face-private.h
+++ b/pango/pango-font-face-private.h
@@ -23,63 +23,63 @@
#include <pango/pango-font-description.h>
-struct _PangoFontFace
+struct _Pango2FontFace
{
GObject parent_instance;
- PangoFontFamily *family;
- PangoFontDescription *description;
+ Pango2FontFamily *family;
+ Pango2FontDescription *description;
char *name;
char *faceid;
};
-typedef struct _PangoFontFaceClass PangoFontFaceClass;
+typedef struct _Pango2FontFaceClass Pango2FontFaceClass;
-struct _PangoFontFaceClass
+struct _Pango2FontFaceClass
{
GObjectClass parent_class;
- gboolean (* is_synthesized) (PangoFontFace *face);
- gboolean (* is_monospace) (PangoFontFace *face);
- gboolean (* is_variable) (PangoFontFace *face);
- gboolean (* supports_language) (PangoFontFace *face,
- PangoLanguage *language);
- PangoLanguage ** (* get_languages) (PangoFontFace *face);
- gboolean (* has_char) (PangoFontFace *face,
- gunichar wc);
- const char * (* get_faceid) (PangoFontFace *face);
- PangoFont * (* create_font) (PangoFontFace *face,
- const PangoFontDescription *desc,
- float dpi,
- const PangoMatrix *ctm);
+ gboolean (* is_synthesized) (Pango2FontFace *face);
+ gboolean (* is_monospace) (Pango2FontFace *face);
+ gboolean (* is_variable) (Pango2FontFace *face);
+ gboolean (* supports_language) (Pango2FontFace *face,
+ Pango2Language *language);
+ Pango2Language ** (* get_languages) (Pango2FontFace *face);
+ gboolean (* has_char) (Pango2FontFace *face,
+ gunichar wc);
+ const char * (* get_faceid) (Pango2FontFace *face);
+ Pango2Font * (* create_font) (Pango2FontFace *face,
+ const Pango2FontDescription *desc,
+ float dpi,
+ const Pango2Matrix *ctm);
};
-#define PANGO_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
-#define PANGO_FONT_FACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
+#define PANGO2_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO2_TYPE_FONT_FACE, Pango2FontFaceClass))
+#define PANGO2_FONT_FACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO2_TYPE_FONT_FACE, Pango2FontFaceClass))
-const char * pango_font_face_get_faceid (PangoFontFace *face);
-PangoFont * pango_font_face_create_font (PangoFontFace *face,
- const PangoFontDescription *desc,
- float dpi,
- const PangoMatrix *ctm);
+const char * pango2_font_face_get_faceid (Pango2FontFace *face);
+Pango2Font * pango2_font_face_create_font (Pango2FontFace *face,
+ const Pango2FontDescription *desc,
+ float dpi,
+ const Pango2Matrix *ctm);
static inline void
-pango_font_face_set_name (PangoFontFace *face,
- const char *name)
+pango2_font_face_set_name (Pango2FontFace *face,
+ const char *name)
{
face->name = g_strdup (name);
}
static inline void
-pango_font_face_set_description (PangoFontFace *face,
- const PangoFontDescription *description)
+pango2_font_face_set_description (Pango2FontFace *face,
+ const Pango2FontDescription *description)
{
- face->description = pango_font_description_copy (description);
+ face->description = pango2_font_description_copy (description);
}
static inline void
-pango_font_face_set_family (PangoFontFace *face,
- PangoFontFamily *family)
+pango2_font_face_set_family (Pango2FontFace *face,
+ Pango2FontFamily *family)
{
face->family = family;
}
diff --git a/pango/pango-font-face.c b/pango/pango-font-face.c
index 36232694..475cb871 100644
--- a/pango/pango-font-face.c
+++ b/pango/pango-font-face.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 1999 Red Hat Software
*
@@ -52,19 +52,19 @@ get_backtrace (void)
#endif
/**
- * PangoFontFace:
+ * Pango2FontFace:
*
- * A `PangoFontFace` is used to represent a group of fonts with
+ * A `Pango2FontFace` is used to represent a group of fonts with
* the same family, slant, weight, and width, but varying sizes.
*
- * `PangoFontFace` provides APIs to determine coverage information,
- * such as [method@Pango.FontFace.has_char] and
- * [method@Pango.FontFace.supports_language], as well as general
- * information about the font face like [method@Pango.FontFace.is_monospace]
- * or [method@Pango.FontFace.is_variable].
+ * `Pango2FontFace` provides APIs to determine coverage information,
+ * such as [method@Pango2.FontFace.has_char] and
+ * [method@Pango2.FontFace.supports_language], as well as general
+ * information about the font face like [method@Pango2.FontFace.is_monospace]
+ * or [method@Pango2.FontFace.is_variable].
*/
-/* {{{ PangoFontFace implementation */
+/* {{{ Pango2FontFace implementation */
enum {
PROP_NAME = 1,
@@ -78,73 +78,73 @@ enum {
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
-G_DEFINE_ABSTRACT_TYPE (PangoFontFace, pango_font_face, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE (Pango2FontFace, pango2_font_face, G_TYPE_OBJECT)
static gboolean
-pango_font_face_default_is_monospace (PangoFontFace *face)
+pango2_font_face_default_is_monospace (Pango2FontFace *face)
{
return FALSE;
}
static gboolean
-pango_font_face_default_is_variable (PangoFontFace *face)
+pango2_font_face_default_is_variable (Pango2FontFace *face)
{
return FALSE;
}
static gboolean
-pango_font_face_default_supports_language (PangoFontFace *face,
- PangoLanguage *language)
+pango2_font_face_default_supports_language (Pango2FontFace *face,
+ Pango2Language *language)
{
return TRUE;
}
-static PangoLanguage **
-pango_font_face_default_get_languages (PangoFontFace *face)
+static Pango2Language **
+pango2_font_face_default_get_languages (Pango2FontFace *face)
{
return NULL;
}
static gboolean
-pango_font_face_default_has_char (PangoFontFace *face,
- gunichar wc)
+pango2_font_face_default_has_char (Pango2FontFace *face,
+ gunichar wc)
{
return FALSE;
}
static const char *
-pango_font_face_default_get_faceid (PangoFontFace *face)
+pango2_font_face_default_get_faceid (Pango2FontFace *face)
{
return "";
}
-static PangoFont *
-pango_font_face_default_create_font (PangoFontFace *face,
- const PangoFontDescription *desc,
- float dpi,
- const PangoMatrix *ctm)
+static Pango2Font *
+pango2_font_face_default_create_font (Pango2FontFace *face,
+ const Pango2FontDescription *desc,
+ float dpi,
+ const Pango2Matrix *ctm)
{
return NULL;
}
static void
-pango_font_face_finalize (GObject *object)
+pango2_font_face_finalize (GObject *object)
{
- PangoFontFace *face = PANGO_FONT_FACE (object);
+ Pango2FontFace *face = PANGO2_FONT_FACE (object);
- pango_font_description_free (face->description);
+ pango2_font_description_free (face->description);
g_free (face->name);
- G_OBJECT_CLASS (pango_font_face_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_font_face_parent_class)->finalize (object);
}
static void
-pango_font_face_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+pango2_font_face_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- PangoFontFace *face = PANGO_FONT_FACE (object);
+ Pango2FontFace *face = PANGO2_FONT_FACE (object);
switch (property_id)
{
@@ -153,9 +153,9 @@ pango_font_face_get_property (GObject *object,
break;
case PROP_DESCRIPTION:
- if ((pango_font_description_get_set_fields (face->description) & PANGO_FONT_MASK_FACEID) == 0)
- pango_font_description_set_faceid (face->description,
- pango_font_face_get_faceid (face));
+ if ((pango2_font_description_get_set_fields (face->description) & PANGO2_FONT_MASK_FACEID) == 0)
+ pango2_font_description_set_faceid (face->description,
+ pango2_font_face_get_faceid (face));
g_value_set_boxed (value, face->description);
break;
@@ -165,15 +165,15 @@ pango_font_face_get_property (GObject *object,
break;
case PROP_SYNTHESIZED:
- g_value_set_boolean (value, pango_font_face_is_synthesized (face));
+ g_value_set_boolean (value, pango2_font_face_is_synthesized (face));
break;
case PROP_MONOSPACE:
- g_value_set_boolean (value, pango_font_face_is_monospace (face));
+ g_value_set_boolean (value, pango2_font_face_is_monospace (face));
break;
case PROP_VARIABLE:
- g_value_set_boolean (value, pango_font_face_is_variable (face));
+ g_value_set_boolean (value, pango2_font_face_is_variable (face));
break;
default:
@@ -182,23 +182,23 @@ pango_font_face_get_property (GObject *object,
}
static void
-pango_font_face_class_init (PangoFontFaceClass *class)
+pango2_font_face_class_init (Pango2FontFaceClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = pango_font_face_finalize;
- object_class->get_property = pango_font_face_get_property;
+ object_class->finalize = pango2_font_face_finalize;
+ object_class->get_property = pango2_font_face_get_property;
- class->is_monospace = pango_font_face_default_is_monospace;
- class->is_variable = pango_font_face_default_is_variable;
- class->get_languages = pango_font_face_default_get_languages;
- class->supports_language = pango_font_face_default_supports_language;
- class->has_char = pango_font_face_default_has_char;
- class->get_faceid = pango_font_face_default_get_faceid;
- class->create_font = pango_font_face_default_create_font;
+ class->is_monospace = pango2_font_face_default_is_monospace;
+ class->is_variable = pango2_font_face_default_is_variable;
+ class->get_languages = pango2_font_face_default_get_languages;
+ class->supports_language = pango2_font_face_default_supports_language;
+ class->has_char = pango2_font_face_default_has_char;
+ class->get_faceid = pango2_font_face_default_get_faceid;
+ class->create_font = pango2_font_face_default_create_font;
/**
- * PangoFontFace:name: (attributes org.gtk.Property.get=pango_font_face_get_name)
+ * Pango2FontFace:name: (attributes org.gtk.Property.get=pango2_font_face_get_name)
*
* A name representing the style of this face.
*/
@@ -207,7 +207,7 @@ pango_font_face_class_init (PangoFontFaceClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFontFace:description: (attributes org.gtk.Property.get=pango_font_face_describe)
+ * Pango2FontFace:description: (attributes org.gtk.Property.get=pango2_font_face_describe)
*
* A font description that matches the face.
*
@@ -217,21 +217,21 @@ pango_font_face_class_init (PangoFontFaceClass *class)
*/
properties[PROP_DESCRIPTION] =
g_param_spec_boxed ("description", NULL, NULL,
- PANGO_TYPE_FONT_DESCRIPTION,
+ PANGO2_TYPE_FONT_DESCRIPTION,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFontFace:family: (attributes org.gtk.Property.get=pango_font_face_get_family)
+ * Pango2FontFace:family: (attributes org.gtk.Property.get=pango2_font_face_get_family)
*
- * The `PangoFontFamily` that the face belongs to.
+ * The `Pango2FontFamily` that the face belongs to.
*/
properties[PROP_FAMILY] =
g_param_spec_object ("family", NULL, NULL,
- PANGO_TYPE_FONT_FAMILY,
+ PANGO2_TYPE_FONT_FAMILY,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFontFace:synthesized: (attributes org.gtk.Property.get=pango_font_face_is_synthesized)
+ * Pango2FontFace:synthesized: (attributes org.gtk.Property.get=pango2_font_face_is_synthesized)
*
* `TRUE` if the face is synthesized.
*
@@ -244,7 +244,7 @@ pango_font_face_class_init (PangoFontFaceClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFontFace:monospace: (attributes org.gtk.Property.get=pango_font_face_is_monospace)
+ * Pango2FontFace:monospace: (attributes org.gtk.Property.get=pango2_font_face_is_monospace)
*
* `TRUE` if the face is designed for text display where the the
* characters form a regular grid.
@@ -254,7 +254,7 @@ pango_font_face_class_init (PangoFontFaceClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFontFace:variable: (attributes org.gtk.Property.get=pango_font_face_is_variable)
+ * Pango2FontFace:variable: (attributes org.gtk.Property.get=pango2_font_face_is_variable)
*
* `TRUE` if the face has axes that can be modified
* to produce variations.
@@ -267,40 +267,40 @@ pango_font_face_class_init (PangoFontFaceClass *class)
}
static void
-pango_font_face_init (PangoFontFace *face G_GNUC_UNUSED)
+pango2_font_face_init (Pango2FontFace *face G_GNUC_UNUSED)
{
}
/* }}} */
/* {{{ Private API */
-PangoFont *
-pango_font_face_create_font (PangoFontFace *face,
- const PangoFontDescription *desc,
- float dpi,
- const PangoMatrix *ctm)
+Pango2Font *
+pango2_font_face_create_font (Pango2FontFace *face,
+ const Pango2FontDescription *desc,
+ float dpi,
+ const Pango2Matrix *ctm)
{
- if (!PANGO_IS_FONT_FACE (face))
+ if (!PANGO2_IS_FONT_FACE (face))
{
- char *s = pango_font_description_to_string (desc);
+ char *s = pango2_font_description_to_string (desc);
#ifdef __linux__
char *bs = get_backtrace ();
#else
char *bs = g_strdup ("");
#endif
- g_critical ("pango_font_face_create_font called without a face for %s\n%s", s, bs);
+ g_critical ("pango2_font_face_create_font called without a face for %s\n%s", s, bs);
g_free (s);
g_free (bs);
}
- g_return_val_if_fail (PANGO_IS_FONT_FACE (face), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT_FACE (face), NULL);
- return PANGO_FONT_FACE_GET_CLASS (face)->create_font (face, desc, dpi, ctm);
+ return PANGO2_FONT_FACE_GET_CLASS (face)->create_font (face, desc, dpi, ctm);
}
/*< private >
- * pango_font_face_get_faceid:
- * @self: a `PangoHbFace`
+ * pango2_font_face_get_faceid:
+ * @self: a `Pango2HbFace`
*
* Returns the faceid of the face.
*
@@ -310,10 +310,10 @@ pango_font_face_create_font (PangoFontFace *face,
* this), the face index, the instance ID, as well as synthetic
* tweaks such as emboldening and transforms and variations.
*
- * [method@Pango.FontFace.describe] adds the faceid to the font
+ * [method@Pango2.FontFace.describe] adds the faceid to the font
* description that it produces.
*
- * See pango_hb_family_find_face() for the code that takes the
+ * See pango2_hb_family_find_face() for the code that takes the
* faceid into account when searching for a face. It is careful
* to fall back to approximate matching if an exact match for
* the faceid isn't found. That should make it safe to preserve
@@ -328,19 +328,19 @@ pango_font_face_create_font (PangoFontFace *face,
* Returns: (transfer none): the faceid
*/
const char *
-pango_font_face_get_faceid (PangoFontFace *face)
+pango2_font_face_get_faceid (Pango2FontFace *face)
{
- g_return_val_if_fail (PANGO_IS_FONT_FACE (face), "");
+ g_return_val_if_fail (PANGO2_IS_FONT_FACE (face), "");
- return PANGO_FONT_FACE_GET_CLASS (face)->get_faceid (face);
+ return PANGO2_FONT_FACE_GET_CLASS (face)->get_faceid (face);
}
/* }}} */
/* {{{ Public API */
/**
- * pango_font_face_describe:
- * @face: a `PangoFontFace`
+ * pango2_font_face_describe:
+ * @face: a `Pango2FontFace`
*
* Returns a font description that matches the face.
*
@@ -348,27 +348,27 @@ pango_font_face_get_faceid (PangoFontFace *face)
* variant, weight and stretch of the face, but its size field
* will be unset.
*
- * Return value: a newly-created `PangoFontDescription` structure
- * holding the description of the face. Use [method@Pango.FontDescription.free]
+ * Return value: a newly-created `Pango2FontDescription` structure
+ * holding the description of the face. Use [method@Pango2.FontDescription.free]
* to free the result.
*/
-PangoFontDescription *
-pango_font_face_describe (PangoFontFace *face)
+Pango2FontDescription *
+pango2_font_face_describe (Pango2FontFace *face)
{
- g_return_val_if_fail (PANGO_IS_FONT_FACE (face), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT_FACE (face), NULL);
- if ((pango_font_description_get_set_fields (face->description) & PANGO_FONT_MASK_FACEID) == 0)
- pango_font_description_set_faceid (face->description,
- pango_font_face_get_faceid (face));
+ if ((pango2_font_description_get_set_fields (face->description) & PANGO2_FONT_MASK_FACEID) == 0)
+ pango2_font_description_set_faceid (face->description,
+ pango2_font_face_get_faceid (face));
- return pango_font_description_copy (face->description);
+ return pango2_font_description_copy (face->description);
}
/**
- * pango_font_face_is_synthesized:
- * @face: a `PangoFontFace`
+ * pango2_font_face_is_synthesized:
+ * @face: a `Pango2FontFace`
*
- * Returns whether a `PangoFontFace` is synthesized.
+ * Returns whether a `Pango2FontFace` is synthesized.
*
* This will be the case if the underlying font rendering engine
* creates this face from another face, by shearing, emboldening,
@@ -377,19 +377,19 @@ pango_font_face_describe (PangoFontFace *face)
* Return value: whether @face is synthesized
*/
gboolean
-pango_font_face_is_synthesized (PangoFontFace *face)
+pango2_font_face_is_synthesized (Pango2FontFace *face)
{
- g_return_val_if_fail (PANGO_IS_FONT_FACE (face), FALSE);
+ g_return_val_if_fail (PANGO2_IS_FONT_FACE (face), FALSE);
- if (PANGO_FONT_FACE_GET_CLASS (face)->is_synthesized != NULL)
- return PANGO_FONT_FACE_GET_CLASS (face)->is_synthesized (face);
+ if (PANGO2_FONT_FACE_GET_CLASS (face)->is_synthesized != NULL)
+ return PANGO2_FONT_FACE_GET_CLASS (face)->is_synthesized (face);
else
return FALSE;
}
/**
- * pango_font_face_get_name:
- * @face: a `PangoFontFace`.
+ * pango2_font_face_get_name:
+ * @face: a `Pango2FontFace`.
*
* Gets a name representing the style of this face.
*
@@ -401,32 +401,32 @@ pango_font_face_is_synthesized (PangoFontFace *face)
* owned by the face object and must not be modified or freed.
*/
const char *
-pango_font_face_get_name (PangoFontFace *face)
+pango2_font_face_get_name (Pango2FontFace *face)
{
- g_return_val_if_fail (PANGO_IS_FONT_FACE (face), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT_FACE (face), NULL);
return face->name;
}
/**
- * pango_font_face_get_family:
- * @face: a `PangoFontFace`
+ * pango2_font_face_get_family:
+ * @face: a `Pango2FontFace`
*
- * Gets the `PangoFontFamily` that the face belongs to.
+ * Gets the `Pango2FontFamily` that the face belongs to.
*
- * Returns: (transfer none): the `PangoFontFamily`
+ * Returns: (transfer none): the `Pango2FontFamily`
*/
-PangoFontFamily *
-pango_font_face_get_family (PangoFontFace *face)
+Pango2FontFamily *
+pango2_font_face_get_family (Pango2FontFace *face)
{
- g_return_val_if_fail (PANGO_IS_FONT_FACE (face), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT_FACE (face), NULL);
return face->family;
}
/**
- * pango_font_face_is_monospace:
- * @face: a `PangoFontFace`
+ * pango2_font_face_is_monospace:
+ * @face: a `Pango2FontFace`
*
* Returns whether this font face is monospace.
*
@@ -441,23 +441,23 @@ pango_font_face_get_family (PangoFontFace *face)
* font.
*
* The best way to find out the grid-cell size is to call
- * [method@Pango.FontMetrics.get_approximate_digit_width], since the
- * results of [method@Pango.FontMetrics.get_approximate_char_width] may
+ * [method@Pango2.FontMetrics.get_approximate_digit_width], since the
+ * results of [method@Pango2.FontMetrics.get_approximate_char_width] may
* be affected by double-width characters.
*
* Returns: `TRUE` if @face is monospace
*/
gboolean
-pango_font_face_is_monospace (PangoFontFace *face)
+pango2_font_face_is_monospace (Pango2FontFace *face)
{
- g_return_val_if_fail (PANGO_IS_FONT_FACE (face), FALSE);
+ g_return_val_if_fail (PANGO2_IS_FONT_FACE (face), FALSE);
- return PANGO_FONT_FACE_GET_CLASS (face)->is_monospace (face);
+ return PANGO2_FONT_FACE_GET_CLASS (face)->is_monospace (face);
}
/**
- * pango_font_face_is_variable:
- * @face: a `PangoFontFace`
+ * pango2_font_face_is_variable:
+ * @face: a `Pango2FontFace`
*
* Returns whether this font face is variable.
*
@@ -465,22 +465,22 @@ pango_font_face_is_monospace (PangoFontFace *face)
* to produce variations.
*
* Such axes are also known as _variations_; see
- * [method@Pango.FontDescription.set_variations] for more information.
+ * [method@Pango2.FontDescription.set_variations] for more information.
*
* Returns: `TRUE` if @face is variable
*/
gboolean
-pango_font_face_is_variable (PangoFontFace *face)
+pango2_font_face_is_variable (Pango2FontFace *face)
{
- g_return_val_if_fail (PANGO_IS_FONT_FACE (face), FALSE);
+ g_return_val_if_fail (PANGO2_IS_FONT_FACE (face), FALSE);
- return PANGO_FONT_FACE_GET_CLASS (face)->is_variable (face);
+ return PANGO2_FONT_FACE_GET_CLASS (face)->is_variable (face);
}
/**
- * pango_font_face_supports_language:
- * @face: a `PangoFontFace`
- * @language: a `PangoLanguage`
+ * pango2_font_face_supports_language:
+ * @face: a `Pango2FontFace`
+ * @language: a `Pango2Language`
*
* Returns whether the face has all the glyphs necessary to
* support this language.
@@ -488,17 +488,17 @@ pango_font_face_is_variable (PangoFontFace *face)
* Returns: `TRUE` if @face supports @language
*/
gboolean
-pango_font_face_supports_language (PangoFontFace *face,
- PangoLanguage *language)
+pango2_font_face_supports_language (Pango2FontFace *face,
+ Pango2Language *language)
{
- g_return_val_if_fail (PANGO_IS_FONT_FACE (face), FALSE);
+ g_return_val_if_fail (PANGO2_IS_FONT_FACE (face), FALSE);
- return PANGO_FONT_FACE_GET_CLASS (face)->supports_language (face, language);
+ return PANGO2_FONT_FACE_GET_CLASS (face)->supports_language (face, language);
}
/**
- * pango_font_face_get_languages:
- * @face: a `PangoFontFace`
+ * pango2_font_face_get_languages:
+ * @face: a `Pango2FontFace`
*
* Returns the languages that are supported by the face.
*
@@ -509,20 +509,20 @@ pango_font_face_supports_language (PangoFontFace *face,
* The returned array is only valid as long as the face
* and its fontmap are valid.
*
- * Returns: (transfer none) (nullable) (array zero-terminated=1) (element-type PangoLanguage):
- * an array of `PangoLanguage`
+ * Returns: (transfer none) (nullable) (array zero-terminated=1) (element-type Pango2Language):
+ * an array of `Pango2Language`
*/
-PangoLanguage **
-pango_font_face_get_languages (PangoFontFace *face)
+Pango2Language **
+pango2_font_face_get_languages (Pango2FontFace *face)
{
- g_return_val_if_fail (PANGO_IS_FONT_FACE (face), FALSE);
+ g_return_val_if_fail (PANGO2_IS_FONT_FACE (face), FALSE);
- return PANGO_FONT_FACE_GET_CLASS (face)->get_languages (face);
+ return PANGO2_FONT_FACE_GET_CLASS (face)->get_languages (face);
}
/**
- * pango_font_face_has_char:
- * @face: a `PangoFontFace`
+ * pango2_font_face_has_char:
+ * @face: a `Pango2FontFace`
* @wc: a Unicode character
*
* Returns whether the face provides a glyph for this character.
@@ -530,12 +530,12 @@ pango_font_face_get_languages (PangoFontFace *face)
* Returns: `TRUE` if @font can render @wc
*/
gboolean
-pango_font_face_has_char (PangoFontFace *face,
- gunichar wc)
+pango2_font_face_has_char (Pango2FontFace *face,
+ gunichar wc)
{
- g_return_val_if_fail (PANGO_IS_FONT_FACE (face), FALSE);
+ g_return_val_if_fail (PANGO2_IS_FONT_FACE (face), FALSE);
- return PANGO_FONT_FACE_GET_CLASS (face)->has_char (face, wc);
+ return PANGO2_FONT_FACE_GET_CLASS (face)->has_char (face, wc);
}
/* }}} */
diff --git a/pango/pango-font-face.h b/pango/pango-font-face.h
index 2a5a32c3..37c1f18a 100644
--- a/pango/pango-font-face.h
+++ b/pango/pango-font-face.h
@@ -26,36 +26,36 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_FONT_FACE (pango_font_face_get_type ())
-
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoFontFace, pango_font_face, PANGO, FONT_FACE, GObject)
-
-PANGO_AVAILABLE_IN_ALL
-PangoFontDescription * pango_font_face_describe (PangoFontFace *face);
-PANGO_AVAILABLE_IN_ALL
-const char * pango_font_face_get_name (PangoFontFace *face) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_font_face_is_synthesized (PangoFontFace *face) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_font_face_is_monospace (PangoFontFace *face);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_font_face_is_variable (PangoFontFace *face);
-
-PANGO_AVAILABLE_IN_ALL
-PangoFontFamily * pango_font_face_get_family (PangoFontFace *face);
-
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_font_face_supports_language
- (PangoFontFace *face,
- PangoLanguage *language);
-
-PANGO_AVAILABLE_IN_ALL
-PangoLanguage ** pango_font_face_get_languages (PangoFontFace *face);
-
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_font_face_has_char (PangoFontFace *face,
- gunichar wc);
+#define PANGO2_TYPE_FONT_FACE (pango2_font_face_get_type ())
+
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2FontFace, pango2_font_face, PANGO2, FONT_FACE, GObject)
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontDescription * pango2_font_face_describe (Pango2FontFace *face);
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_font_face_get_name (Pango2FontFace *face) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_font_face_is_synthesized (Pango2FontFace *face) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_font_face_is_monospace (Pango2FontFace *face);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_font_face_is_variable (Pango2FontFace *face);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontFamily * pango2_font_face_get_family (Pango2FontFace *face);
+
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_font_face_supports_language
+ (Pango2FontFace *face,
+ Pango2Language *language);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Language ** pango2_font_face_get_languages (Pango2FontFace *face);
+
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_font_face_has_char (Pango2FontFace *face,
+ gunichar wc);
G_END_DECLS
diff --git a/pango/pango-font-family-private.h b/pango/pango-font-family-private.h
index 32b2fc41..6875678c 100644
--- a/pango/pango-font-family-private.h
+++ b/pango/pango-font-family-private.h
@@ -22,37 +22,37 @@
#include <pango/pango-font-family.h>
-typedef struct _PangoFontFamilyClass PangoFontFamilyClass;
+typedef struct _Pango2FontFamilyClass Pango2FontFamilyClass;
-struct _PangoFontFamily
+struct _Pango2FontFamily
{
GObject parent_instance;
- PangoFontMap *map;
+ Pango2FontMap *map;
char *name;
};
-struct _PangoFontFamilyClass
+struct _Pango2FontFamilyClass
{
GObjectClass parent_class;
- PangoFontFace * (* get_face) (PangoFontFamily *family,
+ Pango2FontFace * (* get_face) (Pango2FontFamily *family,
const char *name);
};
-#define PANGO_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
-#define PANGO_FONT_FAMILY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
+#define PANGO2_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO2_TYPE_FONT_FAMILY, Pango2FontFamilyClass))
+#define PANGO2_FONT_FAMILY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO2_TYPE_FONT_FAMILY, Pango2FontFamilyClass))
static inline void
-pango_font_family_set_name (PangoFontFamily *family,
- const char *name)
+pango2_font_family_set_name (Pango2FontFamily *family,
+ const char *name)
{
family->name = g_strdup (name);
}
static inline void
-pango_font_family_set_font_map (PangoFontFamily *family,
- PangoFontMap *map)
+pango2_font_family_set_font_map (Pango2FontFamily *family,
+ Pango2FontMap *map)
{
if (family->map)
g_object_remove_weak_pointer (G_OBJECT (family->map),
diff --git a/pango/pango-font-family.c b/pango/pango-font-family.c
index 0d745d9f..1042c7d3 100644
--- a/pango/pango-font-family.c
+++ b/pango/pango-font-family.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 1999 Red Hat Software
*
@@ -27,51 +27,51 @@
#include "pango-font.h"
/**
- * PangoFontFamily:
+ * Pango2FontFamily:
*
- * A `PangoFontFamily` is used to represent a family of related
+ * A `Pango2FontFamily` is used to represent a family of related
* font faces.
*
* The font faces in a family share a common design, but differ in
* slant, weight, width or other aspects.
*
- * `PangoFontFamily` implements the [iface@Gio.ListModel] interface,
+ * `Pango2FontFamily` implements the [iface@Gio.ListModel] interface,
* to provide a list of font faces.
*/
/* {{{ GListModel implementation */
static GType
-pango_font_family_get_item_type (GListModel *list)
+pango2_font_family_get_item_type (GListModel *list)
{
- return PANGO_TYPE_FONT_FACE;
+ return PANGO2_TYPE_FONT_FACE;
}
static guint
-pango_font_family_get_n_items (GListModel *list)
+pango2_font_family_get_n_items (GListModel *list)
{
g_assert_not_reached ();
return 0;
}
static gpointer
-pango_font_family_get_item (GListModel *list,
- guint position)
+pango2_font_family_get_item (GListModel *list,
+ guint position)
{
g_assert_not_reached ();
return NULL;
}
static void
-pango_font_family_list_model_init (GListModelInterface *iface)
+pango2_font_family_list_model_init (GListModelInterface *iface)
{
- iface->get_item_type = pango_font_family_get_item_type;
- iface->get_n_items = pango_font_family_get_n_items;
- iface->get_item = pango_font_family_get_item;
+ iface->get_item_type = pango2_font_family_get_item_type;
+ iface->get_n_items = pango2_font_family_get_n_items;
+ iface->get_item = pango2_font_family_get_item;
}
/* }}} */
-/* {{{ PangoFontFamily implementation */
+/* {{{ Pango2FontFamily implementation */
enum {
PROP_NAME = 1,
@@ -82,23 +82,23 @@ enum {
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (PangoFontFamily, pango_font_family, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_font_family_list_model_init))
+G_DEFINE_ABSTRACT_TYPE_WITH_CODE (Pango2FontFamily, pango2_font_family, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango2_font_family_list_model_init))
-static PangoFontFace *
-pango_font_family_real_get_face (PangoFontFamily *family,
- const char *name)
+static Pango2FontFace *
+pango2_font_family_real_get_face (Pango2FontFamily *family,
+ const char *name)
{
- PangoFontFace *face;
+ Pango2FontFace *face;
face = NULL;
for (int i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (family)); i++)
{
- PangoFontFace *f = g_list_model_get_item (G_LIST_MODEL (family), i);
+ Pango2FontFace *f = g_list_model_get_item (G_LIST_MODEL (family), i);
g_object_unref (f);
if (name == NULL ||
- strcmp (name, pango_font_face_get_name (f)) == 0)
+ strcmp (name, pango2_font_face_get_name (f)) == 0)
{
face = f;
break;
@@ -109,24 +109,24 @@ pango_font_family_real_get_face (PangoFontFamily *family,
}
static void
-pango_font_family_finalize (GObject *object)
+pango2_font_family_finalize (GObject *object)
{
- PangoFontFamily *family = PANGO_FONT_FAMILY (object);
+ Pango2FontFamily *family = PANGO2_FONT_FAMILY (object);
g_free (family->name);
if (family->map)
g_object_remove_weak_pointer (G_OBJECT (family->map), (gpointer *)&family->map);
- G_OBJECT_CLASS (pango_font_family_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_font_family_parent_class)->finalize (object);
}
static void
-pango_font_family_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+pango2_font_family_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- PangoFontFamily *family = PANGO_FONT_FAMILY (object);
+ Pango2FontFamily *family = PANGO2_FONT_FAMILY (object);
switch (property_id)
{
@@ -135,11 +135,11 @@ pango_font_family_get_property (GObject *object,
break;
case PROP_ITEM_TYPE:
- g_value_set_gtype (value, PANGO_TYPE_FONT);
+ g_value_set_gtype (value, PANGO2_TYPE_FONT);
break;
case PROP_N_ITEMS:
- g_value_set_uint (value, pango_font_family_get_n_items (G_LIST_MODEL (object)));
+ g_value_set_uint (value, pango2_font_family_get_n_items (G_LIST_MODEL (object)));
break;
default:
@@ -148,17 +148,17 @@ pango_font_family_get_property (GObject *object,
}
static void
-pango_font_family_class_init (PangoFontFamilyClass *class)
+pango2_font_family_class_init (Pango2FontFamilyClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = pango_font_family_finalize;
- object_class->get_property = pango_font_family_get_property;
+ object_class->finalize = pango2_font_family_finalize;
+ object_class->get_property = pango2_font_family_get_property;
- class->get_face = pango_font_family_real_get_face;
+ class->get_face = pango2_font_family_real_get_face;
/**
- * PangoFontFamily:name: (attributes org.gtk.Property.get=pango_font_family_get_name)
+ * Pango2FontFamily:name: (attributes org.gtk.Property.get=pango2_font_family_get_name)
*
* The name of the family.
*/
@@ -167,16 +167,16 @@ pango_font_family_class_init (PangoFontFamilyClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFontFamily:item-type:
+ * Pango2FontFamily:item-type:
*
* The type of objects that the family contains.
*/
properties[PROP_ITEM_TYPE] =
- g_param_spec_gtype ("item-type", NULL, NULL, PANGO_TYPE_FONT_FACE,
+ g_param_spec_gtype ("item-type", NULL, NULL, PANGO2_TYPE_FONT_FACE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFontFamily:n-items:
+ * Pango2FontFamily:n-items:
*
* The number of faces contained in the family.
*/
@@ -188,7 +188,7 @@ pango_font_family_class_init (PangoFontFamilyClass *class)
}
static void
-pango_font_family_init (PangoFontFamily *family G_GNUC_UNUSED)
+pango2_font_family_init (Pango2FontFamily *family G_GNUC_UNUSED)
{
}
@@ -196,10 +196,10 @@ pango_font_family_init (PangoFontFamily *family G_GNUC_UNUSED)
/* {{{ Public API */
/**
- * pango_font_family_get_font_map:
- * @family: a `PangoFontFamily`
+ * pango2_font_family_get_font_map:
+ * @family: a `Pango2FontFamily`
*
- * Returns the `PangoFontMap that @family belongs to.
+ * Returns the `Pango2FontMap that @family belongs to.
*
* Note that the family maintains a *weak* reference to
* the font map, so if all references to font map are
@@ -209,57 +209,57 @@ pango_font_family_init (PangoFontFamily *family G_GNUC_UNUSED)
*
* It is the responsibility of the user to ensure that the
* font map is kept alive. In most uses this is not an issue
- * as a `PangoContext` holds a reference to the font map.
+ * as a `Pango2Context` holds a reference to the font map.
*
- * Return value: (transfer none) (nullable): the `PangoFontMap
+ * Return value: (transfer none) (nullable): the `Pango2FontMap
*/
-PangoFontMap *
-pango_font_family_get_font_map (PangoFontFamily *family)
+Pango2FontMap *
+pango2_font_family_get_font_map (Pango2FontFamily *family)
{
return family->map;
}
/**
- * pango_font_family_get_name:
- * @family: a `PangoFontFamily`
+ * pango2_font_family_get_name:
+ * @family: a `Pango2FontFamily`
*
* Gets the name of the family.
*
* The name is unique among all fonts for the font backend and can
- * be used in a `PangoFontDescription` to specify that a face from
+ * be used in a `Pango2FontDescription` to specify that a face from
* this family is desired.
*
* Return value: the name of the family. This string is owned
* by the family object and must not be modified or freed.
*/
const char *
-pango_font_family_get_name (PangoFontFamily *family)
+pango2_font_family_get_name (Pango2FontFamily *family)
{
- g_return_val_if_fail (PANGO_IS_FONT_FAMILY (family), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT_FAMILY (family), NULL);
return family->name;
}
/**
- * pango_font_family_get_face:
- * @family: a `PangoFontFamily`
+ * pango2_font_family_get_face:
+ * @family: a `Pango2FontFamily`
* @name: (nullable): the name of a face. If the name is `NULL`,
* the family's default face (fontconfig calls it "Regular")
* will be returned.
*
- * Gets the `PangoFontFace` of the family with the given name.
+ * Gets the `Pango2FontFace` of the family with the given name.
*
- * Returns: (transfer none) (nullable): the `PangoFontFace`,
+ * Returns: (transfer none) (nullable): the `Pango2FontFace`,
* or `NULL` if no face with the given name exists.
*/
-PangoFontFace *
-pango_font_family_get_face (PangoFontFamily *family,
- const char *name)
+Pango2FontFace *
+pango2_font_family_get_face (Pango2FontFamily *family,
+ const char *name)
{
- g_return_val_if_fail (PANGO_IS_FONT_FAMILY (family), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT_FAMILY (family), NULL);
- return PANGO_FONT_FAMILY_GET_CLASS (family)->get_face (family, name);
+ return PANGO2_FONT_FAMILY_GET_CLASS (family)->get_face (family, name);
}
/* }}} */
diff --git a/pango/pango-font-family.h b/pango/pango-font-family.h
index 2056d7a2..667bb9b9 100644
--- a/pango/pango-font-family.h
+++ b/pango/pango-font-family.h
@@ -26,19 +26,19 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_FONT_FAMILY (pango_font_family_get_type ())
+#define PANGO2_TYPE_FONT_FAMILY (pango2_font_family_get_type ())
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoFontFamily, pango_font_family, PANGO, FONT_FAMILY, GObject)
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2FontFamily, pango2_font_family, PANGO2, FONT_FAMILY, GObject)
-PANGO_AVAILABLE_IN_ALL
-PangoFontMap * pango_font_family_get_font_map (PangoFontFamily *family);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontMap * pango2_font_family_get_font_map (Pango2FontFamily *family);
-PANGO_AVAILABLE_IN_ALL
-const char * pango_font_family_get_name (PangoFontFamily *family) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_font_family_get_name (Pango2FontFamily *family) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-PangoFontFace * pango_font_family_get_face (PangoFontFamily *family,
- const char *name);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontFace * pango2_font_family_get_face (Pango2FontFamily *family,
+ const char *name);
G_END_DECLS
diff --git a/pango/pango-font-metrics-private.h b/pango/pango-font-metrics-private.h
index 70ddfa52..c01e295a 100644
--- a/pango/pango-font-metrics-private.h
+++ b/pango/pango-font-metrics-private.h
@@ -21,7 +21,7 @@
#include <pango/pango-font-metrics.h>
-struct _PangoFontMetrics
+struct _Pango2FontMetrics
{
/* <private> */
guint ref_count;
@@ -37,4 +37,4 @@ struct _PangoFontMetrics
int strikethrough_thickness;
};
-PangoFontMetrics *pango_font_metrics_new (void);
+Pango2FontMetrics *pango2_font_metrics_new (void);
diff --git a/pango/pango-font-metrics.c b/pango/pango-font-metrics.c
index 21a7c735..d2b61d44 100644
--- a/pango/pango-font-metrics.c
+++ b/pango/pango-font-metrics.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-font-metrics.c:
*
* Copyright (C) 1999 Red Hat Software
@@ -24,57 +24,57 @@
#include "pango-font-metrics-private.h"
-G_DEFINE_BOXED_TYPE (PangoFontMetrics, pango_font_metrics,
- pango_font_metrics_copy,
- pango_font_metrics_free);
+G_DEFINE_BOXED_TYPE (Pango2FontMetrics, pango2_font_metrics,
+ pango2_font_metrics_copy,
+ pango2_font_metrics_free);
/**
- * pango_font_metrics_new:
+ * pango2_font_metrics_new:
*
- * Creates a new `PangoFontMetrics` structure.
+ * Creates a new `Pango2FontMetrics` structure.
*
- * This is only for internal use by Pango backends and there is
+ * This is only for internal use by Pango2 backends and there is
* no public way to set the fields of the structure.
*
- * Return value: a newly-created `PangoFontMetrics` structure
+ * Return value: a newly-created `Pango2FontMetrics` structure
*/
-PangoFontMetrics *
-pango_font_metrics_new (void)
+Pango2FontMetrics *
+pango2_font_metrics_new (void)
{
- PangoFontMetrics *metrics = g_slice_new0 (PangoFontMetrics);
+ Pango2FontMetrics *metrics = g_slice_new0 (Pango2FontMetrics);
return metrics;
}
/**
- * pango_font_metrics_copy:
- * @metrics: (nullable): a `PangoFontMetrics` structure, may be %NULL
+ * pango2_font_metrics_copy:
+ * @metrics: (nullable): a `Pango2FontMetrics` structure, may be %NULL
*
* Create a copy of @metrics.
*
* Return value: (nullable): @metrics
*/
-PangoFontMetrics *
-pango_font_metrics_copy (PangoFontMetrics *metrics)
+Pango2FontMetrics *
+pango2_font_metrics_copy (Pango2FontMetrics *metrics)
{
- return g_slice_dup (PangoFontMetrics, metrics);
+ return g_slice_dup (Pango2FontMetrics, metrics);
}
/**
- * pango_font_metrics_free:
- * @metrics: (nullable): a `PangoFontMetrics` structure, may be %NULL
+ * pango2_font_metrics_free:
+ * @metrics: (nullable): a `Pango2FontMetrics` structure, may be %NULL
*
* Free the @metrics.
*/
void
-pango_font_metrics_free (PangoFontMetrics *metrics)
+pango2_font_metrics_free (Pango2FontMetrics *metrics)
{
- g_slice_free (PangoFontMetrics, metrics);
+ g_slice_free (Pango2FontMetrics, metrics);
}
/**
- * pango_font_metrics_get_ascent:
- * @metrics: a `PangoFontMetrics` structure
+ * pango2_font_metrics_get_ascent:
+ * @metrics: a `Pango2FontMetrics` structure
*
* Gets the ascent from a font metrics structure.
*
@@ -83,10 +83,10 @@ pango_font_metrics_free (PangoFontMetrics *metrics)
* of the actual drawn ink. It is necessary to lay out the text to
* figure where the ink will be.)
*
- * Return value: the ascent, in Pango units.
+ * Return value: the ascent, in Pango2 units.
*/
int
-pango_font_metrics_get_ascent (PangoFontMetrics *metrics)
+pango2_font_metrics_get_ascent (Pango2FontMetrics *metrics)
{
g_return_val_if_fail (metrics != NULL, 0);
@@ -94,8 +94,8 @@ pango_font_metrics_get_ascent (PangoFontMetrics *metrics)
}
/**
- * pango_font_metrics_get_descent:
- * @metrics: a `PangoFontMetrics` structure
+ * pango2_font_metrics_get_descent:
+ * @metrics: a `Pango2FontMetrics` structure
*
* Gets the descent from a font metrics structure.
*
@@ -104,10 +104,10 @@ pango_font_metrics_get_ascent (PangoFontMetrics *metrics)
* bottom of the actual drawn ink. It is necessary to lay out the text
* to figure where the ink will be.)
*
- * Return value: the descent, in Pango units.
+ * Return value: the descent, in Pango2 units.
*/
int
-pango_font_metrics_get_descent (PangoFontMetrics *metrics)
+pango2_font_metrics_get_descent (Pango2FontMetrics *metrics)
{
g_return_val_if_fail (metrics != NULL, 0);
@@ -115,8 +115,8 @@ pango_font_metrics_get_descent (PangoFontMetrics *metrics)
}
/**
- * pango_font_metrics_get_height:
- * @metrics: a `PangoFontMetrics` structure
+ * pango2_font_metrics_get_height:
+ * @metrics: a `Pango2FontMetrics` structure
*
* Gets the line height from a font metrics structure.
*
@@ -125,10 +125,10 @@ pango_font_metrics_get_descent (PangoFontMetrics *metrics)
*
* If the line height is not available, 0 is returned.
*
- * Return value: the height, in Pango units
+ * Return value: the height, in Pango2 units
*/
int
-pango_font_metrics_get_height (PangoFontMetrics *metrics)
+pango2_font_metrics_get_height (Pango2FontMetrics *metrics)
{
g_return_val_if_fail (metrics != NULL, 0);
@@ -136,8 +136,8 @@ pango_font_metrics_get_height (PangoFontMetrics *metrics)
}
/**
- * pango_font_metrics_get_approximate_char_width:
- * @metrics: a `PangoFontMetrics` structure
+ * pango2_font_metrics_get_approximate_char_width:
+ * @metrics: a `Pango2FontMetrics` structure
*
* Gets the approximate character width for a font metrics structure.
*
@@ -145,10 +145,10 @@ pango_font_metrics_get_height (PangoFontMetrics *metrics)
* determining the initial size for a window. Actual characters in
* text will be wider and narrower than this.
*
- * Return value: the character width, in Pango units.
+ * Return value: the character width, in Pango2 units.
*/
int
-pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics)
+pango2_font_metrics_get_approximate_char_width (Pango2FontMetrics *metrics)
{
g_return_val_if_fail (metrics != NULL, 0);
@@ -156,8 +156,8 @@ pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics)
}
/**
- * pango_font_metrics_get_approximate_digit_width:
- * @metrics: a `PangoFontMetrics` structure
+ * pango2_font_metrics_get_approximate_digit_width:
+ * @metrics: a `Pango2FontMetrics` structure
*
* Gets the approximate digit width for a font metrics structure.
*
@@ -165,12 +165,12 @@ pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics)
* determining the initial size for a window. Actual digits in
* text can be wider or narrower than this, though this value
* is generally somewhat more accurate than the result of
- * pango_font_metrics_get_approximate_char_width() for digits.
+ * pango2_font_metrics_get_approximate_char_width() for digits.
*
- * Return value: the digit width, in Pango units.
+ * Return value: the digit width, in Pango2 units.
*/
int
-pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics)
+pango2_font_metrics_get_approximate_digit_width (Pango2FontMetrics *metrics)
{
g_return_val_if_fail (metrics != NULL, 0);
@@ -178,8 +178,8 @@ pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics)
}
/**
- * pango_font_metrics_get_underline_position:
- * @metrics: a `PangoFontMetrics` structure
+ * pango2_font_metrics_get_underline_position:
+ * @metrics: a `Pango2FontMetrics` structure
*
* Gets the suggested position to draw the underline.
*
@@ -187,10 +187,10 @@ pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics)
* of the underline. Since most fonts have underline positions beneath
* the baseline, this value is typically negative.
*
- * Return value: the suggested underline position, in Pango units.
+ * Return value: the suggested underline position, in Pango2 units.
*/
int
-pango_font_metrics_get_underline_position (PangoFontMetrics *metrics)
+pango2_font_metrics_get_underline_position (Pango2FontMetrics *metrics)
{
g_return_val_if_fail (metrics != NULL, 0);
@@ -198,15 +198,15 @@ pango_font_metrics_get_underline_position (PangoFontMetrics *metrics)
}
/**
- * pango_font_metrics_get_underline_thickness:
- * @metrics: a `PangoFontMetrics` structure
+ * pango2_font_metrics_get_underline_thickness:
+ * @metrics: a `Pango2FontMetrics` structure
*
* Gets the suggested thickness to draw for the underline.
*
- * Return value: the suggested underline thickness, in Pango units.
+ * Return value: the suggested underline thickness, in Pango2 units.
*/
int
-pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics)
+pango2_font_metrics_get_underline_thickness (Pango2FontMetrics *metrics)
{
g_return_val_if_fail (metrics != NULL, 0);
@@ -214,18 +214,18 @@ pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics)
}
/**
- * pango_font_metrics_get_strikethrough_position:
- * @metrics: a `PangoFontMetrics` structure
+ * pango2_font_metrics_get_strikethrough_position:
+ * @metrics: a `Pango2FontMetrics` structure
*
* Gets the suggested position to draw the strikethrough.
*
* The value returned is the distance *above* the
* baseline of the top of the strikethrough.
*
- * Return value: the suggested strikethrough position, in Pango units.
+ * Return value: the suggested strikethrough position, in Pango2 units.
*/
int
-pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics)
+pango2_font_metrics_get_strikethrough_position (Pango2FontMetrics *metrics)
{
g_return_val_if_fail (metrics != NULL, 0);
@@ -233,15 +233,15 @@ pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics)
}
/**
- * pango_font_metrics_get_strikethrough_thickness:
- * @metrics: a `PangoFontMetrics` structure
+ * pango2_font_metrics_get_strikethrough_thickness:
+ * @metrics: a `Pango2FontMetrics` structure
*
* Gets the suggested thickness to draw for the strikethrough.
*
- * Return value: the suggested strikethrough thickness, in Pango units.
+ * Return value: the suggested strikethrough thickness, in Pango2 units.
*/
int
-pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics)
+pango2_font_metrics_get_strikethrough_thickness (Pango2FontMetrics *metrics)
{
g_return_val_if_fail (metrics != NULL, 0);
diff --git a/pango/pango-font-metrics.h b/pango/pango-font-metrics.h
index ff919e02..9d89a791 100644
--- a/pango/pango-font-metrics.h
+++ b/pango/pango-font-metrics.h
@@ -26,12 +26,12 @@
G_BEGIN_DECLS
/**
- * PangoFontMetrics:
+ * Pango2FontMetrics:
*
- * A `PangoFontMetrics` structure holds the overall metric information
+ * A `Pango2FontMetrics` structure holds the overall metric information
* for a font.
*
- * The information in a `PangoFontMetrics` structure may be restricted
+ * The information in a `Pango2FontMetrics` structure may be restricted
* to a script. The fields of this structure are private to implementations
* of a font backend. See the documentation of the corresponding getters
* for documentation of their meaning.
@@ -44,35 +44,35 @@ G_BEGIN_DECLS
* </picture>
*/
-typedef struct _PangoFontMetrics PangoFontMetrics;
+typedef struct _Pango2FontMetrics Pango2FontMetrics;
-#define PANGO_TYPE_FONT_METRICS (pango_font_metrics_get_type ())
+#define PANGO2_TYPE_FONT_METRICS (pango2_font_metrics_get_type ())
-PANGO_AVAILABLE_IN_ALL
-GType pango_font_metrics_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoFontMetrics *pango_font_metrics_copy (PangoFontMetrics *metrics);
-PANGO_AVAILABLE_IN_ALL
-void pango_font_metrics_free (PangoFontMetrics *metrics);
-PANGO_AVAILABLE_IN_ALL
-int pango_font_metrics_get_ascent (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-int pango_font_metrics_get_descent (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-int pango_font_metrics_get_height (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-int pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-int pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-int pango_font_metrics_get_underline_position (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-int pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-int pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-int pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_font_metrics_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontMetrics *pango2_font_metrics_copy (Pango2FontMetrics *metrics);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_metrics_free (Pango2FontMetrics *metrics);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_font_metrics_get_ascent (Pango2FontMetrics *metrics) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+int pango2_font_metrics_get_descent (Pango2FontMetrics *metrics) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+int pango2_font_metrics_get_height (Pango2FontMetrics *metrics) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+int pango2_font_metrics_get_approximate_char_width (Pango2FontMetrics *metrics) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+int pango2_font_metrics_get_approximate_digit_width (Pango2FontMetrics *metrics) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+int pango2_font_metrics_get_underline_position (Pango2FontMetrics *metrics) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+int pango2_font_metrics_get_underline_thickness (Pango2FontMetrics *metrics) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+int pango2_font_metrics_get_strikethrough_position (Pango2FontMetrics *metrics) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+int pango2_font_metrics_get_strikethrough_thickness (Pango2FontMetrics *metrics) G_GNUC_PURE;
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontMetrics, pango_font_metrics_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2FontMetrics, pango2_font_metrics_free)
G_END_DECLS
diff --git a/pango/pango-font-private.h b/pango/pango-font-private.h
index db4720dc..8d5e067b 100644
--- a/pango/pango-font-private.h
+++ b/pango/pango-font-private.h
@@ -29,100 +29,100 @@
#include <cairo.h>
#endif
-struct _PangoFont
+struct _Pango2Font
{
GObject parent_instance;
- PangoFontFace *face;
+ Pango2FontFace *face;
hb_font_t *hb_font;
- int size; /* point size, scaled by PANGO_SCALE */
+ int size; /* point size, scaled by PANGO2_SCALE */
float dpi;
- PangoGravity gravity;
- PangoMatrix ctm;
+ Pango2Gravity gravity;
+ Pango2Matrix ctm;
#ifdef HAVE_CAIRO
cairo_font_options_t *options;
#endif
};
-typedef struct _PangoFontClass PangoFontClass;
-struct _PangoFontClass
+typedef struct _Pango2FontClass Pango2FontClass;
+struct _Pango2FontClass
{
GObjectClass parent_class;
- PangoFontDescription * (* describe) (PangoFont *font);
- void (* get_glyph_extents) (PangoFont *font,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
- PangoFontMetrics * (* get_metrics) (PangoFont *font,
- PangoLanguage *language);
- hb_font_t * (* create_hb_font) (PangoFont *font);
- gboolean (* is_hinted) (PangoFont *font);
- void (* get_scale_factors) (PangoFont *font,
- double *x_scale,
- double *y_scale);
- void (* get_transform) (PangoFont *font,
- PangoMatrix *matrix);
+ Pango2FontDescription * (* describe) (Pango2Font *font);
+ void (* get_glyph_extents) (Pango2Font *font,
+ Pango2Glyph glyph,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect);
+ Pango2FontMetrics * (* get_metrics) (Pango2Font *font,
+ Pango2Language *language);
+ hb_font_t * (* create_hb_font) (Pango2Font *font);
+ gboolean (* is_hinted) (Pango2Font *font);
+ void (* get_scale_factors) (Pango2Font *font,
+ double *x_scale,
+ double *y_scale);
+ void (* get_transform) (Pango2Font *font,
+ Pango2Matrix *matrix);
};
-#define PANGO_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT, PangoFontClass))
-#define PANGO_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT, PangoFontClass))
+#define PANGO2_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO2_TYPE_FONT, Pango2FontClass))
+#define PANGO2_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO2_TYPE_FONT, Pango2FontClass))
static inline void
-pango_font_set_face (PangoFont *font,
- PangoFontFace *face)
+pango2_font_set_face (Pango2Font *font,
+ Pango2FontFace *face)
{
- font->face = (PangoFontFace *) g_object_ref (face);
+ font->face = (Pango2FontFace *) g_object_ref (face);
}
static inline void
-pango_font_set_size (PangoFont *font,
- int size)
+pango2_font_set_size (Pango2Font *font,
+ int size)
{
font->size = size;
}
static inline void
-pango_font_set_dpi (PangoFont *font,
- float dpi)
+pango2_font_set_dpi (Pango2Font *font,
+ float dpi)
{
font->dpi = dpi;
}
static inline void
-pango_font_set_gravity (PangoFont *font,
- PangoGravity gravity)
+pango2_font_set_gravity (Pango2Font *font,
+ Pango2Gravity gravity)
{
font->gravity = gravity;
}
static inline void
-pango_font_set_ctm (PangoFont *font,
- const PangoMatrix *ctm)
+pango2_font_set_ctm (Pango2Font *font,
+ const Pango2Matrix *ctm)
{
- const PangoMatrix matrix_init = PANGO_MATRIX_INIT;
+ const Pango2Matrix matrix_init = PANGO2_MATRIX_INIT;
font->ctm = ctm ? *ctm : matrix_init;
}
-gboolean pango_font_is_hinted (PangoFont *font);
-void pango_font_get_scale_factors (PangoFont *font,
- double *x_scale,
- double *y_scale);
-void pango_font_get_transform (PangoFont *font,
- PangoMatrix *matrix);
+gboolean pango2_font_is_hinted (Pango2Font *font);
+void pango2_font_get_scale_factors (Pango2Font *font,
+ double *x_scale,
+ double *y_scale);
+void pango2_font_get_transform (Pango2Font *font,
+ Pango2Matrix *matrix);
-gboolean pango_font_description_is_similar (const PangoFontDescription *a,
- const PangoFontDescription *b);
+gboolean pango2_font_description_is_similar (const Pango2FontDescription *a,
+ const Pango2FontDescription *b);
-int pango_font_description_compute_distance (const PangoFontDescription *a,
- const PangoFontDescription *b);
+int pango2_font_description_compute_distance (const Pango2FontDescription *a,
+ const Pango2FontDescription *b);
/* We use these values in a few places as a fallback size for an
* unknown glyph, if we have no better information.
*/
-#define PANGO_UNKNOWN_GLYPH_WIDTH 10
-#define PANGO_UNKNOWN_GLYPH_HEIGHT 14
+#define PANGO2_UNKNOWN_GLYPH_WIDTH 10
+#define PANGO2_UNKNOWN_GLYPH_HEIGHT 14
diff --git a/pango/pango-font.c b/pango/pango-font.c
index d8f081ad..cdf2fc42 100644
--- a/pango/pango-font.c
+++ b/pango/pango-font.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* fonts.c:
*
* Copyright (C) 1999 Red Hat Software
@@ -35,14 +35,14 @@
#include <hb-gobject.h>
/**
- * PangoFont:
+ * Pango2Font:
*
- * A `PangoFont` is used to represent a font in a
+ * A `Pango2Font` is used to represent a font in a
* rendering-system-independent manner.
*/
/* }}} */
-/* {{{ PangoFont implementation */
+/* {{{ Pango2Font implementation */
enum {
PROP_FACE = 1,
@@ -55,26 +55,26 @@ enum {
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
-G_DEFINE_ABSTRACT_TYPE (PangoFont, pango_font, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE (Pango2Font, pango2_font, G_TYPE_OBJECT)
static void
-pango_font_finalize (GObject *object)
+pango2_font_finalize (GObject *object)
{
- PangoFont *font = PANGO_FONT (object);
+ Pango2Font *font = PANGO2_FONT (object);
g_object_unref (font->face);
hb_font_destroy (font->hb_font);
- G_OBJECT_CLASS (pango_font_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_font_parent_class)->finalize (object);
}
static void
-pango_font_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+pango2_font_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- PangoFont *font = PANGO_FONT (object);
+ Pango2Font *font = PANGO2_FONT (object);
switch (property_id)
{
@@ -83,7 +83,7 @@ pango_font_get_property (GObject *object,
break;
case PROP_HB_FONT:
- g_value_set_boxed (value, pango_font_get_hb_font (font));
+ g_value_set_boxed (value, pango2_font_get_hb_font (font));
break;
case PROP_SIZE:
@@ -104,49 +104,49 @@ pango_font_get_property (GObject *object,
}
static gboolean
-pango_font_default_is_hinted (PangoFont *font)
+pango2_font_default_is_hinted (Pango2Font *font)
{
return FALSE;
}
static void
-pango_font_default_get_scale_factors (PangoFont *font,
- double *x_scale,
- double *y_scale)
+pango2_font_default_get_scale_factors (Pango2Font *font,
+ double *x_scale,
+ double *y_scale)
{
*x_scale = *y_scale = 1.0;
}
static void
-pango_font_default_get_transform (PangoFont *font,
- PangoMatrix *matrix)
+pango2_font_default_get_transform (Pango2Font *font,
+ Pango2Matrix *matrix)
{
- *matrix = (PangoMatrix) PANGO_MATRIX_INIT;
+ *matrix = (Pango2Matrix) PANGO2_MATRIX_INIT;
}
static void
-pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED)
+pango2_font_class_init (Pango2FontClass *class G_GNUC_UNUSED)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = pango_font_finalize;
- object_class->get_property = pango_font_get_property;
+ object_class->finalize = pango2_font_finalize;
+ object_class->get_property = pango2_font_get_property;
- class->is_hinted = pango_font_default_is_hinted;
- class->get_scale_factors = pango_font_default_get_scale_factors;
- class->get_transform = pango_font_default_get_transform;
+ class->is_hinted = pango2_font_default_is_hinted;
+ class->get_scale_factors = pango2_font_default_get_scale_factors;
+ class->get_transform = pango2_font_default_get_transform;
/**
- * PangoFont:face: (attributes org.gtk.Property.get=pango_font_get_face)
+ * Pango2Font:face: (attributes org.gtk.Property.get=pango2_font_get_face)
*
* The face to which the font belongs.
*/
properties[PROP_FACE] =
- g_param_spec_object ("face", NULL, NULL, PANGO_TYPE_FONT_FACE,
+ g_param_spec_object ("face", NULL, NULL, PANGO2_TYPE_FONT_FACE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFont:hb-font: (attributes org.gtk.Property.get=pango_font_get_hb_font)
+ * Pango2Font:hb-font: (attributes org.gtk.Property.get=pango2_font_get_hb_font)
*
* A `hb_font_t` object backing this font.
*/
@@ -155,16 +155,16 @@ pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFont:size: (attributes org.gtk.Property.get=pango_font_get_size)
+ * Pango2Font:size: (attributes org.gtk.Property.get=pango2_font_get_size)
*
- * The size of the font, scaled by `PANGO_SCALE`.
+ * The size of the font, scaled by `PANGO2_SCALE`.
*/
properties[PROP_SIZE] =
g_param_spec_int ("size", NULL, NULL, 0, G_MAXINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFont:dpi:
+ * Pango2Font:dpi:
*
* The resolution at which the font is rendered.
*
@@ -177,59 +177,59 @@ pango_font_class_init (PangoFontClass *class G_GNUC_UNUSED)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFont:gravity: (attributes org.gtk.Property.get=pango_font_get_gravity)
+ * Pango2Font:gravity: (attributes org.gtk.Property.get=pango2_font_get_gravity)
*
* The gravity of the font.
*/
properties[PROP_GRAVITY] =
- g_param_spec_enum ("gravity", NULL, NULL, PANGO_TYPE_GRAVITY,
- PANGO_GRAVITY_AUTO,
+ g_param_spec_enum ("gravity", NULL, NULL, PANGO2_TYPE_GRAVITY,
+ PANGO2_GRAVITY_AUTO,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
}
static void
-pango_font_init (PangoFont *font)
+pango2_font_init (Pango2Font *font)
{
- font->gravity = PANGO_GRAVITY_AUTO;
- font->ctm = (PangoMatrix) PANGO_MATRIX_INIT;
+ font->gravity = PANGO2_GRAVITY_AUTO;
+ font->ctm = (Pango2Matrix) PANGO2_MATRIX_INIT;
}
/* }}} */
/* {{{ Private API */
/*< private >
- * pango_font_get_transform:
- * @font: a `PangoFont`
+ * pango2_font_get_transform:
+ * @font: a `Pango2Font`
* @matrix: the matrix to fill in
*
* Gets the matrix for the transformation from 'font space' to 'user space'.
*/
void
-pango_font_get_transform (PangoFont *font,
- PangoMatrix *matrix)
+pango2_font_get_transform (Pango2Font *font,
+ Pango2Matrix *matrix)
{
- PANGO_FONT_GET_CLASS (font)->get_transform (font, matrix);
+ PANGO2_FONT_GET_CLASS (font)->get_transform (font, matrix);
}
/*< private >
- * pango_font_is_hinted:
- * @font: a `PangoFont`
+ * pango2_font_is_hinted:
+ * @font: a `Pango2Font`
*
* Gets whether this font is hinted.
*
* Returns: %TRUE if @font is hinted
*/
gboolean
-pango_font_is_hinted (PangoFont *font)
+pango2_font_is_hinted (Pango2Font *font)
{
- return PANGO_FONT_GET_CLASS (font)->is_hinted (font);
+ return PANGO2_FONT_GET_CLASS (font)->is_hinted (font);
}
/*< private >
- * pango_font_get_scale_factors:
- * @font: a `PangoFont`
+ * pango2_font_get_scale_factors:
+ * @font: a `Pango2Font`
* @x_scale: return location for X scale
* @y_scale: return location for Y scale
*
@@ -239,62 +239,62 @@ pango_font_is_hinted (PangoFont *font)
* loaded for.
*/
void
-pango_font_get_scale_factors (PangoFont *font,
- double *x_scale,
- double *y_scale)
+pango2_font_get_scale_factors (Pango2Font *font,
+ double *x_scale,
+ double *y_scale)
{
- PANGO_FONT_GET_CLASS (font)->get_scale_factors (font, x_scale, y_scale);
+ PANGO2_FONT_GET_CLASS (font)->get_scale_factors (font, x_scale, y_scale);
}
/* }}} */
/* {{{ Public API */
/**
- * pango_font_describe:
- * @font: a `PangoFont`
+ * pango2_font_describe:
+ * @font: a `Pango2Font`
*
* Returns a description of the font, with font size set in points.
*
- * Use [method@Pango.Font.describe_with_absolute_size] if you want
+ * Use [method@Pango2.Font.describe_with_absolute_size] if you want
* the font size in device units.
*
- * Return value: a newly-allocated `PangoFontDescription` object.
+ * Return value: a newly-allocated `Pango2FontDescription` object.
*/
-PangoFontDescription *
-pango_font_describe (PangoFont *font)
+Pango2FontDescription *
+pango2_font_describe (Pango2Font *font)
{
g_return_val_if_fail (font != NULL, NULL);
- return PANGO_FONT_GET_CLASS (font)->describe (font);
+ return PANGO2_FONT_GET_CLASS (font)->describe (font);
}
/**
- * pango_font_describe_with_absolute_size:
- * @font: a `PangoFont`
+ * pango2_font_describe_with_absolute_size:
+ * @font: a `Pango2Font`
*
* Returns a description of the font, with absolute font size set
* in device units.
*
- * Use [method@Pango.Font.describe] if you want the font size in points.
+ * Use [method@Pango2.Font.describe] if you want the font size in points.
*
- * Return value: a newly-allocated `PangoFontDescription` object.
+ * Return value: a newly-allocated `Pango2FontDescription` object.
*/
-PangoFontDescription *
-pango_font_describe_with_absolute_size (PangoFont *font)
+Pango2FontDescription *
+pango2_font_describe_with_absolute_size (Pango2Font *font)
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
g_return_val_if_fail (font != NULL, NULL);
- desc = pango_font_describe (font);
- pango_font_description_set_absolute_size (desc, font->size * font->dpi / 72.);
+ desc = pango2_font_describe (font);
+ pango2_font_description_set_absolute_size (desc, font->size * font->dpi / 72.);
return desc;
}
/**
- * pango_font_get_glyph_extents:
- * @font: (nullable): a `PangoFont`
+ * pango2_font_get_glyph_extents:
+ * @font: (nullable): a `Pango2Font`
* @glyph: the glyph index
* @ink_rect: (out) (optional): rectangle used to store the extents of the glyph as drawn
* @logical_rect: (out) (optional): rectangle used to store the logical extents of the glyph
@@ -303,45 +303,45 @@ pango_font_describe_with_absolute_size (PangoFont *font)
*
* The coordinate system for each rectangle has its origin at the
* base line and horizontal origin of the character with increasing
- * coordinates extending to the right and down. The macros PANGO_ASCENT(),
- * PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING() can be used to convert
+ * coordinates extending to the right and down. The macros PANGO2_ASCENT(),
+ * PANGO2_DESCENT(), PANGO2_LBEARING(), and PANGO2_RBEARING() can be used to convert
* from the extents rectangle to more traditional font metrics. The units
- * of the rectangles are in 1/PANGO_SCALE of a device unit.
+ * of the rectangles are in 1/PANGO2_SCALE of a device unit.
*
* If @font is %NULL, this function gracefully sets some sane values in the
* output variables and returns.
*/
void
-pango_font_get_glyph_extents (PangoFont *font,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_font_get_glyph_extents (Pango2Font *font,
+ Pango2Glyph glyph,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
if (G_UNLIKELY (!font))
{
if (ink_rect)
{
- ink_rect->x = PANGO_SCALE;
- ink_rect->y = - (PANGO_UNKNOWN_GLYPH_HEIGHT - 1) * PANGO_SCALE;
- ink_rect->height = (PANGO_UNKNOWN_GLYPH_HEIGHT - 2) * PANGO_SCALE;
- ink_rect->width = (PANGO_UNKNOWN_GLYPH_WIDTH - 2) * PANGO_SCALE;
+ ink_rect->x = PANGO2_SCALE;
+ ink_rect->y = - (PANGO2_UNKNOWN_GLYPH_HEIGHT - 1) * PANGO2_SCALE;
+ ink_rect->height = (PANGO2_UNKNOWN_GLYPH_HEIGHT - 2) * PANGO2_SCALE;
+ ink_rect->width = (PANGO2_UNKNOWN_GLYPH_WIDTH - 2) * PANGO2_SCALE;
}
if (logical_rect)
{
logical_rect->x = 0;
- logical_rect->y = - PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE;
- logical_rect->height = PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE;
- logical_rect->width = PANGO_UNKNOWN_GLYPH_WIDTH * PANGO_SCALE;
+ logical_rect->y = - PANGO2_UNKNOWN_GLYPH_HEIGHT * PANGO2_SCALE;
+ logical_rect->height = PANGO2_UNKNOWN_GLYPH_HEIGHT * PANGO2_SCALE;
+ logical_rect->width = PANGO2_UNKNOWN_GLYPH_WIDTH * PANGO2_SCALE;
}
return;
}
- PANGO_FONT_GET_CLASS (font)->get_glyph_extents (font, glyph, ink_rect, logical_rect);
+ PANGO2_FONT_GET_CLASS (font)->get_glyph_extents (font, glyph, ink_rect, logical_rect);
}
/**
- * pango_font_get_metrics:
- * @font: (nullable): a `PangoFont`
+ * pango2_font_get_metrics:
+ * @font: (nullable): a `Pango2Font`
* @language: (nullable): language tag used to determine which script
* to get the metrics for, or %NULL to indicate to get the metrics for
* the entire font.
@@ -355,52 +355,52 @@ pango_font_get_glyph_extents (PangoFont *font,
* If @font is %NULL, this function gracefully sets some sane values in the
* output variables and returns.
*
- * Return value: a `PangoFontMetrics` object. The caller must call
- * [method@Pango.FontMetrics.free] when finished using the object.
+ * Return value: a `Pango2FontMetrics` object. The caller must call
+ * [method@Pango2.FontMetrics.free] when finished using the object.
*/
-PangoFontMetrics *
-pango_font_get_metrics (PangoFont *font,
- PangoLanguage *language)
+Pango2FontMetrics *
+pango2_font_get_metrics (Pango2Font *font,
+ Pango2Language *language)
{
if (G_UNLIKELY (!font))
{
- PangoFontMetrics *metrics = pango_font_metrics_new ();
+ Pango2FontMetrics *metrics = pango2_font_metrics_new ();
- metrics->ascent = PANGO_SCALE * PANGO_UNKNOWN_GLYPH_HEIGHT;
+ metrics->ascent = PANGO2_SCALE * PANGO2_UNKNOWN_GLYPH_HEIGHT;
metrics->descent = 0;
metrics->height = 0;
- metrics->approximate_char_width = PANGO_SCALE * PANGO_UNKNOWN_GLYPH_WIDTH;
- metrics->approximate_digit_width = PANGO_SCALE * PANGO_UNKNOWN_GLYPH_WIDTH;
- metrics->underline_position = -PANGO_SCALE;
- metrics->underline_thickness = PANGO_SCALE;
- metrics->strikethrough_position = PANGO_SCALE * PANGO_UNKNOWN_GLYPH_HEIGHT / 2;
- metrics->strikethrough_thickness = PANGO_SCALE;
+ metrics->approximate_char_width = PANGO2_SCALE * PANGO2_UNKNOWN_GLYPH_WIDTH;
+ metrics->approximate_digit_width = PANGO2_SCALE * PANGO2_UNKNOWN_GLYPH_WIDTH;
+ metrics->underline_position = -PANGO2_SCALE;
+ metrics->underline_thickness = PANGO2_SCALE;
+ metrics->strikethrough_position = PANGO2_SCALE * PANGO2_UNKNOWN_GLYPH_HEIGHT / 2;
+ metrics->strikethrough_thickness = PANGO2_SCALE;
return metrics;
}
- return PANGO_FONT_GET_CLASS (font)->get_metrics (font, language);
+ return PANGO2_FONT_GET_CLASS (font)->get_metrics (font, language);
}
/**
- * pango_font_get_face:
- * @font: a `PangoFont`
+ * pango2_font_get_face:
+ * @font: a `Pango2Font`
*
- * Gets the `PangoFontFace` to which the font belongs.
+ * Gets the `Pango2FontFace` to which the font belongs.
*
- * Returns: (transfer none): the `PangoFontFace`
+ * Returns: (transfer none): the `Pango2FontFace`
*/
-PangoFontFace *
-pango_font_get_face (PangoFont *font)
+Pango2FontFace *
+pango2_font_get_face (Pango2Font *font)
{
- g_return_val_if_fail (PANGO_IS_FONT (font), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT (font), NULL);
return font->face;
}
/**
- * pango_font_get_hb_font:
- * @font: a `PangoFont`
+ * pango2_font_get_hb_font:
+ * @font: a `Pango2Font`
*
* Get a `hb_font_t` object backing this font.
*
@@ -412,13 +412,13 @@ pango_font_get_face (PangoFont *font)
* backing the font
*/
hb_font_t *
-pango_font_get_hb_font (PangoFont *font)
+pango2_font_get_hb_font (Pango2Font *font)
{
- g_return_val_if_fail (PANGO_IS_FONT (font), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT (font), NULL);
if (!font->hb_font)
{
- font->hb_font = PANGO_FONT_GET_CLASS (font)->create_hb_font (font);
+ font->hb_font = PANGO2_FONT_GET_CLASS (font)->create_hb_font (font);
hb_font_make_immutable (font->hb_font);
}
@@ -426,49 +426,49 @@ pango_font_get_hb_font (PangoFont *font)
}
/**
- * pango_font_get_size:
- * @font: a `PangoFont`
+ * pango2_font_get_size:
+ * @font: a `Pango2Font`
*
- * Returns the size of the font, scaled by `PANGO_SCALE`.
+ * Returns the size of the font, scaled by `PANGO2_SCALE`.
*
* Return value: the size of the font
*/
int
-pango_font_get_size (PangoFont *font)
+pango2_font_get_size (Pango2Font *font)
{
- g_return_val_if_fail (PANGO_IS_FONT (font), 0);
+ g_return_val_if_fail (PANGO2_IS_FONT (font), 0);
return font->size;
}
/**
- * pango_font_get_absolute_size:
- * @font: a `PangoFont`
+ * pango2_font_get_absolute_size:
+ * @font: a `Pango2Font`
*
- * Returns the pixel size of the font, scaled by `PANGO_SCALE`.
+ * Returns the pixel size of the font, scaled by `PANGO2_SCALE`.
*
* Return value: the pixel size of the font
*/
double
-pango_font_get_absolute_size (PangoFont *font)
+pango2_font_get_absolute_size (Pango2Font *font)
{
- g_return_val_if_fail (PANGO_IS_FONT (font), 0.);
+ g_return_val_if_fail (PANGO2_IS_FONT (font), 0.);
return font->size * font->dpi / 72.;
}
/**
- * pango_font_get_gravity:
- * @font: a `PangoFont`
+ * pango2_font_get_gravity:
+ * @font: a `Pango2Font`
*
* Returns the gravity of the font.
*
* Return value: the gravity of the font
*/
-PangoGravity
-pango_font_get_gravity (PangoFont *font)
+Pango2Gravity
+pango2_font_get_gravity (Pango2Font *font)
{
- g_return_val_if_fail (PANGO_IS_FONT (font), PANGO_GRAVITY_SOUTH);
+ g_return_val_if_fail (PANGO2_IS_FONT (font), PANGO2_GRAVITY_SOUTH);
return font->gravity;
}
diff --git a/pango/pango-font.h b/pango/pango-font.h
index e5f6ca3d..6d144647 100644
--- a/pango/pango-font.h
+++ b/pango/pango-font.h
@@ -30,45 +30,45 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_FONT (pango_font_get_type ())
-
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoFont, pango_font, PANGO, FONT, GObject)
-
-PANGO_AVAILABLE_IN_ALL
-PangoFontDescription *pango_font_describe (PangoFont *font);
-PANGO_AVAILABLE_IN_ALL
-PangoFontDescription *pango_font_describe_with_absolute_size (PangoFont *font);
-PANGO_AVAILABLE_IN_ALL
-PangoFontMetrics * pango_font_get_metrics (PangoFont *font,
- PangoLanguage *language);
-PANGO_AVAILABLE_IN_ALL
-void pango_font_get_glyph_extents (PangoFont *font,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
-
-PANGO_AVAILABLE_IN_ALL
-PangoFontFace * pango_font_get_face (PangoFont *font);
-
-PANGO_AVAILABLE_IN_ALL
-hb_font_t * pango_font_get_hb_font (PangoFont *font);
-
-PANGO_AVAILABLE_IN_ALL
-int pango_font_get_size (PangoFont *font);
-
-PANGO_AVAILABLE_IN_ALL
-double pango_font_get_absolute_size (PangoFont *font);
-
-PANGO_AVAILABLE_IN_ALL
-PangoGravity pango_font_get_gravity (PangoFont *font);
-
-PANGO_AVAILABLE_IN_ALL
-GBytes * pango_font_serialize (PangoFont *font);
-
-PANGO_AVAILABLE_IN_ALL
-PangoFont * pango_font_deserialize (PangoContext *context,
- GBytes *bytes,
- GError **error);
+#define PANGO2_TYPE_FONT (pango2_font_get_type ())
+
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2Font, pango2_font, PANGO2, FONT, GObject)
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontDescription * pango2_font_describe (Pango2Font *font);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontDescription * pango2_font_describe_with_absolute_size (Pango2Font *font);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontMetrics * pango2_font_get_metrics (Pango2Font *font,
+ Pango2Language *language);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_get_glyph_extents (Pango2Font *font,
+ Pango2Glyph glyph,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontFace * pango2_font_get_face (Pango2Font *font);
+
+PANGO2_AVAILABLE_IN_ALL
+hb_font_t * pango2_font_get_hb_font (Pango2Font *font);
+
+PANGO2_AVAILABLE_IN_ALL
+int pango2_font_get_size (Pango2Font *font);
+
+PANGO2_AVAILABLE_IN_ALL
+double pango2_font_get_absolute_size (Pango2Font *font);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Gravity pango2_font_get_gravity (Pango2Font *font);
+
+PANGO2_AVAILABLE_IN_ALL
+GBytes * pango2_font_serialize (Pango2Font *font);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Font * pango2_font_deserialize (Pango2Context *context,
+ GBytes *bytes,
+ GError **error);
G_END_DECLS
diff --git a/pango/pango-fontmap-private.h b/pango/pango-fontmap-private.h
index b353e254..4a80f00c 100644
--- a/pango/pango-fontmap-private.h
+++ b/pango/pango-fontmap-private.h
@@ -26,7 +26,7 @@
G_BEGIN_DECLS
-struct _PangoFontMap
+struct _Pango2FontMap
{
GObject parent_instance;
@@ -36,7 +36,7 @@ struct _PangoFontMap
GPtrArray *families;
GHashTable *fontsets;
GQueue fontset_cache;
- PangoFontMap *fallback;
+ Pango2FontMap *fallback;
float dpi;
gboolean in_populate;
@@ -44,31 +44,31 @@ struct _PangoFontMap
};
/**
- * PangoFontMapClass:
- * @populate: Subclasses should call pango_font_map_add_face to populate
+ * Pango2FontMapClass:
+ * @populate: Subclasses should call pango2_font_map_add_face to populate
* the map with faces and families in this vfunc.
*/
-struct _PangoFontMapClass
+struct _Pango2FontMapClass
{
GObjectClass parent_class;
- PangoFont * (* load_font) (PangoFontMap *self,
- PangoContext *context,
- const PangoFontDescription *desc);
- PangoFontset * (* load_fontset) (PangoFontMap *self,
- PangoContext *context,
- const PangoFontDescription *desc,
- PangoLanguage *language);
- guint (* get_serial) (PangoFontMap *self);
- void (* changed) (PangoFontMap *self);
- PangoFontFamily * (* get_family) (PangoFontMap *self,
- const char *name);
- void (* populate) (PangoFontMap *self);
+ Pango2Font * (* load_font) (Pango2FontMap *self,
+ Pango2Context *context,
+ const Pango2FontDescription *desc);
+ Pango2Fontset * (* load_fontset) (Pango2FontMap *self,
+ Pango2Context *context,
+ const Pango2FontDescription *desc,
+ Pango2Language *language);
+ guint (* get_serial) (Pango2FontMap *self);
+ void (* changed) (Pango2FontMap *self);
+ Pango2FontFamily * (* get_family) (Pango2FontMap *self,
+ const char *name);
+ void (* populate) (Pango2FontMap *self);
};
-void pango_font_map_repopulate (PangoFontMap *self,
- gboolean add_synthetic);
+void pango2_font_map_repopulate (Pango2FontMap *self,
+ gboolean add_synthetic);
-void pango_font_map_changed (PangoFontMap *self);
+void pango2_font_map_changed (Pango2FontMap *self);
G_END_DECLS
diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c
index b76a0ded..bca8fcff 100644
--- a/pango/pango-fontmap.c
+++ b/pango/pango-fontmap.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -57,43 +57,43 @@
/**
- * PangoFontMap:
+ * Pango2FontMap:
*
- * `PangoFontMap` is the base class for font enumeration.
+ * `Pango2FontMap` is the base class for font enumeration.
* It also handles caching and lookup of faces and fonts.
- * To obtain fonts from a `PangoFontMap`, use [method@Pango.FontMap.load_font]
- * or [method@Pango.FontMap.load_fontset].
+ * To obtain fonts from a `Pango2FontMap`, use [method@Pango2.FontMap.load_font]
+ * or [method@Pango2.FontMap.load_fontset].
*
* Subclasses populate the fontmap using backend-specific APIs
* to enumerate the available fonts on the sytem, but it is
- * also possible to create an instance of `PangoFontMap` and
- * populate it manually using [method@Pango.FontMap.add_file]
- * and [method@Pango.FontMap.add_face].
+ * also possible to create an instance of `Pango2FontMap` and
+ * populate it manually using [method@Pango2.FontMap.add_file]
+ * and [method@Pango2.FontMap.add_face].
*
- * Fontmaps can be combined using [method@Pango.FontMap.set_fallback].
+ * Fontmaps can be combined using [method@Pango2.FontMap.set_fallback].
* This can be useful to add custom fonts to the default fonts
* without making them available to every user of the default
* fontmap.
*
* Note that to be fully functional, a fontmap needs to provide
* generic families for monospace and sans-serif. These can
- * be added using [method@Pango.FontMap.add_family] and
- * [ctor@Pango.GenericFamily.new].
+ * be added using [method@Pango2.FontMap.add_family] and
+ * [ctor@Pango2.GenericFamily.new].
*
- * `PangoFontMap` implements the [iface@Gio.ListModel] interface,
+ * `Pango2FontMap` implements the [iface@Gio.ListModel] interface,
* to provide a list of font families.
*/
/* The central api is load_fontset, which takes a font description
- * and language, finds the matching faces, and creates a PangoFontset
+ * and language, finds the matching faces, and creates a Pango2Fontset
* for them. To speed this operation up, the font map maintains a
* cache of fontsets (in the form of a GQueue) and has a hash table
* for looking up existing fontsets.
*
- * The PangoFontsetCached object is the fontset subclass that is used
+ * The Pango2FontsetCached object is the fontset subclass that is used
* here, and it contains the necessary data for the cashing and hashing.
- * PangoFontsetCached also caches the character-to-font mapping that is
+ * Pango2FontsetCached also caches the character-to-font mapping that is
* used when itemizing text.
*/
@@ -101,15 +101,15 @@
/* {{{ GListModel implementation */
static GType
-pango_font_map_get_item_type (GListModel *list)
+pango2_font_map_get_item_type (GListModel *list)
{
- return PANGO_TYPE_FONT_FAMILY;
+ return PANGO2_TYPE_FONT_FAMILY;
}
static guint
-pango_font_map_get_n_items (GListModel *list)
+pango2_font_map_get_n_items (GListModel *list)
{
- PangoFontMap *self = PANGO_FONT_MAP (list);
+ Pango2FontMap *self = PANGO2_FONT_MAP (list);
if (self->fallback)
return self->families->len + g_list_model_get_n_items (G_LIST_MODEL (self->fallback));
@@ -118,10 +118,10 @@ pango_font_map_get_n_items (GListModel *list)
}
static gpointer
-pango_font_map_get_item (GListModel *list,
- guint position)
+pango2_font_map_get_item (GListModel *list,
+ guint position)
{
- PangoFontMap *self = PANGO_FONT_MAP (list);
+ Pango2FontMap *self = PANGO2_FONT_MAP (list);
if (position < self->families->len)
return g_object_ref (g_ptr_array_index (self->families, position));
@@ -132,11 +132,11 @@ pango_font_map_get_item (GListModel *list,
}
static void
-pango_font_map_list_model_init (GListModelInterface *iface)
+pango2_font_map_list_model_init (GListModelInterface *iface)
{
- iface->get_item_type = pango_font_map_get_item_type;
- iface->get_n_items = pango_font_map_get_n_items;
- iface->get_item = pango_font_map_get_item;
+ iface->get_item_type = pango2_font_map_get_item_type;
+ iface->get_n_items = pango2_font_map_get_n_items;
+ iface->get_item = pango2_font_map_get_item;
}
/* }}} */
@@ -163,7 +163,7 @@ hash_bytes_fnv (unsigned char *buffer,
}
static guint
-pango_fontset_cached_hash (const PangoFontsetCached *fontset)
+pango2_fontset_cached_hash (const Pango2FontsetCached *fontset)
{
guint32 hash = FNV1_32_INIT;
@@ -175,12 +175,12 @@ pango_fontset_cached_hash (const PangoFontsetCached *fontset)
#ifdef HAVE_CAIRO
cairo_font_options_hash (fontset->font_options) ^
#endif
- pango_font_description_hash (fontset->description));
+ pango2_font_description_hash (fontset->description));
}
static gboolean
-pango_fontset_cached_equal (const PangoFontsetCached *a,
- const PangoFontsetCached *b)
+pango2_fontset_cached_equal (const Pango2FontsetCached *a,
+ const Pango2FontsetCached *b)
{
return a->language == b->language &&
#ifdef HAVE_CAIRO
@@ -188,12 +188,12 @@ pango_fontset_cached_equal (const PangoFontsetCached *a,
#endif
(a->ctm == b->ctm ||
(a->ctm && b->ctm && memcmp (a->ctm, b->ctm, 4 * sizeof (double)) == 0)) &&
- pango_font_description_equal (a->description, b->description);
+ pango2_font_description_equal (a->description, b->description);
}
static void
-pango_fontset_cache (PangoFontsetCached *fontset,
- PangoFontMap *self)
+pango2_fontset_cache (Pango2FontsetCached *fontset,
+ Pango2FontMap *self)
{
GQueue *cache = &self->fontset_cache;
GList *link = &fontset->cache_link;
@@ -227,7 +227,7 @@ pango_fontset_cache (PangoFontsetCached *fontset,
/* {{{ Utilities */
static guint
-pango_family_hash (const PangoFontFamily *key)
+pango2_family_hash (const Pango2FontFamily *key)
{
const char *p;
guint32 h = 5381;
@@ -239,90 +239,90 @@ pango_family_hash (const PangoFontFamily *key)
}
static gboolean
-pango_family_equal (const PangoFontFamily *a,
- const PangoFontFamily *b)
+pango2_family_equal (const Pango2FontFamily *a,
+ const Pango2FontFamily *b)
{
return g_ascii_strcasecmp (a->name, b->name) == 0;
}
-static PangoFontFamily *
-find_family (PangoFontMap *self,
- const char *family_name)
+static Pango2FontFamily *
+find_family (Pango2FontMap *self,
+ const char *family_name)
{
- PangoFontFamily lookup;
- PangoFontFamily *family;
+ Pango2FontFamily lookup;
+ Pango2FontFamily *family;
lookup.name = (char *)family_name;
- family = PANGO_FONT_FAMILY (g_hash_table_lookup (self->families_hash, &lookup));
+ family = PANGO2_FONT_FAMILY (g_hash_table_lookup (self->families_hash, &lookup));
return family;
}
static void
-clear_caches (PangoFontMap *self)
+clear_caches (Pango2FontMap *self)
{
g_hash_table_remove_all (self->fontsets);
g_queue_init (&self->fontset_cache);
}
static void
-add_style_variation (PangoHbFamily *family,
- PangoHbFace *face,
- PangoStyle style,
- PangoWeight weight)
+add_style_variation (Pango2HbFamily *family,
+ Pango2HbFace *face,
+ Pango2Style style,
+ Pango2Weight weight)
{
- PangoMatrix italic_matrix = { 1, 0.2, 0, 1, 0, 0 };
- PangoFontDescription *desc;
- PangoHbFace *variation;
-
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, pango_font_family_get_name (PANGO_FONT_FAMILY (family)));
- pango_font_description_set_style (desc, style);
- pango_font_description_set_weight (desc, weight);
-
- variation = pango_hb_face_new_synthetic (face,
- style == PANGO_STYLE_ITALIC ? &italic_matrix : NULL,
- weight == PANGO_WEIGHT_BOLD,
- NULL,
- desc);
- pango_hb_family_add_face (family, PANGO_FONT_FACE (variation));
-
- pango_font_description_free (desc);
+ Pango2Matrix italic_matrix = { 1, 0.2, 0, 1, 0, 0 };
+ Pango2FontDescription *desc;
+ Pango2HbFace *variation;
+
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, pango2_font_family_get_name (PANGO2_FONT_FAMILY (family)));
+ pango2_font_description_set_style (desc, style);
+ pango2_font_description_set_weight (desc, weight);
+
+ variation = pango2_hb_face_new_synthetic (face,
+ style == PANGO2_STYLE_ITALIC ? &italic_matrix : NULL,
+ weight == PANGO2_WEIGHT_BOLD,
+ NULL,
+ desc);
+ pango2_hb_family_add_face (family, PANGO2_FONT_FACE (variation));
+
+ pango2_font_description_free (desc);
}
static void
-synthesize_bold_and_italic_faces (PangoFontMap *map)
+synthesize_bold_and_italic_faces (Pango2FontMap *map)
{
for (int i = 0; i < map->families->len; i++)
{
- PangoFontFamily *family = g_ptr_array_index (map->families, i);
- PangoFontFace *regular_face = NULL;
+ Pango2FontFamily *family = g_ptr_array_index (map->families, i);
+ Pango2FontFace *regular_face = NULL;
int regular_dist = G_MAXINT;
int bold_dist = G_MAXINT;
gboolean has_italic = FALSE;
gboolean has_bold = FALSE;
gboolean has_bold_italic = FALSE;
- if (PANGO_IS_GENERIC_FAMILY (family))
+ if (PANGO2_IS_GENERIC_FAMILY (family))
continue;
for (int j = 0; j < g_list_model_get_n_items (G_LIST_MODEL (family)); j++)
{
- PangoFontFace *face = g_list_model_get_item (G_LIST_MODEL (family), j);
+ Pango2FontFace *face = g_list_model_get_item (G_LIST_MODEL (family), j);
int weight;
- PangoStyle style;
+ Pango2Style style;
int dist;
- if (!PANGO_IS_HB_FACE (face))
+ if (!PANGO2_IS_HB_FACE (face))
continue;
- weight = pango_font_description_get_weight (face->description);
- style = pango_font_description_get_style (face->description);
+ weight = pango2_font_description_get_weight (face->description);
+ style = pango2_font_description_get_style (face->description);
- if (style == PANGO_STYLE_NORMAL)
+ if (style == PANGO2_STYLE_NORMAL)
{
- dist = abs (weight - (int)PANGO_WEIGHT_NORMAL);
+ dist = abs (weight - (int)PANGO2_WEIGHT_NORMAL);
if (dist < regular_dist)
{
@@ -331,7 +331,7 @@ synthesize_bold_and_italic_faces (PangoFontMap *map)
regular_face = face;
}
- dist = abs (weight - (int)PANGO_WEIGHT_BOLD);
+ dist = abs (weight - (int)PANGO2_WEIGHT_BOLD);
if (dist < bold_dist)
{
@@ -341,7 +341,7 @@ synthesize_bold_and_italic_faces (PangoFontMap *map)
}
else
{
- if (weight < PANGO_WEIGHT_SEMIBOLD)
+ if (weight < PANGO2_WEIGHT_SEMIBOLD)
has_italic = TRUE;
else
has_bold_italic = TRUE;
@@ -353,28 +353,28 @@ synthesize_bold_and_italic_faces (PangoFontMap *map)
if (regular_face)
{
if (!has_italic)
- add_style_variation (PANGO_HB_FAMILY (family),
- PANGO_HB_FACE (regular_face),
- PANGO_STYLE_ITALIC,
- PANGO_WEIGHT_NORMAL);
+ add_style_variation (PANGO2_HB_FAMILY (family),
+ PANGO2_HB_FACE (regular_face),
+ PANGO2_STYLE_ITALIC,
+ PANGO2_WEIGHT_NORMAL);
if (!has_bold)
- add_style_variation (PANGO_HB_FAMILY (family),
- PANGO_HB_FACE (regular_face),
- PANGO_STYLE_NORMAL,
- PANGO_WEIGHT_BOLD);
+ add_style_variation (PANGO2_HB_FAMILY (family),
+ PANGO2_HB_FACE (regular_face),
+ PANGO2_STYLE_NORMAL,
+ PANGO2_WEIGHT_BOLD);
if (!has_bold_italic)
- add_style_variation (PANGO_HB_FAMILY (family),
- PANGO_HB_FACE (regular_face),
- PANGO_STYLE_ITALIC,
- PANGO_WEIGHT_BOLD);
+ add_style_variation (PANGO2_HB_FAMILY (family),
+ PANGO2_HB_FACE (regular_face),
+ PANGO2_STYLE_ITALIC,
+ PANGO2_WEIGHT_BOLD);
}
}
}
/* }}} */
-/* {{{ PangoFontMap implementation */
+/* {{{ Pango2FontMap implementation */
enum {
PROP_RESOLUTION = 1,
@@ -386,22 +386,22 @@ enum {
static GParamSpec *properties[N_PROPERTIES] = { NULL };
-G_DEFINE_TYPE_WITH_CODE (PangoFontMap, pango_font_map, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_font_map_list_model_init))
+G_DEFINE_TYPE_WITH_CODE (Pango2FontMap, pango2_font_map, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango2_font_map_list_model_init))
static void
-pango_font_map_init (PangoFontMap *self)
+pango2_font_map_init (Pango2FontMap *self)
{
self->added_faces = g_ptr_array_new_with_free_func (g_object_unref);
self->added_families = g_ptr_array_new_with_free_func (g_object_unref);
self->families = g_ptr_array_new_with_free_func (g_object_unref);
- self->families_hash = g_hash_table_new_full ((GHashFunc) pango_family_hash,
- (GEqualFunc) pango_family_equal,
+ self->families_hash = g_hash_table_new_full ((GHashFunc) pango2_family_hash,
+ (GEqualFunc) pango2_family_equal,
NULL,
NULL);
- self->fontsets = g_hash_table_new_full ((GHashFunc) pango_fontset_cached_hash,
- (GEqualFunc) pango_fontset_cached_equal,
+ self->fontsets = g_hash_table_new_full ((GHashFunc) pango2_fontset_cached_hash,
+ (GEqualFunc) pango2_fontset_cached_equal,
NULL,
(GDestroyNotify) g_object_unref);
g_queue_init (&self->fontset_cache);
@@ -409,9 +409,9 @@ pango_font_map_init (PangoFontMap *self)
}
static void
-pango_font_map_finalize (GObject *object)
+pango2_font_map_finalize (GObject *object)
{
- PangoFontMap *self = PANGO_FONT_MAP (object);
+ Pango2FontMap *self = PANGO2_FONT_MAP (object);
g_clear_object (&self->fallback);
g_ptr_array_unref (self->added_faces);
@@ -420,25 +420,25 @@ pango_font_map_finalize (GObject *object)
g_ptr_array_unref (self->families);
g_hash_table_unref (self->fontsets);
- G_OBJECT_CLASS (pango_font_map_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_font_map_parent_class)->finalize (object);
}
static void
-pango_font_map_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+pango2_font_map_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- PangoFontMap *map = PANGO_FONT_MAP (object);
+ Pango2FontMap *map = PANGO2_FONT_MAP (object);
switch (property_id)
{
case PROP_RESOLUTION:
- pango_font_map_set_resolution (map, g_value_get_float (value));
+ pango2_font_map_set_resolution (map, g_value_get_float (value));
break;
case PROP_FALLBACK:
- pango_font_map_set_fallback (map, g_value_get_object (value));
+ pango2_font_map_set_fallback (map, g_value_get_object (value));
break;
default:
@@ -447,12 +447,12 @@ pango_font_map_set_property (GObject *object,
}
static void
-pango_font_map_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+pango2_font_map_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- PangoFontMap *map = PANGO_FONT_MAP (object);
+ Pango2FontMap *map = PANGO2_FONT_MAP (object);
switch (property_id)
{
@@ -465,11 +465,11 @@ pango_font_map_get_property (GObject *object,
break;
case PROP_ITEM_TYPE:
- g_value_set_gtype (value, PANGO_TYPE_FONT_FAMILY);
+ g_value_set_gtype (value, PANGO2_TYPE_FONT_FAMILY);
break;
case PROP_N_ITEMS:
- g_value_set_uint (value, pango_font_map_get_n_items (G_LIST_MODEL (object)));
+ g_value_set_uint (value, pango2_font_map_get_n_items (G_LIST_MODEL (object)));
break;
default:
@@ -478,72 +478,72 @@ pango_font_map_get_property (GObject *object,
}
/* Load a font from the first matching family */
-static PangoFont *
-pango_font_map_default_load_font (PangoFontMap *self,
- PangoContext *context,
- const PangoFontDescription *description)
+static Pango2Font *
+pango2_font_map_default_load_font (Pango2FontMap *self,
+ Pango2Context *context,
+ const Pango2FontDescription *description)
{
- PangoFontsetCached *fontset;
- PangoLanguage *language;
- PangoFont *font = NULL;
+ Pango2FontsetCached *fontset;
+ Pango2Language *language;
+ Pango2Font *font = NULL;
if (self->families->len == 0)
return NULL;
if (context)
- language = pango_context_get_language (context);
+ language = pango2_context_get_language (context);
else
language = NULL;
- fontset = (PangoFontsetCached *)pango_font_map_load_fontset (self, context, description, language);
- if (pango_fontset_cached_size (fontset) > 0)
- font = pango_fontset_cached_get_first_font (fontset);
+ fontset = (Pango2FontsetCached *)pango2_font_map_load_fontset (self, context, description, language);
+ if (pango2_fontset_cached_size (fontset) > 0)
+ font = pango2_fontset_cached_get_first_font (fontset);
g_object_unref (fontset);
return font;
}
/* Add one font for each family we find */
-static PangoFontset *
-pango_font_map_default_load_fontset (PangoFontMap *self,
- PangoContext *context,
- const PangoFontDescription *description,
- PangoLanguage *language)
+static Pango2Fontset *
+pango2_font_map_default_load_fontset (Pango2FontMap *self,
+ Pango2Context *context,
+ const Pango2FontDescription *description,
+ Pango2Language *language)
{
- PangoFontsetCached lookup;
- PangoFontsetCached *fontset;
- const PangoMatrix *ctm;
+ Pango2FontsetCached lookup;
+ Pango2FontsetCached *fontset;
+ const Pango2Matrix *ctm;
const char *family_name;
char **families;
- PangoFontDescription *copy;
- PangoFontFamily *family;
- PangoFontFace *face;
+ Pango2FontDescription *copy;
+ Pango2FontFamily *family;
+ Pango2FontFace *face;
gboolean has_generic = FALSE;
- PangoFontset *fallback;
+ Pango2Fontset *fallback;
gint64 before G_GNUC_UNUSED;
- before = PANGO_TRACE_CURRENT_TIME;
+ before = PANGO2_TRACE_CURRENT_TIME;
if (!language)
- language = pango_context_get_language (context);
+ language = pango2_context_get_language (context);
- family_name = pango_font_description_get_family (description);
- ctm = pango_context_get_matrix (context);
+ family_name = pango2_font_description_get_family (description);
+ ctm = pango2_context_get_matrix (context);
lookup.language = language;
- lookup.description = (PangoFontDescription *)description;
+ lookup.description = (Pango2FontDescription *)description;
lookup.ctm = ctm;
#ifdef HAVE_CAIRO
- lookup.font_options = (cairo_font_options_t *)pango_cairo_context_get_merged_font_options (context);
+ lookup.font_options = (cairo_font_options_t *)pango2_cairo_context_get_merged_font_options (context);
#endif
fontset = g_hash_table_lookup (self->fontsets, &lookup);
if (fontset)
goto done;
- fontset = pango_fontset_cached_new (description, language, self->dpi, ctm);
+ fontset = pango2_fontset_cached_new (description, language, self->dpi, ctm);
#ifdef HAVE_CAIRO
- fontset->font_options = cairo_font_options_copy (pango_cairo_context_get_merged_font_options (context));
+ fontset->font_options = cairo_font_options_copy (pango2_cairo_context_get_merged_font_options (context));
#endif
if (self->families->len == 0)
@@ -559,11 +559,11 @@ pango_font_map_default_load_fontset (PangoFontMap *self,
families = g_strsplit (family_name ? family_name : "", ",", -1);
- /* Unset gravity and variant since PangoHbFace does not have these fields */
- copy = pango_font_description_copy_static (description);
- pango_font_description_unset_fields (copy, PANGO_FONT_MASK_VARIATIONS |
- PANGO_FONT_MASK_GRAVITY |
- PANGO_FONT_MASK_VARIANT);
+ /* Unset gravity and variant since Pango2HbFace does not have these fields */
+ copy = pango2_font_description_copy_static (description);
+ pango2_font_description_unset_fields (copy, PANGO2_FONT_MASK_VARIATIONS |
+ PANGO2_FONT_MASK_GRAVITY |
+ PANGO2_FONT_MASK_VARIANT);
for (int i = 0; families[i]; i++)
{
@@ -571,22 +571,22 @@ pango_font_map_default_load_fontset (PangoFontMap *self,
if (!family)
continue;
- if (PANGO_IS_GENERIC_FAMILY (family))
+ if (PANGO2_IS_GENERIC_FAMILY (family))
{
- pango_fontset_cached_add_family (fontset, PANGO_GENERIC_FAMILY (family));
+ pango2_fontset_cached_add_family (fontset, PANGO2_GENERIC_FAMILY (family));
has_generic = TRUE;
}
else
{
- face = pango_hb_family_find_face (PANGO_HB_FAMILY (family), copy, language, 0);
+ face = pango2_hb_family_find_face (PANGO2_HB_FAMILY (family), copy, language, 0);
if (face)
- pango_fontset_cached_add_face (fontset, face);
+ pango2_fontset_cached_add_face (fontset, face);
}
}
g_strfreev (families);
- pango_font_description_free (copy);
+ pango2_font_description_free (copy);
/* Returning an empty fontset leads to bad outcomes.
*
@@ -599,13 +599,13 @@ pango_font_map_default_load_fontset (PangoFontMap *self,
if (!has_generic)
{
family = find_family (self, "sans-serif");
- if (PANGO_IS_GENERIC_FAMILY (family))
- pango_fontset_cached_add_family (fontset, PANGO_GENERIC_FAMILY (family));
+ if (PANGO2_IS_GENERIC_FAMILY (family))
+ pango2_fontset_cached_add_family (fontset, PANGO2_GENERIC_FAMILY (family));
else if (self->fallback)
{
add_fallback:
- fallback = pango_font_map_load_fontset (self->fallback, context, description, language);
- pango_fontset_cached_append (fontset, PANGO_FONTSET_CACHED (fallback));
+ fallback = pango2_font_map_load_fontset (self->fallback, context, description, language);
+ pango2_fontset_cached_append (fontset, PANGO2_FONTSET_CACHED (fallback));
g_object_unref (fallback);
}
}
@@ -613,41 +613,41 @@ add_fallback:
g_hash_table_add (self->fontsets, fontset);
done:
- pango_fontset_cache (fontset, self);
+ pango2_fontset_cache (fontset, self);
- if (pango_fontset_cached_size (fontset) == 0)
+ if (pango2_fontset_cached_size (fontset) == 0)
{
- char *s = pango_font_description_to_string (description);
- g_warning ("All font fallbacks failed for \"%s\", in %s !!!!", s, pango_language_to_string (language));
+ char *s = pango2_font_description_to_string (description);
+ g_warning ("All font fallbacks failed for \"%s\", in %s !!!!", s, pango2_language_to_string (language));
g_free (s);
}
done_no_cache:
- pango_trace_mark (before, "pango_fontmap_load_fontset", "%s", family_name);
+ pango2_trace_mark (before, "pango2_fontmap_load_fontset", "%s", family_name);
- return g_object_ref (PANGO_FONTSET (fontset));
+ return g_object_ref (PANGO2_FONTSET (fontset));
}
-static PangoFontFamily *
-pango_font_map_default_get_family (PangoFontMap *self,
- const char *name)
+static Pango2FontFamily *
+pango2_font_map_default_get_family (Pango2FontMap *self,
+ const char *name)
{
- return PANGO_FONT_FAMILY (find_family (self, name));
+ return PANGO2_FONT_FAMILY (find_family (self, name));
}
static void
-pango_font_map_default_populate (PangoFontMap *self)
+pango2_font_map_default_populate (Pango2FontMap *self)
{
}
static guint
-pango_font_map_default_get_serial (PangoFontMap *self)
+pango2_font_map_default_get_serial (Pango2FontMap *self)
{
return self->serial;
}
static void
-pango_font_map_default_changed (PangoFontMap *self)
+pango2_font_map_default_changed (Pango2FontMap *self)
{
self->serial++;
if (self->serial == 0)
@@ -655,28 +655,28 @@ pango_font_map_default_changed (PangoFontMap *self)
}
static void
-pango_font_map_class_init (PangoFontMapClass *class)
+pango2_font_map_class_init (Pango2FontMapClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = pango_font_map_finalize;
- object_class->set_property = pango_font_map_set_property;
- object_class->get_property = pango_font_map_get_property;
+ object_class->finalize = pango2_font_map_finalize;
+ object_class->set_property = pango2_font_map_set_property;
+ object_class->get_property = pango2_font_map_get_property;
- class->load_font = pango_font_map_default_load_font;
- class->load_fontset = pango_font_map_default_load_fontset;
- class->get_serial = pango_font_map_default_get_serial;
- class->changed = pango_font_map_default_changed;
- class->get_family = pango_font_map_default_get_family;
- class->populate = pango_font_map_default_populate;
+ class->load_font = pango2_font_map_default_load_font;
+ class->load_fontset = pango2_font_map_default_load_fontset;
+ class->get_serial = pango2_font_map_default_get_serial;
+ class->changed = pango2_font_map_default_changed;
+ class->get_family = pango2_font_map_default_get_family;
+ class->populate = pango2_font_map_default_populate;
/**
- * PangoFontMap:resolution: (attributes org.gtk.Property.get=pango_font_map_get_resolution org.gtk.Property.set=pango_font_map_set_resolution)
+ * Pango2FontMap:resolution: (attributes org.gtk.Property.get=pango2_font_map_get_resolution org.gtk.Property.set=pango2_font_map_set_resolution)
*
* The resolution for the fontmap.
*
* This is a scale factor between points specified in a
- * `PangoFontDescription` and Cairo units. The default value
+ * `Pango2FontDescription` and Cairo units. The default value
* is 96, meaning that a 10 point font will be 13 units high.
* (10 * 96. / 72. = 13.3).
*/
@@ -685,17 +685,17 @@ pango_font_map_class_init (PangoFontMapClass *class)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFontMap:fallback: (attributes org.gtk.Property.get=pango_font_map_get_fallback org.gtk.Property.set=pango_font_map_set_fallback)
+ * Pango2FontMap:fallback: (attributes org.gtk.Property.get=pango2_font_map_get_fallback org.gtk.Property.set=pango2_font_map_set_fallback)
*
* The fallback fontmap is used to look up fonts that
* this map does not have itself.
*/
properties[PROP_FALLBACK] =
- g_param_spec_object ("fallback", NULL, NULL, PANGO_TYPE_FONT_MAP,
+ g_param_spec_object ("fallback", NULL, NULL, PANGO2_TYPE_FONT_MAP,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFontMap:item-type:
+ * Pango2FontMap:item-type:
*
* The type of items contained in this list.
*/
@@ -704,7 +704,7 @@ pango_font_map_class_init (PangoFontMapClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoFontMap:n-items:
+ * Pango2FontMap:n-items:
*
* The number of items contained in this list.
*/
@@ -719,8 +719,8 @@ pango_font_map_class_init (PangoFontMapClass *class)
/* {{{ Private API */
/*< private >
- * pango_font_map_repopulate:
- * @self: a `PangoFontMap`
+ * pango2_font_map_repopulate:
+ * @self: a `Pango2FontMap`
* @add_synthetic: if `TRUE`, missing bold and italic faces will be synthesized
*
* Clear all cached information and repopulate the fontmap with
@@ -730,8 +730,8 @@ pango_font_map_class_init (PangoFontMapClass *class)
* in a way that requires recreating families and faces.
*/
void
-pango_font_map_repopulate (PangoFontMap *self,
- gboolean add_synthetic)
+pango2_font_map_repopulate (Pango2FontMap *self,
+ gboolean add_synthetic)
{
int removed, added;
@@ -744,21 +744,21 @@ pango_font_map_repopulate (PangoFontMap *self,
self->in_populate = TRUE;
- PANGO_FONT_MAP_GET_CLASS (self)->populate (self);
+ PANGO2_FONT_MAP_GET_CLASS (self)->populate (self);
if (add_synthetic)
synthesize_bold_and_italic_faces (self);
for (int i = 0; i < self->added_faces->len; i++)
{
- PangoFontFace *face = g_ptr_array_index (self->added_faces, i);
- pango_font_map_add_face (self, face);
+ Pango2FontFace *face = g_ptr_array_index (self->added_faces, i);
+ pango2_font_map_add_face (self, face);
}
for (int i = 0; i < self->added_families->len; i++)
{
- PangoFontFamily *family = PANGO_FONT_FAMILY (g_ptr_array_index (self->added_families, i));
- pango_font_map_add_family (self, family);
+ Pango2FontFamily *family = PANGO2_FONT_FAMILY (g_ptr_array_index (self->added_families, i));
+ pango2_font_map_add_family (self, family);
}
self->in_populate = FALSE;
@@ -767,86 +767,86 @@ pango_font_map_repopulate (PangoFontMap *self,
g_list_model_items_changed (G_LIST_MODEL (self), 0, removed, added);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
- pango_font_map_changed (self);
+ pango2_font_map_changed (self);
}
/*< private >
- * pango_font_map_changed:
- * @self: a `PangoFontMap`
+ * pango2_font_map_changed:
+ * @self: a `Pango2FontMap`
*
- * Forces a change in the context, which will cause any `PangoContext`
+ * Forces a change in the context, which will cause any `Pango2Context`
* using this fontmap to change.
*
* This function is only useful when implementing a new backend
- * for Pango, something applications won't do. Backends should
+ * for Pango2, something applications won't do. Backends should
* call this function if they have attached extra data to the
* context and such data is changed.
*/
void
-pango_font_map_changed (PangoFontMap *self)
+pango2_font_map_changed (Pango2FontMap *self)
{
- g_return_if_fail (PANGO_IS_FONT_MAP (self));
+ g_return_if_fail (PANGO2_IS_FONT_MAP (self));
- PANGO_FONT_MAP_GET_CLASS (self)->changed (self);
+ PANGO2_FONT_MAP_GET_CLASS (self)->changed (self);
}
/* }}} */
/* {{{ Public API */
/**
- * pango_font_map_load_font:
- * @self: a `PangoFontMap`
- * @context: the `PangoContext` the font will be used with
- * @desc: a `PangoFontDescription` describing the font to load
+ * pango2_font_map_load_font:
+ * @self: a `Pango2FontMap`
+ * @context: the `Pango2Context` the font will be used with
+ * @desc: a `Pango2FontDescription` describing the font to load
*
* Load the font in the fontmap that is the closest match for
* a font description.
*
- * Returns: (transfer full) (nullable): the `PangoFont` that
+ * Returns: (transfer full) (nullable): the `Pango2Font` that
* was found
*/
-PangoFont *
-pango_font_map_load_font (PangoFontMap *self,
- PangoContext *context,
- const PangoFontDescription *desc)
+Pango2Font *
+pango2_font_map_load_font (Pango2FontMap *self,
+ Pango2Context *context,
+ const Pango2FontDescription *desc)
{
- g_return_val_if_fail (PANGO_IS_FONT_MAP (self), NULL);
- g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL);
g_return_val_if_fail (desc != NULL, NULL);
- return PANGO_FONT_MAP_GET_CLASS (self)->load_font (self, context, desc);
+ return PANGO2_FONT_MAP_GET_CLASS (self)->load_font (self, context, desc);
}
/**
- * pango_font_map_load_fontset:
- * @self: a `PangoFontMap`
- * @context: the `PangoContext` the font will be used with
- * @desc: a `PangoFontDescription` describing the font to load
- * @language: (nullable): a `PangoLanguage` the fonts will be used for,
+ * pango2_font_map_load_fontset:
+ * @self: a `Pango2FontMap`
+ * @context: the `Pango2Context` the font will be used with
+ * @desc: a `Pango2FontDescription` describing the font to load
+ * @language: (nullable): a `Pango2Language` the fonts will be used for,
* or `NULL` to use the language of @context
*
* Load a set of fonts in the fontmap that can be used to render
* a font matching a font description.
*
- * Returns: (transfer full) (nullable): the `PangoFontset` containing
+ * Returns: (transfer full) (nullable): the `Pango2Fontset` containing
* the fonts that were found
*/
-PangoFontset *
-pango_font_map_load_fontset (PangoFontMap *self,
- PangoContext *context,
- const PangoFontDescription *desc,
- PangoLanguage *language)
+Pango2Fontset *
+pango2_font_map_load_fontset (Pango2FontMap *self,
+ Pango2Context *context,
+ const Pango2FontDescription *desc,
+ Pango2Language *language)
{
- g_return_val_if_fail (PANGO_IS_FONT_MAP (self), NULL);
- g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL);
g_return_val_if_fail (desc != NULL, NULL);
- return PANGO_FONT_MAP_GET_CLASS (self)->load_fontset (self, context, desc, language);
+ return PANGO2_FONT_MAP_GET_CLASS (self)->load_fontset (self, context, desc, language);
}
/**
- * pango_font_map_get_serial:
- * @self: a `PangoFontMap`
+ * pango2_font_map_get_serial:
+ * @self: a `Pango2FontMap`
*
* Returns the current serial number of the fontmap.
*
@@ -858,127 +858,127 @@ pango_font_map_load_fontset (PangoFontMap *self,
* The fontmap can only be changed using backend-specific API, like changing
* fontmap resolution.
*
- * This can be used to automatically detect changes to a `PangoFontMap`,
- * like in `PangoContext`.
+ * This can be used to automatically detect changes to a `Pango2FontMap`,
+ * like in `Pango2Context`.
*
* Return value: The current serial number of @fontmap.
*/
guint
-pango_font_map_get_serial (PangoFontMap *self)
+pango2_font_map_get_serial (Pango2FontMap *self)
{
- g_return_val_if_fail (PANGO_IS_FONT_MAP (self), 0);
+ g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), 0);
- return PANGO_FONT_MAP_GET_CLASS (self)->get_serial (self);
+ return PANGO2_FONT_MAP_GET_CLASS (self)->get_serial (self);
}
/**
- * pango_font_map_get_family:
- * @self: a `PangoFontMap`
+ * pango2_font_map_get_family:
+ * @self: a `Pango2FontMap`
* @name: a family name
*
* Gets a font family by name.
*
- * Returns: (transfer none): the `PangoFontFamily`
+ * Returns: (transfer none): the `Pango2FontFamily`
*/
-PangoFontFamily *
-pango_font_map_get_family (PangoFontMap *self,
- const char *name)
+Pango2FontFamily *
+pango2_font_map_get_family (Pango2FontMap *self,
+ const char *name)
{
- g_return_val_if_fail (PANGO_IS_FONT_MAP (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), NULL);
- return PANGO_FONT_MAP_GET_CLASS (self)->get_family (self, name);
+ return PANGO2_FONT_MAP_GET_CLASS (self)->get_family (self, name);
}
/**
- * pango_font_map_new:
+ * pango2_font_map_new:
*
- * Creates a new `PangoFontMap`.
+ * Creates a new `Pango2FontMap`.
*
* A fontmap is used to cache information about available fonts,
* and holds certain global parameters such as the resolution.
*
- * Returns: A newly created `PangoFontMap
+ * Returns: A newly created `Pango2FontMap
*/
-PangoFontMap *
-pango_font_map_new (void)
+Pango2FontMap *
+pango2_font_map_new (void)
{
- return g_object_new (PANGO_TYPE_FONT_MAP, NULL);
+ return g_object_new (PANGO2_TYPE_FONT_MAP, NULL);
}
/**
- * pango_font_map_add_face:
- * @self: a `PangoFontMap`
- * @face: (transfer full): a `PangoFontFace`
+ * pango2_font_map_add_face:
+ * @self: a `Pango2FontMap`
+ * @face: (transfer full): a `Pango2FontFace`
*
* Adds a face to the fontmap.
*
* This is most useful for creating transformed faces or aliases.
- * See [method@Pango.HbFace.new_synthetic] and [method@Pango.HbFace.new_instance].
+ * See [method@Pango2.HbFace.new_synthetic] and [method@Pango2.HbFace.new_instance].
*/
void
-pango_font_map_add_face (PangoFontMap *self,
- PangoFontFace *face)
+pango2_font_map_add_face (Pango2FontMap *self,
+ Pango2FontFace *face)
{
const char *family_name;
- PangoHbFamily *family;
- const PangoFontDescription *description;
+ Pango2HbFamily *family;
+ const Pango2FontDescription *description;
- g_return_if_fail (PANGO_IS_FONT_MAP (self));
- g_return_if_fail (PANGO_IS_HB_FACE (face) || PANGO_IS_USER_FACE (face));
+ g_return_if_fail (PANGO2_IS_FONT_MAP (self));
+ g_return_if_fail (PANGO2_IS_HB_FACE (face) || PANGO2_IS_USER_FACE (face));
description = face->description;
- if (pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_GRAVITY)
- g_warning ("Font description for PangoFontFace includes things that it shouldn't");
+ if (pango2_font_description_get_set_fields (description) & PANGO2_FONT_MASK_GRAVITY)
+ g_warning ("Font description for Pango2FontFace includes things that it shouldn't");
if (!self->in_populate)
g_ptr_array_add (self->added_faces, g_object_ref (face));
- family_name = pango_font_description_get_family (description);
- family = PANGO_HB_FAMILY (pango_font_map_get_family (self, family_name));
+ family_name = pango2_font_description_get_family (description);
+ family = PANGO2_HB_FAMILY (pango2_font_map_get_family (self, family_name));
if (!family)
{
- family = pango_hb_family_new (family_name);
- pango_font_map_add_family (self, PANGO_FONT_FAMILY (family));
+ family = pango2_hb_family_new (family_name);
+ pango2_font_map_add_family (self, PANGO2_FONT_FAMILY (family));
}
- pango_hb_family_add_face (family, face);
+ pango2_hb_family_add_face (family, face);
- pango_font_map_changed (self);
+ pango2_font_map_changed (self);
clear_caches (self);
}
/**
- * pango_font_map_remove_face:
- * @self: a `PangoFontMap`
- * @face: a `PangoFontFace` that belongs to @map
+ * pango2_font_map_remove_face:
+ * @self: a `Pango2FontMap`
+ * @face: a `Pango2FontFace` that belongs to @map
*
* Removes @face from the fontmap.
*
- * @face must have been added with [method@Pango.FontMap.add_face].
+ * @face must have been added with [method@Pango2.FontMap.add_face].
*/
void
-pango_font_map_remove_face (PangoFontMap *self,
- PangoFontFace *face)
+pango2_font_map_remove_face (Pango2FontMap *self,
+ Pango2FontFace *face)
{
- PangoHbFamily *family;
+ Pango2HbFamily *family;
unsigned int position;
- g_return_if_fail (PANGO_IS_FONT_MAP (self));
- g_return_if_fail (PANGO_IS_HB_FACE (face) || PANGO_IS_USER_FACE (face));
+ g_return_if_fail (PANGO2_IS_FONT_MAP (self));
+ g_return_if_fail (PANGO2_IS_HB_FACE (face) || PANGO2_IS_USER_FACE (face));
if (!g_ptr_array_find (self->added_faces, face, &position))
return;
- family = PANGO_HB_FAMILY (pango_font_face_get_family (face));
+ family = PANGO2_HB_FAMILY (pango2_font_face_get_family (face));
- pango_hb_family_remove_face (family, face);
+ pango2_hb_family_remove_face (family, face);
if (family->faces->len == 0)
- pango_font_map_remove_family (self, PANGO_FONT_FAMILY (family));
+ pango2_font_map_remove_family (self, PANGO2_FONT_FAMILY (family));
- pango_font_map_changed (self);
+ pango2_font_map_changed (self);
clear_caches (self);
@@ -986,47 +986,47 @@ pango_font_map_remove_face (PangoFontMap *self,
}
/**
- * pango_font_map_add_file:
- * @self: a `PangoFontMap`
+ * pango2_font_map_add_file:
+ * @self: a `Pango2FontMap`
* @file: font filename
*
- * Creates a new `PangoHbFace` and adds it.
+ * Creates a new `Pango2HbFace` and adds it.
*
* If you need to specify an instance id or other
- * parameters, use [ctor@Pango.HbFace.new_from_file].
+ * parameters, use [ctor@Pango2.HbFace.new_from_file].
*/
void
-pango_font_map_add_file (PangoFontMap *self,
- const char *file)
+pango2_font_map_add_file (Pango2FontMap *self,
+ const char *file)
{
- PangoHbFace *face;
+ Pango2HbFace *face;
- face = pango_hb_face_new_from_file (file, 0, -1, NULL, NULL);
- pango_font_map_add_face (self, PANGO_FONT_FACE (face));
+ face = pango2_hb_face_new_from_file (file, 0, -1, NULL, NULL);
+ pango2_font_map_add_face (self, PANGO2_FONT_FACE (face));
}
/**
- * pango_font_map_add_family:
- * @self: a `PangoFontMap`
- * @family: (transfer full): a `PangoFontFamily`
+ * pango2_font_map_add_family:
+ * @self: a `Pango2FontMap`
+ * @family: (transfer full): a `Pango2FontFamily`
*
- * Adds a family to the `PangoFontMap`.
+ * Adds a family to the `Pango2FontMap`.
*
* The fontmap must not contain a family with the
* same name as @family yet.
*
* This is mostly useful for adding generic families
- * using [ctor@Pango.GenericFamily.new].
+ * using [ctor@Pango2.GenericFamily.new].
*/
void
-pango_font_map_add_family (PangoFontMap *self,
- PangoFontFamily *family)
+pango2_font_map_add_family (Pango2FontMap *self,
+ Pango2FontFamily *family)
{
const char *name;
int position;
- g_return_if_fail (PANGO_IS_FONT_MAP (self));
- g_return_if_fail (PANGO_IS_HB_FAMILY (family) || PANGO_IS_GENERIC_FAMILY (family));
+ g_return_if_fail (PANGO2_IS_FONT_MAP (self));
+ g_return_if_fail (PANGO2_IS_HB_FAMILY (family) || PANGO2_IS_GENERIC_FAMILY (family));
g_return_if_fail (family->map == NULL);
if (!self->in_populate)
@@ -1037,13 +1037,13 @@ pango_font_map_add_family (PangoFontMap *self,
position = 0;
while (position < self->families->len)
{
- PangoFontFamily *f = g_ptr_array_index (self->families, position);
+ Pango2FontFamily *f = g_ptr_array_index (self->families, position);
if (g_ascii_strcasecmp (name, f->name) < 0)
break;
position++;
}
- pango_font_family_set_font_map (family, self);
+ pango2_font_family_set_font_map (family, self);
g_ptr_array_insert (self->families, position, family);
g_hash_table_add (self->families_hash, family);
@@ -1054,24 +1054,24 @@ pango_font_map_add_family (PangoFontMap *self,
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
}
- pango_font_map_changed (self);
+ pango2_font_map_changed (self);
}
/**
- * pango_font_map_remove_family:
- * @self: a `PangoFontMap`
- * @family: a `PangoFontFamily` that belongs to @self
+ * pango2_font_map_remove_family:
+ * @self: a `Pango2FontMap`
+ * @family: a `Pango2FontFamily` that belongs to @self
*
* Removes a family from the fontmap.
*/
void
-pango_font_map_remove_family (PangoFontMap *self,
- PangoFontFamily *family)
+pango2_font_map_remove_family (Pango2FontMap *self,
+ Pango2FontFamily *family)
{
unsigned int position;
- g_return_if_fail (PANGO_IS_FONT_MAP (self));
- g_return_if_fail (PANGO_IS_HB_FAMILY (family) || PANGO_IS_GENERIC_FAMILY (family));
+ g_return_if_fail (PANGO2_IS_FONT_MAP (self));
+ g_return_if_fail (PANGO2_IS_HB_FAMILY (family) || PANGO2_IS_GENERIC_FAMILY (family));
g_return_if_fail (family->map == self);
if (!g_ptr_array_find (self->added_families, family, &position))
@@ -1080,7 +1080,7 @@ pango_font_map_remove_family (PangoFontMap *self,
g_hash_table_remove (self->families_hash, family);
g_ptr_array_remove_index (self->families, position);
- pango_font_family_set_font_map (family, NULL);
+ pango2_font_family_set_font_map (family, NULL);
if (!self->in_populate)
{
@@ -1088,15 +1088,15 @@ pango_font_map_remove_family (PangoFontMap *self,
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]);
}
- pango_font_map_changed (self);
+ pango2_font_map_changed (self);
g_ptr_array_remove_index (self->added_families, position);
}
/**
- * pango_font_map_set_fallback:
- * @self: a `PangoFontMap`
- * @fallback: (nullable): the `PangoFontMap` to use as fallback
+ * pango2_font_map_set_fallback:
+ * @self: a `Pango2FontMap`
+ * @fallback: (nullable): the `Pango2FontMap` to use as fallback
*
* Sets the fontmap to use as fallback when a font isn't found.
*
@@ -1105,11 +1105,11 @@ pango_font_map_remove_family (PangoFontMap *self,
* from the fallback fontmap.
*/
void
-pango_font_map_set_fallback (PangoFontMap *self,
- PangoFontMap *fallback)
+pango2_font_map_set_fallback (Pango2FontMap *self,
+ Pango2FontMap *fallback)
{
- g_return_if_fail (PANGO_IS_FONT_MAP (self));
- g_return_if_fail (fallback == NULL || PANGO_IS_FONT_MAP (fallback));
+ g_return_if_fail (PANGO2_IS_FONT_MAP (self));
+ g_return_if_fail (fallback == NULL || PANGO2_IS_FONT_MAP (fallback));
if (!g_set_object (&self->fallback, fallback))
return;
@@ -1119,40 +1119,40 @@ pango_font_map_set_fallback (PangoFontMap *self,
}
/**
- * pango_font_map_get_fallback:
- * @self: a `PangoFontMap`
+ * pango2_font_map_get_fallback:
+ * @self: a `Pango2FontMap`
*
* Returns the fallback fontmap of the fontmap.
*
- * See [method@Pango.FontMap.set_fallback].
+ * See [method@Pango2.FontMap.set_fallback].
*
* Returns: (nullable) (transfer none): the fallback fontmap
*/
-PangoFontMap *
-pango_font_map_get_fallback (PangoFontMap *self)
+Pango2FontMap *
+pango2_font_map_get_fallback (Pango2FontMap *self)
{
- g_return_val_if_fail (PANGO_IS_FONT_MAP (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), NULL);
return self->fallback;
}
/**
- * pango_font_map_set_resolution:
- * @self: a `PangoFontMap`
+ * pango2_font_map_set_resolution:
+ * @self: a `Pango2FontMap`
* @dpi: the new resolution, in "dots per inch"
*
* Sets the resolution for the fontmap.
*
* This is a scale factor between points specified in a
- * `PangoFontDescription` and Cairo units. The default value
+ * `Pango2FontDescription` and Cairo units. The default value
* is 96, meaning that a 10 point font will be 13 units high.
* (10 * 96. / 72. = 13.3).
*/
void
-pango_font_map_set_resolution (PangoFontMap *self,
- float dpi)
+pango2_font_map_set_resolution (Pango2FontMap *self,
+ float dpi)
{
- g_return_if_fail (PANGO_IS_FONT_MAP (self));
+ g_return_if_fail (PANGO2_IS_FONT_MAP (self));
g_return_if_fail (dpi > 0);
if (self->dpi == dpi)
@@ -1161,25 +1161,25 @@ pango_font_map_set_resolution (PangoFontMap *self,
self->dpi = dpi;
clear_caches (self);
- pango_font_map_changed (self);
+ pango2_font_map_changed (self);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_RESOLUTION]);
}
/**
- * pango_font_map_get_resolution:
- * @self: a `PangoFontMap`
+ * pango2_font_map_get_resolution:
+ * @self: a `Pango2FontMap`
*
* Returns the resolution for the fontmap.
*
- * See [method@Pango.FontMap.set_resolution].
+ * See [method@Pango2.FontMap.set_resolution].
*
* Return value: the resolution for the fontmap
*/
float
-pango_font_map_get_resolution (PangoFontMap *self)
+pango2_font_map_get_resolution (Pango2FontMap *self)
{
- g_return_val_if_fail (PANGO_IS_FONT_MAP (self), 0);
+ g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), 0);
return self->dpi;
}
@@ -1190,66 +1190,66 @@ pango_font_map_get_resolution (PangoFontMap *self)
static GPrivate default_font_map = G_PRIVATE_INIT (g_object_unref); /* MT-safe */
/**
- * pango_font_map_new_default:
+ * pango2_font_map_new_default:
*
- * Creates a new `PangoFontMap` object.
+ * Creates a new `Pango2FontMap` object.
*
* Note that the type of the returned object will depend
- * on the platform that Pango is used on. If you want to
- * explicitly create an instance of `PangoFontMap` itself
- * (and not a platform-specific subclass), see [ctor@Pango.FontMap.new].
+ * on the platform that Pango2 is used on. If you want to
+ * explicitly create an instance of `Pango2FontMap` itself
+ * (and not a platform-specific subclass), see [ctor@Pango2.FontMap.new].
*
- * In most cases, you should use [func@Pango.FontMap.get_default],
+ * In most cases, you should use [func@Pango2.FontMap.get_default],
* which will automatically create a new default fontmap,
* if one has not been created for the current thread yet.
*
- * Return value: (transfer full): the newly allocated `PangoFontMap`
+ * Return value: (transfer full): the newly allocated `Pango2FontMap`
*/
-PangoFontMap *
-pango_font_map_new_default (void)
+Pango2FontMap *
+pango2_font_map_new_default (void)
{
/* If we ever go back to having multiple backends built
- * at the same time, bring back a PANGO_BACKEND env var
+ * at the same time, bring back a PANGO2_BACKEND env var
* here.
*/
#if defined (HAVE_CORE_TEXT)
- return PANGO_FONT_MAP (pango_core_text_font_map_new ());
+ return PANGO2_FONT_MAP (pango2_core_text_font_map_new ());
#elif defined (HAVE_DIRECT_WRITE)
- return PANGO_FONT_MAP (pango_direct_write_font_map_new ());
+ return PANGO2_FONT_MAP (pango2_direct_write_font_map_new ());
#elif defined (HAVE_FONTCONFIG)
- return PANGO_FONT_MAP (pango_fc_font_map_new ());
+ return PANGO2_FONT_MAP (pango2_fc_font_map_new ());
#else
return NULL;
#endif
}
/**
- * pango_font_map_get_default:
+ * pango2_font_map_get_default:
*
- * Gets the default `PangoFontMap`.
+ * Gets the default `Pango2FontMap`.
*
* The type of the returned object will depend on the
- * platform that Pango is used on.
+ * platform that Pango2 is used on.
*
* Note that the default fontmap is per-thread. Each thread gets
- * its own default fontmap. In this way, Pango can be used safely
+ * its own default fontmap. In this way, Pango2 can be used safely
* from multiple threads.
*
* The default fontmap can be changed by using
- * [method@Pango.FontMap.set_default].
+ * [method@Pango2.FontMap.set_default].
*
* Return value: (transfer none): the default fontmap
- * for the current thread. This object is owned by Pango and must
+ * for the current thread. This object is owned by Pango2 and must
* not be freed.
*/
-PangoFontMap *
-pango_font_map_get_default (void)
+Pango2FontMap *
+pango2_font_map_get_default (void)
{
- PangoFontMap *fontmap = g_private_get (&default_font_map);
+ Pango2FontMap *fontmap = g_private_get (&default_font_map);
if (G_UNLIKELY (!fontmap))
{
- fontmap = pango_font_map_new_default ();
+ fontmap = pango2_font_map_new_default ();
g_private_replace (&default_font_map, fontmap);
}
@@ -1257,10 +1257,10 @@ pango_font_map_get_default (void)
}
/**
- * pango_font_map_set_default:
+ * pango2_font_map_set_default:
* @fontmap: (nullable): The new default font map
*
- * Sets a default `PangoFontMap`.
+ * Sets a default `Pango2FontMap`.
*
* The old default font map is unreffed and the new font map referenced.
*
@@ -1268,16 +1268,16 @@ pango_font_map_get_default (void)
* This function only changes the default fontmap for
* the current thread. Default fontmaps of existing threads
* are not changed. Default fontmaps of any new threads will
- * still be created using [ctor@Pango.FontMap.new_default].
+ * still be created using [ctor@Pango2.FontMap.new_default].
*
* A value of %NULL for @fontmap will cause the current default
* font map to be released and a new default font map to be created
- * on demand, using [ctor@Pango.FontMap.new_default].
+ * on demand, using [ctor@Pango2.FontMap.new_default].
*/
void
-pango_font_map_set_default (PangoFontMap *fontmap)
+pango2_font_map_set_default (Pango2FontMap *fontmap)
{
- g_return_if_fail (fontmap == NULL || PANGO_IS_FONT_MAP (fontmap));
+ g_return_if_fail (fontmap == NULL || PANGO2_IS_FONT_MAP (fontmap));
if (fontmap)
g_object_ref (fontmap);
diff --git a/pango/pango-fontmap.h b/pango/pango-fontmap.h
index de806a8a..752b992e 100644
--- a/pango/pango-fontmap.h
+++ b/pango/pango-fontmap.h
@@ -25,67 +25,69 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_FONT_MAP (pango_font_map_get_type ())
-
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoFontMap, pango_font_map, PANGO, FONT_MAP, GObject)
-
-PANGO_AVAILABLE_IN_ALL
-PangoFont * pango_font_map_load_font (PangoFontMap *self,
- PangoContext *context,
- const PangoFontDescription *desc);
-PANGO_AVAILABLE_IN_ALL
-PangoFontset * pango_font_map_load_fontset (PangoFontMap *self,
- PangoContext *context,
- const PangoFontDescription *desc,
- PangoLanguage *language);
-PANGO_AVAILABLE_IN_ALL
-guint pango_font_map_get_serial (PangoFontMap *self);
-
-PANGO_AVAILABLE_IN_ALL
-PangoFontFamily * pango_font_map_get_family (PangoFontMap *self,
- const char *name);
-
-PANGO_AVAILABLE_IN_ALL
-PangoFontMap * pango_font_map_new (void);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_font_map_add_file (PangoFontMap *self,
- const char *file);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_font_map_add_face (PangoFontMap *self,
- PangoFontFace *face);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_font_map_remove_face (PangoFontMap *self,
- PangoFontFace *face);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_font_map_add_family (PangoFontMap *self,
- PangoFontFamily *family);
-PANGO_AVAILABLE_IN_ALL
-void pango_font_map_remove_family (PangoFontMap *self,
- PangoFontFamily *family);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_font_map_set_fallback (PangoFontMap *self,
- PangoFontMap *fallback);
-PANGO_AVAILABLE_IN_ALL
-PangoFontMap * pango_font_map_get_fallback (PangoFontMap *self);
-
-PANGO_AVAILABLE_IN_ALL
-float pango_font_map_get_resolution (PangoFontMap *self);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_font_map_set_resolution (PangoFontMap *self,
- float dpi);
-
-PANGO_AVAILABLE_IN_ALL
-PangoFontMap * pango_font_map_new_default (void);
-PANGO_AVAILABLE_IN_ALL
-PangoFontMap * pango_font_map_get_default (void);
-PANGO_AVAILABLE_IN_ALL
-void pango_font_map_set_default (PangoFontMap *fontmap);
+#define PANGO2_TYPE_FONT_MAP (pango2_font_map_get_type ())
+
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2FontMap, pango2_font_map, PANGO2, FONT_MAP, GObject)
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Font * pango2_font_map_load_font (Pango2FontMap *self,
+ Pango2Context *context,
+ const Pango2FontDescription *desc);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Fontset * pango2_font_map_load_fontset (Pango2FontMap *self,
+ Pango2Context *context,
+ const Pango2FontDescription *desc,
+ Pango2Language *language);
+PANGO2_AVAILABLE_IN_ALL
+guint pango2_font_map_get_serial (Pango2FontMap *self);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontFamily * pango2_font_map_get_family (Pango2FontMap *self,
+ const char *name);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontMap * pango2_font_map_new (void);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_map_add_file (Pango2FontMap *self,
+ const char *file);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_map_add_face (Pango2FontMap *self,
+ Pango2FontFace *face);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_map_remove_face (Pango2FontMap *self,
+ Pango2FontFace *face);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_map_add_family (Pango2FontMap *self,
+ Pango2FontFamily *family);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_map_remove_family (Pango2FontMap *self,
+ Pango2FontFamily *family);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_map_set_fallback (Pango2FontMap *self,
+ Pango2FontMap *fallback);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontMap * pango2_font_map_get_fallback (Pango2FontMap *self);
+
+PANGO2_AVAILABLE_IN_ALL
+float pango2_font_map_get_resolution (Pango2FontMap *self);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_map_set_resolution (Pango2FontMap *self,
+ float dpi);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontMap * pango2_font_map_new_default (void);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontMap * pango2_font_map_get_default (void);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_font_map_set_default (Pango2FontMap *fontmap);
G_END_DECLS
diff --git a/pango/pango-fontset-cached-private.h b/pango/pango-fontset-cached-private.h
index 2f3c7ac3..23309bce 100644
--- a/pango/pango-fontset-cached-private.h
+++ b/pango/pango-fontset-cached-private.h
@@ -28,19 +28,19 @@
#include <cairo.h>
#endif
-#define PANGO_TYPE_FONTSET_CACHED (pango_fontset_cached_get_type ())
+#define PANGO2_TYPE_FONTSET_CACHED (pango2_fontset_cached_get_type ())
-G_DECLARE_FINAL_TYPE (PangoFontsetCached, pango_fontset_cached, PANGO, FONTSET_CACHED, PangoFontset)
+G_DECLARE_FINAL_TYPE (Pango2FontsetCached, pango2_fontset_cached, PANGO2, FONTSET_CACHED, Pango2Fontset)
-struct _PangoFontsetCached
+struct _Pango2FontsetCached
{
- PangoFontset parent_instance;
+ Pango2Fontset parent_instance;
- GPtrArray *items; /* contains PangoHbFont or PangoGenericFamily */
- PangoLanguage *language;
- PangoFontDescription *description;
+ GPtrArray *items; /* contains Pango2HbFont or Pango2GenericFamily */
+ Pango2Language *language;
+ Pango2FontDescription *description;
float dpi;
- const PangoMatrix *ctm;
+ const Pango2Matrix *ctm;
GList cache_link;
GHashTable *cache;
@@ -49,17 +49,17 @@ struct _PangoFontsetCached
#endif
};
-PangoFontsetCached * pango_fontset_cached_new (const PangoFontDescription *description,
- PangoLanguage *language,
- float dpi,
- const PangoMatrix *ctm);
+Pango2FontsetCached * pango2_fontset_cached_new (const Pango2FontDescription *description,
+ Pango2Language *language,
+ float dpi,
+ const Pango2Matrix *ctm);
-void pango_fontset_cached_add_face (PangoFontsetCached *self,
- PangoFontFace *face);
-void pango_fontset_cached_add_family (PangoFontsetCached *self,
- PangoGenericFamily *family);
-int pango_fontset_cached_size (PangoFontsetCached *self);
-PangoFont * pango_fontset_cached_get_first_font (PangoFontsetCached *self);
+void pango2_fontset_cached_add_face (Pango2FontsetCached *self,
+ Pango2FontFace *face);
+void pango2_fontset_cached_add_family (Pango2FontsetCached *self,
+ Pango2GenericFamily *family);
+int pango2_fontset_cached_size (Pango2FontsetCached *self);
+Pango2Font * pango2_fontset_cached_get_first_font (Pango2FontsetCached *self);
-void pango_fontset_cached_append (PangoFontsetCached *self,
- PangoFontsetCached *other);
+void pango2_fontset_cached_append (Pango2FontsetCached *self,
+ Pango2FontsetCached *other);
diff --git a/pango/pango-fontset-cached.c b/pango/pango-fontset-cached.c
index 2692ac24..9feaca79 100644
--- a/pango/pango-fontset-cached.c
+++ b/pango/pango-fontset-cached.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -32,10 +32,10 @@
#include "pangocairo-font.h"
#endif
-G_DEFINE_FINAL_TYPE (PangoFontsetCached, pango_fontset_cached, PANGO_TYPE_FONTSET);
+G_DEFINE_FINAL_TYPE (Pango2FontsetCached, pango2_fontset_cached, PANGO2_TYPE_FONTSET);
static void
-pango_fontset_cached_init (PangoFontsetCached *fontset)
+pango2_fontset_cached_init (Pango2FontsetCached *fontset)
{
fontset->items = g_ptr_array_new_with_free_func (g_object_unref);
fontset->cache = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref);
@@ -46,32 +46,32 @@ pango_fontset_cached_init (PangoFontsetCached *fontset)
}
static void
-pango_fontset_cached_finalize (GObject *object)
+pango2_fontset_cached_finalize (GObject *object)
{
- PangoFontsetCached *self = (PangoFontsetCached *)object;
+ Pango2FontsetCached *self = (Pango2FontsetCached *)object;
g_ptr_array_free (self->items, TRUE);
g_hash_table_unref (self->cache);
- pango_font_description_free (self->description);
+ pango2_font_description_free (self->description);
#ifdef HAVE_CAIRO
if (self->font_options)
cairo_font_options_destroy (self->font_options);
#endif
- G_OBJECT_CLASS (pango_fontset_cached_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_fontset_cached_parent_class)->finalize (object);
}
-static PangoFont *
-find_font_for_face (PangoFontsetCached *self,
- PangoFontFace *face)
+static Pango2Font *
+find_font_for_face (Pango2FontsetCached *self,
+ Pango2FontFace *face)
{
GHashTableIter iter;
- PangoFont *font;
+ Pango2Font *font;
g_hash_table_iter_init (&iter, self->cache);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&font))
{
- if (pango_font_get_face (font) == face)
+ if (pango2_font_get_face (font) == face)
{
return font;
break;
@@ -81,12 +81,12 @@ find_font_for_face (PangoFontsetCached *self,
return NULL;
}
-static PangoFont *
-pango_fontset_cached_get_font (PangoFontset *fontset,
- guint wc)
+static Pango2Font *
+pango2_fontset_cached_get_font (Pango2Fontset *fontset,
+ guint wc)
{
- PangoFontsetCached *self = (PangoFontsetCached *)fontset;
- PangoFont *retval;
+ Pango2FontsetCached *self = (Pango2FontsetCached *)fontset;
+ Pango2Font *retval;
int i;
retval = g_hash_table_lookup (self->cache, GUINT_TO_POINTER (wc));
@@ -97,35 +97,35 @@ pango_fontset_cached_get_font (PangoFontset *fontset,
{
gpointer item = g_ptr_array_index (self->items, i);
- if (PANGO_IS_FONT (item))
+ if (PANGO2_IS_FONT (item))
{
- PangoFont *font = PANGO_FONT (item);
- if (pango_font_face_has_char (font->face, wc))
+ Pango2Font *font = PANGO2_FONT (item);
+ if (pango2_font_face_has_char (font->face, wc))
{
retval = g_object_ref (font);
break;
}
}
- else if (PANGO_IS_GENERIC_FAMILY (item))
+ else if (PANGO2_IS_GENERIC_FAMILY (item))
{
- PangoGenericFamily *family = PANGO_GENERIC_FAMILY (item);
- PangoFontDescription *copy;
- PangoFontFace *face;
+ Pango2GenericFamily *family = PANGO2_GENERIC_FAMILY (item);
+ Pango2FontDescription *copy;
+ Pango2FontFace *face;
/* Here is where we implement delayed picking for generic families.
* If a face does not cover the character and its family is generic,
* choose a different face from the same family and create a font to use.
*/
- copy = pango_font_description_copy_static (self->description);
- pango_font_description_unset_fields (copy, PANGO_FONT_MASK_VARIATIONS |
- PANGO_FONT_MASK_GRAVITY |
- PANGO_FONT_MASK_VARIANT);
- face = pango_generic_family_find_face (family, copy, self->language, wc);
- pango_font_description_free (copy);
+ copy = pango2_font_description_copy_static (self->description);
+ pango2_font_description_unset_fields (copy, PANGO2_FONT_MASK_VARIATIONS |
+ PANGO2_FONT_MASK_GRAVITY |
+ PANGO2_FONT_MASK_VARIANT);
+ face = pango2_generic_family_find_face (family, copy, self->language, wc);
+ pango2_font_description_free (copy);
if (face)
{
- PangoFont *font;
+ Pango2Font *font;
font = find_font_for_face (self, face);
if (font)
@@ -134,12 +134,12 @@ pango_fontset_cached_get_font (PangoFontset *fontset,
}
else
{
- retval = pango_font_face_create_font (face,
- self->description,
- self->dpi,
- self->ctm);
+ retval = pango2_font_face_create_font (face,
+ self->description,
+ self->dpi,
+ self->ctm);
#ifdef HAVE_CAIRO
- pango_cairo_font_set_font_options (retval, self->font_options);
+ pango2_cairo_font_set_font_options (retval, self->font_options);
#endif
}
break;
@@ -153,35 +153,35 @@ pango_fontset_cached_get_font (PangoFontset *fontset,
return retval;
}
-PangoFont *
-pango_fontset_cached_get_first_font (PangoFontsetCached *self)
+Pango2Font *
+pango2_fontset_cached_get_first_font (Pango2FontsetCached *self)
{
gpointer item;
item = g_ptr_array_index (self->items, 0);
- if (PANGO_IS_FONT (item))
- return g_object_ref (PANGO_FONT (item));
- else if (PANGO_IS_GENERIC_FAMILY (item))
+ if (PANGO2_IS_FONT (item))
+ return g_object_ref (PANGO2_FONT (item));
+ else if (PANGO2_IS_GENERIC_FAMILY (item))
{
- PangoFontFace *face;
- PangoFont *font;
+ Pango2FontFace *face;
+ Pango2Font *font;
- face = pango_generic_family_find_face (PANGO_GENERIC_FAMILY (item),
- self->description,
- self->language,
- 0);
+ face = pango2_generic_family_find_face (PANGO2_GENERIC_FAMILY (item),
+ self->description,
+ self->language,
+ 0);
font = find_font_for_face (self, face);
if (font)
g_object_ref (font);
else
{
- font = pango_font_face_create_font (face,
- self->description,
- self->dpi,
- self->ctm);
+ font = pango2_font_face_create_font (face,
+ self->description,
+ self->dpi,
+ self->ctm);
#ifdef HAVE_CAIRO
- pango_cairo_font_set_font_options (font, self->font_options);
+ pango2_cairo_font_set_font_options (font, self->font_options);
#endif
}
@@ -191,71 +191,71 @@ pango_fontset_cached_get_first_font (PangoFontsetCached *self)
return NULL;
}
-static PangoFontMetrics *
-pango_fontset_cached_get_metrics (PangoFontset *fontset)
+static Pango2FontMetrics *
+pango2_fontset_cached_get_metrics (Pango2Fontset *fontset)
{
- PangoFontsetCached *self = (PangoFontsetCached *)fontset;
+ Pango2FontsetCached *self = (Pango2FontsetCached *)fontset;
if (self->items->len == 1)
{
- PangoFont *font;
- PangoFontMetrics *ret;
+ Pango2Font *font;
+ Pango2FontMetrics *ret;
- font = pango_fontset_cached_get_first_font (self);
- ret = pango_font_get_metrics (font, self->language);
+ font = pango2_fontset_cached_get_first_font (self);
+ ret = pango2_font_get_metrics (font, self->language);
g_object_unref (font);
return ret;
}
- return PANGO_FONTSET_CLASS (pango_fontset_cached_parent_class)->get_metrics (fontset);
+ return PANGO2_FONTSET_CLASS (pango2_fontset_cached_parent_class)->get_metrics (fontset);
}
-static PangoLanguage *
-pango_fontset_cached_get_language (PangoFontset *fontset)
+static Pango2Language *
+pango2_fontset_cached_get_language (Pango2Fontset *fontset)
{
- PangoFontsetCached *self = (PangoFontsetCached *)fontset;
+ Pango2FontsetCached *self = (Pango2FontsetCached *)fontset;
return self->language;
}
static void
-pango_fontset_cached_foreach (PangoFontset *fontset,
- PangoFontsetForeachFunc func,
- gpointer data)
+pango2_fontset_cached_foreach (Pango2Fontset *fontset,
+ Pango2FontsetForeachFunc func,
+ gpointer data)
{
- PangoFontsetCached *self = (PangoFontsetCached *)fontset;
+ Pango2FontsetCached *self = (Pango2FontsetCached *)fontset;
unsigned int i;
for (i = 0; i < self->items->len; i++)
{
gpointer item = g_ptr_array_index (self->items, i);
- PangoFont *font = NULL;
+ Pango2Font *font = NULL;
- if (PANGO_IS_FONT (item))
+ if (PANGO2_IS_FONT (item))
{
- font = g_object_ref (PANGO_FONT (item));
+ font = g_object_ref (PANGO2_FONT (item));
}
- else if (PANGO_IS_GENERIC_FAMILY (item))
+ else if (PANGO2_IS_GENERIC_FAMILY (item))
{
- PangoFontFace *face;
+ Pango2FontFace *face;
- face = pango_generic_family_find_face (PANGO_GENERIC_FAMILY (item),
- self->description,
- self->language,
- 0);
+ face = pango2_generic_family_find_face (PANGO2_GENERIC_FAMILY (item),
+ self->description,
+ self->language,
+ 0);
font = find_font_for_face (self, face);
if (font)
g_object_ref (font);
else
{
- font = pango_font_face_create_font (face,
- self->description,
- self->dpi,
- self->ctm);
+ font = pango2_font_face_create_font (face,
+ self->description,
+ self->dpi,
+ self->ctm);
#ifdef HAVE_CAIRO
- pango_cairo_font_set_font_options (font, self->font_options);
+ pango2_cairo_font_set_font_options (font, self->font_options);
#endif
}
}
@@ -270,30 +270,30 @@ pango_fontset_cached_foreach (PangoFontset *fontset,
}
static void
-pango_fontset_cached_class_init (PangoFontsetCachedClass *class)
+pango2_fontset_cached_class_init (Pango2FontsetCachedClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontsetClass *fontset_class = PANGO_FONTSET_CLASS (class);
+ Pango2FontsetClass *fontset_class = PANGO2_FONTSET_CLASS (class);
- object_class->finalize = pango_fontset_cached_finalize;
+ object_class->finalize = pango2_fontset_cached_finalize;
- fontset_class->get_font = pango_fontset_cached_get_font;
- fontset_class->get_metrics = pango_fontset_cached_get_metrics;
- fontset_class->get_language = pango_fontset_cached_get_language;
- fontset_class->foreach = pango_fontset_cached_foreach;
+ fontset_class->get_font = pango2_fontset_cached_get_font;
+ fontset_class->get_metrics = pango2_fontset_cached_get_metrics;
+ fontset_class->get_language = pango2_fontset_cached_get_language;
+ fontset_class->foreach = pango2_fontset_cached_foreach;
}
-PangoFontsetCached *
-pango_fontset_cached_new (const PangoFontDescription *description,
- PangoLanguage *language,
- float dpi,
- const PangoMatrix *ctm)
+Pango2FontsetCached *
+pango2_fontset_cached_new (const Pango2FontDescription *description,
+ Pango2Language *language,
+ float dpi,
+ const Pango2Matrix *ctm)
{
- PangoFontsetCached *self;
+ Pango2FontsetCached *self;
- self = g_object_new (pango_fontset_cached_get_type (), NULL);
+ self = g_object_new (pango2_fontset_cached_get_type (), NULL);
self->language = language;
- self->description = pango_font_description_copy (description);
+ self->description = pango2_font_description_copy (description);
self->dpi = dpi;
self->ctm = ctm;
@@ -301,46 +301,46 @@ pango_fontset_cached_new (const PangoFontDescription *description,
}
void
-pango_fontset_cached_add_face (PangoFontsetCached *self,
- PangoFontFace *face)
+pango2_fontset_cached_add_face (Pango2FontsetCached *self,
+ Pango2FontFace *face)
{
- PangoFont *font;
+ Pango2Font *font;
- font = pango_font_face_create_font (face,
- self->description,
- self->dpi,
- self->ctm);
+ font = pango2_font_face_create_font (face,
+ self->description,
+ self->dpi,
+ self->ctm);
#ifdef HAVE_CAIRO
- pango_cairo_font_set_font_options (font, self->font_options);
+ pango2_cairo_font_set_font_options (font, self->font_options);
#endif
g_ptr_array_add (self->items, font);
}
void
-pango_fontset_cached_add_family (PangoFontsetCached *self,
- PangoGenericFamily *family)
+pango2_fontset_cached_add_family (Pango2FontsetCached *self,
+ Pango2GenericFamily *family)
{
g_ptr_array_add (self->items, g_object_ref (family));
}
int
-pango_fontset_cached_size (PangoFontsetCached *self)
+pango2_fontset_cached_size (Pango2FontsetCached *self)
{
return self->items->len;
}
void
-pango_fontset_cached_append (PangoFontsetCached *self,
- PangoFontsetCached *other)
+pango2_fontset_cached_append (Pango2FontsetCached *self,
+ Pango2FontsetCached *other)
{
for (int i = 0; i < other->items->len; i++)
{
gpointer item = g_ptr_array_index (other->items, i);
- if (PANGO_IS_FONT (item))
- pango_fontset_cached_add_face (self, pango_font_get_face (PANGO_FONT (item)));
- else if (PANGO_IS_GENERIC_FAMILY (item))
- pango_fontset_cached_add_family (self, PANGO_GENERIC_FAMILY (item));
+ if (PANGO2_IS_FONT (item))
+ pango2_fontset_cached_add_face (self, pango2_font_get_face (PANGO2_FONT (item)));
+ else if (PANGO2_IS_GENERIC_FAMILY (item))
+ pango2_fontset_cached_add_family (self, PANGO2_GENERIC_FAMILY (item));
}
}
diff --git a/pango/pango-fontset-private.h b/pango/pango-fontset-private.h
index f67bddb0..06e0e7c0 100644
--- a/pango/pango-fontset-private.h
+++ b/pango/pango-fontset-private.h
@@ -22,30 +22,30 @@
#include "pango-fontset.h"
-#define PANGO_FONTSET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONTSET, PangoFontsetClass))
-#define PANGO_FONTSET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONTSET, PangoFontsetClass))
+#define PANGO2_FONTSET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO2_TYPE_FONTSET, Pango2FontsetClass))
+#define PANGO2_FONTSET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO2_TYPE_FONTSET, Pango2FontsetClass))
-typedef struct _PangoFontsetClass PangoFontsetClass;
+typedef struct _Pango2FontsetClass Pango2FontsetClass;
-struct _PangoFontset
+struct _Pango2Fontset
{
GObject parent_instance;
};
-struct _PangoFontsetClass
+struct _Pango2FontsetClass
{
GObjectClass parent_class;
- PangoFont * (* get_font) (PangoFontset *fontset,
- guint wc);
+ Pango2Font * (* get_font) (Pango2Fontset *fontset,
+ guint wc);
- PangoFontMetrics * (* get_metrics) (PangoFontset *fontset);
- PangoLanguage * (* get_language) (PangoFontset *fontset);
- void (* foreach) (PangoFontset *fontset,
- PangoFontsetForeachFunc func,
- gpointer data);
+ Pango2FontMetrics * (* get_metrics) (Pango2Fontset *fontset);
+ Pango2Language * (* get_language) (Pango2Fontset *fontset);
+ void (* foreach) (Pango2Fontset *fontset,
+ Pango2FontsetForeachFunc func,
+ gpointer data);
};
-PangoLanguage * pango_fontset_get_language (PangoFontset *fontset);
+Pango2Language * pango2_fontset_get_language (Pango2Fontset *fontset);
diff --git a/pango/pango-fontset.c b/pango/pango-fontset.c
index d528ad8d..b3ef1e8e 100644
--- a/pango/pango-fontset.c
+++ b/pango/pango-fontset.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-fontset.c:
*
* Copyright (C) 2001 Red Hat Software
@@ -22,17 +22,17 @@
#include "config.h"
/**
- * PangoFontset:
+ * Pango2Fontset:
*
- * A `PangoFontset` represents a set of `PangoFont` to use when rendering text.
+ * A `Pango2Fontset` represents a set of `Pango2Font` to use when rendering text.
*
- * A `PangoFontset` is the result of resolving a `PangoFontDescription`
- * against a particular `PangoContext`. It has operations for finding the
+ * A `Pango2Fontset` is the result of resolving a `Pango2FontDescription`
+ * against a particular `Pango2Context`. It has operations for finding the
* component font for a particular Unicode character, and for finding a
* composite set of metrics for the entire fontset.
*
- * To obtain a `PangoFontset`, use [method@Pango.Context.load_fontset] or
- * [method@Pango.FontMap.load_fontset].
+ * To obtain a `Pango2Fontset`, use [method@Pango2.Context.load_fontset] or
+ * [method@Pango2.FontMap.load_fontset].
*/
#include "pango-fontset-private.h"
@@ -40,77 +40,77 @@
#include "pango-font-metrics-private.h"
#include "pango-impl-utils.h"
-static PangoFontMetrics *pango_fontset_real_get_metrics (PangoFontset *fontset);
+static Pango2FontMetrics *pango2_fontset_real_get_metrics (Pango2Fontset *fontset);
-G_DEFINE_ABSTRACT_TYPE (PangoFontset, pango_fontset, G_TYPE_OBJECT);
+G_DEFINE_ABSTRACT_TYPE (Pango2Fontset, pango2_fontset, G_TYPE_OBJECT);
static void
-pango_fontset_init (PangoFontset *self)
+pango2_fontset_init (Pango2Fontset *self)
{
}
static void
-pango_fontset_class_init (PangoFontsetClass *class)
+pango2_fontset_class_init (Pango2FontsetClass *class)
{
- class->get_metrics = pango_fontset_real_get_metrics;
+ class->get_metrics = pango2_fontset_real_get_metrics;
}
/**
- * pango_fontset_get_font:
- * @fontset: a `PangoFontset`
+ * pango2_fontset_get_font:
+ * @fontset: a `Pango2Fontset`
* @wc: a Unicode character
*
* Returns the font in the fontset that contains the best
* glyph for a Unicode character.
*
- * Return value: (transfer full): a `PangoFont`
+ * Return value: (transfer full): a `Pango2Font`
*/
-PangoFont *
-pango_fontset_get_font (PangoFontset *fontset,
- guint wc)
+Pango2Font *
+pango2_fontset_get_font (Pango2Fontset *fontset,
+ guint wc)
{
- g_return_val_if_fail (PANGO_IS_FONTSET (fontset), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONTSET (fontset), NULL);
- return PANGO_FONTSET_GET_CLASS (fontset)->get_font (fontset, wc);
+ return PANGO2_FONTSET_GET_CLASS (fontset)->get_font (fontset, wc);
}
/**
- * pango_fontset_get_metrics:
- * @fontset: a `PangoFontset`
+ * pango2_fontset_get_metrics:
+ * @fontset: a `Pango2Fontset`
*
* Get overall metric information for the fonts in the fontset.
*
- * Return value: a `PangoFontMetrics` object
+ * Return value: a `Pango2FontMetrics` object
*/
-PangoFontMetrics *
-pango_fontset_get_metrics (PangoFontset *fontset)
+Pango2FontMetrics *
+pango2_fontset_get_metrics (Pango2Fontset *fontset)
{
- g_return_val_if_fail (PANGO_IS_FONTSET (fontset), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONTSET (fontset), NULL);
- return PANGO_FONTSET_GET_CLASS (fontset)->get_metrics (fontset);
+ return PANGO2_FONTSET_GET_CLASS (fontset)->get_metrics (fontset);
}
/*< private >
- * pango_fontset_get_language:
- * @fontset: a `PangoFontset`
+ * pango2_fontset_get_language:
+ * @fontset: a `Pango2Fontset`
*
* Gets the language that the fontset was created for.
*
* Returns: the language that @fontset was created for
*/
-PangoLanguage *
-pango_fontset_get_language (PangoFontset *fontset)
+Pango2Language *
+pango2_fontset_get_language (Pango2Fontset *fontset)
{
- g_return_val_if_fail (PANGO_IS_FONTSET (fontset), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONTSET (fontset), NULL);
- return PANGO_FONTSET_GET_CLASS (fontset)->get_language (fontset);
+ return PANGO2_FONTSET_GET_CLASS (fontset)->get_language (fontset);
}
/**
- * pango_fontset_foreach:
- * @fontset: a `PangoFontset`
+ * pango2_fontset_foreach:
+ * @fontset: a `Pango2Fontset`
* @func: (closure data) (scope call): Callback function
* @data: (closure): data to pass to the callback function
*
@@ -120,60 +120,60 @@ pango_fontset_get_language (PangoFontset *fontset)
* If @func returns %TRUE, that stops the iteration.
*/
void
-pango_fontset_foreach (PangoFontset *fontset,
- PangoFontsetForeachFunc func,
- gpointer data)
+pango2_fontset_foreach (Pango2Fontset *fontset,
+ Pango2FontsetForeachFunc func,
+ gpointer data)
{
- g_return_if_fail (PANGO_IS_FONTSET (fontset));
+ g_return_if_fail (PANGO2_IS_FONTSET (fontset));
g_return_if_fail (func != NULL);
- PANGO_FONTSET_GET_CLASS (fontset)->foreach (fontset, func, data);
+ PANGO2_FONTSET_GET_CLASS (fontset)->foreach (fontset, func, data);
}
static gboolean
-get_first_metrics_foreach (PangoFontset *fontset,
- PangoFont *font,
+get_first_metrics_foreach (Pango2Fontset *fontset,
+ Pango2Font *font,
gpointer data)
{
- PangoFontMetrics **fontset_metrics = data;
- PangoLanguage *language = pango_fontset_get_language (fontset);
+ Pango2FontMetrics **fontset_metrics = data;
+ Pango2Language *language = pango2_fontset_get_language (fontset);
- *fontset_metrics = pango_font_get_metrics (font, language);
+ *fontset_metrics = pango2_font_get_metrics (font, language);
return TRUE; /* Stops iteration */
}
-static PangoFontMetrics *
-pango_fontset_real_get_metrics (PangoFontset *fontset)
+static Pango2FontMetrics *
+pango2_fontset_real_get_metrics (Pango2Fontset *fontset)
{
- PangoFontMetrics *metrics, *raw_metrics;
+ Pango2FontMetrics *metrics, *raw_metrics;
const char *sample_str;
const char *p;
int count;
GHashTable *fonts_seen;
- PangoFont *font;
- PangoLanguage *language;
+ Pango2Font *font;
+ Pango2Language *language;
- language = pango_fontset_get_language (fontset);
- sample_str = pango_language_get_sample_string (language);
+ language = pango2_fontset_get_language (fontset);
+ sample_str = pango2_language_get_sample_string (language);
count = 0;
metrics = NULL;
fonts_seen = g_hash_table_new_full (NULL, NULL, g_object_unref, NULL);
/* Initialize the metrics from the first font in the fontset */
- pango_fontset_foreach (fontset, get_first_metrics_foreach, &metrics);
+ pango2_fontset_foreach (fontset, get_first_metrics_foreach, &metrics);
p = sample_str;
while (*p)
{
gunichar wc = g_utf8_get_char (p);
- font = pango_fontset_get_font (fontset, wc);
+ font = pango2_fontset_get_font (fontset, wc);
if (font)
{
if (g_hash_table_lookup (fonts_seen, font) == NULL)
{
- raw_metrics = pango_font_get_metrics (font, language);
+ raw_metrics = pango2_font_get_metrics (font, language);
g_hash_table_insert (fonts_seen, font, font);
if (count == 0)
@@ -191,7 +191,7 @@ pango_fontset_real_get_metrics (PangoFontset *fontset)
metrics->approximate_digit_width += raw_metrics->approximate_digit_width;
}
count++;
- pango_font_metrics_free (raw_metrics);
+ pango2_font_metrics_free (raw_metrics);
}
else
g_object_unref (font);
diff --git a/pango/pango-fontset.h b/pango/pango-fontset.h
index 57beea2e..144c4de8 100644
--- a/pango/pango-fontset.h
+++ b/pango/pango-fontset.h
@@ -26,35 +26,35 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_FONTSET (pango_fontset_get_type ())
+#define PANGO2_TYPE_FONTSET (pango2_fontset_get_type ())
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoFontset, pango_fontset, PANGO, FONTSET, GObject)
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2Fontset, pango2_fontset, PANGO2, FONTSET, GObject)
/**
- * PangoFontsetForeachFunc:
- * @fontset: a `PangoFontset`
+ * Pango2FontsetForeachFunc:
+ * @fontset: a `Pango2Fontset`
* @font: a font from @fontset
* @user_data: callback data
*
* Callback used when enumerating fonts in a fontset.
*
- * See [method@Pango.Fontset.foreach].
+ * See [method@Pango2.Fontset.foreach].
*
* Returns: if %TRUE, stop iteration and return immediately.
*/
-typedef gboolean (*PangoFontsetForeachFunc) (PangoFontset *fontset,
- PangoFont *font,
- gpointer user_data);
-
-PANGO_AVAILABLE_IN_ALL
-PangoFont * pango_fontset_get_font (PangoFontset *fontset,
- guint wc);
-PANGO_AVAILABLE_IN_ALL
-PangoFontMetrics * pango_fontset_get_metrics (PangoFontset *fontset);
-PANGO_AVAILABLE_IN_ALL
-void pango_fontset_foreach (PangoFontset *fontset,
- PangoFontsetForeachFunc func,
- gpointer data);
+typedef gboolean (*Pango2FontsetForeachFunc) (Pango2Fontset *fontset,
+ Pango2Font *font,
+ gpointer user_data);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Font * pango2_fontset_get_font (Pango2Fontset *fontset,
+ guint wc);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FontMetrics * pango2_fontset_get_metrics (Pango2Fontset *fontset);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_fontset_foreach (Pango2Fontset *fontset,
+ Pango2FontsetForeachFunc func,
+ gpointer data);
G_END_DECLS
diff --git a/pango/pango-generic-family-private.h b/pango/pango-generic-family-private.h
index 21774c4a..8c406d81 100644
--- a/pango/pango-generic-family-private.h
+++ b/pango/pango-generic-family-private.h
@@ -24,15 +24,15 @@
#include "pango-font-family-private.h"
-struct _PangoGenericFamily
+struct _Pango2GenericFamily
{
- PangoFontFamily parent_instance;
+ Pango2FontFamily parent_instance;
GPtrArray *families;
};
-PangoFontFace * pango_generic_family_find_face (PangoGenericFamily *self,
- PangoFontDescription *description,
- PangoLanguage *language,
- gunichar wc);
+Pango2FontFace * pango2_generic_family_find_face (Pango2GenericFamily *self,
+ Pango2FontDescription *description,
+ Pango2Language *language,
+ gunichar wc);
diff --git a/pango/pango-generic-family.c b/pango/pango-generic-family.c
index b591b846..c0697f00 100644
--- a/pango/pango-generic-family.c
+++ b/pango/pango-generic-family.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2022 Matthias Clasen
*
@@ -29,12 +29,12 @@
#include "pango-font-private.h"
/**
- * PangoGenericFamily:
+ * Pango2GenericFamily:
*
- * An implementation of `PangoFontFamily`
+ * An implementation of `Pango2FontFamily`
* that provides faces from other families.
*
- * `PangoGenericFamily can be used to e.g. assemble a
+ * `Pango2GenericFamily can be used to e.g. assemble a
* generic 'sans-serif' family from a number of other
* font families.
*/
@@ -43,21 +43,21 @@
/* {{{ GListModel implementation */
static GType
-pango_generic_family_get_item_type (GListModel *list)
+pango2_generic_family_get_item_type (GListModel *list)
{
- return PANGO_TYPE_FONT_FACE;
+ return PANGO2_TYPE_FONT_FACE;
}
static guint
-pango_generic_family_get_n_items (GListModel *list)
+pango2_generic_family_get_n_items (GListModel *list)
{
- PangoGenericFamily *self = PANGO_GENERIC_FAMILY (list);
+ Pango2GenericFamily *self = PANGO2_GENERIC_FAMILY (list);
guint n;
n = 0;
for (int i = 0; i < self->families->len; i++)
{
- PangoHbFamily *family = g_ptr_array_index (self->families, i);
+ Pango2HbFamily *family = g_ptr_array_index (self->families, i);
n += g_list_model_get_n_items (G_LIST_MODEL (family));
}
@@ -66,16 +66,16 @@ pango_generic_family_get_n_items (GListModel *list)
}
static gpointer
-pango_generic_family_get_item (GListModel *list,
- guint position)
+pango2_generic_family_get_item (GListModel *list,
+ guint position)
{
- PangoGenericFamily *self = PANGO_GENERIC_FAMILY (list);
+ Pango2GenericFamily *self = PANGO2_GENERIC_FAMILY (list);
guint pos;
pos = position;
for (int i = 0; i < self->families->len; i++)
{
- PangoHbFamily *family = g_ptr_array_index (self->families, i);
+ Pango2HbFamily *family = g_ptr_array_index (self->families, i);
if (pos < g_list_model_get_n_items (G_LIST_MODEL (family)))
return g_list_model_get_item (G_LIST_MODEL (family), pos);
@@ -87,56 +87,56 @@ pango_generic_family_get_item (GListModel *list,
}
static void
-pango_generic_family_list_model_init (GListModelInterface *iface)
+pango2_generic_family_list_model_init (GListModelInterface *iface)
{
- iface->get_item_type = pango_generic_family_get_item_type;
- iface->get_n_items = pango_generic_family_get_n_items;
- iface->get_item = pango_generic_family_get_item;
+ iface->get_item_type = pango2_generic_family_get_item_type;
+ iface->get_n_items = pango2_generic_family_get_n_items;
+ iface->get_item = pango2_generic_family_get_item;
}
/* }}} */
-/* {{{ PangoFontFamily implementation */
+/* {{{ Pango2FontFamily implementation */
-struct _PangoGenericFamilyClass
+struct _Pango2GenericFamilyClass
{
- PangoFontFamilyClass parent_class;
+ Pango2FontFamilyClass parent_class;
};
-G_DEFINE_FINAL_TYPE_WITH_CODE (PangoGenericFamily, pango_generic_family, PANGO_TYPE_FONT_FAMILY,
- G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_generic_family_list_model_init))
+G_DEFINE_FINAL_TYPE_WITH_CODE (Pango2GenericFamily, pango2_generic_family, PANGO2_TYPE_FONT_FAMILY,
+ G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango2_generic_family_list_model_init))
static void
-pango_generic_family_init (PangoGenericFamily *self)
+pango2_generic_family_init (Pango2GenericFamily *self)
{
self->families = g_ptr_array_new_with_free_func (g_object_unref);
}
static void
-pango_generic_family_finalize (GObject *object)
+pango2_generic_family_finalize (GObject *object)
{
- PangoGenericFamily *self = PANGO_GENERIC_FAMILY (object);
+ Pango2GenericFamily *self = PANGO2_GENERIC_FAMILY (object);
g_ptr_array_unref (self->families);
- G_OBJECT_CLASS (pango_generic_family_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_generic_family_parent_class)->finalize (object);
}
static void
-pango_generic_family_class_init (PangoGenericFamilyClass *class)
+pango2_generic_family_class_init (Pango2GenericFamilyClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = pango_generic_family_finalize;
+ object_class->finalize = pango2_generic_family_finalize;
}
/* }}} */
/* {{{ Private API */
/*< private >
- * pango_generic_family_find_face:
- * @family: a `PangoGenericFamily`
- * @description: `PangoFontDescription` to match
- * @language: (nullable): `PangoLanguage` to support
+ * pango2_generic_family_find_face:
+ * @family: a `Pango2GenericFamily`
+ * @description: `Pango2FontDescription` to match
+ * @language: (nullable): `Pango2Language` to support
* @wc: a Unicode character, or 0 to ignore
*
* Finds the face that best matches the font description while
@@ -145,19 +145,19 @@ pango_generic_family_class_init (PangoGenericFamilyClass *class)
*
* Returns: (transfer none) (nullable): the face
*/
-PangoFontFace *
-pango_generic_family_find_face (PangoGenericFamily *self,
- PangoFontDescription *description,
- PangoLanguage *language,
- gunichar wc)
+Pango2FontFace *
+pango2_generic_family_find_face (Pango2GenericFamily *self,
+ Pango2FontDescription *description,
+ Pango2Language *language,
+ gunichar wc)
{
- PangoFontFace *face = NULL;
+ Pango2FontFace *face = NULL;
for (int i = 0; i < self->families->len; i++)
{
- PangoHbFamily *family = g_ptr_array_index (self->families, i);
+ Pango2HbFamily *family = g_ptr_array_index (self->families, i);
- face = pango_hb_family_find_face (family, description, language, wc);
+ face = pango2_hb_family_find_face (family, description, language, wc);
if (face)
break;
}
@@ -165,7 +165,7 @@ pango_generic_family_find_face (PangoGenericFamily *self,
/* last resort */
if (!face && self->families->len > 0)
{
- PangoHbFamily *family = g_ptr_array_index (self->families, 0);
+ Pango2HbFamily *family = g_ptr_array_index (self->families, 0);
face = g_list_model_get_item (G_LIST_MODEL (family), 0);
g_object_unref (face);
}
@@ -177,46 +177,46 @@ pango_generic_family_find_face (PangoGenericFamily *self,
/* {{{ Public API */
/**
- * pango_generic_family_new:
+ * pango2_generic_family_new:
* @name: the family name
*
- * Creates a new `PangoGenericFamily`.
+ * Creates a new `Pango2GenericFamily`.
*
* A generic family does not contain faces, but will return
* faces from other families that match a given query.
*
- * Returns: a newly created `PangoGenericFamily`
+ * Returns: a newly created `Pango2GenericFamily`
*/
-PangoGenericFamily *
-pango_generic_family_new (const char *name)
+Pango2GenericFamily *
+pango2_generic_family_new (const char *name)
{
- PangoGenericFamily *self;
+ Pango2GenericFamily *self;
g_return_val_if_fail (name != NULL, NULL);
- self = g_object_new (PANGO_TYPE_GENERIC_FAMILY, NULL);
+ self = g_object_new (PANGO2_TYPE_GENERIC_FAMILY, NULL);
- pango_font_family_set_name (PANGO_FONT_FAMILY (self), name);
+ pango2_font_family_set_name (PANGO2_FONT_FAMILY (self), name);
return self;
}
/**
- * pango_generic_family_add_family:
- * @self: a `PangoGenericFamily`
- * @family: (transfer none): a `PangoFontFamily` to add
+ * pango2_generic_family_add_family:
+ * @self: a `Pango2GenericFamily`
+ * @family: (transfer none): a `Pango2FontFamily` to add
*
- * Adds a `PangoFontFamily` to a `PangoGenericFamily`.
+ * Adds a `Pango2FontFamily` to a `Pango2GenericFamily`.
*
* It is an error to call this function more than
* once for the same family.
*/
void
-pango_generic_family_add_family (PangoGenericFamily *self,
- PangoFontFamily *family)
+pango2_generic_family_add_family (Pango2GenericFamily *self,
+ Pango2FontFamily *family)
{
- g_return_if_fail (PANGO_IS_GENERIC_FAMILY (self));
- g_return_if_fail (PANGO_IS_FONT_FAMILY (family));
+ g_return_if_fail (PANGO2_IS_GENERIC_FAMILY (self));
+ g_return_if_fail (PANGO2_IS_FONT_FAMILY (family));
g_ptr_array_add (self->families, g_object_ref (family));
}
diff --git a/pango/pango-generic-family.h b/pango/pango-generic-family.h
index fc6de855..ab1d0fd2 100644
--- a/pango/pango-generic-family.h
+++ b/pango/pango-generic-family.h
@@ -23,16 +23,16 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_GENERIC_FAMILY (pango_generic_family_get_type ())
+#define PANGO2_TYPE_GENERIC_FAMILY (pango2_generic_family_get_type ())
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoGenericFamily, pango_generic_family, PANGO, GENERIC_FAMILY, PangoFontFamily)
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2GenericFamily, pango2_generic_family, PANGO2, GENERIC_FAMILY, Pango2FontFamily)
-PANGO_AVAILABLE_IN_ALL
-PangoGenericFamily * pango_generic_family_new (const char *name);
+PANGO2_AVAILABLE_IN_ALL
+Pango2GenericFamily * pango2_generic_family_new (const char *name);
-PANGO_AVAILABLE_IN_ALL
-void pango_generic_family_add_family (PangoGenericFamily *self,
- PangoFontFamily *family);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_generic_family_add_family (Pango2GenericFamily *self,
+ Pango2FontFamily *family);
G_END_DECLS
diff --git a/pango/pango-glyph-item-private.h b/pango/pango-glyph-item-private.h
index 82e5dca4..71e07d1c 100644
--- a/pango/pango-glyph-item-private.h
+++ b/pango/pango-glyph-item-private.h
@@ -27,9 +27,9 @@
G_BEGIN_DECLS
/**
- * PangoGlyphItem:
- * @item: corresponding `PangoItem`
- * @glyphs: corresponding `PangoGlyphString`
+ * Pango2GlyphItem:
+ * @item: corresponding `Pango2Item`
+ * @glyphs: corresponding `Pango2GlyphString`
* @y_offset: shift of the baseline, relative to the baseline
* of the containing line. Positive values shift upwards
* @start_x_offset: horizontal displacement to apply before the
@@ -37,52 +37,52 @@ G_BEGIN_DECLS
* @end_x_offset: horizontal displacement to apply after th
* glyph item. Positive values shift right
*
- * A `PangoGlyphItem` is a pair of a `PangoItem` and the glyphs
+ * A `Pango2GlyphItem` is a pair of a `Pango2Item` and the glyphs
* resulting from shaping the items text.
*
- * As an example of the usage of `PangoGlyphItem`, the results
- * of shaping text with `PangoLayout` is a list of `PangoLine`,
- * each of which contains a list of `PangoGlyphItem`.
+ * As an example of the usage of `Pango2GlyphItem`, the results
+ * of shaping text with `Pango2Layout` is a list of `Pango2Line`,
+ * each of which contains a list of `Pango2GlyphItem`.
*/
-typedef struct _PangoGlyphItem PangoGlyphItem;
+typedef struct _Pango2GlyphItem Pango2GlyphItem;
-struct _PangoGlyphItem
+struct _Pango2GlyphItem
{
- PangoItem *item;
- PangoGlyphString *glyphs;
+ Pango2Item *item;
+ Pango2GlyphString *glyphs;
int y_offset;
int start_x_offset;
int end_x_offset;
};
-#define PANGO_TYPE_GLYPH_ITEM (pango_glyph_item_get_type ())
+#define PANGO2_TYPE_GLYPH_ITEM (pango2_glyph_item_get_type ())
-PANGO_AVAILABLE_IN_ALL
-GType pango_glyph_item_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_glyph_item_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoGlyphItem * pango_glyph_item_split (PangoGlyphItem *orig,
- const char *text,
- int split_index);
-PANGO_AVAILABLE_IN_ALL
-PangoGlyphItem * pango_glyph_item_copy (PangoGlyphItem *orig);
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_item_free (PangoGlyphItem *glyph_item);
-PANGO_AVAILABLE_IN_ALL
-GSList * pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item,
- const char *text,
- PangoAttrList *list);
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_item_letter_space (PangoGlyphItem *glyph_item,
- const char *text,
- PangoLogAttr *log_attrs,
- int letter_spacing);
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_item_get_logical_widths (PangoGlyphItem *glyph_item,
- const char *text,
- int *logical_widths);
+PANGO2_AVAILABLE_IN_ALL
+Pango2GlyphItem * pango2_glyph_item_split (Pango2GlyphItem *orig,
+ const char *text,
+ int split_index);
+PANGO2_AVAILABLE_IN_ALL
+Pango2GlyphItem * pango2_glyph_item_copy (Pango2GlyphItem *orig);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_item_free (Pango2GlyphItem *glyph_item);
+PANGO2_AVAILABLE_IN_ALL
+GSList * pango2_glyph_item_apply_attrs (Pango2GlyphItem *glyph_item,
+ const char *text,
+ Pango2AttrList *list);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_item_letter_space (Pango2GlyphItem *glyph_item,
+ const char *text,
+ Pango2LogAttr *log_attrs,
+ int letter_spacing);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_item_get_logical_widths (Pango2GlyphItem *glyph_item,
+ const char *text,
+ int *logical_widths);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoGlyphItem, pango_glyph_item_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2GlyphItem, pango2_glyph_item_free)
G_END_DECLS
diff --git a/pango/pango-glyph-item.c b/pango/pango-glyph-item.c
index 553bc5f1..6ba75961 100644
--- a/pango/pango-glyph-item.c
+++ b/pango/pango-glyph-item.c
@@ -1,5 +1,5 @@
-/* Pango
- * pango-glyph-item.c: Pair of PangoItem and a glyph string
+/* Pango2
+ * pango-glyph-item.c: Pair of Pango2Item and a glyph string
*
* Copyright (C) 2002 Red Hat Software
*
@@ -32,8 +32,8 @@
#define LTR(glyph_item) (((glyph_item)->item->analysis.level % 2) == 0)
/**
- * pango_glyph_item_split:
- * @orig: a `PangoItem`
+ * pango2_glyph_item_split:
+ * @orig: a `Pango2Item`
* @text: text to which positions in @orig apply
* @split_index: byte index of position to split item, relative to the
* start of the item
@@ -48,14 +48,14 @@
* assigned to each item, you can't create a zero-length item).
*
* Return value: the newly allocated item representing text before
- * @split_index, which should be freed with [method@Pango.GlyphItem.free]
+ * @split_index, which should be freed with [method@Pango2.GlyphItem.free]
*/
-PangoGlyphItem *
-pango_glyph_item_split (PangoGlyphItem *orig,
- const char *text,
- int split_index)
+Pango2GlyphItem *
+pango2_glyph_item_split (Pango2GlyphItem *orig,
+ const char *text,
+ int split_index)
{
- PangoGlyphItem *new;
+ Pango2GlyphItem *new;
int i;
int num_glyphs;
int num_remaining;
@@ -97,34 +97,34 @@ pango_glyph_item_split (PangoGlyphItem *orig,
num_remaining = orig->glyphs->num_glyphs - num_glyphs;
- new = g_slice_new (PangoGlyphItem);
+ new = g_slice_new (Pango2GlyphItem);
split_offset = g_utf8_pointer_to_offset (text + orig->item->offset,
text + orig->item->offset + split_index);
- new->item = pango_item_split (orig->item, split_index, split_offset);
+ new->item = pango2_item_split (orig->item, split_index, split_offset);
- new->glyphs = pango_glyph_string_new ();
- pango_glyph_string_set_size (new->glyphs, num_glyphs);
+ new->glyphs = pango2_glyph_string_new ();
+ pango2_glyph_string_set_size (new->glyphs, num_glyphs);
if (LTR (orig))
{
- memcpy (new->glyphs->glyphs, orig->glyphs->glyphs, num_glyphs * sizeof (PangoGlyphInfo));
+ memcpy (new->glyphs->glyphs, orig->glyphs->glyphs, num_glyphs * sizeof (Pango2GlyphInfo));
memcpy (new->glyphs->log_clusters, orig->glyphs->log_clusters, num_glyphs * sizeof (int));
memmove (orig->glyphs->glyphs, orig->glyphs->glyphs + num_glyphs,
- num_remaining * sizeof (PangoGlyphInfo));
+ num_remaining * sizeof (Pango2GlyphInfo));
for (i = num_glyphs; i < orig->glyphs->num_glyphs; i++)
orig->glyphs->log_clusters[i - num_glyphs] = orig->glyphs->log_clusters[i] - split_index;
}
else
{
- memcpy (new->glyphs->glyphs, orig->glyphs->glyphs + num_remaining, num_glyphs * sizeof (PangoGlyphInfo));
+ memcpy (new->glyphs->glyphs, orig->glyphs->glyphs + num_remaining, num_glyphs * sizeof (Pango2GlyphInfo));
memcpy (new->glyphs->log_clusters, orig->glyphs->log_clusters + num_remaining, num_glyphs * sizeof (int));
for (i = 0; i < num_remaining; i++)
orig->glyphs->log_clusters[i] = orig->glyphs->log_clusters[i] - split_index;
}
- pango_glyph_string_set_size (orig->glyphs, orig->glyphs->num_glyphs - num_glyphs);
+ pango2_glyph_string_set_size (orig->glyphs, orig->glyphs->num_glyphs - num_glyphs);
new->y_offset = orig->y_offset;
new->start_x_offset = orig->start_x_offset;
@@ -134,25 +134,25 @@ pango_glyph_item_split (PangoGlyphItem *orig,
}
/**
- * pango_glyph_item_copy:
- * @orig: (nullable): a `PangoGlyphItem`
+ * pango2_glyph_item_copy:
+ * @orig: (nullable): a `Pango2GlyphItem`
*
- * Make a deep copy of an existing `PangoGlyphItem` structure.
+ * Make a deep copy of an existing `Pango2GlyphItem` structure.
*
- * Return value: (nullable): the newly allocated `PangoGlyphItem`
+ * Return value: (nullable): the newly allocated `Pango2GlyphItem`
*/
-PangoGlyphItem *
-pango_glyph_item_copy (PangoGlyphItem *orig)
+Pango2GlyphItem *
+pango2_glyph_item_copy (Pango2GlyphItem *orig)
{
- PangoGlyphItem *result;
+ Pango2GlyphItem *result;
if (orig == NULL)
return NULL;
- result = g_slice_new (PangoGlyphItem);
+ result = g_slice_new (Pango2GlyphItem);
- result->item = pango_item_copy (orig->item);
- result->glyphs = pango_glyph_string_copy (orig->glyphs);
+ result->item = pango2_item_copy (orig->item);
+ result->glyphs = pango2_glyph_string_copy (orig->glyphs);
result->y_offset = orig->y_offset;
result->start_x_offset = orig->start_x_offset;
result->end_x_offset = orig->end_x_offset;
@@ -161,47 +161,47 @@ pango_glyph_item_copy (PangoGlyphItem *orig)
}
/**
- * pango_glyph_item_free:
- * @glyph_item: (nullable): a `PangoGlyphItem`
+ * pango2_glyph_item_free:
+ * @glyph_item: (nullable): a `Pango2GlyphItem`
*
- * Frees a `PangoGlyphItem` and resources to which it points.
+ * Frees a `Pango2GlyphItem` and resources to which it points.
*/
void
-pango_glyph_item_free (PangoGlyphItem *glyph_item)
+pango2_glyph_item_free (Pango2GlyphItem *glyph_item)
{
if (glyph_item == NULL)
return;
if (glyph_item->item)
- pango_item_free (glyph_item->item);
+ pango2_item_free (glyph_item->item);
if (glyph_item->glyphs)
- pango_glyph_string_free (glyph_item->glyphs);
+ pango2_glyph_string_free (glyph_item->glyphs);
- g_slice_free (PangoGlyphItem, glyph_item);
+ g_slice_free (Pango2GlyphItem, glyph_item);
}
-G_DEFINE_BOXED_TYPE (PangoGlyphItem, pango_glyph_item,
- pango_glyph_item_copy,
- pango_glyph_item_free);
+G_DEFINE_BOXED_TYPE (Pango2GlyphItem, pango2_glyph_item,
+ pango2_glyph_item_copy,
+ pango2_glyph_item_free);
/**
- * pango_glyph_item_iter_copy:
- * @orig: (nullable): a `PangoGlyphItem`Iter
+ * pango2_glyph_item_iter_copy:
+ * @orig: (nullable): a `Pango2GlyphItem`Iter
*
- * Make a shallow copy of an existing `PangoGlyphItemIter` structure.
+ * Make a shallow copy of an existing `Pango2GlyphItemIter` structure.
*
- * Return value: (nullable): the newly allocated `PangoGlyphItemIter`
+ * Return value: (nullable): the newly allocated `Pango2GlyphItemIter`
*/
-PangoGlyphItemIter *
-pango_glyph_item_iter_copy (PangoGlyphItemIter *orig)
+Pango2GlyphItemIter *
+pango2_glyph_item_iter_copy (Pango2GlyphItemIter *orig)
{
- PangoGlyphItemIter *result;
+ Pango2GlyphItemIter *result;
if (orig == NULL)
return NULL;
- result = g_slice_new (PangoGlyphItemIter);
+ result = g_slice_new (Pango2GlyphItemIter);
*result = *orig;
@@ -209,42 +209,42 @@ pango_glyph_item_iter_copy (PangoGlyphItemIter *orig)
}
/**
- * pango_glyph_item_iter_free:
- * @iter: (nullable): a `PangoGlyphItemIter`
+ * pango2_glyph_item_iter_free:
+ * @iter: (nullable): a `Pango2GlyphItemIter`
*
- * Frees a `PangoGlyphItemIter`.
+ * Frees a `Pango2GlyphItemIter`.
*/
void
-pango_glyph_item_iter_free (PangoGlyphItemIter *iter)
+pango2_glyph_item_iter_free (Pango2GlyphItemIter *iter)
{
if (iter == NULL)
return;
- g_slice_free (PangoGlyphItemIter, iter);
+ g_slice_free (Pango2GlyphItemIter, iter);
}
-G_DEFINE_BOXED_TYPE (PangoGlyphItemIter, pango_glyph_item_iter,
- pango_glyph_item_iter_copy,
- pango_glyph_item_iter_free)
+G_DEFINE_BOXED_TYPE (Pango2GlyphItemIter, pango2_glyph_item_iter,
+ pango2_glyph_item_iter_copy,
+ pango2_glyph_item_iter_free)
/**
- * pango_glyph_item_iter_next_cluster:
- * @iter: a `PangoGlyphItemIter`
+ * pango2_glyph_item_iter_next_cluster:
+ * @iter: a `Pango2GlyphItemIter`
*
* Advances the iterator to the next cluster in the glyph item.
*
- * See `PangoGlyphItemIter` for details of cluster orders.
+ * See `Pango2GlyphItemIter` for details of cluster orders.
*
* Return value: %TRUE if the iterator was advanced,
* %FALSE if we were already on the last cluster.
*/
gboolean
-pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter)
+pango2_glyph_item_iter_next_cluster (Pango2GlyphItemIter *iter)
{
int glyph_index = iter->end_glyph;
- PangoGlyphString *glyphs = iter->glyph_item->glyphs;
+ Pango2GlyphString *glyphs = iter->glyph_item->glyphs;
int cluster;
- PangoItem *item = iter->glyph_item->item;
+ Pango2Item *item = iter->glyph_item->item;
if (LTR (iter->glyph_item))
{
@@ -278,8 +278,8 @@ pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter)
if (glyphs->log_clusters[glyph_index] > cluster)
{
iter->end_index = item->offset + glyphs->log_clusters[glyph_index];
- iter->end_char += pango_utf8_strlen (iter->text + iter->start_index,
- iter->end_index - iter->start_index);
+ iter->end_char += pango2_utf8_strlen (iter->text + iter->start_index,
+ iter->end_index - iter->start_index);
break;
}
}
@@ -301,8 +301,8 @@ pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter)
if (glyphs->log_clusters[glyph_index] > cluster)
{
iter->end_index = item->offset + glyphs->log_clusters[glyph_index];
- iter->end_char += pango_utf8_strlen (iter->text + iter->start_index,
- iter->end_index - iter->start_index);
+ iter->end_char += pango2_utf8_strlen (iter->text + iter->start_index,
+ iter->end_index - iter->start_index);
break;
}
}
@@ -317,22 +317,22 @@ pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter)
}
/**
- * pango_glyph_item_iter_prev_cluster:
- * @iter: a `PangoGlyphItemIter`
+ * pango2_glyph_item_iter_prev_cluster:
+ * @iter: a `Pango2GlyphItemIter`
*
* Moves the iterator to the preceding cluster in the glyph item.
- * See `PangoGlyphItemIter` for details of cluster orders.
+ * See `Pango2GlyphItemIter` for details of cluster orders.
*
* Return value: %TRUE if the iterator was moved,
* %FALSE if we were already on the first cluster.
*/
gboolean
-pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter)
+pango2_glyph_item_iter_prev_cluster (Pango2GlyphItemIter *iter)
{
int glyph_index = iter->start_glyph;
- PangoGlyphString *glyphs = iter->glyph_item->glyphs;
+ Pango2GlyphString *glyphs = iter->glyph_item->glyphs;
int cluster;
- PangoItem *item = iter->glyph_item->item;
+ Pango2Item *item = iter->glyph_item->item;
if (LTR (iter->glyph_item))
{
@@ -368,8 +368,8 @@ pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter)
{
glyph_index++;
iter->start_index = item->offset + glyphs->log_clusters[glyph_index];
- iter->start_char -= pango_utf8_strlen (iter->text + iter->start_index,
- iter->end_index - iter->start_index);
+ iter->start_char -= pango2_utf8_strlen (iter->text + iter->start_index,
+ iter->end_index - iter->start_index);
break;
}
}
@@ -392,8 +392,8 @@ pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter)
{
glyph_index--;
iter->start_index = item->offset + glyphs->log_clusters[glyph_index];
- iter->start_char -= pango_utf8_strlen (iter->text + iter->start_index,
- iter->end_index - iter->start_index);
+ iter->start_char -= pango2_utf8_strlen (iter->text + iter->start_index,
+ iter->end_index - iter->start_index);
break;
}
}
@@ -408,22 +408,22 @@ pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter)
}
/**
- * pango_glyph_item_iter_init_start:
- * @iter: a `PangoGlyphItemIter`
+ * pango2_glyph_item_iter_init_start:
+ * @iter: a `Pango2GlyphItemIter`
* @glyph_item: the glyph item to iterate over
* @text: text corresponding to the glyph item
*
- * Initializes a `PangoGlyphItemIter` structure to point to the
+ * Initializes a `Pango2GlyphItemIter` structure to point to the
* first cluster in a glyph item.
*
- * See `PangoGlyphItemIter` for details of cluster orders.
+ * See `Pango2GlyphItemIter` for details of cluster orders.
*
* Return value: %FALSE if there are no clusters in the glyph item
*/
gboolean
-pango_glyph_item_iter_init_start (PangoGlyphItemIter *iter,
- PangoGlyphItem *glyph_item,
- const char *text)
+pango2_glyph_item_iter_init_start (Pango2GlyphItemIter *iter,
+ Pango2GlyphItem *glyph_item,
+ const char *text)
{
iter->glyph_item = glyph_item;
iter->text = text;
@@ -441,26 +441,26 @@ pango_glyph_item_iter_init_start (PangoGlyphItemIter *iter,
iter->start_char = iter->end_char;
/* Advance onto the first cluster of the glyph item */
- return pango_glyph_item_iter_next_cluster (iter);
+ return pango2_glyph_item_iter_next_cluster (iter);
}
/**
- * pango_glyph_item_iter_init_end:
- * @iter: a `PangoGlyphItemIter`
+ * pango2_glyph_item_iter_init_end:
+ * @iter: a `Pango2GlyphItemIter`
* @glyph_item: the glyph item to iterate over
* @text: text corresponding to the glyph item
*
- * Initializes a `PangoGlyphItemIter` structure to point to the
+ * Initializes a `Pango2GlyphItemIter` structure to point to the
* last cluster in a glyph item.
*
- * See `PangoGlyphItemIter` for details of cluster orders.
+ * See `Pango2GlyphItemIter` for details of cluster orders.
*
* Return value: %FALSE if there are no clusters in the glyph item
*/
gboolean
-pango_glyph_item_iter_init_end (PangoGlyphItemIter *iter,
- PangoGlyphItem *glyph_item,
- const char *text)
+pango2_glyph_item_iter_init_end (Pango2GlyphItemIter *iter,
+ Pango2GlyphItem *glyph_item,
+ const char *text)
{
iter->glyph_item = glyph_item;
iter->text = text;
@@ -478,12 +478,12 @@ pango_glyph_item_iter_init_end (PangoGlyphItemIter *iter,
iter->end_char = iter->start_char;
/* Advance onto the first cluster of the glyph item */
- return pango_glyph_item_iter_prev_cluster (iter);
+ return pango2_glyph_item_iter_prev_cluster (iter);
}
typedef struct
{
- PangoGlyphItemIter iter;
+ Pango2GlyphItemIter iter;
GSList *segment_attrs;
} ApplyAttrsState;
@@ -491,14 +491,14 @@ typedef struct
/* Tack @attrs onto the attributes of glyph_item
*/
static void
-append_attrs (PangoGlyphItem *glyph_item,
- GSList *attrs)
+append_attrs (Pango2GlyphItem *glyph_item,
+ GSList *attrs)
{
glyph_item->item->analysis.extra_attrs =
g_slist_concat (glyph_item->item->analysis.extra_attrs, attrs);
}
-/* Make a deep copy of a GSList of PangoAttribute
+/* Make a deep copy of a GSList of Pango2Attribute
*/
static GSList *
attr_slist_copy (GSList *attrs)
@@ -509,20 +509,20 @@ attr_slist_copy (GSList *attrs)
new_attrs = g_slist_copy (attrs);
for (tmp_list = new_attrs; tmp_list; tmp_list = tmp_list->next)
- tmp_list->data = pango_attribute_copy (tmp_list->data);
+ tmp_list->data = pango2_attribute_copy (tmp_list->data);
return new_attrs;
}
/* Split the glyph item at the start of the current cluster
*/
-static PangoGlyphItem *
+static Pango2GlyphItem *
split_before_cluster_start (ApplyAttrsState *state)
{
- PangoGlyphItem *split_item;
+ Pango2GlyphItem *split_item;
int split_len = state->iter.start_index - state->iter.glyph_item->item->offset;
- split_item = pango_glyph_item_split (state->iter.glyph_item, state->iter.text, split_len);
+ split_item = pango2_glyph_item_split (state->iter.glyph_item, state->iter.text, split_len);
append_attrs (split_item, state->segment_attrs);
/* Adjust iteration to account for the split
@@ -540,17 +540,17 @@ split_before_cluster_start (ApplyAttrsState *state)
}
/**
- * pango_glyph_item_apply_attrs:
+ * pango2_glyph_item_apply_attrs:
* @glyph_item: a shaped item
* @text: text that @list applies to
- * @list: a `PangoAttrList`
+ * @list: a `Pango2AttrList`
*
- * Splits a shaped item (`PangoGlyphItem`) into multiple items based
+ * Splits a shaped item (`Pango2GlyphItem`) into multiple items based
* on an attribute list.
*
* The idea is that if you have attributes that don't affect shaping,
* such as color or underline, to avoid affecting shaping, you filter
- * them out ([method@Pango.AttrList.filter]), apply the shaping process
+ * them out ([method@Pango2.AttrList.filter]), apply the shaping process
* and then reapply them to the result using this function.
*
* All attributes that start or end inside a cluster are applied
@@ -563,17 +563,17 @@ split_before_cluster_start (ApplyAttrsState *state)
* This function takes ownership of @glyph_item; it will be reused
* as one of the elements in the list.
*
- * Return value: (transfer full) (element-type Pango.GlyphItem): a
+ * Return value: (transfer full) (element-type Pango2.GlyphItem): a
* list of glyph items resulting from splitting @glyph_item. Free
- * the elements using [method@Pango.GlyphItem.free], the list using
+ * the elements using [method@Pango2.GlyphItem.free], the list using
* [func@GLib.SList.free]
*/
GSList *
-pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item,
- const char *text,
- PangoAttrList *list)
+pango2_glyph_item_apply_attrs (Pango2GlyphItem *glyph_item,
+ const char *text,
+ Pango2AttrList *list)
{
- PangoAttrIterator iter;
+ Pango2AttrIterator iter;
GSList *result = NULL;
ApplyAttrsState state;
gboolean start_new_segment = FALSE;
@@ -596,18 +596,18 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item,
/* Advance the attr iterator to the start of the item
*/
- pango_attr_list_init_iterator (list, &iter);
+ pango2_attr_list_init_iterator (list, &iter);
do
{
- pango_attr_iterator_range (&iter, &range_start, &range_end);
+ pango2_attr_iterator_range (&iter, &range_start, &range_end);
if (range_end > glyph_item->item->offset)
break;
}
- while (pango_attr_iterator_next (&iter));
+ while (pango2_attr_iterator_next (&iter));
- state.segment_attrs = pango_attr_iterator_get_attrs (&iter);
+ state.segment_attrs = pango2_attr_iterator_get_attrs (&iter);
- is_ellipsis = (glyph_item->item->analysis.flags & PANGO_ANALYSIS_FLAG_IS_ELLIPSIS) != 0;
+ is_ellipsis = (glyph_item->item->analysis.flags & PANGO2_ANALYSIS_FLAG_IS_ELLIPSIS) != 0;
/* Short circuit the case when we don't actually need to
* split the item
@@ -617,9 +617,9 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item,
range_end >= glyph_item->item->offset + glyph_item->item->length))
goto out;
- for (have_cluster = pango_glyph_item_iter_init_start (&state.iter, glyph_item, text);
+ for (have_cluster = pango2_glyph_item_iter_init_start (&state.iter, glyph_item, text);
have_cluster;
- have_cluster = pango_glyph_item_iter_next_cluster (&state.iter))
+ have_cluster = pango2_glyph_item_iter_next_cluster (&state.iter))
{
gboolean have_next;
@@ -634,7 +634,7 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item,
{
result = g_slist_prepend (result,
split_before_cluster_start (&state));
- state.segment_attrs = pango_attr_iterator_get_attrs (&iter);
+ state.segment_attrs = pango2_attr_iterator_get_attrs (&iter);
}
start_new_segment = FALSE;
@@ -653,8 +653,8 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item,
*/
start_new_segment = TRUE;
- have_next = pango_attr_iterator_next (&iter);
- pango_attr_iterator_range (&iter, &range_start, &range_end);
+ have_next = pango2_attr_iterator_next (&iter);
+ pango2_attr_iterator_range (&iter, &range_start, &range_end);
if (range_start >= state.iter.end_index) /* New range doesn't intersect this cluster */
{
@@ -678,7 +678,7 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item,
}
state.segment_attrs = g_slist_concat (state.segment_attrs,
- pango_attr_iterator_get_attrs (&iter));
+ pango2_attr_iterator_get_attrs (&iter));
}
while (have_next);
}
@@ -692,14 +692,14 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item,
if (LTR (glyph_item))
result = g_slist_reverse (result);
- pango_attr_iterator_clear (&iter);
+ pango2_attr_iterator_clear (&iter);
return result;
}
/**
- * pango_glyph_item_letter_space:
- * @glyph_item: a `PangoGlyphItem`
+ * pango2_glyph_item_letter_space:
+ * @glyph_item: a `Pango2GlyphItem`
* @text: text that @glyph_item corresponds to
* (glyph_item->item->offset is an offset from the
* start of @text)
@@ -707,36 +707,36 @@ pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item,
* (the first logical attribute refers to the position
* before the first character in the item)
* @letter_spacing: amount of letter spacing to add
- * in Pango units. May be negative, though too large
+ * in Pango2 units. May be negative, though too large
* negative values will give ugly results.
*
* Adds spacing between the graphemes of @glyph_item to
* give the effect of typographic letter spacing.
*/
void
-pango_glyph_item_letter_space (PangoGlyphItem *glyph_item,
- const char *text,
- PangoLogAttr *log_attrs,
- int letter_spacing)
+pango2_glyph_item_letter_space (Pango2GlyphItem *glyph_item,
+ const char *text,
+ Pango2LogAttr *log_attrs,
+ int letter_spacing)
{
- PangoGlyphItemIter iter;
- PangoGlyphInfo *glyphs = glyph_item->glyphs->glyphs;
+ Pango2GlyphItemIter iter;
+ Pango2GlyphInfo *glyphs = glyph_item->glyphs->glyphs;
gboolean have_cluster;
int space_left, space_right;
space_left = letter_spacing / 2;
/* hinting */
- if ((letter_spacing & (PANGO_SCALE - 1)) == 0)
+ if ((letter_spacing & (PANGO2_SCALE - 1)) == 0)
{
- space_left = PANGO_UNITS_ROUND (space_left);
+ space_left = PANGO2_UNITS_ROUND (space_left);
}
space_right = letter_spacing - space_left;
- for (have_cluster = pango_glyph_item_iter_init_start (&iter, glyph_item, text);
+ for (have_cluster = pango2_glyph_item_iter_init_start (&iter, glyph_item, text);
have_cluster;
- have_cluster = pango_glyph_item_iter_next_cluster (&iter))
+ have_cluster = pango2_glyph_item_iter_next_cluster (&iter))
{
if (!log_attrs[iter.start_char].is_cursor_position)
{
@@ -778,8 +778,8 @@ pango_glyph_item_letter_space (PangoGlyphItem *glyph_item,
}
/**
- * pango_glyph_item_get_logical_widths:
- * @glyph_item: a `PangoGlyphItem`
+ * pango2_glyph_item_get_logical_widths:
+ * @glyph_item: a `Pango2GlyphItem`
* @text: text that @glyph_item corresponds to
* (glyph_item->item->offset is an offset from the
* start of @text)
@@ -787,27 +787,27 @@ pango_glyph_item_letter_space (PangoGlyphItem *glyph_item,
* characters in glyph_item (equal to glyph_item->item->num_chars)
* to be filled in with the resulting character widths.
*
- * Given a `PangoGlyphItem` and the corresponding text, determine the
+ * Given a `Pango2GlyphItem` and the corresponding text, determine the
* width corresponding to each character.
*
* When multiple characters compose a single cluster, the width of the
* entire cluster is divided equally among the characters.
*
- * See also [method@Pango.GlyphString.get_logical_widths].
+ * See also [method@Pango2.GlyphString.get_logical_widths].
*/
void
-pango_glyph_item_get_logical_widths (PangoGlyphItem *glyph_item,
- const char *text,
- int *logical_widths)
+pango2_glyph_item_get_logical_widths (Pango2GlyphItem *glyph_item,
+ const char *text,
+ int *logical_widths)
{
- PangoGlyphItemIter iter;
+ Pango2GlyphItemIter iter;
gboolean has_cluster;
int dir;
dir = glyph_item->item->analysis.level % 2 == 0 ? +1 : -1;
- for (has_cluster = pango_glyph_item_iter_init_start (&iter, glyph_item, text);
+ for (has_cluster = pango2_glyph_item_iter_init_start (&iter, glyph_item, text);
has_cluster;
- has_cluster = pango_glyph_item_iter_next_cluster (&iter))
+ has_cluster = pango2_glyph_item_iter_next_cluster (&iter))
{
int glyph_index, char_index, num_chars, cluster_width = 0, char_width;
diff --git a/pango/pango-glyph-iter-private.h b/pango/pango-glyph-iter-private.h
index c07d7306..35c038f0 100644
--- a/pango/pango-glyph-iter-private.h
+++ b/pango/pango-glyph-iter-private.h
@@ -24,10 +24,10 @@
G_BEGIN_DECLS
/**
- * PangoGlyphItemIter:
+ * Pango2GlyphItemIter:
*
- * A `PangoGlyphItemIter` is an iterator over the clusters in a
- * `PangoGlyphItem`.
+ * A `Pango2GlyphItemIter` is an iterator over the clusters in a
+ * `Pango2GlyphItem`.
*
* The *forward direction* of the iterator is the logical direction of text.
* That is, with increasing @start_index and @start_char values. If @glyph_item
@@ -36,22 +36,22 @@ G_BEGIN_DECLS
* in right-to-left cases, @start_glyph is greater than @end_glyph.
*
* An iterator should be initialized using either
- * [method@Pango.GlyphItemIter.init_start] or
- * [method@Pango.GlyphItemIter.init_end], for forward and backward iteration
+ * [method@Pango2.GlyphItemIter.init_start] or
+ * [method@Pango2.GlyphItemIter.init_end], for forward and backward iteration
* respectively, and walked over using any desired mixture of
- * [method@Pango.GlyphItemIter.next_cluster] and
- * [method@Pango.GlyphItemIter.prev_cluster].
+ * [method@Pango2.GlyphItemIter.next_cluster] and
+ * [method@Pango2.GlyphItemIter.prev_cluster].
*
* A common idiom for doing a forward iteration over the clusters is:
*
* ```
- * PangoGlyphItemIter cluster_iter;
+ * Pango2GlyphItemIter cluster_iter;
* gboolean have_cluster;
*
- * for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter,
- * glyph_item, text);
+ * for (have_cluster = pango2_glyph_item_iter_init_start (&cluster_iter,
+ * glyph_item, text);
* have_cluster;
- * have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter))
+ * have_cluster = pango2_glyph_item_iter_next_cluster (&cluster_iter))
* {
* ...
* }
@@ -65,13 +65,13 @@ G_BEGIN_DECLS
* the start variables is included in the cluster while the one pointed at by
* end variables is not.
*
- * None of the members of a `PangoGlyphItemIter` should be modified manually.
+ * None of the members of a `Pango2GlyphItemIter` should be modified manually.
*/
-typedef struct _PangoGlyphItemIter PangoGlyphItemIter;
+typedef struct _Pango2GlyphItemIter Pango2GlyphItemIter;
-struct _PangoGlyphItemIter
+struct _Pango2GlyphItemIter
{
- PangoGlyphItem *glyph_item;
+ Pango2GlyphItem *glyph_item;
const char *text;
int start_glyph;
@@ -83,28 +83,28 @@ struct _PangoGlyphItemIter
int end_char;
};
-#define PANGO_TYPE_GLYPH_ITEM_ITER (pango_glyph_item_iter_get_type ())
+#define PANGO2_TYPE_GLYPH_ITEM_ITER (pango2_glyph_item_iter_get_type ())
-PANGO_AVAILABLE_IN_ALL
-GType pango_glyph_item_iter_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoGlyphItemIter * pango_glyph_item_iter_copy (PangoGlyphItemIter *orig);
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_item_iter_free (PangoGlyphItemIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_glyph_item_iter_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+Pango2GlyphItemIter * pango2_glyph_item_iter_copy (Pango2GlyphItemIter *orig);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_item_iter_free (Pango2GlyphItemIter *iter);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_glyph_item_iter_init_start (PangoGlyphItemIter *iter,
- PangoGlyphItem *glyph_item,
- const char *text);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_glyph_item_iter_init_end (PangoGlyphItemIter *iter,
- PangoGlyphItem *glyph_item,
- const char *text);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_glyph_item_iter_init_start (Pango2GlyphItemIter *iter,
+ Pango2GlyphItem *glyph_item,
+ const char *text);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_glyph_item_iter_init_end (Pango2GlyphItemIter *iter,
+ Pango2GlyphItem *glyph_item,
+ const char *text);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_glyph_item_iter_next_cluster (Pango2GlyphItemIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_glyph_item_iter_prev_cluster (Pango2GlyphItemIter *iter);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoGlyphItemIter, pango_glyph_item_iter_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2GlyphItemIter, pango2_glyph_item_iter_free)
G_END_DECLS
diff --git a/pango/pango-glyph.h b/pango/pango-glyph.h
index 8dafd623..d2b0770b 100644
--- a/pango/pango-glyph.h
+++ b/pango/pango-glyph.h
@@ -25,38 +25,38 @@
G_BEGIN_DECLS
-typedef struct _PangoGlyphGeometry PangoGlyphGeometry;
-typedef struct _PangoGlyphVisAttr PangoGlyphVisAttr;
-typedef struct _PangoGlyphInfo PangoGlyphInfo;
-typedef struct _PangoGlyphString PangoGlyphString;
+typedef struct _Pango2GlyphGeometry Pango2GlyphGeometry;
+typedef struct _Pango2GlyphVisAttr Pango2GlyphVisAttr;
+typedef struct _Pango2GlyphInfo Pango2GlyphInfo;
+typedef struct _Pango2GlyphString Pango2GlyphString;
/* 1024ths of a device unit */
/**
- * PangoGlyphUnit:
+ * Pango2GlyphUnit:
*
- * The `PangoGlyphUnit` type is used to store dimensions within
- * Pango.
+ * The `Pango2GlyphUnit` type is used to store dimensions within
+ * Pango2.
*
- * Dimensions are stored in 1/PANGO_SCALE of a device unit.
+ * Dimensions are stored in 1/PANGO2_SCALE of a device unit.
* (A device unit might be a pixel for screen display, or
- * a point on a printer.) PANGO_SCALE is currently 1024, and
+ * a point on a printer.) PANGO2_SCALE is currently 1024, and
* may change in the future (unlikely though), but you should not
* depend on its exact value.
*
- * The PANGO_PIXELS() macro can be used to convert from glyph units
+ * The PANGO2_PIXELS() macro can be used to convert from glyph units
* into device units with correct rounding.
*/
-typedef gint32 PangoGlyphUnit;
+typedef gint32 Pango2GlyphUnit;
/* Positioning information about a glyph
*/
/**
- * PangoGlyphGeometry:
+ * Pango2GlyphGeometry:
* @width: the logical width to use for the the character.
* @x_offset: horizontal offset from nominal character position.
* @y_offset: vertical offset from nominal character position.
*
- * The `PangoGlyphGeometry` structure contains width and positioning
+ * The `Pango2GlyphGeometry` structure contains width and positioning
* information for a single glyph.
*
* Note that @width is not guaranteed to be the same as the glyph
@@ -72,21 +72,21 @@ typedef gint32 PangoGlyphUnit;
* 3. Advance the current point to (x + width, y)
* 4. Render the next glyph
*/
-struct _PangoGlyphGeometry
+struct _Pango2GlyphGeometry
{
- PangoGlyphUnit width;
- PangoGlyphUnit x_offset;
- PangoGlyphUnit y_offset;
+ Pango2GlyphUnit width;
+ Pango2GlyphUnit x_offset;
+ Pango2GlyphUnit y_offset;
};
/* Visual attributes of a glyph
*/
/**
- * PangoGlyphVisAttr:
+ * Pango2GlyphVisAttr:
* @is_cluster_start: set for the first logical glyph in each cluster.
* @is_color: set if the the font will render this glyph with color. Since 1.50
*
- * A `PangoGlyphVisAttr` structure communicates information between
+ * A `Pango2GlyphVisAttr` structure communicates information between
* the shaping and rendering phases.
*
* Currently, it contains cluster start and color information.
@@ -97,7 +97,7 @@ struct _PangoGlyphGeometry
* that is, in Arabic text, accent glyphs follow the glyphs for the
* base character.
*/
-struct _PangoGlyphVisAttr
+struct _Pango2GlyphVisAttr
{
guint is_cluster_start : 1;
guint is_color : 1;
@@ -106,192 +106,192 @@ struct _PangoGlyphVisAttr
/* A single glyph
*/
/**
- * PangoGlyphInfo:
+ * Pango2GlyphInfo:
* @glyph: the glyph itself.
* @geometry: the positional information about the glyph.
* @attr: the visual attributes of the glyph.
*
- * A `PangoGlyphInfo` structure represents a single glyph with
+ * A `Pango2GlyphInfo` structure represents a single glyph with
* positioning information and visual attributes.
*/
-struct _PangoGlyphInfo
+struct _Pango2GlyphInfo
{
- PangoGlyph glyph;
- PangoGlyphGeometry geometry;
- PangoGlyphVisAttr attr;
+ Pango2Glyph glyph;
+ Pango2GlyphGeometry geometry;
+ Pango2GlyphVisAttr attr;
};
/**
- * PangoGlyphString:
+ * Pango2GlyphString:
* @num_glyphs: number of glyphs in this glyph string
* @glyphs: (array length=num_glyphs): array of glyph information
* @log_clusters: logical cluster info, indexed by the byte index
* within the text corresponding to the glyph string
*
- * A `PangoGlyphString` is used to store strings of glyphs with geometry
+ * A `Pango2GlyphString` is used to store strings of glyphs with geometry
* and visual attribute information.
*
* The storage for the glyph information is owned by the structure
* which simplifies memory management.
*/
-struct _PangoGlyphString {
+struct _Pango2GlyphString {
int num_glyphs;
- PangoGlyphInfo *glyphs;
+ Pango2GlyphInfo *glyphs;
int *log_clusters;
/*< private >*/
int space;
};
-#define PANGO_TYPE_GLYPH_STRING (pango_glyph_string_get_type ())
-
-PANGO_AVAILABLE_IN_ALL
-GType pango_glyph_string_get_type (void) G_GNUC_CONST;
-
-PANGO_AVAILABLE_IN_ALL
-PangoGlyphString * pango_glyph_string_new (void);
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_string_set_size (PangoGlyphString *string,
- int new_len);
-
-PANGO_AVAILABLE_IN_ALL
-PangoGlyphString * pango_glyph_string_copy (PangoGlyphString *string);
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_string_free (PangoGlyphString *string);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_string_extents (PangoGlyphString *glyphs,
- PangoFont *font,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
-PANGO_AVAILABLE_IN_ALL
-int pango_glyph_string_get_width (PangoGlyphString *glyphs);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_string_extents_range (PangoGlyphString *glyphs,
- int start,
- int end,
- PangoFont *font,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs,
- const char *text,
- int length,
- int embedding_level,
- int *logical_widths);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_string_index_to_x (PangoGlyphString *glyphs,
- const char *text,
- int length,
- const PangoAnalysis *analysis,
- int index_,
- gboolean trailing,
- int *x_pos);
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_string_x_to_index (PangoGlyphString *glyphs,
- const char *text,
- int length,
- const PangoAnalysis *analysis,
- int x_pos,
- int *index_,
- int *trailing);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_glyph_string_index_to_x_full (PangoGlyphString *glyphs,
- const char *text,
- int length,
- const PangoAnalysis *analysis,
- PangoLogAttr *attrs,
- int index_,
- gboolean trailing,
- int *x_pos);
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoGlyphString, pango_glyph_string_free)
+#define PANGO2_TYPE_GLYPH_STRING (pango2_glyph_string_get_type ())
+
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_glyph_string_get_type (void) G_GNUC_CONST;
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2GlyphString * pango2_glyph_string_new (void);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_string_set_size (Pango2GlyphString *string,
+ int new_len);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2GlyphString * pango2_glyph_string_copy (Pango2GlyphString *string);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_string_free (Pango2GlyphString *string);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_string_extents (Pango2GlyphString *glyphs,
+ Pango2Font *font,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_glyph_string_get_width (Pango2GlyphString *glyphs);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_string_extents_range (Pango2GlyphString *glyphs,
+ int start,
+ int end,
+ Pango2Font *font,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_string_get_logical_widths (Pango2GlyphString *glyphs,
+ const char *text,
+ int length,
+ int embedding_level,
+ int *logical_widths);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_string_index_to_x (Pango2GlyphString *glyphs,
+ const char *text,
+ int length,
+ const Pango2Analysis *analysis,
+ int index_,
+ gboolean trailing,
+ int *x_pos);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_string_x_to_index (Pango2GlyphString *glyphs,
+ const char *text,
+ int length,
+ const Pango2Analysis *analysis,
+ int x_pos,
+ int *index_,
+ int *trailing);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_glyph_string_index_to_x_full (Pango2GlyphString *glyphs,
+ const char *text,
+ int length,
+ const Pango2Analysis *analysis,
+ Pango2LogAttr *attrs,
+ int index_,
+ gboolean trailing,
+ int *x_pos);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2GlyphString, pango2_glyph_string_free)
/* Shaping */
/**
- * PangoShapeFlags:
- * @PANGO_SHAPE_NONE: Default value
- * @PANGO_SHAPE_ROUND_POSITIONS: Round glyph positions and widths to whole device units
+ * Pango2ShapeFlags:
+ * @PANGO2_SHAPE_NONE: Default value
+ * @PANGO2_SHAPE_ROUND_POSITIONS: Round glyph positions and widths to whole device units
* This option should be set if the target renderer can't do subpixel positioning of glyphs
*
- * `PangoShapeFlags` influence the shaping process.
+ * `Pango2ShapeFlags` influence the shaping process.
*
- * These flags can be passed to [func@Pango.shape].
+ * These flags can be passed to [func@Pango2.shape].
*/
typedef enum {
- PANGO_SHAPE_NONE = 0,
- PANGO_SHAPE_ROUND_POSITIONS = 1 << 0,
-} PangoShapeFlags;
+ PANGO2_SHAPE_NONE = 0,
+ PANGO2_SHAPE_ROUND_POSITIONS = 1 << 0,
+} Pango2ShapeFlags;
-PANGO_AVAILABLE_IN_ALL
-void pango_shape (const char *item_text,
+PANGO2_AVAILABLE_IN_ALL
+void pango2_shape (const char *item_text,
int item_length,
const char *paragraph_text,
int paragraph_length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags);
+ const Pango2Analysis *analysis,
+ Pango2GlyphString *glyphs,
+ Pango2ShapeFlags flags);
-PANGO_AVAILABLE_IN_ALL
-void pango_shape_item (PangoItem *item,
+PANGO2_AVAILABLE_IN_ALL
+void pango2_shape_item (Pango2Item *item,
const char *paragraph_text,
int paragraph_length,
- PangoLogAttr *log_attrs,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags);
+ Pango2LogAttr *log_attrs,
+ Pango2GlyphString *glyphs,
+ Pango2ShapeFlags flags);
/**
- * PANGO_GLYPH_EMPTY:
+ * PANGO2_GLYPH_EMPTY:
*
- * A `PangoGlyph` value that indicates a zero-width empty glpyh.
+ * A `Pango2Glyph` value that indicates a zero-width empty glpyh.
*
* This is useful for example in shaper modules, to use as the glyph for
* various zero-width Unicode characters (those passing [func@is_zero_width]).
*/
-#define PANGO_GLYPH_EMPTY ((PangoGlyph)0x0FFFFFFF)
+#define PANGO2_GLYPH_EMPTY ((Pango2Glyph)0x0FFFFFFF)
/**
- * PANGO_GLYPH_INVALID_INPUT:
+ * PANGO2_GLYPH_INVALID_INPUT:
*
- * A `PangoGlyph` value for invalid input.
+ * A `Pango2Glyph` value for invalid input.
*
- * `PangoLayout` produces one such glyph per invalid input UTF-8 byte and such
+ * `Pango2Layout` produces one such glyph per invalid input UTF-8 byte and such
* a glyph is rendered as a crossed box.
*
- * Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG
+ * Note that this value is defined such that it has the %PANGO2_GLYPH_UNKNOWN_FLAG
* set.
*/
-#define PANGO_GLYPH_INVALID_INPUT ((PangoGlyph)0xFFFFFFFF)
+#define PANGO2_GLYPH_INVALID_INPUT ((Pango2Glyph)0xFFFFFFFF)
/**
- * PANGO_GLYPH_UNKNOWN_FLAG:
+ * PANGO2_GLYPH_UNKNOWN_FLAG:
*
- * Flag used in `PangoGlyph` to turn a `gunichar` value of a valid Unicode
+ * Flag used in `Pango2Glyph` to turn a `gunichar` value of a valid Unicode
* character into an unknown-character glyph for that `gunichar`.
*
* Such unknown-character glyphs may be rendered as a 'hex box'.
*/
-#define PANGO_GLYPH_UNKNOWN_FLAG ((PangoGlyph)0x10000000)
+#define PANGO2_GLYPH_UNKNOWN_FLAG ((Pango2Glyph)0x10000000)
/**
- * PANGO_GET_UNKNOWN_GLYPH:
+ * PANGO2_GET_UNKNOWN_GLYPH:
* @wc: a Unicode character
*
* The way this unknown glyphs are rendered is backend specific. For example,
* a box with the hexadecimal Unicode code-point of the character written in it
* is what is done in the most common backends.
*
- * Returns: a `PangoGlyph` value that means no glyph was found for @wc.
+ * Returns: a `Pango2Glyph` value that means no glyph was found for @wc.
*/
-#define PANGO_GET_UNKNOWN_GLYPH(wc) ((PangoGlyph)(wc)|PANGO_GLYPH_UNKNOWN_FLAG)
+#define PANGO2_GET_UNKNOWN_GLYPH(wc) ((Pango2Glyph)(wc)|PANGO2_GLYPH_UNKNOWN_FLAG)
G_END_DECLS
diff --git a/pango/pango-gravity.c b/pango/pango-gravity.c
index e987ae68..0e9b4299 100644
--- a/pango/pango-gravity.c
+++ b/pango/pango-gravity.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-gravity.c: Gravity routines
*
* Copyright (C) 2006, 2007 Red Hat Software
@@ -10,7 +10,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -26,64 +26,72 @@
#include <math.h>
/**
- * pango_gravity_to_rotation:
- * @gravity: gravity to query, should not be %PANGO_GRAVITY_AUTO
+ * pango2_gravity_to_rotation:
+ * @gravity: gravity to query, should not be %PANGO2_GRAVITY_AUTO
*
- * Converts a `PangoGravity` value to its natural rotation in radians.
+ * Converts a `Pango2Gravity` value to its natural rotation in radians.
*
- * Note that [method@Pango.Matrix.rotate] takes angle in degrees, not radians.
- * So, to call [method@Pango.Matrix,rotate] with the output of this function
+ * Note that [method@Pango2.Matrix.rotate] takes angle in degrees, not radians.
+ * So, to call [method@Pango2.Matrix,rotate] with the output of this function
* you should multiply it by (180. / G_PI).
*
* Return value: the rotation value corresponding to @gravity.
*/
double
-pango_gravity_to_rotation (PangoGravity gravity)
+pango2_gravity_to_rotation (Pango2Gravity gravity)
{
double rotation;
- g_return_val_if_fail (gravity != PANGO_GRAVITY_AUTO, 0);
+ g_return_val_if_fail (gravity != PANGO2_GRAVITY_AUTO, 0);
switch (gravity)
{
default:
- case PANGO_GRAVITY_AUTO: /* shut gcc up */
- case PANGO_GRAVITY_SOUTH: rotation = 0; break;
- case PANGO_GRAVITY_NORTH: rotation = G_PI; break;
- case PANGO_GRAVITY_EAST: rotation = -G_PI_2; break;
- case PANGO_GRAVITY_WEST: rotation = +G_PI_2; break;
+ case PANGO2_GRAVITY_AUTO: /* shut gcc up */
+ case PANGO2_GRAVITY_SOUTH:
+ rotation = 0;
+ break;
+ case PANGO2_GRAVITY_NORTH:
+ rotation = G_PI;
+ break;
+ case PANGO2_GRAVITY_EAST:
+ rotation = -G_PI_2;
+ break;
+ case PANGO2_GRAVITY_WEST:
+ rotation = +G_PI_2;
+ break;
}
return rotation;
}
/**
- * pango_gravity_get_for_matrix:
- * @matrix: (nullable): a `PangoMatrix`
+ * pango2_gravity_get_for_matrix:
+ * @matrix: (nullable): a `Pango2Matrix`
*
* Finds the gravity that best matches the rotation component
- * in a `PangoMatrix`.
+ * in a `Pango2Matrix`.
*
* Return value: the gravity of @matrix, which will never be
- * %PANGO_GRAVITY_AUTO, or %PANGO_GRAVITY_SOUTH if @matrix is %NULL
+ * %PANGO2_GRAVITY_AUTO, or %PANGO2_GRAVITY_SOUTH if @matrix is %NULL
*/
-PangoGravity
-pango_gravity_get_for_matrix (const PangoMatrix *matrix)
+Pango2Gravity
+pango2_gravity_get_for_matrix (const Pango2Matrix *matrix)
{
- PangoGravity gravity;
+ Pango2Gravity gravity;
double x;
double y;
if (!matrix)
- return PANGO_GRAVITY_SOUTH;
+ return PANGO2_GRAVITY_SOUTH;
x = matrix->xy;
y = matrix->yy;
if (fabs (x) > fabs (y))
- gravity = x > 0 ? PANGO_GRAVITY_WEST : PANGO_GRAVITY_EAST;
+ gravity = x > 0 ? PANGO2_GRAVITY_WEST : PANGO2_GRAVITY_EAST;
else
- gravity = y < 0 ? PANGO_GRAVITY_NORTH : PANGO_GRAVITY_SOUTH;
+ gravity = y < 0 ? PANGO2_GRAVITY_NORTH : PANGO2_GRAVITY_SOUTH;
return gravity;
}
@@ -92,226 +100,226 @@ pango_gravity_get_for_matrix (const PangoMatrix *matrix)
typedef enum
{
- PANGO_VERTICAL_DIRECTION_NONE,
- PANGO_VERTICAL_DIRECTION_TTB,
- PANGO_VERTICAL_DIRECTION_BTT
-} PangoVerticalDirection;
+ PANGO2_VERTICAL_DIRECTION_NONE,
+ PANGO2_VERTICAL_DIRECTION_TTB,
+ PANGO2_VERTICAL_DIRECTION_BTT
+} Pango2VerticalDirection;
typedef struct {
- /* PangoDirection */
- guint8 horiz_dir; /* Orientation in horizontal context */
+ /* Pango2Direction */
+ guint8 horiz_dir; /* Orientation in horizontal context */
- /* PangoVerticalDirection */
- guint8 vert_dir; /* Orientation in vertical context */
+ /* Pango2VerticalDirection */
+ guint8 vert_dir; /* Orientation in vertical context */
- /* PangoGravity */
- guint8 preferred_gravity; /* Preferred context gravity */
+ /* Pango2Gravity */
+ guint8 preferred_gravity; /* Preferred context gravity */
/* gboolean */
- guint8 wide; /* Whether script is mostly wide.
- * Wide characters are upright (ie.
- * not rotated) in foreign context */
-} PangoScriptProperties;
-
-#define NONE PANGO_VERTICAL_DIRECTION_NONE
-#define TTB PANGO_VERTICAL_DIRECTION_TTB
-#define BTT PANGO_VERTICAL_DIRECTION_BTT
-
-#define LTR PANGO_DIRECTION_LTR
-#define RTL PANGO_DIRECTION_RTL
-#define WEAK PANGO_DIRECTION_WEAK_LTR
-
-#define S PANGO_GRAVITY_SOUTH
-#define E PANGO_GRAVITY_EAST
-#define W PANGO_GRAVITY_WEST
-
-const PangoScriptProperties script_properties[] =
- { /* ISO 15924 code */
- {LTR, NONE, S, FALSE}, /* Zyyy */
- {LTR, NONE, S, FALSE}, /* Qaai */
- {RTL, NONE, S, FALSE}, /* Arab */
- {LTR, NONE, S, FALSE}, /* Armn */
- {LTR, NONE, S, FALSE}, /* Beng */
- {LTR, TTB, E, TRUE }, /* Bopo */
- {LTR, NONE, S, FALSE}, /* Cher */
- {LTR, NONE, S, FALSE}, /* Qaac */
- {LTR, NONE, S, FALSE}, /* Cyrl (Cyrs) */
- {LTR, NONE, S, FALSE}, /* Dsrt */
- {LTR, NONE, S, FALSE}, /* Deva */
- {LTR, NONE, S, FALSE}, /* Ethi */
- {LTR, NONE, S, FALSE}, /* Geor (Geon, Geoa) */
- {LTR, NONE, S, FALSE}, /* Goth */
- {LTR, NONE, S, FALSE}, /* Grek */
- {LTR, NONE, S, FALSE}, /* Gujr */
- {LTR, NONE, S, FALSE}, /* Guru */
- {LTR, TTB, E, TRUE }, /* Hani */
- {LTR, TTB, E, TRUE }, /* Hang */
- {RTL, NONE, S, FALSE}, /* Hebr */
- {LTR, TTB, E, TRUE }, /* Hira */
- {LTR, NONE, S, FALSE}, /* Knda */
- {LTR, TTB, E, TRUE }, /* Kana */
- {LTR, NONE, S, FALSE}, /* Khmr */
- {LTR, NONE, S, FALSE}, /* Laoo */
- {LTR, NONE, S, FALSE}, /* Latn (Latf, Latg) */
- {LTR, NONE, S, FALSE}, /* Mlym */
- {WEAK,TTB, W, FALSE}, /* Mong */
- {LTR, NONE, S, FALSE}, /* Mymr */
- {LTR, BTT, W, FALSE}, /* Ogam */
- {LTR, NONE, S, FALSE}, /* Ital */
- {LTR, NONE, S, FALSE}, /* Orya */
- {LTR, NONE, S, FALSE}, /* Runr */
- {LTR, NONE, S, FALSE}, /* Sinh */
- {RTL, NONE, S, FALSE}, /* Syrc (Syrj, Syrn, Syre) */
- {LTR, NONE, S, FALSE}, /* Taml */
- {LTR, NONE, S, FALSE}, /* Telu */
- {RTL, NONE, S, FALSE}, /* Thaa */
- {LTR, NONE, S, FALSE}, /* Thai */
- {LTR, NONE, S, FALSE}, /* Tibt */
- {LTR, NONE, S, FALSE}, /* Cans */
- {LTR, TTB, S, TRUE }, /* Yiii */
- {LTR, NONE, S, FALSE}, /* Tglg */
- {LTR, NONE, S, FALSE}, /* Hano */
- {LTR, NONE, S, FALSE}, /* Buhd */
- {LTR, NONE, S, FALSE}, /* Tagb */
+ guint8 wide; /* Whether script is mostly wide.
+ * Wide characters are upright (ie.
+ * not rotated) in foreign context */
+} Pango2ScriptProperties;
+
+#define NONE PANGO2_VERTICAL_DIRECTION_NONE
+#define TTB PANGO2_VERTICAL_DIRECTION_TTB
+#define BTT PANGO2_VERTICAL_DIRECTION_BTT
+
+#define LTR PANGO2_DIRECTION_LTR
+#define RTL PANGO2_DIRECTION_RTL
+#define WEAK PANGO2_DIRECTION_WEAK_LTR
+
+#define S PANGO2_GRAVITY_SOUTH
+#define E PANGO2_GRAVITY_EAST
+#define W PANGO2_GRAVITY_WEST
+
+const Pango2ScriptProperties script_properties[] =
+ { /* ISO 15924 code */
+ {LTR, NONE, S, FALSE}, /* Zyyy */
+ {LTR, NONE, S, FALSE}, /* Qaai */
+ {RTL, NONE, S, FALSE}, /* Arab */
+ {LTR, NONE, S, FALSE}, /* Armn */
+ {LTR, NONE, S, FALSE}, /* Beng */
+ {LTR, TTB, E, TRUE }, /* Bopo */
+ {LTR, NONE, S, FALSE}, /* Cher */
+ {LTR, NONE, S, FALSE}, /* Qaac */
+ {LTR, NONE, S, FALSE}, /* Cyrl (Cyrs) */
+ {LTR, NONE, S, FALSE}, /* Dsrt */
+ {LTR, NONE, S, FALSE}, /* Deva */
+ {LTR, NONE, S, FALSE}, /* Ethi */
+ {LTR, NONE, S, FALSE}, /* Geor (Geon, Geoa) */
+ {LTR, NONE, S, FALSE}, /* Goth */
+ {LTR, NONE, S, FALSE}, /* Grek */
+ {LTR, NONE, S, FALSE}, /* Gujr */
+ {LTR, NONE, S, FALSE}, /* Guru */
+ {LTR, TTB, E, TRUE }, /* Hani */
+ {LTR, TTB, E, TRUE }, /* Hang */
+ {RTL, NONE, S, FALSE}, /* Hebr */
+ {LTR, TTB, E, TRUE }, /* Hira */
+ {LTR, NONE, S, FALSE}, /* Knda */
+ {LTR, TTB, E, TRUE }, /* Kana */
+ {LTR, NONE, S, FALSE}, /* Khmr */
+ {LTR, NONE, S, FALSE}, /* Laoo */
+ {LTR, NONE, S, FALSE}, /* Latn (Latf, Latg) */
+ {LTR, NONE, S, FALSE}, /* Mlym */
+ {WEAK,TTB, W, FALSE}, /* Mong */
+ {LTR, NONE, S, FALSE}, /* Mymr */
+ {LTR, BTT, W, FALSE}, /* Ogam */
+ {LTR, NONE, S, FALSE}, /* Ital */
+ {LTR, NONE, S, FALSE}, /* Orya */
+ {LTR, NONE, S, FALSE}, /* Runr */
+ {LTR, NONE, S, FALSE}, /* Sinh */
+ {RTL, NONE, S, FALSE}, /* Syrc (Syrj, Syrn, Syre) */
+ {LTR, NONE, S, FALSE}, /* Taml */
+ {LTR, NONE, S, FALSE}, /* Telu */
+ {RTL, NONE, S, FALSE}, /* Thaa */
+ {LTR, NONE, S, FALSE}, /* Thai */
+ {LTR, NONE, S, FALSE}, /* Tibt */
+ {LTR, NONE, S, FALSE}, /* Cans */
+ {LTR, TTB, S, TRUE }, /* Yiii */
+ {LTR, NONE, S, FALSE}, /* Tglg */
+ {LTR, NONE, S, FALSE}, /* Hano */
+ {LTR, NONE, S, FALSE}, /* Buhd */
+ {LTR, NONE, S, FALSE}, /* Tagb */
/* Unicode-4.0 additions */
- {LTR, NONE, S, FALSE}, /* Brai */
- {RTL, NONE, S, FALSE}, /* Cprt */
- {LTR, NONE, S, FALSE}, /* Limb */
- {LTR, NONE, S, FALSE}, /* Osma */
- {LTR, NONE, S, FALSE}, /* Shaw */
- {LTR, NONE, S, FALSE}, /* Linb */
- {LTR, NONE, S, FALSE}, /* Tale */
- {LTR, NONE, S, FALSE}, /* Ugar */
+ {LTR, NONE, S, FALSE}, /* Brai */
+ {RTL, NONE, S, FALSE}, /* Cprt */
+ {LTR, NONE, S, FALSE}, /* Limb */
+ {LTR, NONE, S, FALSE}, /* Osma */
+ {LTR, NONE, S, FALSE}, /* Shaw */
+ {LTR, NONE, S, FALSE}, /* Linb */
+ {LTR, NONE, S, FALSE}, /* Tale */
+ {LTR, NONE, S, FALSE}, /* Ugar */
/* Unicode-4.1 additions */
- {LTR, NONE, S, FALSE}, /* Talu */
- {LTR, NONE, S, FALSE}, /* Bugi */
- {LTR, NONE, S, FALSE}, /* Glag */
- {LTR, NONE, S, FALSE}, /* Tfng */
- {LTR, NONE, S, FALSE}, /* Sylo */
- {LTR, NONE, S, FALSE}, /* Xpeo */
- {RTL, NONE, S, FALSE}, /* Khar */
+ {LTR, NONE, S, FALSE}, /* Talu */
+ {LTR, NONE, S, FALSE}, /* Bugi */
+ {LTR, NONE, S, FALSE}, /* Glag */
+ {LTR, NONE, S, FALSE}, /* Tfng */
+ {LTR, NONE, S, FALSE}, /* Sylo */
+ {LTR, NONE, S, FALSE}, /* Xpeo */
+ {RTL, NONE, S, FALSE}, /* Khar */
/* Unicode-5.0 additions */
- {LTR, NONE, S, FALSE}, /* Zzzz */
- {LTR, NONE, S, FALSE}, /* Bali */
- {LTR, NONE, S, FALSE}, /* Xsux */
- {RTL, NONE, S, FALSE}, /* Phnx */
- {LTR, NONE, S, FALSE}, /* Phag */
+ {LTR, NONE, S, FALSE}, /* Zzzz */
+ {LTR, NONE, S, FALSE}, /* Bali */
+ {LTR, NONE, S, FALSE}, /* Xsux */
+ {RTL, NONE, S, FALSE}, /* Phnx */
+ {LTR, NONE, S, FALSE}, /* Phag */
{RTL, NONE, S, FALSE}, /* Nkoo */
/* Unicode-5.1 additions */
- {LTR, NONE, S, FALSE}, /* Kali */
- {LTR, NONE, S, FALSE}, /* Lepc */
- {LTR, NONE, S, FALSE}, /* Rjng */
- {LTR, NONE, S, FALSE}, /* Sund */
- {LTR, NONE, S, FALSE}, /* Saur */
- {LTR, NONE, S, FALSE}, /* Cham */
- {LTR, NONE, S, FALSE}, /* Olck */
- {LTR, NONE, S, FALSE}, /* Vaii */
- {LTR, NONE, S, FALSE}, /* Cari */
- {LTR, NONE, S, FALSE}, /* Lyci */
- {RTL, NONE, S, FALSE}, /* Lydi */
+ {LTR, NONE, S, FALSE}, /* Kali */
+ {LTR, NONE, S, FALSE}, /* Lepc */
+ {LTR, NONE, S, FALSE}, /* Rjng */
+ {LTR, NONE, S, FALSE}, /* Sund */
+ {LTR, NONE, S, FALSE}, /* Saur */
+ {LTR, NONE, S, FALSE}, /* Cham */
+ {LTR, NONE, S, FALSE}, /* Olck */
+ {LTR, NONE, S, FALSE}, /* Vaii */
+ {LTR, NONE, S, FALSE}, /* Cari */
+ {LTR, NONE, S, FALSE}, /* Lyci */
+ {RTL, NONE, S, FALSE}, /* Lydi */
/* Unicode-5.2 additions */
- {RTL, NONE, S, FALSE}, /* Avst */
- {LTR, NONE, S, FALSE}, /* Bamu */
- {LTR, NONE, S, FALSE}, /* Egyp */
- {RTL, NONE, S, FALSE}, /* Armi */
- {RTL, NONE, S, FALSE}, /* Phli */
- {RTL, NONE, S, FALSE}, /* Prti */
- {LTR, NONE, S, FALSE}, /* Java */
- {LTR, NONE, S, FALSE}, /* Kthi */
- {LTR, NONE, S, FALSE}, /* Lisu */
- {LTR, NONE, S, FALSE}, /* Mtei */
- {RTL, NONE, S, FALSE}, /* Sarb */
- {RTL, NONE, S, FALSE}, /* Orkh */
- {RTL, TTB, S, FALSE}, /* Samr */
- {LTR, NONE, S, FALSE}, /* Lana */
- {LTR, NONE, S, FALSE}, /* Tavt */
+ {RTL, NONE, S, FALSE}, /* Avst */
+ {LTR, NONE, S, FALSE}, /* Bamu */
+ {LTR, NONE, S, FALSE}, /* Egyp */
+ {RTL, NONE, S, FALSE}, /* Armi */
+ {RTL, NONE, S, FALSE}, /* Phli */
+ {RTL, NONE, S, FALSE}, /* Prti */
+ {LTR, NONE, S, FALSE}, /* Java */
+ {LTR, NONE, S, FALSE}, /* Kthi */
+ {LTR, NONE, S, FALSE}, /* Lisu */
+ {LTR, NONE, S, FALSE}, /* Mtei */
+ {RTL, NONE, S, FALSE}, /* Sarb */
+ {RTL, NONE, S, FALSE}, /* Orkh */
+ {RTL, TTB, S, FALSE}, /* Samr */
+ {LTR, NONE, S, FALSE}, /* Lana */
+ {LTR, NONE, S, FALSE}, /* Tavt */
/* Unicode-6.0 additions */
- {LTR, NONE, S, FALSE}, /* Batk */
- {LTR, NONE, S, FALSE}, /* Brah */
- {RTL, NONE, S, FALSE}, /* Mand */
+ {LTR, NONE, S, FALSE}, /* Batk */
+ {LTR, NONE, S, FALSE}, /* Brah */
+ {RTL, NONE, S, FALSE}, /* Mand */
/* Unicode-6.1 additions */
- {LTR, NONE, S, FALSE}, /* Cakm */
- {RTL, NONE, S, FALSE}, /* Merc */
- {RTL, NONE, S, FALSE}, /* Mero */
- {LTR, NONE, S, FALSE}, /* Plrd */
- {LTR, NONE, S, FALSE}, /* Shrd */
- {LTR, NONE, S, FALSE}, /* Sora */
- {LTR, NONE, S, FALSE}, /* Takr */
+ {LTR, NONE, S, FALSE}, /* Cakm */
+ {RTL, NONE, S, FALSE}, /* Merc */
+ {RTL, NONE, S, FALSE}, /* Mero */
+ {LTR, NONE, S, FALSE}, /* Plrd */
+ {LTR, NONE, S, FALSE}, /* Shrd */
+ {LTR, NONE, S, FALSE}, /* Sora */
+ {LTR, NONE, S, FALSE}, /* Takr */
/* Unicode-7.0 additions */
- {LTR, NONE, S, FALSE}, /* Bass */
- {LTR, NONE, S, FALSE}, /* Aghb */
- {LTR, NONE, S, FALSE}, /* Dupl */
- {LTR, NONE, S, FALSE}, /* Elba */
- {LTR, NONE, S, FALSE}, /* Gran */
- {LTR, NONE, S, FALSE}, /* Khoj */
- {LTR, NONE, S, FALSE}, /* Sind */
- {LTR, NONE, S, FALSE}, /* Lina */
- {LTR, NONE, S, FALSE}, /* Mahj */
- {RTL, NONE, S, FALSE}, /* Mani */
- {RTL, NONE, S, FALSE}, /* Mend */
- {LTR, NONE, S, FALSE}, /* Modi */
- {LTR, NONE, S, FALSE}, /* Mroo */
- {RTL, NONE, S, FALSE}, /* Nbat */
- {RTL, NONE, S, FALSE}, /* Narb */
- {LTR, NONE, S, FALSE}, /* Perm */
- {LTR, NONE, S, FALSE}, /* Hmng */
- {RTL, NONE, S, FALSE}, /* Palm */
- {LTR, NONE, S, FALSE}, /* Pauc */
- {RTL, NONE, S, FALSE}, /* Phlp */
- {LTR, NONE, S, FALSE}, /* Sidd */
- {LTR, NONE, S, FALSE}, /* Tirh */
- {LTR, NONE, S, FALSE}, /* Wara */
+ {LTR, NONE, S, FALSE}, /* Bass */
+ {LTR, NONE, S, FALSE}, /* Aghb */
+ {LTR, NONE, S, FALSE}, /* Dupl */
+ {LTR, NONE, S, FALSE}, /* Elba */
+ {LTR, NONE, S, FALSE}, /* Gran */
+ {LTR, NONE, S, FALSE}, /* Khoj */
+ {LTR, NONE, S, FALSE}, /* Sind */
+ {LTR, NONE, S, FALSE}, /* Lina */
+ {LTR, NONE, S, FALSE}, /* Mahj */
+ {RTL, NONE, S, FALSE}, /* Mani */
+ {RTL, NONE, S, FALSE}, /* Mend */
+ {LTR, NONE, S, FALSE}, /* Modi */
+ {LTR, NONE, S, FALSE}, /* Mroo */
+ {RTL, NONE, S, FALSE}, /* Nbat */
+ {RTL, NONE, S, FALSE}, /* Narb */
+ {LTR, NONE, S, FALSE}, /* Perm */
+ {LTR, NONE, S, FALSE}, /* Hmng */
+ {RTL, NONE, S, FALSE}, /* Palm */
+ {LTR, NONE, S, FALSE}, /* Pauc */
+ {RTL, NONE, S, FALSE}, /* Phlp */
+ {LTR, NONE, S, FALSE}, /* Sidd */
+ {LTR, NONE, S, FALSE}, /* Tirh */
+ {LTR, NONE, S, FALSE}, /* Wara */
/* Unicode-8.0 additions */
- {LTR, NONE, S, FALSE}, /* Ahom */
- {LTR, NONE, S, FALSE}, /* Hluw */
- {RTL, NONE, S, FALSE}, /* Hatr */
+ {LTR, NONE, S, FALSE}, /* Ahom */
+ {LTR, NONE, S, FALSE}, /* Hluw */
+ {RTL, NONE, S, FALSE}, /* Hatr */
{LTR, NONE, S, FALSE}, /* Mult */
- {LTR, NONE, S, FALSE}, /* Hung */
- {LTR, NONE, S, FALSE}, /* Sgnw */
+ {LTR, NONE, S, FALSE}, /* Hung */
+ {LTR, NONE, S, FALSE}, /* Sgnw */
/* Unicode-9.0 additions */
- {RTL, NONE, S, FALSE}, /* Adlm */
- {LTR, NONE, S, FALSE}, /* Bhks */
- {LTR, NONE, S, FALSE}, /* Marc */
- {LTR, NONE, S, FALSE}, /* Newa */
- {LTR, NONE, S, FALSE}, /* Osge */
- {LTR, NONE, S, FALSE}, /* Tang */
+ {RTL, NONE, S, FALSE}, /* Adlm */
+ {LTR, NONE, S, FALSE}, /* Bhks */
+ {LTR, NONE, S, FALSE}, /* Marc */
+ {LTR, NONE, S, FALSE}, /* Newa */
+ {LTR, NONE, S, FALSE}, /* Osge */
+ {LTR, NONE, S, FALSE}, /* Tang */
/* Unicode-10.0 additions */
- {LTR, NONE, S, FALSE}, /* Gonm */
- {LTR, NONE, S, FALSE}, /* Nshu */
- {LTR, NONE, S, FALSE}, /* Soyo */
- {LTR, NONE, S, FALSE}, /* Zanb */
+ {LTR, NONE, S, FALSE}, /* Gonm */
+ {LTR, NONE, S, FALSE}, /* Nshu */
+ {LTR, NONE, S, FALSE}, /* Soyo */
+ {LTR, NONE, S, FALSE}, /* Zanb */
/* Unicode-11.0 additions */
- {LTR, NONE, S, FALSE}, /* Dogr */
- {LTR, NONE, S, FALSE}, /* Gong */
- {RTL, NONE, S, FALSE}, /* Rohg */
- {LTR, NONE, S, FALSE}, /* Maka */
- {LTR, NONE, S, FALSE}, /* Medf */
- {RTL, NONE, S, FALSE}, /* Sogo */
- {RTL, NONE, S, FALSE}, /* Sogd */
+ {LTR, NONE, S, FALSE}, /* Dogr */
+ {LTR, NONE, S, FALSE}, /* Gong */
+ {RTL, NONE, S, FALSE}, /* Rohg */
+ {LTR, NONE, S, FALSE}, /* Maka */
+ {LTR, NONE, S, FALSE}, /* Medf */
+ {RTL, NONE, S, FALSE}, /* Sogo */
+ {RTL, NONE, S, FALSE}, /* Sogd */
/* Unicode-12.0 additions */
- {RTL, NONE, S, FALSE}, /* Elym */
- {LTR, NONE, S, FALSE}, /* Nand */
- {LTR, NONE, S, FALSE}, /* Rohg */
- {LTR, NONE, S, FALSE}, /* Wcho */
+ {RTL, NONE, S, FALSE}, /* Elym */
+ {LTR, NONE, S, FALSE}, /* Nand */
+ {LTR, NONE, S, FALSE}, /* Rohg */
+ {LTR, NONE, S, FALSE}, /* Wcho */
/* Unicode-13.0 additions */
- {RTL, NONE, S, FALSE}, /* Chrs */
- {LTR, NONE, S, FALSE}, /* Diak */
- {LTR, NONE, S, FALSE}, /* Kits */
- {RTL, NONE, S, FALSE}, /* Yezi */
+ {RTL, NONE, S, FALSE}, /* Chrs */
+ {LTR, NONE, S, FALSE}, /* Diak */
+ {LTR, NONE, S, FALSE}, /* Kits */
+ {RTL, NONE, S, FALSE}, /* Yezi */
{LTR, NONE, S, FALSE}, /* Cpmn */
{RTL, NONE, S, FALSE}, /* Ougr */
@@ -333,7 +341,7 @@ const PangoScriptProperties script_properties[] =
#undef N
#undef W
-static PangoScriptProperties
+static Pango2ScriptProperties
get_script_properties (GUnicodeScript script)
{
g_return_val_if_fail (script >= 0, script_properties[0]);
@@ -345,72 +353,72 @@ get_script_properties (GUnicodeScript script)
}
/**
- * pango_gravity_get_for_script:
- * @script: `PangoScript` to query
+ * pango2_gravity_get_for_script:
+ * @script: `Pango2Script` to query
* @base_gravity: base gravity of the paragraph
* @hint: orientation hint
*
- * Returns the gravity to use in laying out a `PangoItem`.
+ * Returns the gravity to use in laying out a `Pango2Item`.
*
* The gravity is determined based on the script, base gravity, and hint.
*
- * If @base_gravity is %PANGO_GRAVITY_AUTO, it is first replaced with the
+ * If @base_gravity is %PANGO2_GRAVITY_AUTO, it is first replaced with the
* preferred gravity of @script. To get the preferred gravity of a script,
- * pass %PANGO_GRAVITY_AUTO and %PANGO_GRAVITY_HINT_STRONG in.
+ * pass %PANGO2_GRAVITY_AUTO and %PANGO2_GRAVITY_HINT_STRONG in.
*
* Return value: resolved gravity suitable to use for a run of text
* with @script
*/
-PangoGravity
-pango_gravity_get_for_script (GUnicodeScript script,
- PangoGravity base_gravity,
- PangoGravityHint hint)
+Pango2Gravity
+pango2_gravity_get_for_script (GUnicodeScript script,
+ Pango2Gravity base_gravity,
+ Pango2GravityHint hint)
{
- PangoScriptProperties props = get_script_properties (script);
+ Pango2ScriptProperties props = get_script_properties (script);
- return pango_gravity_get_for_script_and_width (script, props.wide,
+ return pango2_gravity_get_for_script_and_width (script, props.wide,
base_gravity, hint);
}
/**
- * pango_gravity_get_for_script_and_width:
- * @script: `PangoScript` to query
+ * pango2_gravity_get_for_script_and_width:
+ * @script: `Pango2Script` to query
* @wide: %TRUE for wide characters as returned by g_unichar_iswide()
* @base_gravity: base gravity of the paragraph
* @hint: orientation hint
*
* Returns the gravity to use in laying out a single character
- * or `PangoItem`.
+ * or `Pango2Item`.
*
* The gravity is determined based on the script, East Asian width,
* base gravity, and hint,
*
- * This function is similar to [func@Pango.Gravity.get_for_script] except
+ * This function is similar to [func@Pango2.Gravity.get_for_script] except
* that this function makes a distinction between narrow/half-width and
* wide/full-width characters also. Wide/full-width characters always
* stand *upright*, that is, they always take the base gravity,
* whereas narrow/full-width characters are always rotated in vertical
* context.
*
- * If @base_gravity is %PANGO_GRAVITY_AUTO, it is first replaced with the
+ * If @base_gravity is %PANGO2_GRAVITY_AUTO, it is first replaced with the
* preferred gravity of @script.
*
* Return value: resolved gravity suitable to use for a run of text
* with @script and @wide.
*/
-PangoGravity
-pango_gravity_get_for_script_and_width (GUnicodeScript script,
- gboolean wide,
- PangoGravity base_gravity,
- PangoGravityHint hint)
+Pango2Gravity
+pango2_gravity_get_for_script_and_width (GUnicodeScript script,
+ gboolean wide,
+ Pango2Gravity base_gravity,
+ Pango2GravityHint hint)
{
- PangoScriptProperties props = get_script_properties (script);
+ Pango2ScriptProperties props = get_script_properties (script);
gboolean vertical;
- if (G_UNLIKELY (base_gravity == PANGO_GRAVITY_AUTO))
+ if (G_UNLIKELY (base_gravity == PANGO2_GRAVITY_AUTO))
base_gravity = props.preferred_gravity;
- vertical = PANGO_GRAVITY_IS_VERTICAL (base_gravity);
+ vertical = PANGO2_GRAVITY_IS_VERTICAL (base_gravity);
/* Everything is designed such that a system with no vertical support
* renders everything correctly horizontally. So, if not in a vertical
@@ -427,23 +435,23 @@ pango_gravity_get_for_script_and_width (GUnicodeScript script,
switch (hint)
{
default:
- case PANGO_GRAVITY_HINT_NATURAL:
- if (props.vert_dir == PANGO_VERTICAL_DIRECTION_NONE)
- return PANGO_GRAVITY_SOUTH;
- if ((base_gravity == PANGO_GRAVITY_EAST) ^
- (props.vert_dir == PANGO_VERTICAL_DIRECTION_BTT))
- return PANGO_GRAVITY_SOUTH;
+ case PANGO2_GRAVITY_HINT_NATURAL:
+ if (props.vert_dir == PANGO2_VERTICAL_DIRECTION_NONE)
+ return PANGO2_GRAVITY_SOUTH;
+ if ((base_gravity == PANGO2_GRAVITY_EAST) ^
+ (props.vert_dir == PANGO2_VERTICAL_DIRECTION_BTT))
+ return PANGO2_GRAVITY_SOUTH;
else
- return PANGO_GRAVITY_NORTH;
+ return PANGO2_GRAVITY_NORTH;
- case PANGO_GRAVITY_HINT_STRONG:
+ case PANGO2_GRAVITY_HINT_STRONG:
return base_gravity;
- case PANGO_GRAVITY_HINT_LINE:
- if ((base_gravity == PANGO_GRAVITY_EAST) ^
- (props.horiz_dir == PANGO_DIRECTION_RTL))
- return PANGO_GRAVITY_SOUTH;
+ case PANGO2_GRAVITY_HINT_LINE:
+ if ((base_gravity == PANGO2_GRAVITY_EAST) ^
+ (props.horiz_dir == PANGO2_DIRECTION_RTL))
+ return PANGO2_GRAVITY_SOUTH;
else
- return PANGO_GRAVITY_NORTH;
+ return PANGO2_GRAVITY_NORTH;
}
}
diff --git a/pango/pango-gravity.h b/pango/pango-gravity.h
index 53007442..c12fe1da 100644
--- a/pango/pango-gravity.h
+++ b/pango/pango-gravity.h
@@ -24,101 +24,101 @@
G_BEGIN_DECLS
/**
- * PangoGravity:
- * @PANGO_GRAVITY_SOUTH: Glyphs stand upright (default) <img align="right" valign="center" src="m-south.png">
- * @PANGO_GRAVITY_EAST: Glyphs are rotated 90 degrees counter-clockwise. <img align="right" valign="center" src="m-east.png">
- * @PANGO_GRAVITY_NORTH: Glyphs are upside-down. <img align="right" valign="cener" src="m-north.png">
- * @PANGO_GRAVITY_WEST: Glyphs are rotated 90 degrees clockwise. <img align="right" valign="center" src="m-west.png">
- * @PANGO_GRAVITY_AUTO: Gravity is resolved from the context matrix
+ * Pango2Gravity:
+ * @PANGO2_GRAVITY_SOUTH: Glyphs stand upright (default) <img align="right" valign="center" src="m-south.png">
+ * @PANGO2_GRAVITY_EAST: Glyphs are rotated 90 degrees counter-clockwise. <img align="right" valign="center" src="m-east.png">
+ * @PANGO2_GRAVITY_NORTH: Glyphs are upside-down. <img align="right" valign="cener" src="m-north.png">
+ * @PANGO2_GRAVITY_WEST: Glyphs are rotated 90 degrees clockwise. <img align="right" valign="center" src="m-west.png">
+ * @PANGO2_GRAVITY_AUTO: Gravity is resolved from the context matrix
*
- * `PangoGravity` represents the orientation of glyphs in a segment
+ * `Pango2Gravity` represents the orientation of glyphs in a segment
* of text.
*
* This is useful when rendering vertical text layouts. In those situations,
- * the layout is rotated using a non-identity [struct@Pango.Matrix], and then
- * glyph orientation is controlled using `PangoGravity`.
+ * the layout is rotated using a non-identity [struct@Pango2.Matrix], and then
+ * glyph orientation is controlled using `Pango2Gravity`.
*
* Not every value in this enumeration makes sense for every usage of
- * `PangoGravity`; for example, %PANGO_GRAVITY_AUTO only can be passed to
- * [method@Pango.Context.set_base_gravity] and can only be returned by
- * [method@Pango.Context.get_base_gravity].
+ * `Pango2Gravity`; for example, %PANGO2_GRAVITY_AUTO only can be passed to
+ * [method@Pango2.Context.set_base_gravity] and can only be returned by
+ * [method@Pango2.Context.get_base_gravity].
*
- * See also: [enum@Pango.GravityHint]
+ * See also: [enum@Pango2.GravityHint]
*/
typedef enum {
- PANGO_GRAVITY_SOUTH,
- PANGO_GRAVITY_EAST,
- PANGO_GRAVITY_NORTH,
- PANGO_GRAVITY_WEST,
- PANGO_GRAVITY_AUTO
-} PangoGravity;
+ PANGO2_GRAVITY_SOUTH,
+ PANGO2_GRAVITY_EAST,
+ PANGO2_GRAVITY_NORTH,
+ PANGO2_GRAVITY_WEST,
+ PANGO2_GRAVITY_AUTO
+} Pango2Gravity;
/**
- * PangoGravityHint:
- * @PANGO_GRAVITY_HINT_NATURAL: scripts will take their natural gravity based
+ * Pango2GravityHint:
+ * @PANGO2_GRAVITY_HINT_NATURAL: scripts will take their natural gravity based
* on the base gravity and the script. This is the default.
- * @PANGO_GRAVITY_HINT_STRONG: always use the base gravity set, regardless of
+ * @PANGO2_GRAVITY_HINT_STRONG: always use the base gravity set, regardless of
* the script.
- * @PANGO_GRAVITY_HINT_LINE: for scripts not in their natural direction (eg.
+ * @PANGO2_GRAVITY_HINT_LINE: for scripts not in their natural direction (eg.
* Latin in East gravity), choose per-script gravity such that every script
* respects the line progression. This means, Latin and Arabic will take
* opposite gravities and both flow top-to-bottom for example.
*
- * `PangoGravityHint` defines how horizontal scripts should behave in a
+ * `Pango2GravityHint` defines how horizontal scripts should behave in a
* vertical context.
*
* That is, English excerpts in a vertical paragraph for example.
*
- * See also [enum@Pango.Gravity]
+ * See also [enum@Pango2.Gravity]
*/
typedef enum {
- PANGO_GRAVITY_HINT_NATURAL,
- PANGO_GRAVITY_HINT_STRONG,
- PANGO_GRAVITY_HINT_LINE
-} PangoGravityHint;
+ PANGO2_GRAVITY_HINT_NATURAL,
+ PANGO2_GRAVITY_HINT_STRONG,
+ PANGO2_GRAVITY_HINT_LINE
+} Pango2GravityHint;
/**
- * PANGO_GRAVITY_IS_VERTICAL:
- * @gravity: the `PangoGravity` to check
+ * PANGO2_GRAVITY_IS_VERTICAL:
+ * @gravity: the `Pango2Gravity` to check
*
- * Whether a `PangoGravity` represents vertical writing directions.
+ * Whether a `Pango2Gravity` represents vertical writing directions.
*
- * Returns: %TRUE if @gravity is %PANGO_GRAVITY_EAST or %PANGO_GRAVITY_WEST,
+ * Returns: %TRUE if @gravity is %PANGO2_GRAVITY_EAST or %PANGO2_GRAVITY_WEST,
* %FALSE otherwise.
*/
-#define PANGO_GRAVITY_IS_VERTICAL(gravity) \
- ((gravity) == PANGO_GRAVITY_EAST || (gravity) == PANGO_GRAVITY_WEST)
+#define PANGO2_GRAVITY_IS_VERTICAL(gravity) \
+ ((gravity) == PANGO2_GRAVITY_EAST || (gravity) == PANGO2_GRAVITY_WEST)
/**
- * PANGO_GRAVITY_IS_IMPROPER:
- * @gravity: the `PangoGravity` to check
+ * PANGO2_GRAVITY_IS_IMPROPER:
+ * @gravity: the `Pango2Gravity` to check
*
- * Whether a `PangoGravity` represents a gravity that results in reversal
+ * Whether a `Pango2Gravity` represents a gravity that results in reversal
* of text direction.
*
- * Returns: %TRUE if @gravity is %PANGO_GRAVITY_WEST or %PANGO_GRAVITY_NORTH,
+ * Returns: %TRUE if @gravity is %PANGO2_GRAVITY_WEST or %PANGO2_GRAVITY_NORTH,
* %FALSE otherwise.
*/
-#define PANGO_GRAVITY_IS_IMPROPER(gravity) \
- ((gravity) == PANGO_GRAVITY_WEST || (gravity) == PANGO_GRAVITY_NORTH)
+#define PANGO2_GRAVITY_IS_IMPROPER(gravity) \
+ ((gravity) == PANGO2_GRAVITY_WEST || (gravity) == PANGO2_GRAVITY_NORTH)
#include <pango/pango-matrix.h>
#include <pango/pango-script.h>
-PANGO_AVAILABLE_IN_ALL
-double pango_gravity_to_rotation (PangoGravity gravity) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoGravity pango_gravity_get_for_matrix (const PangoMatrix *matrix) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-PangoGravity pango_gravity_get_for_script (GUnicodeScript script,
- PangoGravity base_gravity,
- PangoGravityHint hint) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoGravity pango_gravity_get_for_script_and_width
- (GUnicodeScript script,
- gboolean wide,
- PangoGravity base_gravity,
- PangoGravityHint hint) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+double pango2_gravity_to_rotation (Pango2Gravity gravity) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+Pango2Gravity pango2_gravity_get_for_matrix (const Pango2Matrix *matrix) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+Pango2Gravity pango2_gravity_get_for_script (GUnicodeScript script,
+ Pango2Gravity base_gravity,
+ Pango2GravityHint hint) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+Pango2Gravity pango2_gravity_get_for_script_and_width
+ (GUnicodeScript script,
+ gboolean wide,
+ Pango2Gravity base_gravity,
+ Pango2GravityHint hint) G_GNUC_CONST;
G_END_DECLS
diff --git a/pango/pango-hbface-private.h b/pango/pango-hbface-private.h
index 403ff66d..e2920388 100644
--- a/pango/pango-hbface-private.h
+++ b/pango/pango-hbface-private.h
@@ -25,9 +25,9 @@
#include "pango-language-set-private.h"
#include <hb.h>
-struct _PangoHbFace
+struct _Pango2HbFace
{
- PangoFontFace parent_instance;
+ Pango2FontFace parent_instance;
char *faceid;
unsigned int index;
@@ -36,17 +36,17 @@ struct _PangoHbFace
hb_face_t *face;
hb_variation_t *variations;
unsigned int n_variations;
- PangoMatrix *transform;
+ Pango2Matrix *transform;
double x_scale, y_scale;
- PangoLanguageSet *languages;
+ Pango2LanguageSet *languages;
gboolean embolden;
gboolean synthetic;
};
-PangoLanguageSet * pango_hb_face_get_language_set (PangoHbFace *self);
+Pango2LanguageSet * pango2_hb_face_get_language_set (Pango2HbFace *self);
-void pango_hb_face_set_language_set (PangoHbFace *self,
- PangoLanguageSet *languages);
+void pango2_hb_face_set_language_set (Pango2HbFace *self,
+ Pango2LanguageSet *languages);
-void pango_hb_face_set_matrix (PangoHbFace *self,
- const PangoMatrix *matrix);
+void pango2_hb_face_set_matrix (Pango2HbFace *self,
+ const Pango2Matrix *matrix);
diff --git a/pango/pango-hbface.c b/pango/pango-hbface.c
index adee83f4..f549b41a 100644
--- a/pango/pango-hbface.c
+++ b/pango/pango-hbface.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -31,19 +31,19 @@
#include <hb-gobject.h>
/**
- * PangoHbFace:
+ * Pango2HbFace:
*
- * `PangoHbFace` is a `PangoFontFace` implementation that wraps
- * a `hb_face_t` object and implements all of the `PangoFontFace`
+ * `Pango2HbFace` is a `Pango2FontFace` implementation that wraps
+ * a `hb_face_t` object and implements all of the `Pango2FontFace`
* functionality using HarfBuzz.
*
* In addition to making a `hb_face_t` available for rendering
- * glyphs with Pango, `PangoHbFace` allows some tweaks to the
+ * glyphs with Pango2, `Pango2HbFace` allows some tweaks to the
* rendering, such as artificial slant (using a transformation
* matrix) or artificial emboldening.
*
- * To get a font instance at a specific size from a `PangoHbFace`,
- * use [ctor@Pango.HbFont.new].
+ * To get a font instance at a specific size from a `Pango2HbFace`,
+ * use [ctor@Pango2.HbFont.new].
*/
/* {{{ Utilities */
@@ -73,7 +73,7 @@ get_name_from_hb_face (hb_face_t *face,
}
static void
-ensure_hb_face (PangoHbFace *self)
+ensure_hb_face (Pango2HbFace *self)
{
hb_blob_t *blob;
@@ -124,15 +124,15 @@ variations_to_string (const hb_variation_t *variations,
}
static void
-set_name_and_description (PangoHbFace *self,
- const char *name,
- const PangoFontDescription *description)
+set_name_and_description (Pango2HbFace *self,
+ const char *name,
+ const Pango2FontDescription *description)
{
- PangoFontFace *face = PANGO_FONT_FACE (self);
+ Pango2FontFace *face = PANGO2_FONT_FACE (self);
if (name)
{
- pango_font_face_set_name (face, name);
+ pango2_font_face_set_name (face, name);
}
else
{
@@ -151,12 +151,12 @@ set_name_and_description (PangoHbFace *self,
HB_OT_NAME_ID_FONT_SUBFAMILY,
face_name, sizeof (face_name));
- pango_font_face_set_name (face, face_name);
+ pango2_font_face_set_name (face, face_name);
}
if (description)
{
- face->description = pango_font_description_copy (description);
+ face->description = pango2_font_description_copy (description);
}
else
{
@@ -175,15 +175,15 @@ set_name_and_description (PangoHbFace *self,
* out of the face name. FIXME: we should look at variation
* coordinates too, here, instead of these guessing games.
*/
- face->description = pango_font_description_from_string (fullname);
- pango_font_description_unset_fields (face->description,
- PANGO_FONT_MASK_VARIATIONS |
- PANGO_FONT_MASK_GRAVITY);
+ face->description = pango2_font_description_from_string (fullname);
+ pango2_font_description_unset_fields (face->description,
+ PANGO2_FONT_MASK_VARIATIONS |
+ PANGO2_FONT_MASK_GRAVITY);
/* Make sure we don't leave any leftovers misinterpreted
* as part of the family name.
*/
- pango_font_description_set_family (face->description, family);
+ pango2_font_description_set_family (face->description, family);
g_free (fullname);
}
@@ -191,7 +191,7 @@ set_name_and_description (PangoHbFace *self,
if (self->n_variations > 0)
{
char *str = variations_to_string (self->variations, self->n_variations, "=", ",");
- pango_font_description_set_variations (face->description, str);
+ pango2_font_description_set_variations (face->description, str);
g_free (str);
}
}
@@ -232,7 +232,7 @@ hb_face_is_monospace (hb_face_t *face)
}
static void
-ensure_faceid (PangoHbFace *self)
+ensure_faceid (Pango2HbFace *self)
{
double slant;
char buf0[32], buf1[32], buf2[32];
@@ -259,7 +259,7 @@ ensure_faceid (PangoHbFace *self)
*p = '?';
if (self->transform)
- slant = pango_matrix_get_slant_ratio (self->transform);
+ slant = pango2_matrix_get_slant_ratio (self->transform);
else
slant = 0.;
@@ -280,27 +280,27 @@ ensure_faceid (PangoHbFace *self)
}
static const char *
-style_from_font_description (const PangoFontDescription *desc)
+style_from_font_description (const Pango2FontDescription *desc)
{
- PangoStyle style = pango_font_description_get_style (desc);
- PangoWeight weight = pango_font_description_get_weight (desc);
+ Pango2Style style = pango2_font_description_get_style (desc);
+ Pango2Weight weight = pango2_font_description_get_weight (desc);
switch (style)
{
- case PANGO_STYLE_ITALIC:
- if (weight == PANGO_WEIGHT_BOLD)
+ case PANGO2_STYLE_ITALIC:
+ if (weight == PANGO2_WEIGHT_BOLD)
return "Bold Italic";
else
return "Italic";
break;
- case PANGO_STYLE_OBLIQUE:
- if (weight == PANGO_WEIGHT_BOLD)
+ case PANGO2_STYLE_OBLIQUE:
+ if (weight == PANGO2_WEIGHT_BOLD)
return "Bold Oblique";
else
return "Oblique";
break;
- case PANGO_STYLE_NORMAL:
- if (weight == PANGO_WEIGHT_BOLD)
+ case PANGO2_STYLE_NORMAL:
+ if (weight == PANGO2_WEIGHT_BOLD)
return "Bold";
else
return "Regular";
@@ -312,11 +312,11 @@ style_from_font_description (const PangoFontDescription *desc)
}
/* }}} */
-/* {{{ PangoFontFace implementation */
+/* {{{ Pango2FontFace implementation */
-struct _PangoHbFaceClass
+struct _Pango2HbFaceClass
{
- PangoFontFaceClass parent_class;
+ Pango2FontFaceClass parent_class;
};
enum {
@@ -332,19 +332,19 @@ enum {
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
-G_DEFINE_FINAL_TYPE (PangoHbFace, pango_hb_face, PANGO_TYPE_FONT_FACE)
+G_DEFINE_FINAL_TYPE (Pango2HbFace, pango2_hb_face, PANGO2_TYPE_FONT_FACE)
static void
-pango_hb_face_init (PangoHbFace *self)
+pango2_hb_face_init (Pango2HbFace *self)
{
self->transform = NULL;
self->x_scale = self->y_scale = 1.;
}
static void
-pango_hb_face_finalize (GObject *object)
+pango2_hb_face_finalize (GObject *object)
{
- PangoHbFace *self = PANGO_HB_FACE (object);
+ Pango2HbFace *self = PANGO2_HB_FACE (object);
g_free (self->faceid);
if (self->face)
@@ -356,21 +356,21 @@ pango_hb_face_finalize (GObject *object)
if (self->transform)
g_free (self->transform);
- G_OBJECT_CLASS (pango_hb_face_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_hb_face_parent_class)->finalize (object);
}
static gboolean
-pango_hb_face_is_synthesized (PangoFontFace *face)
+pango2_hb_face_is_synthesized (Pango2FontFace *face)
{
- PangoHbFace *self = PANGO_HB_FACE (face);
+ Pango2HbFace *self = PANGO2_HB_FACE (face);
return self->synthetic;
}
static gboolean
-pango_hb_face_is_monospace (PangoFontFace *face)
+pango2_hb_face_is_monospace (Pango2FontFace *face)
{
- PangoHbFace *self = PANGO_HB_FACE (face);
+ Pango2HbFace *self = PANGO2_HB_FACE (face);
ensure_hb_face (self);
@@ -378,9 +378,9 @@ pango_hb_face_is_monospace (PangoFontFace *face)
}
static gboolean
-pango_hb_face_is_variable (PangoFontFace *face)
+pango2_hb_face_is_variable (Pango2FontFace *face)
{
- PangoHbFace *self = PANGO_HB_FACE (face);
+ Pango2HbFace *self = PANGO2_HB_FACE (face);
/* We don't consider named instances as variable, i.e.
* a font chooser UI should not expose axes for them.
@@ -398,35 +398,35 @@ pango_hb_face_is_variable (PangoFontFace *face)
}
static gboolean
-pango_hb_face_supports_language (PangoFontFace *face,
- PangoLanguage *language)
+pango2_hb_face_supports_language (Pango2FontFace *face,
+ Pango2Language *language)
{
- PangoHbFace *self = PANGO_HB_FACE (face);
- PangoLanguageSet *set = pango_hb_face_get_language_set (self);
+ Pango2HbFace *self = PANGO2_HB_FACE (face);
+ Pango2LanguageSet *set = pango2_hb_face_get_language_set (self);
if (set)
- return pango_language_set_matches_language (set, language);
+ return pango2_language_set_matches_language (set, language);
return TRUE;
}
-static PangoLanguage **
-pango_hb_face_get_languages (PangoFontFace *face)
+static Pango2Language **
+pango2_hb_face_get_languages (Pango2FontFace *face)
{
- PangoHbFace *self = PANGO_HB_FACE (face);
- PangoLanguageSet *set = pango_hb_face_get_language_set (self);
+ Pango2HbFace *self = PANGO2_HB_FACE (face);
+ Pango2LanguageSet *set = pango2_hb_face_get_language_set (self);
if (set)
- return pango_language_set_get_languages (set);
+ return pango2_language_set_get_languages (set);
return NULL;
}
static gboolean
-pango_hb_face_has_char (PangoFontFace *face,
- gunichar wc)
+pango2_hb_face_has_char (Pango2FontFace *face,
+ gunichar wc)
{
- PangoHbFace *self = PANGO_HB_FACE (face);
+ Pango2HbFace *self = PANGO2_HB_FACE (face);
hb_font_t *hb_font;
hb_codepoint_t glyph;
gboolean ret;
@@ -441,50 +441,50 @@ pango_hb_face_has_char (PangoFontFace *face,
}
static const char *
-pango_hb_face_get_faceid (PangoFontFace *face)
+pango2_hb_face_get_faceid (Pango2FontFace *face)
{
- PangoHbFace *self = PANGO_HB_FACE (face);
+ Pango2HbFace *self = PANGO2_HB_FACE (face);
ensure_faceid (self);
return self->faceid;
}
-static PangoFont *
-pango_hb_face_create_font (PangoFontFace *face,
- const PangoFontDescription *desc,
- float dpi,
- const PangoMatrix *ctm)
+static Pango2Font *
+pango2_hb_face_create_font (Pango2FontFace *face,
+ const Pango2FontDescription *desc,
+ float dpi,
+ const Pango2Matrix *ctm)
{
- PangoHbFace *self = PANGO_HB_FACE (face);
+ Pango2HbFace *self = PANGO2_HB_FACE (face);
- return PANGO_FONT (pango_hb_font_new_for_description (self, desc, dpi, ctm));
+ return PANGO2_FONT (pango2_hb_font_new_for_description (self, desc, dpi, ctm));
}
static void
-pango_hb_face_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+pango2_hb_face_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- PangoHbFace *self = PANGO_HB_FACE (object);
+ Pango2HbFace *self = PANGO2_HB_FACE (object);
switch (property_id)
{
case PROP_HB_FACE:
- g_value_set_boxed (value, pango_hb_face_get_hb_face (self));
+ g_value_set_boxed (value, pango2_hb_face_get_hb_face (self));
break;
case PROP_FILE:
- g_value_set_string (value, pango_hb_face_get_file (self));
+ g_value_set_string (value, pango2_hb_face_get_file (self));
break;
case PROP_FACE_INDEX:
- g_value_set_uint (value, pango_hb_face_get_face_index (self));
+ g_value_set_uint (value, pango2_hb_face_get_face_index (self));
break;
case PROP_INSTANCE_ID:
- g_value_set_int (value, pango_hb_face_get_instance_id (self));
+ g_value_set_int (value, pango2_hb_face_get_instance_id (self));
break;
case PROP_VARIATIONS:
@@ -497,11 +497,11 @@ pango_hb_face_get_property (GObject *object,
break;
case PROP_EMBOLDEN:
- g_value_set_boolean (value, pango_hb_face_get_embolden (self));
+ g_value_set_boolean (value, pango2_hb_face_get_embolden (self));
break;
case PROP_TRANSFORM:
- g_value_set_boxed (value, pango_hb_face_get_transform (self));
+ g_value_set_boxed (value, pango2_hb_face_get_transform (self));
break;
default:
@@ -510,25 +510,25 @@ pango_hb_face_get_property (GObject *object,
}
static void
-pango_hb_face_class_init (PangoHbFaceClass *class)
+pango2_hb_face_class_init (Pango2HbFaceClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontFaceClass *face_class = PANGO_FONT_FACE_CLASS (class);
+ Pango2FontFaceClass *face_class = PANGO2_FONT_FACE_CLASS (class);
- object_class->finalize = pango_hb_face_finalize;
- object_class->get_property = pango_hb_face_get_property;
+ object_class->finalize = pango2_hb_face_finalize;
+ object_class->get_property = pango2_hb_face_get_property;
- face_class->is_synthesized = pango_hb_face_is_synthesized;
- face_class->is_monospace = pango_hb_face_is_monospace;
- face_class->is_variable = pango_hb_face_is_variable;
- face_class->supports_language = pango_hb_face_supports_language;
- face_class->get_languages = pango_hb_face_get_languages;
- face_class->has_char = pango_hb_face_has_char;
- face_class->get_faceid = pango_hb_face_get_faceid;
- face_class->create_font = pango_hb_face_create_font;
+ face_class->is_synthesized = pango2_hb_face_is_synthesized;
+ face_class->is_monospace = pango2_hb_face_is_monospace;
+ face_class->is_variable = pango2_hb_face_is_variable;
+ face_class->supports_language = pango2_hb_face_supports_language;
+ face_class->get_languages = pango2_hb_face_get_languages;
+ face_class->has_char = pango2_hb_face_has_char;
+ face_class->get_faceid = pango2_hb_face_get_faceid;
+ face_class->create_font = pango2_hb_face_create_font;
/**
- * PangoHbFace:hb-face: (attributes org.gtk.Property.get=pango_hb_face_get_hb_face)
+ * Pango2HbFace:hb-face: (attributes org.gtk.Property.get=pango2_hb_face_get_hb_face)
*
* A `hb_face_t` object backing this face.
*/
@@ -537,7 +537,7 @@ pango_hb_face_class_init (PangoHbFaceClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoHbFace:file: (attributes org.gtk.Property.get=pango_hb_face_get_file)
+ * Pango2HbFace:file: (attributes org.gtk.Property.get=pango2_hb_face_get_file)
*
* The file that this face was created from, if any.
*/
@@ -546,7 +546,7 @@ pango_hb_face_class_init (PangoHbFaceClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoHbFace:face-index: (attributes org.gtk.Property.get=pango_hb_face_get_face_index)
+ * Pango2HbFace:face-index: (attributes org.gtk.Property.get=pango2_hb_face_get_face_index)
*
* The index of the face, in case that it was created
* from a file containing data for multiple faces.
@@ -556,7 +556,7 @@ pango_hb_face_class_init (PangoHbFaceClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoHbFace:instance-id: (attributes org.gtk.Property.get=pango_hb_face_get_instance_id)
+ * Pango2HbFace:instance-id: (attributes org.gtk.Property.get=pango2_hb_face_get_instance_id)
*
* The ID of the named instance of this face.
*
@@ -569,7 +569,7 @@ pango_hb_face_class_init (PangoHbFaceClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoHbFace:variations: (attributes org.gtk.Property.get=pango_hb_face_get_variations)
+ * Pango2HbFace:variations: (attributes org.gtk.Property.get=pango2_hb_face_get_variations)
*
* The variations that are applied for this face.
*
@@ -580,7 +580,7 @@ pango_hb_face_class_init (PangoHbFaceClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoHbFace:embolden: (attributes org.gtk.Property.get=pango_hb_face_get_embolden)
+ * Pango2HbFace:embolden: (attributes org.gtk.Property.get=pango2_hb_face_get_embolden)
*
* `TRUE` if the face is using synthetic emboldening.
*/
@@ -589,7 +589,7 @@ pango_hb_face_class_init (PangoHbFaceClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoHbFace:transform: (attributes org.gtk.Property.get=pango_hb_face_get_transform)
+ * Pango2HbFace:transform: (attributes org.gtk.Property.get=pango2_hb_face_get_transform)
*
* The transform from 'font space' to 'user space' that
* this face uses.
@@ -598,7 +598,7 @@ pango_hb_face_class_init (PangoHbFaceClass *class)
* sythetic italics and width variations.
*/
properties[PROP_TRANSFORM] =
- g_param_spec_boxed ("transform", NULL, NULL, PANGO_TYPE_MATRIX,
+ g_param_spec_boxed ("transform", NULL, NULL, PANGO2_TYPE_MATRIX,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
@@ -608,104 +608,104 @@ pango_hb_face_class_init (PangoHbFaceClass *class)
/* {{{ Private API */
/*< private >
- * pango_hb_face_get_language_set:
- * @face: a `PangoHbFace`
+ * pango2_hb_face_get_language_set:
+ * @face: a `Pango2HbFace`
*
* Returns the languages supported by @face.
*
- * Returns: (transfer none): a `PangoLanguageSet`
+ * Returns: (transfer none): a `Pango2LanguageSet`
*/
-PangoLanguageSet *
-pango_hb_face_get_language_set (PangoHbFace *face)
+Pango2LanguageSet *
+pango2_hb_face_get_language_set (Pango2HbFace *face)
{
return face->languages;
}
/*< private >
- * pango_hb_face_set_language_set:
- * @self: a `PangoHbFace`
- * @languages: a `PangoLanguageSet`
+ * pango2_hb_face_set_language_set:
+ * @self: a `Pango2HbFace`
+ * @languages: a `Pango2LanguageSet`
*
* Sets the languages that are supported by @face.
*
* This should only be called by fontmap implementations.
*/
void
-pango_hb_face_set_language_set (PangoHbFace *self,
- PangoLanguageSet *languages)
+pango2_hb_face_set_language_set (Pango2HbFace *self,
+ Pango2LanguageSet *languages)
{
g_set_object (&self->languages, languages);
}
/*< private >
- * pango_hb_face_set_matrix:
- * @self: a `PangoHbFace`
- * @matrix: the `PangoMatrix`
+ * pango2_hb_face_set_matrix:
+ * @self: a `Pango2HbFace`
+ * @matrix: the `Pango2Matrix`
*
* Sets the font matrix for @self.
*
* This should only be called by fontmap implementations.
*/
void
-pango_hb_face_set_matrix (PangoHbFace *self,
- const PangoMatrix *matrix)
+pango2_hb_face_set_matrix (Pango2HbFace *self,
+ const Pango2Matrix *matrix)
{
if (!self->transform)
- self->transform = g_new (PangoMatrix, 1);
+ self->transform = g_new (Pango2Matrix, 1);
*self->transform = *matrix;
- pango_matrix_get_font_scale_factors (self->transform, &self->x_scale, &self->y_scale);
- pango_matrix_scale (self->transform, 1./self->x_scale, 1./self->y_scale);
+ pango2_matrix_get_font_scale_factors (self->transform, &self->x_scale, &self->y_scale);
+ pango2_matrix_scale (self->transform, 1./self->x_scale, 1./self->y_scale);
}
/* }}} */
/* {{{ Public API */
/**
- * pango_hb_face_new_from_hb_face:
+ * pango2_hb_face_new_from_hb_face:
* @face: an immutable `hb_face_t`
* @instance_id: named instance id, or -1 for the default instance
* or -2 for no instance
* @name: (nullable): name for the face
- * @description: (nullable): `PangoFontDescription` for the font
+ * @description: (nullable): `Pango2FontDescription` for the font
*
- * Creates a new `PangoHbFace` by wrapping an existing `hb_face_t`.
+ * Creates a new `Pango2HbFace` by wrapping an existing `hb_face_t`.
*
* The @instance_id can be used to pick one of the available named
* instances in a variable font. See hb_ot_var_get_named_instance_count()
* to learn about the available named instances.
*
* If @instance_id is -2 and @face has variation axes, then
- * [method@Pango.FontFace.is_variable] will return `TRUE` for
- * the returned `PangoHbFace`.
+ * [method@Pango2.FontFace.is_variable] will return `TRUE` for
+ * the returned `Pango2HbFace`.
*
* If @name is provided, it is used as the name for the face.
- * Otherwise, Pango will use the named instance subfamily name
+ * Otherwise, Pango2 will use the named instance subfamily name
* or `HB_OT_NAME_ID_TYPOGRAPHIC_SUBFAMILY`.
*
* If @description is provided, it is used as the font description
- * for the face. Otherwise, Pango creates a description using
+ * for the face. Otherwise, Pango2 creates a description using
* `HB_OT_NAME_ID_TYPOGRAPHIC_FAMILY` and the name of the face.
*
- * Returns: a newly created `PangoHbFace`
+ * Returns: a newly created `Pango2HbFace`
*/
-PangoHbFace *
-pango_hb_face_new_from_hb_face (hb_face_t *face,
- int instance_id,
- const char *name,
- const PangoFontDescription *description)
+Pango2HbFace *
+pango2_hb_face_new_from_hb_face (hb_face_t *face,
+ int instance_id,
+ const char *name,
+ const Pango2FontDescription *description)
{
- PangoHbFace *self;
+ Pango2HbFace *self;
g_return_val_if_fail (face != NULL, NULL);
g_return_val_if_fail (hb_face_is_immutable (face), NULL);
g_return_val_if_fail (instance_id >= -2, NULL);
g_return_val_if_fail (description == NULL ||
- (pango_font_description_get_set_fields (description) &
- (PANGO_FONT_MASK_SIZE|PANGO_FONT_MASK_GRAVITY)) == 0, NULL);
+ (pango2_font_description_get_set_fields (description) &
+ (PANGO2_FONT_MASK_SIZE|PANGO2_FONT_MASK_GRAVITY)) == 0, NULL);
- self = g_object_new (PANGO_TYPE_HB_FACE, NULL);
+ self = g_object_new (PANGO2_TYPE_HB_FACE, NULL);
self->face = hb_face_reference (face);
self->index = hb_face_get_index (face) & 0xffff;
@@ -720,15 +720,15 @@ pango_hb_face_new_from_hb_face (hb_face_t *face,
}
/**
- * pango_hb_face_new_from_file:
+ * pango2_hb_face_new_from_file:
* @file: font filename
* @index: face index
* @instance_id: named instance id, or -1 for the default instance
* or -2 for no instance
* @name: (nullable): name for the face
- * @description: (nullable): `PangoFontDescription` for the font
+ * @description: (nullable): `Pango2FontDescription` for the font
*
- * Creates a new `PangoHbFace` from a font file.
+ * Creates a new `Pango2HbFace` from a font file.
*
* The @index can be used to pick a face from a file containing
* multiple faces, such as TTC or DFont.
@@ -738,40 +738,40 @@ pango_hb_face_new_from_hb_face (hb_face_t *face,
* to learn about the available named instances.
*
* If @instance_id is -2 and @face has variation axes, then
- * [method@Pango.FontFace.is_variable] will return `TRUE` for
- * the returned `PangoHbFace`.
+ * [method@Pango2.FontFace.is_variable] will return `TRUE` for
+ * the returned `Pango2HbFace`.
*
* If @name is provided, it is used as the name for the face.
- * Otherwise, Pango will use the named instance subfamily name
+ * Otherwise, Pango2 will use the named instance subfamily name
* or `HB_OT_NAME_ID_TYPOGRAPHIC_SUBFAMILY`.
*
* If @description is provided, it is used as the font description
- * for the face. Otherwise, Pango creates a description using
+ * for the face. Otherwise, Pango2 creates a description using
* `HB_OT_NAME_ID_TYPOGRAPHIC_FAMILY` and the name of the face.
*
- * If @desc and @name are provided, then the returned `PangoHbFace`
+ * If @desc and @name are provided, then the returned `Pango2HbFace`
* object will be lazily initialized as needed.
*
- * Returns: a newly created `PangoHbFace`
+ * Returns: a newly created `Pango2HbFace`
*/
-PangoHbFace *
-pango_hb_face_new_from_file (const char *file,
- unsigned int index,
- int instance_id,
- const char *name,
- const PangoFontDescription *description)
+Pango2HbFace *
+pango2_hb_face_new_from_file (const char *file,
+ unsigned int index,
+ int instance_id,
+ const char *name,
+ const Pango2FontDescription *description)
{
- PangoHbFace *self;
+ Pango2HbFace *self;
g_return_val_if_fail (file!= NULL, NULL);
g_return_val_if_fail (instance_id >= -2, NULL);
g_return_val_if_fail (description == NULL ||
- (pango_font_description_get_set_fields (description) &
- (PANGO_FONT_MASK_VARIANT|
- PANGO_FONT_MASK_SIZE|
- PANGO_FONT_MASK_GRAVITY)) == 0, NULL);
+ (pango2_font_description_get_set_fields (description) &
+ (PANGO2_FONT_MASK_VARIANT|
+ PANGO2_FONT_MASK_SIZE|
+ PANGO2_FONT_MASK_GRAVITY)) == 0, NULL);
- self = g_object_new (PANGO_TYPE_HB_FACE, NULL);
+ self = g_object_new (PANGO2_TYPE_HB_FACE, NULL);
self->file = g_strdup (file);
self->index = index;
@@ -783,23 +783,23 @@ pango_hb_face_new_from_file (const char *file,
}
/**
- * pango_hb_face_new_synthetic:
- * @face: a `PangoHbFace`
+ * pango2_hb_face_new_synthetic:
+ * @face: a `Pango2HbFace`
* @transform: (nullable): the transform to apply
* @embolden: `TRUE` to render the font bolder
* @name: (nullable): name for the face
- * @description: a `PangoFontDescription` to override fields from @face's description
+ * @description: a `Pango2FontDescription` to override fields from @face's description
*
- * Creates a new `PangoHbFace` that is a synthetic variant of @face.
+ * Creates a new `Pango2HbFace` that is a synthetic variant of @face.
*
* Here, 'synthetic' means that the variant is implemented by rendering
* the glyphs differently, not by using data from the original @face.
- * See [method@Pango.HbFace.new_instance] for that.
+ * See [method@Pango2.HbFace.new_instance] for that.
*
* @transform can be used to specify a non-trivial font matrix for creating
* synthetic italics or synthetic condensed variants of an existing face.
*
- * If @embolden is `TRUE`, Pango will render the glyphs bolder, creating
+ * If @embolden is `TRUE`, Pango2 will render the glyphs bolder, creating
* a synthetic bold variant of the face.
*
* If a @name is not specified, the name for the face will be derived
@@ -815,30 +815,30 @@ pango_hb_face_new_from_file (const char *file,
* + weight, to indicate a bolder weight
* + family, to provide an alternative family name
*
- * [method@Pango.FontFace.is_synthesized] will return `TRUE` for objects
+ * [method@Pango2.FontFace.is_synthesized] will return `TRUE` for objects
* created by this function.
*
- * Returns: (transfer full): a newly created `PangoHbFace`
+ * Returns: (transfer full): a newly created `Pango2HbFace`
*/
-PangoHbFace *
-pango_hb_face_new_synthetic (PangoHbFace *face,
- const PangoMatrix *transform,
- gboolean embolden,
- const char *name,
- const PangoFontDescription *description)
+Pango2HbFace *
+pango2_hb_face_new_synthetic (Pango2HbFace *face,
+ const Pango2Matrix *transform,
+ gboolean embolden,
+ const char *name,
+ const Pango2FontDescription *description)
{
- PangoHbFace *self;
- PangoFontDescription *desc;
+ Pango2HbFace *self;
+ Pango2FontDescription *desc;
- g_return_val_if_fail (PANGO_IS_HB_FACE (face), NULL);
+ g_return_val_if_fail (PANGO2_IS_HB_FACE (face), NULL);
g_return_val_if_fail (description != NULL, NULL);
- g_return_val_if_fail ((pango_font_description_get_set_fields (description) &
- ~(PANGO_FONT_MASK_FAMILY|
- PANGO_FONT_MASK_STYLE|
- PANGO_FONT_MASK_STRETCH|
- PANGO_FONT_MASK_WEIGHT)) == 0, NULL);
+ g_return_val_if_fail ((pango2_font_description_get_set_fields (description) &
+ ~(PANGO2_FONT_MASK_FAMILY|
+ PANGO2_FONT_MASK_STYLE|
+ PANGO2_FONT_MASK_STRETCH|
+ PANGO2_FONT_MASK_WEIGHT)) == 0, NULL);
- self = g_object_new (PANGO_TYPE_HB_FACE, NULL);
+ self = g_object_new (PANGO2_TYPE_HB_FACE, NULL);
self->file = g_strdup (face->file);
if (face->face)
@@ -850,35 +850,35 @@ pango_hb_face_new_synthetic (PangoHbFace *face,
self->n_variations = face->n_variations;
if (transform)
- pango_hb_face_set_matrix (self, transform);
+ pango2_hb_face_set_matrix (self, transform);
self->embolden = embolden;
self->synthetic = self->embolden || (self->transform != NULL);
- desc = pango_font_description_copy (PANGO_FONT_FACE (face)->description);
- pango_font_description_merge (desc, description, TRUE);
+ desc = pango2_font_description_copy (PANGO2_FONT_FACE (face)->description);
+ pango2_font_description_merge (desc, description, TRUE);
if (!name)
name = style_from_font_description (desc);
set_name_and_description (self, name, desc);
- pango_hb_face_set_language_set (self, face->languages);
+ pango2_hb_face_set_language_set (self, face->languages);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
return self;
}
/**
- * pango_hb_face_new_instance:
- * @face: a `PangoHbFace`
+ * pango2_hb_face_new_instance:
+ * @face: a `Pango2HbFace`
* @variations: (nullable) (array length=n_variations): font variations to apply
* @n_variations: length of @variations
* @name: (nullable): name for the face
- * @description: a `PangoFontDescription` to override fields from @face's description
+ * @description: a `Pango2FontDescription` to override fields from @face's description
*
- * Creates a new `PangoHbFace` that is a variant of @face.
+ * Creates a new `Pango2HbFace` that is a variant of @face.
*
* The @variations provide values for variation axes of @face. Axes that
* are not included in @variations will keep the values they have in @face.
@@ -900,27 +900,27 @@ pango_hb_face_new_synthetic (PangoHbFace *face,
* - weight, to indicate a bolder weight
* - family, to provide an alternative family name
*
- * Returns: (transfer full): a newly created `PangoHbFace`
+ * Returns: (transfer full): a newly created `Pango2HbFace`
*/
-PangoHbFace *
-pango_hb_face_new_instance (PangoHbFace *face,
- const hb_variation_t *variations,
- unsigned int n_variations,
- const char *name,
- const PangoFontDescription *description)
+Pango2HbFace *
+pango2_hb_face_new_instance (Pango2HbFace *face,
+ const hb_variation_t *variations,
+ unsigned int n_variations,
+ const char *name,
+ const Pango2FontDescription *description)
{
- PangoHbFace *self;
- PangoFontDescription *desc;
+ Pango2HbFace *self;
+ Pango2FontDescription *desc;
- g_return_val_if_fail (PANGO_IS_HB_FACE (face), NULL);
+ g_return_val_if_fail (PANGO2_IS_HB_FACE (face), NULL);
g_return_val_if_fail (description != NULL, NULL);
- g_return_val_if_fail ((pango_font_description_get_set_fields (description) &
- ~(PANGO_FONT_MASK_FAMILY|
- PANGO_FONT_MASK_STYLE|
- PANGO_FONT_MASK_STRETCH|
- PANGO_FONT_MASK_WEIGHT)) == 0, NULL);
+ g_return_val_if_fail ((pango2_font_description_get_set_fields (description) &
+ ~(PANGO2_FONT_MASK_FAMILY|
+ PANGO2_FONT_MASK_STYLE|
+ PANGO2_FONT_MASK_STRETCH|
+ PANGO2_FONT_MASK_WEIGHT)) == 0, NULL);
- self = g_object_new (PANGO_TYPE_HB_FACE, NULL);
+ self = g_object_new (PANGO2_TYPE_HB_FACE, NULL);
self->file = g_strdup (face->file);
if (face->face)
@@ -931,7 +931,7 @@ pango_hb_face_new_instance (PangoHbFace *face,
if (face->transform)
{
- self->transform = g_memdup2 (face->transform, sizeof (PangoMatrix));
+ self->transform = g_memdup2 (face->transform, sizeof (Pango2Matrix));
self->x_scale = face->x_scale;
self->y_scale = face->y_scale;
}
@@ -942,35 +942,35 @@ pango_hb_face_new_instance (PangoHbFace *face,
self->variations = g_memdup2 (variations, sizeof (hb_variation_t) * n_variations);
self->n_variations = n_variations;
- desc = pango_font_description_copy (PANGO_FONT_FACE (face)->description);
- pango_font_description_merge (desc, description, TRUE);
+ desc = pango2_font_description_copy (PANGO2_FONT_FACE (face)->description);
+ pango2_font_description_merge (desc, description, TRUE);
if (!name)
name = style_from_font_description (desc);
set_name_and_description (self, name, desc);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
return self;
}
/**
- * pango_hb_face_get_hb_face:
- * @self: a `PangoHbFace`
+ * pango2_hb_face_get_hb_face:
+ * @self: a `Pango2HbFace`
*
* Gets the `hb_face_t` object backing this face.
*
* Note that the objects returned by this function are cached
- * and immutable, and may be shared between `PangoHbFace` objects.
+ * and immutable, and may be shared between `Pango2HbFace` objects.
*
* Returns: (transfer none): the `hb_face_t` object
* backing the face
*/
hb_face_t *
-pango_hb_face_get_hb_face (PangoHbFace *self)
+pango2_hb_face_get_hb_face (Pango2HbFace *self)
{
- g_return_val_if_fail (PANGO_IS_HB_FACE (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_HB_FACE (self), NULL);
ensure_hb_face (self);
@@ -978,56 +978,56 @@ pango_hb_face_get_hb_face (PangoHbFace *self)
}
/**
- * pango_hb_face_get_file:
- * @self: a `PangoHbFace`
+ * pango2_hb_face_get_file:
+ * @self: a `Pango2HbFace`
*
* Gets the file that backs the face.
*
* Returns: (transfer none) (nullable): the file backing the face
*/
const char *
-pango_hb_face_get_file (PangoHbFace *self)
+pango2_hb_face_get_file (Pango2HbFace *self)
{
- g_return_val_if_fail (PANGO_IS_HB_FACE (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_HB_FACE (self), NULL);
return self->file;
}
/**
- * pango_hb_face_get_face_index:
- * @self: a `PangoHbFace`
+ * pango2_hb_face_get_face_index:
+ * @self: a `Pango2HbFace`
*
* Gets the face index of the face.
*
* Returns: the face indexx
*/
unsigned int
-pango_hb_face_get_face_index (PangoHbFace *self)
+pango2_hb_face_get_face_index (Pango2HbFace *self)
{
- g_return_val_if_fail (PANGO_IS_HB_FACE (self), 0);
+ g_return_val_if_fail (PANGO2_IS_HB_FACE (self), 0);
return self->index;
}
/**
- * pango_hb_face_get_instance_id:
- * @self: a `PangoHbFace`
+ * pango2_hb_face_get_instance_id:
+ * @self: a `Pango2HbFace`
*
* Gets the instance id of the face.
*
* Returns: the instance id
*/
int
-pango_hb_face_get_instance_id (PangoHbFace *self)
+pango2_hb_face_get_instance_id (Pango2HbFace *self)
{
- g_return_val_if_fail (PANGO_IS_HB_FACE (self), -1);
+ g_return_val_if_fail (PANGO2_IS_HB_FACE (self), -1);
return self->instance_id;
}
/**
- * pango_hb_face_get_variations:
- * @self: a `PangoHbFace`
+ * pango2_hb_face_get_variations:
+ * @self: a `Pango2HbFace`
* @n_variations: (nullable) (out caller-allocates): return location for
* the length of the returned array
*
@@ -1036,10 +1036,10 @@ pango_hb_face_get_instance_id (PangoHbFace *self)
* Returns: (nullable) (transfer none): the variations
*/
const hb_variation_t *
-pango_hb_face_get_variations (PangoHbFace *self,
- unsigned int *n_variations)
+pango2_hb_face_get_variations (Pango2HbFace *self,
+ unsigned int *n_variations)
{
- g_return_val_if_fail (PANGO_IS_HB_FACE (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_HB_FACE (self), NULL);
if (n_variations)
*n_variations = self->n_variations;
@@ -1048,24 +1048,24 @@ pango_hb_face_get_variations (PangoHbFace *self,
}
/**
- * pango_hb_face_get_embolden:
- * @self: a `PangoHbFace`
+ * pango2_hb_face_get_embolden:
+ * @self: a `Pango2HbFace`
*
* Gets whether face is using synthetic emboldening.
*
* Returns: `TRUE` if the face is using synthetic embolding
*/
gboolean
-pango_hb_face_get_embolden (PangoHbFace *self)
+pango2_hb_face_get_embolden (Pango2HbFace *self)
{
- g_return_val_if_fail (PANGO_IS_HB_FACE (self), FALSE);
+ g_return_val_if_fail (PANGO2_IS_HB_FACE (self), FALSE);
return self->embolden;
}
/**
- * pango_hb_face_get_transform:
- * @self: a `PangoHbFace`
+ * pango2_hb_face_get_transform:
+ * @self: a `Pango2HbFace`
*
* Gets the transform from 'font space' to 'user space' that this face uses.
*
@@ -1074,10 +1074,10 @@ pango_hb_face_get_embolden (PangoHbFace *self)
*
* Returns: (nullable) (transfer none): the transform of face
*/
-const PangoMatrix *
-pango_hb_face_get_transform (PangoHbFace *self)
+const Pango2Matrix *
+pango2_hb_face_get_transform (Pango2HbFace *self)
{
- g_return_val_if_fail (PANGO_IS_HB_FACE (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_HB_FACE (self), NULL);
return self->transform;
}
diff --git a/pango/pango-hbface.h b/pango/pango-hbface.h
index d2dd9973..356db1e4 100644
--- a/pango/pango-hbface.h
+++ b/pango/pango-hbface.h
@@ -26,60 +26,58 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_HB_FACE (pango_hb_face_get_type ())
-
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoHbFace, pango_hb_face, PANGO, HB_FACE, PangoFontFace)
-
-PANGO_AVAILABLE_IN_ALL
-PangoHbFace * pango_hb_face_new_from_hb_face (hb_face_t *face,
- int instance_id,
- const char *name,
- const PangoFontDescription *description);
-
-PANGO_AVAILABLE_IN_ALL
-PangoHbFace * pango_hb_face_new_from_file (const char *file,
- unsigned int index,
- int instance_id,
- const char *name,
- const PangoFontDescription *description);
-
-PANGO_AVAILABLE_IN_ALL
-PangoHbFace * pango_hb_face_new_synthetic (PangoHbFace *face,
- const PangoMatrix *transform,
- gboolean embolden,
- const char *name,
- const PangoFontDescription *description);
-
-PANGO_AVAILABLE_IN_ALL
-PangoHbFace * pango_hb_face_new_instance (PangoHbFace *face,
- const hb_variation_t *variations,
- unsigned int n_variations,
- const char *name,
- const PangoFontDescription *description);
-
-PANGO_AVAILABLE_IN_ALL
-hb_face_t * pango_hb_face_get_hb_face (PangoHbFace *self);
-
-PANGO_AVAILABLE_IN_ALL
-const char * pango_hb_face_get_file (PangoHbFace *self);
-
-PANGO_AVAILABLE_IN_ALL
-unsigned int pango_hb_face_get_face_index (PangoHbFace *self);
-
-PANGO_AVAILABLE_IN_ALL
-int pango_hb_face_get_instance_id (PangoHbFace *self);
-
-PANGO_AVAILABLE_IN_ALL
-const hb_variation_t *
- pango_hb_face_get_variations (PangoHbFace *self,
- unsigned int *n_variations);
-
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_hb_face_get_embolden (PangoHbFace *self);
-
-PANGO_AVAILABLE_IN_ALL
-const PangoMatrix *
- pango_hb_face_get_transform (PangoHbFace *self);
+#define PANGO2_TYPE_HB_FACE (pango2_hb_face_get_type ())
+
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2HbFace, pango2_hb_face, PANGO2, HB_FACE, Pango2FontFace)
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2HbFace * pango2_hb_face_new_from_hb_face (hb_face_t *face,
+ int instance_id,
+ const char *name,
+ const Pango2FontDescription *description);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2HbFace * pango2_hb_face_new_from_file (const char *file,
+ unsigned int index,
+ int instance_id,
+ const char *name,
+ const Pango2FontDescription *description);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2HbFace * pango2_hb_face_new_synthetic (Pango2HbFace *face,
+ const Pango2Matrix *transform,
+ gboolean embolden,
+ const char *name,
+ const Pango2FontDescription *description);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2HbFace * pango2_hb_face_new_instance (Pango2HbFace *face,
+ const hb_variation_t *variations,
+ unsigned int n_variations,
+ const char *name,
+ const Pango2FontDescription *description);
+
+PANGO2_AVAILABLE_IN_ALL
+hb_face_t * pango2_hb_face_get_hb_face (Pango2HbFace *self);
+
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_hb_face_get_file (Pango2HbFace *self);
+
+PANGO2_AVAILABLE_IN_ALL
+unsigned int pango2_hb_face_get_face_index (Pango2HbFace *self);
+
+PANGO2_AVAILABLE_IN_ALL
+int pango2_hb_face_get_instance_id (Pango2HbFace *self);
+
+PANGO2_AVAILABLE_IN_ALL
+const hb_variation_t * pango2_hb_face_get_variations (Pango2HbFace *self,
+ unsigned int *n_variations);
+
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_hb_face_get_embolden (Pango2HbFace *self);
+
+PANGO2_AVAILABLE_IN_ALL
+const Pango2Matrix * pango2_hb_face_get_transform (Pango2HbFace *self);
G_END_DECLS
diff --git a/pango/pango-hbfamily-private.h b/pango/pango-hbfamily-private.h
index 5719609f..fb92cfb6 100644
--- a/pango/pango-hbfamily-private.h
+++ b/pango/pango-hbfamily-private.h
@@ -23,26 +23,26 @@
#include "pango-hbface.h"
-#define PANGO_TYPE_HB_FAMILY (pango_hb_family_get_type ())
+#define PANGO2_TYPE_HB_FAMILY (pango2_hb_family_get_type ())
-G_DECLARE_FINAL_TYPE (PangoHbFamily, pango_hb_family, PANGO, HB_FAMILY, PangoFontFamily)
+G_DECLARE_FINAL_TYPE (Pango2HbFamily, pango2_hb_family, PANGO2, HB_FAMILY, Pango2FontFamily)
-struct _PangoHbFamily
+struct _Pango2HbFamily
{
- PangoFontFamily parent_instance;
+ Pango2FontFamily parent_instance;
GPtrArray *faces;
};
-PangoHbFamily * pango_hb_family_new (const char *name);
+Pango2HbFamily * pango2_hb_family_new (const char *name);
-void pango_hb_family_add_face (PangoHbFamily *self,
- PangoFontFace *face);
+void pango2_hb_family_add_face (Pango2HbFamily *self,
+ Pango2FontFace *face);
-void pango_hb_family_remove_face (PangoHbFamily *self,
- PangoFontFace *face);
+void pango2_hb_family_remove_face (Pango2HbFamily *self,
+ Pango2FontFace *face);
-PangoFontFace * pango_hb_family_find_face (PangoHbFamily *self,
- PangoFontDescription *description,
- PangoLanguage *language,
- gunichar wc);
+Pango2FontFace * pango2_hb_family_find_face (Pango2HbFamily *self,
+ Pango2FontDescription *description,
+ Pango2Language *language,
+ gunichar wc);
diff --git a/pango/pango-hbfamily.c b/pango/pango-hbfamily.c
index 30f2dbe3..dc990683 100644
--- a/pango/pango-hbfamily.c
+++ b/pango/pango-hbfamily.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -32,24 +32,24 @@
/* {{{ GListModel implementation */
static GType
-pango_hb_family_get_item_type (GListModel *list)
+pango2_hb_family_get_item_type (GListModel *list)
{
- return PANGO_TYPE_FONT_FACE;
+ return PANGO2_TYPE_FONT_FACE;
}
static guint
-pango_hb_family_get_n_items (GListModel *list)
+pango2_hb_family_get_n_items (GListModel *list)
{
- PangoHbFamily *self = PANGO_HB_FAMILY (list);
+ Pango2HbFamily *self = PANGO2_HB_FAMILY (list);
return self->faces->len;
}
static gpointer
-pango_hb_family_get_item (GListModel *list,
- guint position)
+pango2_hb_family_get_item (GListModel *list,
+ guint position)
{
- PangoHbFamily *self = PANGO_HB_FAMILY (list);
+ Pango2HbFamily *self = PANGO2_HB_FAMILY (list);
if (position < self->faces->len)
return g_object_ref (g_ptr_array_index (self->faces, position));
@@ -58,34 +58,34 @@ pango_hb_family_get_item (GListModel *list,
}
static void
-pango_hb_family_list_model_init (GListModelInterface *iface)
+pango2_hb_family_list_model_init (GListModelInterface *iface)
{
- iface->get_item_type = pango_hb_family_get_item_type;
- iface->get_n_items = pango_hb_family_get_n_items;
- iface->get_item = pango_hb_family_get_item;
+ iface->get_item_type = pango2_hb_family_get_item_type;
+ iface->get_n_items = pango2_hb_family_get_n_items;
+ iface->get_item = pango2_hb_family_get_item;
}
/* }}} */
/* {{{ Utilities */
static int
-sort_face_func (PangoFontFace *face1,
- PangoFontFace *face2)
+sort_face_func (Pango2FontFace *face1,
+ Pango2FontFace *face2)
{
int a, b;
- a = pango_font_description_get_style (face1->description);
- b = pango_font_description_get_style (face2->description);
+ a = pango2_font_description_get_style (face1->description);
+ b = pango2_font_description_get_style (face2->description);
if (a != b)
return a - b;
- a = pango_font_description_get_weight (face1->description);
- b = pango_font_description_get_weight (face2->description);
+ a = pango2_font_description_get_weight (face1->description);
+ b = pango2_font_description_get_weight (face2->description);
if (a != b)
return a - b;
- a = pango_font_description_get_stretch (face1->description);
- b = pango_font_description_get_stretch (face2->description);
+ a = pango2_font_description_get_stretch (face1->description);
+ b = pango2_font_description_get_stretch (face2->description);
if (a != b)
return a - b;
@@ -97,11 +97,11 @@ sort_face_func (PangoFontFace *face1,
* 0 otherwise
*/
static int
-face_get_variableness (PangoFontFace *face)
+face_get_variableness (Pango2FontFace *face)
{
- if (pango_font_face_is_variable (PANGO_FONT_FACE (face)))
+ if (pango2_font_face_is_variable (PANGO2_FONT_FACE (face)))
{
- if (PANGO_HB_FACE (face)->instance_id != -1)
+ if (PANGO2_HB_FACE (face)->instance_id != -1)
return 2;
else
return 1;
@@ -110,49 +110,49 @@ face_get_variableness (PangoFontFace *face)
}
/* }}} */
-/* {{{ PangoFontFamily implementation */
+/* {{{ Pango2FontFamily implementation */
-struct _PangoHbFamilyClass
+struct _Pango2HbFamilyClass
{
- PangoFontFamilyClass parent_class;
+ Pango2FontFamilyClass parent_class;
};
-G_DEFINE_TYPE_WITH_CODE (PangoHbFamily, pango_hb_family, PANGO_TYPE_FONT_FAMILY,
- G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_hb_family_list_model_init))
+G_DEFINE_TYPE_WITH_CODE (Pango2HbFamily, pango2_hb_family, PANGO2_TYPE_FONT_FAMILY,
+ G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango2_hb_family_list_model_init))
static void
-pango_hb_family_init (PangoHbFamily *self)
+pango2_hb_family_init (Pango2HbFamily *self)
{
self->faces = g_ptr_array_new_with_free_func (g_object_unref);
}
static void
-pango_hb_family_finalize (GObject *object)
+pango2_hb_family_finalize (GObject *object)
{
- PangoHbFamily *self = PANGO_HB_FAMILY (object);
+ Pango2HbFamily *self = PANGO2_HB_FAMILY (object);
for (int i = 0; i < self->faces->len; i++)
{
- PangoFontFace *face = g_ptr_array_index (self->faces, i);
+ Pango2FontFace *face = g_ptr_array_index (self->faces, i);
face->family = NULL;
}
g_ptr_array_unref (self->faces);
- G_OBJECT_CLASS (pango_hb_family_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_hb_family_parent_class)->finalize (object);
}
-static PangoFontFace *
-pango_hb_family_get_face (PangoFontFamily *family,
- const char *name)
+static Pango2FontFace *
+pango2_hb_family_get_face (Pango2FontFamily *family,
+ const char *name)
{
- PangoHbFamily *self = PANGO_HB_FAMILY (family);
+ Pango2HbFamily *self = PANGO2_HB_FAMILY (family);
for (int i = 0; i < self->faces->len; i++)
{
- PangoFontFace *face = g_ptr_array_index (self->faces, i);
+ Pango2FontFace *face = g_ptr_array_index (self->faces, i);
- if (name == NULL || strcmp (name, pango_font_face_get_name (face)) == 0)
+ if (name == NULL || strcmp (name, pango2_font_face_get_name (face)) == 0)
return face;
}
@@ -160,45 +160,45 @@ pango_hb_family_get_face (PangoFontFamily *family,
}
static void
-pango_hb_family_class_init (PangoHbFamilyClass *class)
+pango2_hb_family_class_init (Pango2HbFamilyClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontFamilyClass *family_class = PANGO_FONT_FAMILY_CLASS (class);
+ Pango2FontFamilyClass *family_class = PANGO2_FONT_FAMILY_CLASS (class);
- object_class->finalize = pango_hb_family_finalize;
+ object_class->finalize = pango2_hb_family_finalize;
- family_class->get_face = pango_hb_family_get_face;
+ family_class->get_face = pango2_hb_family_get_face;
}
/* }}} */
/* {{{ Private API */
/*< private >
- * pango_hb_family_new:
+ * pango2_hb_family_new:
* @name: the family name
*
- * Creates a new `PangoHbFamily`.
+ * Creates a new `Pango2HbFamily`.
*
- * Returns: a newly created `PangoHbFamily`
+ * Returns: a newly created `Pango2HbFamily`
*/
-PangoHbFamily *
-pango_hb_family_new (const char *name)
+Pango2HbFamily *
+pango2_hb_family_new (const char *name)
{
- PangoHbFamily *self;
+ Pango2HbFamily *self;
- self = g_object_new (PANGO_TYPE_HB_FAMILY, NULL);
+ self = g_object_new (PANGO2_TYPE_HB_FAMILY, NULL);
- pango_font_family_set_name (PANGO_FONT_FAMILY (self), name);
+ pango2_font_family_set_name (PANGO2_FONT_FAMILY (self), name);
return self;
}
/*< private >
- * pango_hb_family_add_face:
- * @self: a `PangoHbFamily`
- * @face: (transfer full): a `PangoFontFace` to add
+ * pango2_hb_family_add_face:
+ * @self: a `Pango2HbFamily`
+ * @face: (transfer full): a `Pango2FontFace` to add
*
- * Adds a `PangoFontFace` to a `PangoHbFamily`.
+ * Adds a `Pango2FontFace` to a `Pango2HbFamily`.
*
* The family takes ownership of the added face.
*
@@ -206,17 +206,17 @@ pango_hb_family_new (const char *name)
* once for the same face.
*/
void
-pango_hb_family_add_face (PangoHbFamily *self,
- PangoFontFace *face)
+pango2_hb_family_add_face (Pango2HbFamily *self,
+ Pango2FontFace *face)
{
int position;
- g_return_if_fail (PANGO_IS_HB_FACE (face) || PANGO_IS_USER_FACE (face));
+ g_return_if_fail (PANGO2_IS_HB_FACE (face) || PANGO2_IS_USER_FACE (face));
position = 0;
while (position < self->faces->len)
{
- PangoFontFace *f = g_ptr_array_index (self->faces, position);
+ Pango2FontFace *f = g_ptr_array_index (self->faces, position);
if (sort_face_func (face, f) < 0)
break;
position++;
@@ -224,31 +224,31 @@ pango_hb_family_add_face (PangoHbFamily *self,
g_ptr_array_insert (self->faces, position, face);
- pango_font_face_set_family (face, PANGO_FONT_FAMILY (self));
+ pango2_font_face_set_family (face, PANGO2_FONT_FAMILY (self));
g_list_model_items_changed (G_LIST_MODEL (self), position, 0, 1);
g_object_notify (G_OBJECT (self), "n-items");
}
/*< private >
- * pango_hb_family_remove_face:
- * @self: a `PangoHbFamily`
- * @face: a `PangoFontFace`
+ * pango2_hb_family_remove_face:
+ * @self: a `Pango2HbFamily`
+ * @face: a `Pango2FontFace`
*
- * Remove a `PangoFontFace` from a `PangoHbFamily`.
+ * Remove a `Pango2FontFace` from a `Pango2HbFamily`.
*/
void
-pango_hb_family_remove_face (PangoHbFamily *self,
- PangoFontFace *face)
+pango2_hb_family_remove_face (Pango2HbFamily *self,
+ Pango2FontFace *face)
{
unsigned int position;
- g_return_if_fail (PANGO_IS_HB_FACE (face) || PANGO_IS_USER_FACE (face));
+ g_return_if_fail (PANGO2_IS_HB_FACE (face) || PANGO2_IS_USER_FACE (face));
if (!g_ptr_array_find (self->faces, face, &position))
return;
- pango_font_face_set_family (face, NULL);
+ pango2_font_face_set_family (face, NULL);
g_ptr_array_remove_index (self->faces, position);
@@ -257,10 +257,10 @@ pango_hb_family_remove_face (PangoHbFamily *self,
}
/*< private >
- * pango_hb_family_find_face:
- * @family: a `PangoHbFamily`
- * @description: `PangoFontDescription` to match
- * @language: (nullable): `PangoLanguage` to support
+ * pango2_hb_family_find_face:
+ * @family: a `Pango2HbFamily`
+ * @description: `Pango2FontDescription` to match
+ * @language: (nullable): `Pango2Language` to support
* @wc: a Unicode character, or 0 to ignore
*
* Finds the face in @family that best matches the font description while
@@ -272,25 +272,25 @@ pango_hb_family_remove_face (PangoHbFamily *self,
*
* Returns: (transfer none) (nullable): the face
*/
-PangoFontFace *
-pango_hb_family_find_face (PangoHbFamily *family,
- PangoFontDescription *description,
- PangoLanguage *language,
- gunichar wc)
+Pango2FontFace *
+pango2_hb_family_find_face (Pango2HbFamily *family,
+ Pango2FontDescription *description,
+ Pango2Language *language,
+ gunichar wc)
{
- PangoFontFace *face = NULL;
+ Pango2FontFace *face = NULL;
int best_distance = G_MAXINT;
int best_variableness = 0;
/* First look for an exact match if the description has a faceid */
- if (pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_FACEID)
+ if (pango2_font_description_get_set_fields (description) & PANGO2_FONT_MASK_FACEID)
{
- const char *faceid = pango_font_description_get_faceid (description);
+ const char *faceid = pango2_font_description_get_faceid (description);
for (int i = 0; i < family->faces->len; i++)
{
- PangoFontFace *face2 = g_ptr_array_index (family->faces, i);
- const char *faceid2 = pango_font_face_get_faceid (face2);
+ Pango2FontFace *face2 = g_ptr_array_index (family->faces, i);
+ const char *faceid2 = pango2_font_face_get_faceid (face2);
if (g_strcmp0 (faceid, faceid2) == 0)
return face2;
@@ -299,22 +299,22 @@ pango_hb_family_find_face (PangoHbFamily *family,
for (int i = 0; i < family->faces->len; i++)
{
- PangoFontFace *face2 = g_ptr_array_index (family->faces, i);
+ Pango2FontFace *face2 = g_ptr_array_index (family->faces, i);
int distance;
int variableness;
- if (language && !pango_font_face_supports_language (face2, language))
+ if (language && !pango2_font_face_supports_language (face2, language))
continue;
- if (wc && !pango_font_face_has_char (face2, wc))
+ if (wc && !pango2_font_face_has_char (face2, wc))
continue;
- if (!pango_font_description_is_similar (description, face2->description))
+ if (!pango2_font_description_is_similar (description, face2->description))
continue;
- distance = pango_font_description_compute_distance (description, face2->description);
+ distance = pango2_font_description_compute_distance (description, face2->description);
- variableness = face_get_variableness (PANGO_FONT_FACE (face2));
+ variableness = face_get_variableness (PANGO2_FONT_FACE (face2));
if (distance < best_distance ||
(distance == best_distance && variableness > best_variableness))
{
diff --git a/pango/pango-hbfont-private.h b/pango/pango-hbfont-private.h
index 6fef1a9c..6794357f 100644
--- a/pango/pango-hbfont-private.h
+++ b/pango/pango-hbfont-private.h
@@ -29,7 +29,7 @@
typedef struct _HexBoxInfo HexBoxInfo;
struct _HexBoxInfo
{
- PangoFont *font;
+ Pango2Font *font;
int rows;
double digit_width;
double digit_height;
@@ -40,9 +40,9 @@ struct _HexBoxInfo
double box_height;
};
-struct _PangoHbFont
+struct _Pango2HbFont
{
- PangoFont parent_instance;
+ Pango2Font parent_instance;
hb_feature_t *features;
unsigned int n_features;
@@ -50,7 +50,7 @@ struct _PangoHbFont
unsigned int n_variations;
HexBoxInfo *hex_box_info;
- PangoLanguage *approximate_char_lang;
+ Pango2Language *approximate_char_lang;
int approximate_char_width;
int approximate_digit_width;
};
diff --git a/pango/pango-hbfont.c b/pango/pango-hbfont.c
index fd523a98..a8876224 100644
--- a/pango/pango-hbfont.c
+++ b/pango/pango-hbfont.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -32,14 +32,14 @@
#include <hb-ot.h>
/**
- * PangoHbFont:
+ * Pango2HbFont:
*
- * `PangoHbFont` is a `PangoFont` implementation that wraps
- * a `hb_font_t` object and implements all of the `PangoFont`
+ * `Pango2HbFont` is a `Pango2Font` implementation that wraps
+ * a `hb_font_t` object and implements all of the `Pango2Font`
* functionality using HarfBuzz.
*
- * In addition to a `PangoHbFace` and a size, a number of optional
- * parameters can be tweaked when creating a `PangoHbFont`. First
+ * In addition to a `Pango2HbFace` and a size, a number of optional
+ * parameters can be tweaked when creating a `Pango2HbFont`. First
* there are OpenType font features, which can be used to e.g.
* select Small Caps. If the face has variation axes, then
* coordinates for these axes can be provided. Finally, there are
@@ -50,37 +50,37 @@
/* {{{ Utilities */
static int
-get_average_char_width (PangoFont *font,
+get_average_char_width (Pango2Font *font,
const char *text)
{
- hb_font_t *hb_font = pango_font_get_hb_font (font);
+ hb_font_t *hb_font = pango2_font_get_hb_font (font);
int width = 0;
for (const char *p = text; *p; p = g_utf8_next_char (p))
{
gunichar wc;
hb_codepoint_t glyph;
- PangoRectangle extents;
+ Pango2Rectangle extents;
wc = g_utf8_get_char (p);
if (!hb_font_get_nominal_glyph (hb_font, wc, &glyph))
continue;
- pango_font_get_glyph_extents (font, glyph, &extents, NULL);
+ pango2_font_get_glyph_extents (font, glyph, &extents, NULL);
width += extents.x + extents.width;
}
- return width / pango_utf8_strwidth (text);
+ return width / pango2_utf8_strwidth (text);
}
static void
-get_max_char_size (PangoFont *font,
+get_max_char_size (Pango2Font *font,
const char *text,
int *width,
int *height)
{
- hb_font_t *hb_font = pango_font_get_hb_font (font);
+ hb_font_t *hb_font = pango2_font_get_hb_font (font);
int w = 0;
int h = 0;
@@ -88,13 +88,13 @@ get_max_char_size (PangoFont *font,
{
gunichar wc;
hb_codepoint_t glyph;
- PangoRectangle extents;
+ Pango2Rectangle extents;
wc = g_utf8_get_char (p);
if (!hb_font_get_nominal_glyph (hb_font, wc, &glyph))
continue;
- pango_font_get_glyph_extents (font, glyph, &extents, NULL);
+ pango2_font_get_glyph_extents (font, glyph, &extents, NULL);
w = MAX (w, extents.x + extents.width);
h = MAX (h, extents.height);
@@ -107,11 +107,11 @@ get_max_char_size (PangoFont *font,
*height = h;
}
-static PangoVariant
-pango_variant_from_features (hb_feature_t *features,
- unsigned int n_features)
+static Pango2Variant
+pango2_variant_from_features (hb_feature_t *features,
+ unsigned int n_features)
{
- PangoVariant variant = PANGO_VARIANT_NORMAL;
+ Pango2Variant variant = PANGO2_VARIANT_NORMAL;
gboolean all_caps = FALSE;
for (int i = 0; i < n_features; i++)
@@ -123,33 +123,33 @@ pango_variant_from_features (hb_feature_t *features,
{
case HB_TAG('s','m','c','p'):
if (all_caps)
- variant = PANGO_VARIANT_ALL_SMALL_CAPS;
+ variant = PANGO2_VARIANT_ALL_SMALL_CAPS;
else
- variant = PANGO_VARIANT_SMALL_CAPS;
+ variant = PANGO2_VARIANT_SMALL_CAPS;
break;
case HB_TAG('c','2','s','c'):
- if (variant == PANGO_VARIANT_SMALL_CAPS)
- variant = PANGO_VARIANT_ALL_SMALL_CAPS;
+ if (variant == PANGO2_VARIANT_SMALL_CAPS)
+ variant = PANGO2_VARIANT_ALL_SMALL_CAPS;
else
all_caps = TRUE;
break;
case HB_TAG('p','c','a','p'):
if (all_caps)
- variant = PANGO_VARIANT_ALL_PETITE_CAPS;
+ variant = PANGO2_VARIANT_ALL_PETITE_CAPS;
else
- variant = PANGO_VARIANT_PETITE_CAPS;
+ variant = PANGO2_VARIANT_PETITE_CAPS;
break;
case HB_TAG('c','2','p','c'):
- if (variant == PANGO_VARIANT_PETITE_CAPS)
- variant = PANGO_VARIANT_ALL_PETITE_CAPS;
+ if (variant == PANGO2_VARIANT_PETITE_CAPS)
+ variant = PANGO2_VARIANT_ALL_PETITE_CAPS;
else
all_caps = TRUE;
break;
case HB_TAG('u','n','i','c'):
- variant = PANGO_VARIANT_UNICASE;
+ variant = PANGO2_VARIANT_UNICASE;
break;
case HB_TAG('t','i','t','l'):
- variant = PANGO_VARIANT_TITLE_CAPS;
+ variant = PANGO2_VARIANT_TITLE_CAPS;
break;
default:
break;
@@ -160,10 +160,10 @@ pango_variant_from_features (hb_feature_t *features,
}
static void
-font_description_get_features (const PangoFontDescription *description,
- hb_feature_t *features,
- unsigned int length,
- unsigned int *n_features)
+font_description_get_features (const Pango2FontDescription *description,
+ hb_feature_t *features,
+ unsigned int length,
+ unsigned int *n_features)
{
#define ADD_FEATURE(name) \
@@ -176,29 +176,29 @@ font_description_get_features (const PangoFontDescription *description,
g_assert (length >= 2);
*n_features = 0;
- switch (pango_font_description_get_variant (description))
+ switch (pango2_font_description_get_variant (description))
{
- case PANGO_VARIANT_SMALL_CAPS:
+ case PANGO2_VARIANT_SMALL_CAPS:
ADD_FEATURE ("smcp");
break;
- case PANGO_VARIANT_ALL_SMALL_CAPS:
+ case PANGO2_VARIANT_ALL_SMALL_CAPS:
ADD_FEATURE ("smcp");
ADD_FEATURE ("c2sc");
break;
- case PANGO_VARIANT_PETITE_CAPS:
+ case PANGO2_VARIANT_PETITE_CAPS:
ADD_FEATURE ("pcap");
break;
- case PANGO_VARIANT_ALL_PETITE_CAPS:
+ case PANGO2_VARIANT_ALL_PETITE_CAPS:
ADD_FEATURE ("pcap");
ADD_FEATURE ("c2pc");
break;
- case PANGO_VARIANT_UNICASE:
+ case PANGO2_VARIANT_UNICASE:
ADD_FEATURE ("unic");
break;
- case PANGO_VARIANT_TITLE_CAPS:
+ case PANGO2_VARIANT_TITLE_CAPS:
ADD_FEATURE ("titl");
break;
- case PANGO_VARIANT_NORMAL:
+ case PANGO2_VARIANT_NORMAL:
break;
default:
g_assert_not_reached ();
@@ -329,12 +329,12 @@ collect_variations (hb_variation_t *variations,
/* This code needs to stay in sync with the hexbox rendering code in pangocairo-render.c */
static HexBoxInfo *
-create_hex_box_info (PangoHbFont *self)
+create_hex_box_info (Pango2HbFont *self)
{
- PangoFont *font = PANGO_FONT (self);
+ Pango2Font *font = PANGO2_FONT (self);
const char hexdigits[] = "0123456789ABCDEF";
hb_font_t *hb_font;
- PangoFont *mini_font;
+ Pango2Font *mini_font;
HexBoxInfo *hbi;
int rows;
double pad;
@@ -343,20 +343,20 @@ create_hex_box_info (PangoHbFont *self)
hb_font_extents_t font_extents;
double font_ascent, font_descent;
double mini_size;
- PangoFontDescription *desc;
- PangoContext *context;
- PangoFontMap *map;
+ Pango2FontDescription *desc;
+ Pango2Context *context;
+ Pango2FontMap *map;
- if (!PANGO_FONT_FACE (font->face)->family)
+ if (!PANGO2_FONT_FACE (font->face)->family)
return NULL;
- map = PANGO_FONT_FACE (font->face)->family->map;
+ map = PANGO2_FONT_FACE (font->face)->family->map;
if (!map)
return NULL;
- desc = pango_font_describe_with_absolute_size (font);
- hb_font = pango_font_get_hb_font (font);
+ desc = pango2_font_describe_with_absolute_size (font);
+ hb_font = pango2_font_get_hb_font (font);
/* Create mini_font description */
@@ -366,9 +366,9 @@ create_hex_box_info (PangoHbFont *self)
*/
/* We should rotate the box, not glyphs */
- pango_font_description_unset_fields (desc, PANGO_FONT_MASK_GRAVITY);
+ pango2_font_description_unset_fields (desc, PANGO2_FONT_MASK_GRAVITY);
- pango_font_description_set_family_static (desc, "monospace");
+ pango2_font_description_set_family_static (desc, "monospace");
rows = 2;
mini_size = font->size / 2.2;
@@ -379,34 +379,34 @@ create_hex_box_info (PangoHbFont *self)
mini_size = MIN (MAX (font->size - 1, 0), 6.0);
}
- pango_font_description_set_size (desc, mini_size);
+ pango2_font_description_set_size (desc, mini_size);
/* Load mini_font */
- context = pango_context_new_with_font_map (map);
- pango_context_set_matrix (context, &font->ctm);
- pango_context_set_language (context, pango_script_get_sample_language (G_UNICODE_SCRIPT_LATIN));
+ context = pango2_context_new_with_font_map (map);
+ pango2_context_set_matrix (context, &font->ctm);
+ pango2_context_set_language (context, pango2_script_get_sample_language (G_UNICODE_SCRIPT_LATIN));
- mini_font = pango_font_map_load_font (map, context, desc);
+ mini_font = pango2_font_map_load_font (map, context, desc);
g_object_unref (context);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
get_max_char_size (mini_font, hexdigits, &width, &height);
hb_font_get_extents_for_direction (hb_font, HB_DIRECTION_LTR, &font_extents);
- font_ascent = font_extents.ascender / (double) PANGO_SCALE;
- font_descent = - font_extents.descender / (double) PANGO_SCALE;
+ font_ascent = font_extents.ascender / (double) PANGO2_SCALE;
+ font_descent = - font_extents.descender / (double) PANGO2_SCALE;
pad = (font_ascent + font_descent) / 43.;
- pad = MIN (pad, mini_size / (double) PANGO_SCALE);
+ pad = MIN (pad, mini_size / (double) PANGO2_SCALE);
hbi = g_new (HexBoxInfo, 1);
hbi->font = mini_font;
hbi->rows = rows;
- hbi->digit_width = width / (double) PANGO_SCALE;
- hbi->digit_height = height / (double) PANGO_SCALE;
+ hbi->digit_width = width / (double) PANGO2_SCALE;
+ hbi->digit_height = height / (double) PANGO2_SCALE;
hbi->pad_x = pad;
hbi->pad_y = pad;
@@ -426,17 +426,17 @@ create_hex_box_info (PangoHbFont *self)
}
static void
-get_space_extents (PangoHbFont *self,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+get_space_extents (Pango2HbFont *self,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
- PangoFont *font = PANGO_FONT (self);
- hb_font_t *hb_font = pango_font_get_hb_font (font);
+ Pango2Font *font = PANGO2_FONT (self);
+ hb_font_t *hb_font = pango2_font_get_hb_font (font);
int width;
hb_direction_t direction;
hb_font_extents_t font_extents;
- direction = PANGO_GRAVITY_IS_VERTICAL (font->gravity)
+ direction = PANGO2_GRAVITY_IS_VERTICAL (font->gravity)
? HB_DIRECTION_TTB
: HB_DIRECTION_LTR;
@@ -462,16 +462,16 @@ get_space_extents (PangoHbFont *self,
}
static void
-get_glyph_extents_missing (PangoHbFont *self,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+get_glyph_extents_missing (Pango2HbFont *self,
+ Pango2Glyph glyph,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
gunichar ch;
int rows, cols;
HexBoxInfo *hbi;
- ch = glyph & ~PANGO_GLYPH_UNKNOWN_FLAG;
+ ch = glyph & ~PANGO2_GLYPH_UNKNOWN_FLAG;
if (!self->hex_box_info)
self->hex_box_info = create_hex_box_info (self);
@@ -484,12 +484,12 @@ get_glyph_extents_missing (PangoHbFont *self,
hbi = self->hex_box_info;
- if (G_UNLIKELY (glyph == PANGO_GLYPH_INVALID_INPUT || ch > 0x10FFFF))
+ if (G_UNLIKELY (glyph == PANGO2_GLYPH_INVALID_INPUT || ch > 0x10FFFF))
{
rows = hbi->rows;
cols = 1;
}
- else if (pango_get_ignorable_size (ch, &rows, &cols))
+ else if (pango2_get_ignorable_size (ch, &rows, &cols))
{
/* We special-case ignorables when rendering hex boxes */
}
@@ -501,27 +501,27 @@ get_glyph_extents_missing (PangoHbFont *self,
if (ink_rect)
{
- ink_rect->x = PANGO_SCALE * hbi->pad_x;
- ink_rect->y = PANGO_SCALE * (hbi->box_descent - hbi->box_height);
- ink_rect->width = PANGO_SCALE * (3 * hbi->pad_x + cols * (hbi->digit_width + hbi->pad_x));
- ink_rect->height = PANGO_SCALE * hbi->box_height;
+ ink_rect->x = PANGO2_SCALE * hbi->pad_x;
+ ink_rect->y = PANGO2_SCALE * (hbi->box_descent - hbi->box_height);
+ ink_rect->width = PANGO2_SCALE * (3 * hbi->pad_x + cols * (hbi->digit_width + hbi->pad_x));
+ ink_rect->height = PANGO2_SCALE * hbi->box_height;
}
if (logical_rect)
{
logical_rect->x = 0;
- logical_rect->y = PANGO_SCALE * (hbi->box_descent - (hbi->box_height + hbi->pad_y));
- logical_rect->width = PANGO_SCALE * (5 * hbi->pad_x + cols * (hbi->digit_width + hbi->pad_x));
- logical_rect->height = PANGO_SCALE * (hbi->box_height + 2 * hbi->pad_y);
+ logical_rect->y = PANGO2_SCALE * (hbi->box_descent - (hbi->box_height + hbi->pad_y));
+ logical_rect->width = PANGO2_SCALE * (5 * hbi->pad_x + cols * (hbi->digit_width + hbi->pad_x));
+ logical_rect->height = PANGO2_SCALE * (hbi->box_height + 2 * hbi->pad_y);
}
}
/* }}} */
-/* {{{ PangoFont implementation */
+/* {{{ Pango2Font implementation */
-struct _PangoHbFontClass
+struct _Pango2HbFontClass
{
- PangoFontClass parent_class;
+ Pango2FontClass parent_class;
};
enum {
@@ -531,10 +531,10 @@ enum {
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
-G_DEFINE_FINAL_TYPE (PangoHbFont, pango_hb_font, PANGO_TYPE_FONT)
+G_DEFINE_FINAL_TYPE (Pango2HbFont, pango2_hb_font, PANGO2_TYPE_FONT)
static void
-pango_hb_font_init (PangoHbFont *self)
+pango2_hb_font_init (Pango2HbFont *self)
{
}
@@ -546,24 +546,24 @@ hex_box_info_destroy (HexBoxInfo *hex_box_info)
}
static void
-pango_hb_font_finalize (GObject *object)
+pango2_hb_font_finalize (GObject *object)
{
- PangoHbFont *self = PANGO_HB_FONT (object);
+ Pango2HbFont *self = PANGO2_HB_FONT (object);
g_free (self->variations);
g_clear_pointer (&self->hex_box_info, hex_box_info_destroy);
- G_OBJECT_CLASS (pango_hb_font_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_hb_font_parent_class)->finalize (object);
}
static void
-pango_hb_font_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+pango2_hb_font_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- PangoHbFont *self = PANGO_HB_FONT (object);
+ Pango2HbFont *self = PANGO2_HB_FONT (object);
switch (property_id)
{
@@ -581,21 +581,21 @@ pango_hb_font_get_property (GObject *object,
}
}
-static PangoFontDescription *
-pango_hb_font_describe (PangoFont *font)
+static Pango2FontDescription *
+pango2_hb_font_describe (Pango2Font *font)
{
- PangoHbFont *self = PANGO_HB_FONT (font);
- PangoHbFace *face = PANGO_HB_FACE (font->face);
- PangoFontDescription *desc;
- PangoVariant variant;
-
- desc = pango_font_face_describe (font->face);
- pango_font_description_set_gravity (desc, font->gravity);
- pango_font_description_set_size (desc, font->size);
-
- variant = pango_variant_from_features (self->features, self->n_features);
- if (variant != PANGO_VARIANT_NORMAL)
- pango_font_description_set_variant (desc, variant);
+ Pango2HbFont *self = PANGO2_HB_FONT (font);
+ Pango2HbFace *face = PANGO2_HB_FACE (font->face);
+ Pango2FontDescription *desc;
+ Pango2Variant variant;
+
+ desc = pango2_font_face_describe (font->face);
+ pango2_font_description_set_gravity (desc, font->gravity);
+ pango2_font_description_set_size (desc, font->size);
+
+ variant = pango2_variant_from_features (self->features, self->n_features);
+ if (variant != PANGO2_VARIANT_NORMAL)
+ pango2_font_description_set_variant (desc, variant);
if (self->n_variations > 0 || face->n_variations > 0)
{
hb_variation_t *variations;
@@ -616,7 +616,7 @@ pango_hb_font_describe (PangoFont *font)
}
str = variations_to_string (variations, n_variations);
- pango_font_description_set_variations (desc, str);
+ pango2_font_description_set_variations (desc, str);
g_free (str);
}
@@ -624,25 +624,25 @@ pango_hb_font_describe (PangoFont *font)
}
static void
-pango_hb_font_get_glyph_extents (PangoFont *font,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_hb_font_get_glyph_extents (Pango2Font *font,
+ Pango2Glyph glyph,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
- PangoHbFont *self = PANGO_HB_FONT (font);
- PangoHbFace *face = PANGO_HB_FACE (font->face);
- hb_font_t *hb_font = pango_font_get_hb_font (font);
+ Pango2HbFont *self = PANGO2_HB_FONT (font);
+ Pango2HbFace *face = PANGO2_HB_FACE (font->face);
+ hb_font_t *hb_font = pango2_font_get_hb_font (font);
hb_glyph_extents_t extents;
hb_direction_t direction;
hb_font_extents_t font_extents;
- direction = PANGO_GRAVITY_IS_VERTICAL (font->gravity)
+ direction = PANGO2_GRAVITY_IS_VERTICAL (font->gravity)
? HB_DIRECTION_TTB
: HB_DIRECTION_LTR;
hb_font_get_extents_for_direction (hb_font, direction, &font_extents);
- if (glyph == PANGO_GLYPH_EMPTY)
+ if (glyph == PANGO2_GLYPH_EMPTY)
{
if (ink_rect)
ink_rect->x = ink_rect->y = ink_rect->width = ink_rect->height = 0;
@@ -656,7 +656,7 @@ pango_hb_font_get_glyph_extents (PangoFont *font,
return;
}
- else if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ else if (glyph & PANGO2_GLYPH_UNKNOWN_FLAG)
{
get_glyph_extents_missing (self, glyph, ink_rect, logical_rect);
@@ -667,8 +667,8 @@ pango_hb_font_get_glyph_extents (PangoFont *font,
if (ink_rect)
{
- PangoRectangle r;
- PangoMatrix m = PANGO_MATRIX_INIT;
+ Pango2Rectangle r;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
r.x = extents.x_bearing;
r.y = - extents.y_bearing;
@@ -682,31 +682,31 @@ pango_hb_font_get_glyph_extents (PangoFont *font,
m.xy = - face->transform->xy;
m.yy = face->transform->yy;
- pango_matrix_transform_rectangle (&m, &r);
+ pango2_matrix_transform_rectangle (&m, &r);
}
switch (font->gravity)
{
- case PANGO_GRAVITY_AUTO:
- case PANGO_GRAVITY_SOUTH:
+ case PANGO2_GRAVITY_AUTO:
+ case PANGO2_GRAVITY_SOUTH:
ink_rect->x = r.x;
ink_rect->y = r.y;
ink_rect->width = r.width;
ink_rect->height = r.height;
break;
- case PANGO_GRAVITY_NORTH:
+ case PANGO2_GRAVITY_NORTH:
ink_rect->x = - r.x;
ink_rect->y = - r.y;
ink_rect->width = - r.width;
ink_rect->height = - r.height;
break;
- case PANGO_GRAVITY_EAST:
+ case PANGO2_GRAVITY_EAST:
ink_rect->x = r.y;
ink_rect->y = - r.x - r.width;
ink_rect->width = r.height;
ink_rect->height = r.width;
break;
- case PANGO_GRAVITY_WEST:
+ case PANGO2_GRAVITY_WEST:
ink_rect->x = - r.y - r.height;
ink_rect->y = r.x;
ink_rect->width = r.height;
@@ -716,11 +716,11 @@ pango_hb_font_get_glyph_extents (PangoFont *font,
g_assert_not_reached ();
}
- if (PANGO_GRAVITY_IS_IMPROPER (font->gravity))
+ if (PANGO2_GRAVITY_IS_IMPROPER (font->gravity))
{
- PangoMatrix matrix = (PangoMatrix) PANGO_MATRIX_INIT;
- pango_matrix_scale (&matrix, -1, -1);
- pango_matrix_transform_rectangle (&matrix, ink_rect);
+ Pango2Matrix matrix = (Pango2Matrix) PANGO2_MATRIX_INIT;
+ pango2_matrix_scale (&matrix, -1, -1);
+ pango2_matrix_transform_rectangle (&matrix, ink_rect);
}
}
@@ -737,20 +737,20 @@ pango_hb_font_get_glyph_extents (PangoFont *font,
switch (font->gravity)
{
- case PANGO_GRAVITY_AUTO:
- case PANGO_GRAVITY_SOUTH:
+ case PANGO2_GRAVITY_AUTO:
+ case PANGO2_GRAVITY_SOUTH:
logical_rect->y = - extents.ascender;
logical_rect->width = h_advance;
break;
- case PANGO_GRAVITY_NORTH:
+ case PANGO2_GRAVITY_NORTH:
logical_rect->y = extents.descender;
logical_rect->width = h_advance;
break;
- case PANGO_GRAVITY_EAST:
+ case PANGO2_GRAVITY_EAST:
logical_rect->y = - logical_rect->height / 2;
logical_rect->width = logical_rect->height;
break;
- case PANGO_GRAVITY_WEST:
+ case PANGO2_GRAVITY_WEST:
logical_rect->y = - logical_rect->height / 2;
logical_rect->width = - logical_rect->height;
break;
@@ -758,7 +758,7 @@ pango_hb_font_get_glyph_extents (PangoFont *font,
g_assert_not_reached ();
}
- if (PANGO_GRAVITY_IS_IMPROPER (font->gravity))
+ if (PANGO2_GRAVITY_IS_IMPROPER (font->gravity))
{
logical_rect->height = - logical_rect->height;
logical_rect->y = - logical_rect->y;
@@ -766,17 +766,17 @@ pango_hb_font_get_glyph_extents (PangoFont *font,
}
}
-static PangoFontMetrics *
-pango_hb_font_get_metrics (PangoFont *font,
- PangoLanguage *language)
+static Pango2FontMetrics *
+pango2_hb_font_get_metrics (Pango2Font *font,
+ Pango2Language *language)
{
- PangoHbFont *self = PANGO_HB_FONT (font);
- hb_font_t *hb_font = pango_font_get_hb_font (font);
- PangoFontMetrics *metrics;
+ Pango2HbFont *self = PANGO2_HB_FONT (font);
+ hb_font_t *hb_font = pango2_font_get_hb_font (font);
+ Pango2FontMetrics *metrics;
hb_font_extents_t extents;
hb_position_t position;
- metrics = pango_font_metrics_new ();
+ metrics = pango2_font_metrics_new ();
hb_font_get_extents_for_direction (hb_font, HB_DIRECTION_LTR, &extents);
@@ -787,17 +787,17 @@ pango_hb_font_get_metrics (PangoFont *font,
if (hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_TAG_UNDERLINE_SIZE, &position) && position != 0)
metrics->underline_thickness = position;
else
- metrics->underline_thickness = PANGO_SCALE;
+ metrics->underline_thickness = PANGO2_SCALE;
if (hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_TAG_UNDERLINE_OFFSET, &position) && position != 0)
metrics->underline_position = position;
else
- metrics->underline_position = - PANGO_SCALE;
+ metrics->underline_position = - PANGO2_SCALE;
if (hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_TAG_STRIKEOUT_SIZE, &position) && position != 0)
metrics->strikethrough_thickness = position;
else
- metrics->strikethrough_thickness = PANGO_SCALE;
+ metrics->strikethrough_thickness = PANGO2_SCALE;
if (hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_TAG_STRIKEOUT_OFFSET, &position) && position != 0)
metrics->strikethrough_position = position;
@@ -806,7 +806,7 @@ pango_hb_font_get_metrics (PangoFont *font,
if (self->approximate_char_width == 0 || self->approximate_char_lang != language)
{
- self->approximate_char_width = get_average_char_width (font, pango_language_get_sample_string (language));
+ self->approximate_char_width = get_average_char_width (font, pango2_language_get_sample_string (language));
self->approximate_char_lang = language;
}
@@ -820,10 +820,10 @@ pango_hb_font_get_metrics (PangoFont *font,
}
static hb_font_t *
-pango_hb_font_create_hb_font (PangoFont *font)
+pango2_hb_font_create_hb_font (Pango2Font *font)
{
- PangoHbFont *self = PANGO_HB_FONT (font);
- PangoHbFace *face = PANGO_HB_FACE (font->face);
+ Pango2HbFont *self = PANGO2_HB_FONT (font);
+ Pango2HbFace *face = PANGO2_HB_FACE (font->face);
hb_font_t *hb_font;
double x_scale, y_scale;
unsigned int n_axes;
@@ -831,23 +831,23 @@ pango_hb_font_create_hb_font (PangoFont *font)
float *coords;
int size;
- hb_font = hb_font_create (pango_hb_face_get_hb_face (face));
+ hb_font = hb_font_create (pango2_hb_face_get_hb_face (face));
size = font->size * font->dpi / 72.f;
x_scale = face->x_scale;
y_scale = face->y_scale;
- if (PANGO_GRAVITY_IS_IMPROPER (font->gravity))
+ if (PANGO2_GRAVITY_IS_IMPROPER (font->gravity))
{
x_scale = - x_scale;
y_scale = - y_scale;
}
hb_font_set_scale (hb_font, size * x_scale, size * y_scale);
- hb_font_set_ptem (hb_font, font->size / PANGO_SCALE);
+ hb_font_set_ptem (hb_font, font->size / PANGO2_SCALE);
#if HB_VERSION_ATLEAST (3, 3, 0)
- hb_font_set_synthetic_slant (hb_font, pango_matrix_get_slant_ratio (face->transform));
+ hb_font_set_synthetic_slant (hb_font, pango2_matrix_get_slant_ratio (face->transform));
#endif
if (face->instance_id >= 0)
@@ -879,37 +879,37 @@ pango_hb_font_create_hb_font (PangoFont *font)
}
static void
-pango_hb_font_get_transform (PangoFont *font,
- PangoMatrix *matrix)
+pango2_hb_font_get_transform (Pango2Font *font,
+ Pango2Matrix *matrix)
{
- PangoHbFace *face = PANGO_HB_FACE (font->face);
+ Pango2HbFace *face = PANGO2_HB_FACE (font->face);
if (face->transform)
{
*matrix = *face->transform;
- pango_matrix_scale (matrix, face->x_scale, face->y_scale);
+ pango2_matrix_scale (matrix, face->x_scale, face->y_scale);
}
else
- *matrix = (PangoMatrix) PANGO_MATRIX_INIT;
+ *matrix = (Pango2Matrix) PANGO2_MATRIX_INIT;
}
static void
-pango_hb_font_class_init (PangoHbFontClass *class)
+pango2_hb_font_class_init (Pango2HbFontClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontClass *font_class = PANGO_FONT_CLASS (class);
+ Pango2FontClass *font_class = PANGO2_FONT_CLASS (class);
- object_class->finalize = pango_hb_font_finalize;
- object_class->get_property = pango_hb_font_get_property;
+ object_class->finalize = pango2_hb_font_finalize;
+ object_class->get_property = pango2_hb_font_get_property;
- font_class->describe = pango_hb_font_describe;
- font_class->get_glyph_extents = pango_hb_font_get_glyph_extents;
- font_class->get_metrics = pango_hb_font_get_metrics;
- font_class->create_hb_font = pango_hb_font_create_hb_font;
- font_class->get_transform = pango_hb_font_get_transform;
+ font_class->describe = pango2_hb_font_describe;
+ font_class->get_glyph_extents = pango2_hb_font_get_glyph_extents;
+ font_class->get_metrics = pango2_hb_font_get_metrics;
+ font_class->create_hb_font = pango2_hb_font_create_hb_font;
+ font_class->get_transform = pango2_hb_font_get_transform;
/**
- * PangoHbFont:variations: (attributes org.gtk.Property.get=pango_hb_font_get_variations)
+ * Pango2HbFont:variations: (attributes org.gtk.Property.get=pango2_hb_font_get_variations)
*
* The variations that are applied for this font.
*
@@ -926,9 +926,9 @@ pango_hb_font_class_init (PangoHbFontClass *class)
/* {{{ Public API */
/**
- * pango_hb_font_new:
- * @face: the `PangoHbFace` to use
- * @size: the desired size in points, scaled by `PANGO_SCALE`
+ * pango2_hb_font_new:
+ * @face: the `Pango2HbFace` to use
+ * @size: the desired size in points, scaled by `PANGO2_SCALE`
* @features: (nullable) (array length=n_features): OpenType font features to use for this font
* @n_features: length of @features
* @variations: (nullable) (array length=n_variations): font variations to apply
@@ -937,37 +937,37 @@ pango_hb_font_class_init (PangoHbFontClass *class)
* @dpi: the dpi used when rendering
* @ctm: (nullable): transformation matrix to use when rendering
*
- * Creates a new `PangoHbFont`.
+ * Creates a new `Pango2HbFont`.
*
- * Returns: a newly created `PangoHbFont`
+ * Returns: a newly created `Pango2HbFont`
*/
-PangoHbFont *
-pango_hb_font_new (PangoHbFace *face,
- int size,
- hb_feature_t *features,
- unsigned int n_features,
- hb_variation_t *variations,
- unsigned int n_variations,
- PangoGravity gravity,
- float dpi,
- const PangoMatrix *ctm)
+Pango2HbFont *
+pango2_hb_font_new (Pango2HbFace *face,
+ int size,
+ hb_feature_t *features,
+ unsigned int n_features,
+ hb_variation_t *variations,
+ unsigned int n_variations,
+ Pango2Gravity gravity,
+ float dpi,
+ const Pango2Matrix *ctm)
{
- PangoHbFont *self;
- PangoFont *font;
+ Pango2HbFont *self;
+ Pango2Font *font;
- g_return_val_if_fail (PANGO_IS_HB_FACE (face), NULL);
+ g_return_val_if_fail (PANGO2_IS_HB_FACE (face), NULL);
g_return_val_if_fail (size > 0, NULL);
g_return_val_if_fail (dpi > 0, NULL);
- self = g_object_new (PANGO_TYPE_HB_FONT, NULL);
+ self = g_object_new (PANGO2_TYPE_HB_FONT, NULL);
- font = PANGO_FONT (self);
+ font = PANGO2_FONT (self);
- pango_font_set_face (font, PANGO_FONT_FACE (face));
- pango_font_set_size (font, size);
- pango_font_set_dpi (font, dpi);
- pango_font_set_gravity (font, gravity);
- pango_font_set_ctm (font, ctm);
+ pango2_font_set_face (font, PANGO2_FONT_FACE (face));
+ pango2_font_set_size (font, size);
+ pango2_font_set_dpi (font, dpi);
+ pango2_font_set_gravity (font, gravity);
+ pango2_font_set_ctm (font, ctm);
self->features = g_memdup2 (features, sizeof (hb_feature_t) * n_features);
self->n_features = n_features;
@@ -978,22 +978,22 @@ pango_hb_font_new (PangoHbFace *face,
}
/**
- * pango_hb_font_new_for_description:
- * @face: the `PangoHbFace` to use
- * @description: a `PangoFontDescription`
+ * pango2_hb_font_new_for_description:
+ * @face: the `Pango2HbFace` to use
+ * @description: a `Pango2FontDescription`
* @dpi: the dpi used when rendering
* @ctm: (nullable): transformation matrix to use when rendering
*
- * Creates a new `PangoHbFont` with size, features, variations and
+ * Creates a new `Pango2HbFont` with size, features, variations and
* gravity taken from a font description.
*
- * Returns: a newly created `PangoHbFont`
+ * Returns: a newly created `Pango2HbFont`
*/
-PangoHbFont *
-pango_hb_font_new_for_description (PangoHbFace *face,
- const PangoFontDescription *description,
- float dpi,
- const PangoMatrix *ctm)
+Pango2HbFont *
+pango2_hb_font_new_for_description (Pango2HbFace *face,
+ const Pango2FontDescription *description,
+ float dpi,
+ const Pango2Matrix *ctm)
{
int size;
hb_feature_t features[10];
@@ -1001,27 +1001,27 @@ pango_hb_font_new_for_description (PangoHbFace *face,
hb_variation_t *variations;
unsigned int n_variations;
unsigned int length;
- PangoGravity gravity;
+ Pango2Gravity gravity;
const char *str;
- g_return_val_if_fail (PANGO_IS_HB_FACE (face), NULL);
+ g_return_val_if_fail (PANGO2_IS_HB_FACE (face), NULL);
g_return_val_if_fail (description != NULL, NULL);
g_return_val_if_fail (dpi > 0, NULL);
- if ((pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_SIZE) == 0)
- size = 10 * PANGO_SCALE;
- else if (pango_font_description_get_size_is_absolute (description))
- size = pango_font_description_get_size (description) * 72. / dpi;
+ if ((pango2_font_description_get_set_fields (description) & PANGO2_FONT_MASK_SIZE) == 0)
+ size = 10 * PANGO2_SCALE;
+ else if (pango2_font_description_get_size_is_absolute (description))
+ size = pango2_font_description_get_size (description) * 72. / dpi;
else
- size = pango_font_description_get_size (description);
+ size = pango2_font_description_get_size (description);
g_return_val_if_fail (size > 0, NULL);
font_description_get_features (description, features, G_N_ELEMENTS (features), &n_features);
- if ((pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_VARIATIONS) != 0)
+ if ((pango2_font_description_get_set_fields (description) & PANGO2_FONT_MASK_VARIATIONS) != 0)
{
- str = pango_font_description_get_variations (description);
+ str = pango2_font_description_get_variations (description);
length = count_variations (str);
variations = g_alloca (sizeof (hb_variation_t) * length);
parse_variations (str, variations, length, &n_variations);
@@ -1032,18 +1032,18 @@ pango_hb_font_new_for_description (PangoHbFace *face,
n_variations = 0;
}
- if ((pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_GRAVITY) != 0 &&
- pango_font_description_get_gravity (description) != PANGO_GRAVITY_SOUTH)
- gravity = pango_font_description_get_gravity (description);
+ if ((pango2_font_description_get_set_fields (description) & PANGO2_FONT_MASK_GRAVITY) != 0 &&
+ pango2_font_description_get_gravity (description) != PANGO2_GRAVITY_SOUTH)
+ gravity = pango2_font_description_get_gravity (description);
else
- gravity = PANGO_GRAVITY_AUTO;
+ gravity = PANGO2_GRAVITY_AUTO;
- return pango_hb_font_new (face, size, features, n_features, variations, n_variations, gravity, dpi, ctm);
+ return pango2_hb_font_new (face, size, features, n_features, variations, n_variations, gravity, dpi, ctm);
}
/**
- * pango_hb_font_get_features:
- * @self: a `PangoFont`
+ * pango2_hb_font_get_features:
+ * @self: a `Pango2Font`
* @n_features: (nullable) (out caller-allocates): return location for
* the length of the returned array
*
@@ -1058,10 +1058,10 @@ pango_hb_font_new_for_description (PangoHbFace *face,
* Returns: (nullable) (transfer none): the features
*/
const hb_feature_t *
-pango_hb_font_get_features (PangoHbFont *self,
- unsigned int *n_features)
+pango2_hb_font_get_features (Pango2HbFont *self,
+ unsigned int *n_features)
{
- g_return_val_if_fail (PANGO_IS_HB_FONT (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_HB_FONT (self), NULL);
if (n_features)
*n_features = self->n_features;
@@ -1071,8 +1071,8 @@ pango_hb_font_get_features (PangoHbFont *self,
/**
- * pango_hb_font_get_variations:
- * @self: a `PangoHbFont`
+ * pango2_hb_font_get_variations:
+ * @self: a `Pango2HbFont`
* @n_variations: (nullable) (out caller-allocates): return location for
* the length of the returned array
*
@@ -1081,10 +1081,10 @@ pango_hb_font_get_features (PangoHbFont *self,
* Returns: (nullable) (transfer none): the variations
*/
const hb_variation_t *
-pango_hb_font_get_variations (PangoHbFont *self,
- unsigned int *n_variations)
+pango2_hb_font_get_variations (Pango2HbFont *self,
+ unsigned int *n_variations)
{
- g_return_val_if_fail (PANGO_IS_HB_FONT (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_HB_FONT (self), NULL);
if (n_variations)
*n_variations = self->n_variations;
diff --git a/pango/pango-hbfont.h b/pango/pango-hbfont.h
index ec9eac7c..26fd4d43 100644
--- a/pango/pango-hbfont.h
+++ b/pango/pango-hbfont.h
@@ -26,34 +26,34 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_HB_FONT (pango_hb_font_get_type ())
-
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoHbFont, pango_hb_font, PANGO, HB_FONT, PangoFont)
-
-PANGO_AVAILABLE_IN_ALL
-PangoHbFont * pango_hb_font_new (PangoHbFace *face,
- int size,
- hb_feature_t *features,
- unsigned int n_features,
- hb_variation_t *variations,
- unsigned int n_variations,
- PangoGravity gravity,
- float dpi,
- const PangoMatrix *ctm);
-
-PANGO_AVAILABLE_IN_ALL
-PangoHbFont * pango_hb_font_new_for_description (PangoHbFace *face,
- const PangoFontDescription *description,
- float dpi,
- const PangoMatrix *ctm);
-
-PANGO_AVAILABLE_IN_ALL
-const hb_feature_t * pango_hb_font_get_features (PangoHbFont *self,
- unsigned int *n_features);
-
-PANGO_AVAILABLE_IN_ALL
-const hb_variation_t * pango_hb_font_get_variations (PangoHbFont *self,
- unsigned int *n_variations);
+#define PANGO2_TYPE_HB_FONT (pango2_hb_font_get_type ())
+
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2HbFont, pango2_hb_font, PANGO2, HB_FONT, Pango2Font)
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2HbFont * pango2_hb_font_new (Pango2HbFace *face,
+ int size,
+ hb_feature_t *features,
+ unsigned int n_features,
+ hb_variation_t *variations,
+ unsigned int n_variations,
+ Pango2Gravity gravity,
+ float dpi,
+ const Pango2Matrix *ctm);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2HbFont * pango2_hb_font_new_for_description (Pango2HbFace *face,
+ const Pango2FontDescription *description,
+ float dpi,
+ const Pango2Matrix *ctm);
+
+PANGO2_AVAILABLE_IN_ALL
+const hb_feature_t * pango2_hb_font_get_features (Pango2HbFont *self,
+ unsigned int *n_features);
+
+PANGO2_AVAILABLE_IN_ALL
+const hb_variation_t * pango2_hb_font_get_variations (Pango2HbFont *self,
+ unsigned int *n_variations);
G_END_DECLS
diff --git a/pango/pango-impl-utils.h b/pango/pango-impl-utils.h
index c3ab531e..3723fcfb 100644
--- a/pango/pango-impl-utils.h
+++ b/pango/pango-impl-utils.h
@@ -36,21 +36,21 @@ G_BEGIN_DECLS
*/
static inline G_GNUC_UNUSED int
-pango_unichar_width (gunichar c)
+pango2_unichar_width (gunichar c)
{
return G_UNLIKELY (g_unichar_iszerowidth (c)) ? 0 :
- G_UNLIKELY (g_unichar_iswide (c)) ? 2 : 1;
+ G_UNLIKELY (g_unichar_iswide (c)) ? 2 : 1;
}
static G_GNUC_UNUSED glong
-pango_utf8_strwidth (const char *p)
+pango2_utf8_strwidth (const char *p)
{
glong len = 0;
g_return_val_if_fail (p != NULL, 0);
while (*p)
{
- len += pango_unichar_width (g_utf8_get_char (p));
+ len += pango2_unichar_width (g_utf8_get_char (p));
p = g_utf8_next_char (p);
}
@@ -60,7 +60,8 @@ pango_utf8_strwidth (const char *p)
/* Glib's g_utf8_strlen() is broken and stops at embedded NUL's.
* Wrap it here. */
static G_GNUC_UNUSED glong
-pango_utf8_strlen (const char *p, gssize max)
+pango2_utf8_strlen (const char *p,
+ gssize max)
{
glong len = 0;
const char *start = p;
@@ -89,14 +90,15 @@ pango_utf8_strlen (const char *p, gssize max)
/* To be made public at some point */
static G_GNUC_UNUSED void
-pango_glyph_string_reverse_range (PangoGlyphString *glyphs,
- int start, int end)
+pango2_glyph_string_reverse_range (Pango2GlyphString *glyphs,
+ int start,
+ int end)
{
int i, j;
for (i = start, j = end - 1; i < j; i++, j--)
{
- PangoGlyphInfo glyph_info;
+ Pango2GlyphInfo glyph_info;
int log_cluster;
glyph_info = glyphs->glyphs[i];
@@ -110,7 +112,7 @@ pango_glyph_string_reverse_range (PangoGlyphString *glyphs,
}
static inline gboolean
-pango_is_default_ignorable (gunichar ch)
+pango2_is_default_ignorable (gunichar ch)
{
int plane = ch >> 16;
@@ -145,7 +147,7 @@ pango_is_default_ignorable (gunichar ch)
}
/* These are the default ignorables that we render as hexboxes
- * with nicks if PANGO_SHOW_IGNORABLES is used.
+ * with nicks if PANGO2_SHOW_IGNORABLES is used.
*
* The cairo hexbox drawing code assumes that these nicks are
* 1-6 ASCII chars
@@ -181,7 +183,7 @@ static struct {
};
static inline G_GNUC_UNUSED const char *
-pango_get_ignorable (gunichar ch)
+pango2_get_ignorable (gunichar ch)
{
for (guint i = 0; i < G_N_ELEMENTS (ignorables); i++)
{
@@ -196,14 +198,14 @@ pango_get_ignorable (gunichar ch)
}
static inline G_GNUC_UNUSED const char *
-pango_get_ignorable_size (gunichar ch,
- int *rows,
- int *cols)
+pango2_get_ignorable_size (gunichar ch,
+ int *rows,
+ int *cols)
{
const char *nick;
int len;
- nick = pango_get_ignorable (ch);
+ nick = pango2_get_ignorable (ch);
if (nick)
{
len = strlen (nick);
diff --git a/pango/pango-item-private.h b/pango/pango-item-private.h
index e46948c6..da7d8ae4 100644
--- a/pango/pango-item-private.h
+++ b/pango/pango-item-private.h
@@ -23,98 +23,98 @@
#include <pango/pango-break.h>
/*< private >
- * PangoAnalysis:
+ * Pango2Analysis:
* @size_font: font to use for determining line height
* @font: the font for this segment
* @level: the bidirectional level for this segment.
- * @gravity: the glyph orientation for this segment (A `PangoGravity`).
+ * @gravity: the glyph orientation for this segment (A `Pango2Gravity`).
* @flags: boolean flags for this segment
- * @script: the detected script for this segment (A `PangoScript`)
+ * @script: the detected script for this segment (A `Pango2Script`)
* @language: the detected language for this segment.
* @extra_attrs: extra attributes for this segment.
*
- * The `PangoAnalysis` structure stores information about
+ * The `Pango2Analysis` structure stores information about
* the properties of a segment of text.
*/
-struct _PangoAnalysis
+struct _Pango2Analysis
{
- PangoFont *size_font;
- PangoFont *font;
+ Pango2Font *size_font;
+ Pango2Font *font;
guint8 level;
guint8 gravity;
guint8 flags;
guint8 script;
- PangoLanguage *language;
+ Pango2Language *language;
GSList *extra_attrs;
};
/*< private>
- * PangoItem:
+ * Pango2Item:
* @offset: byte offset of the start of this item in text.
* @length: length of this item in bytes.
* @num_chars: number of Unicode characters in the item.
* @char_offset: character offset of the start of this item in text. Since 1.50
* @analysis: analysis results for the item.
*
- * The `PangoItem` structure stores information about a segment of text.
+ * The `Pango2Item` structure stores information about a segment of text.
*
- * You typically obtain `PangoItems` by itemizing a piece of text
+ * You typically obtain `Pango2Items` by itemizing a piece of text
* with [func@itemize].
*/
-struct _PangoItem
+struct _Pango2Item
{
int offset;
int length;
int num_chars;
int char_offset;
- PangoAnalysis analysis;
+ Pango2Analysis analysis;
};
-void pango_analysis_collect_features (const PangoAnalysis *analysis,
- hb_feature_t *features,
- guint length,
- guint *num_features);
-
-void pango_analysis_set_size_font (PangoAnalysis *analysis,
- PangoFont *font);
-PangoFont * pango_analysis_get_size_font (const PangoAnalysis *analysis);
-
-GList * pango_itemize_with_font (PangoContext *context,
- PangoDirection base_dir,
- const char *text,
- int start_index,
- int length,
- PangoAttrList *attrs,
- PangoAttrIterator *cached_iter,
- const PangoFontDescription *desc);
-
-GList * pango_itemize_post_process_items (PangoContext *context,
- const char *text,
- PangoLogAttr *log_attrs,
- GList *items);
-
-PangoItem * pango_item_new (void);
-PangoItem * pango_item_split (PangoItem *orig,
- int split_index,
- int split_offset);
-void pango_item_unsplit (PangoItem *orig,
- int split_index,
- int split_offset);
-void pango_item_apply_attrs (PangoItem *item,
- PangoAttrIterator *iter);
+void pango2_analysis_collect_features (const Pango2Analysis *analysis,
+ hb_feature_t *features,
+ guint length,
+ guint *num_features);
+
+void pango2_analysis_set_size_font (Pango2Analysis *analysis,
+ Pango2Font *font);
+Pango2Font * pango2_analysis_get_size_font (const Pango2Analysis *analysis);
+
+GList * pango2_itemize_with_font (Pango2Context *context,
+ Pango2Direction base_dir,
+ const char *text,
+ int start_index,
+ int length,
+ Pango2AttrList *attrs,
+ Pango2AttrIterator *cached_iter,
+ const Pango2FontDescription *desc);
+
+GList * pango2_itemize_post_process_items (Pango2Context *context,
+ const char *text,
+ Pango2LogAttr *log_attrs,
+ GList *items);
+
+Pango2Item * pango2_item_new (void);
+Pango2Item * pango2_item_split (Pango2Item *orig,
+ int split_index,
+ int split_offset);
+void pango2_item_unsplit (Pango2Item *orig,
+ int split_index,
+ int split_offset);
+void pango2_item_apply_attrs (Pango2Item *item,
+ Pango2AttrIterator *iter);
typedef struct _ItemProperties ItemProperties;
struct _ItemProperties
{
- PangoLineStyle uline_style;
- PangoUnderlinePosition uline_position;
- PangoLineStyle strikethrough_style;
- PangoLineStyle oline_style;
+ Pango2LineStyle uline_style;
+ Pango2UnderlinePosition uline_position;
+ Pango2LineStyle strikethrough_style;
+ Pango2LineStyle oline_style;
guint oline_single : 1;
guint showing_space : 1;
guint no_paragraph_break : 1;
@@ -122,8 +122,8 @@ struct _ItemProperties
int line_spacing;
int absolute_line_height;
double line_height;
- PangoAttribute *shape;
+ Pango2Attribute *shape;
};
-void pango_item_get_properties (PangoItem *item,
+void pango2_item_get_properties (Pango2Item *item,
ItemProperties *properties);
diff --git a/pango/pango-item.c b/pango/pango-item.c
index 3c878b4d..97b0a2b9 100644
--- a/pango/pango-item.c
+++ b/pango/pango-item.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-item.c: Single run handling
*
* Copyright (C) 2000 Red Hat Software
@@ -26,56 +26,56 @@
#include "pango-impl-utils.h"
/**
- * PangoAnalysis:
+ * Pango2Analysis:
*
- * The `PangoAnalysis` structure stores information about
+ * The `Pango2Analysis` structure stores information about
* the properties of a segment of text.
*/
/**
- * PangoItem:
+ * Pango2Item:
*
- * The `PangoItem` structure stores information about
+ * The `Pango2Item` structure stores information about
* a segment of text.
*
- * You typically obtain `PangoItems` by itemizing a piece
- * of text with [func@Pango.itemize].
+ * You typically obtain `Pango2Items` by itemizing a piece
+ * of text with [func@Pango2.itemize].
*/
/**
- * pango_item_new:
+ * pango2_item_new:
*
- * Creates a new `PangoItem` structure initialized to default values.
+ * Creates a new `Pango2Item` structure initialized to default values.
*
- * Return value: the newly allocated `PangoItem`, which should
- * be freed with [method@Pango.Item.free].
+ * Return value: the newly allocated `Pango2Item`, which should
+ * be freed with [method@Pango2.Item.free].
*/
-PangoItem *
-pango_item_new (void)
+Pango2Item *
+pango2_item_new (void)
{
- PangoItem *result = g_slice_new0 (PangoItem);
+ Pango2Item *result = g_slice_new0 (Pango2Item);
- return (PangoItem *)result;
+ return (Pango2Item *)result;
}
/**
- * pango_item_copy:
- * @item: (nullable): a `PangoItem`
+ * pango2_item_copy:
+ * @item: (nullable): a `Pango2Item`
*
- * Copy an existing `PangoItem` structure.
+ * Copy an existing `Pango2Item` structure.
*
- * Return value: (nullable): the newly allocated `PangoItem`
+ * Return value: (nullable): the newly allocated `Pango2Item`
*/
-PangoItem *
-pango_item_copy (PangoItem *item)
+Pango2Item *
+pango2_item_copy (Pango2Item *item)
{
GSList *extra_attrs, *tmp_list;
- PangoItem *result;
+ Pango2Item *result;
if (item == NULL)
return NULL;
- result = pango_item_new ();
+ result = pango2_item_new ();
result->offset = item->offset;
result->length = item->length;
@@ -93,7 +93,7 @@ pango_item_copy (PangoItem *item)
tmp_list = item->analysis.extra_attrs;
while (tmp_list)
{
- extra_attrs = g_slist_prepend (extra_attrs, pango_attribute_copy (tmp_list->data));
+ extra_attrs = g_slist_prepend (extra_attrs, pango2_attribute_copy (tmp_list->data));
tmp_list = tmp_list->next;
}
@@ -103,20 +103,20 @@ pango_item_copy (PangoItem *item)
}
/**
- * pango_item_free:
- * @item: (nullable): a `PangoItem`, may be %NULL
+ * pango2_item_free:
+ * @item: (nullable): a `Pango2Item`, may be %NULL
*
- * Free a `PangoItem` and all associated memory.
+ * Free a `Pango2Item` and all associated memory.
**/
void
-pango_item_free (PangoItem *item)
+pango2_item_free (Pango2Item *item)
{
if (item == NULL)
return;
if (item->analysis.extra_attrs)
{
- g_slist_foreach (item->analysis.extra_attrs, (GFunc)pango_attribute_destroy, NULL);
+ g_slist_foreach (item->analysis.extra_attrs, (GFunc)pango2_attribute_destroy, NULL);
g_slist_free (item->analysis.extra_attrs);
}
@@ -126,16 +126,16 @@ pango_item_free (PangoItem *item)
if (item->analysis.font)
g_object_unref (item->analysis.font);
- g_slice_free (PangoItem, item);
+ g_slice_free (Pango2Item, item);
}
-G_DEFINE_BOXED_TYPE (PangoItem, pango_item,
- pango_item_copy,
- pango_item_free);
+G_DEFINE_BOXED_TYPE (Pango2Item, pango2_item,
+ pango2_item_copy,
+ pango2_item_free);
/**
- * pango_item_split:
- * @orig: a `PangoItem`
+ * pango2_item_split:
+ * @orig: a `Pango2Item`
* @split_index: byte index of position to split item, relative to the
* start of the item
* @split_offset: number of chars between start of @orig and @split_index
@@ -150,18 +150,18 @@ G_DEFINE_BOXED_TYPE (PangoItem, pango_item,
* assigned to each item, you can't create a zero-length item).
* @split_offset is the length of the first item in chars, and must be
* provided because the text used to generate the item isn't available,
- * so `pango_item_split()` can't count the char length of the split items
+ * so `pango2_item_split()` can't count the char length of the split items
* itself.
*
* Return value: new item representing text before @split_index, which
- * should be freed with [method@Pango.Item.free].
+ * should be freed with [method@Pango2.Item.free].
*/
-PangoItem *
-pango_item_split (PangoItem *orig,
- int split_index,
- int split_offset)
+Pango2Item *
+pango2_item_split (Pango2Item *orig,
+ int split_index,
+ int split_offset)
{
- PangoItem *new_item;
+ Pango2Item *new_item;
g_return_val_if_fail (orig != NULL, NULL);
g_return_val_if_fail (split_index > 0, NULL);
@@ -169,7 +169,7 @@ pango_item_split (PangoItem *orig,
g_return_val_if_fail (split_offset > 0, NULL);
g_return_val_if_fail (split_offset < orig->num_chars, NULL);
- new_item = pango_item_copy (orig);
+ new_item = pango2_item_copy (orig);
new_item->length = split_index;
new_item->num_chars = split_offset;
@@ -182,21 +182,21 @@ pango_item_split (PangoItem *orig,
}
/*< private >
- * pango_item_unsplit:
+ * pango2_item_unsplit:
* @orig: the item to unsplit
- * @split_index: value passed to pango_item_split()
- * @split_offset: value passed to pango_item_split()
+ * @split_index: value passed to pango2_item_split()
+ * @split_offset: value passed to pango2_item_split()
*
- * Undoes the effect of a pango_item_split() call with
+ * Undoes the effect of a pango2_item_split() call with
* the same arguments.
*
* You are expected to free the new item that was returned
- * by pango_item_split() yourself.
+ * by pango2_item_split() yourself.
*/
void
-pango_item_unsplit (PangoItem *orig,
- int split_index,
- int split_offset)
+pango2_item_unsplit (Pango2Item *orig,
+ int split_index,
+ int split_offset)
{
orig->offset -= split_index;
orig->length += split_index;
@@ -207,9 +207,9 @@ pango_item_unsplit (PangoItem *orig,
static int
compare_attr (gconstpointer p1, gconstpointer p2)
{
- const PangoAttribute *a1 = p1;
- const PangoAttribute *a2 = p2;
- if (pango_attribute_equal (a1, a2) &&
+ const Pango2Attribute *a1 = p1;
+ const Pango2Attribute *a2 = p2;
+ if (pango2_attribute_equal (a1, a2) &&
a1->start_index == a2->start_index &&
a1->end_index == a2->end_index)
return 0;
@@ -218,15 +218,15 @@ compare_attr (gconstpointer p1, gconstpointer p2)
}
/**
- * pango_item_apply_attrs:
- * @item: a `PangoItem`
- * @iter: a `PangoAttrIterator`
+ * pango2_item_apply_attrs:
+ * @item: a `Pango2Item`
+ * @iter: a `Pango2AttrIterator`
*
- * Add attributes to a `PangoItem`.
+ * Add attributes to a `Pango2Item`.
*
* The idea is that you have attributes that don't affect itemization,
* such as font features, so you filter them out using
- * [method@Pango.AttrList.filter], itemize your text, then reapply the
+ * [method@Pango2.AttrList.filter], itemize your text, then reapply the
* attributes to the resulting items using this function.
*
* The @iter should be positioned before the range of the item,
@@ -235,15 +235,15 @@ compare_attr (gconstpointer p1, gconstpointer p2)
* the iter to each call.
*/
void
-pango_item_apply_attrs (PangoItem *item,
- PangoAttrIterator *iter)
+pango2_item_apply_attrs (Pango2Item *item,
+ Pango2AttrIterator *iter)
{
int start, end;
GSList *attrs = NULL;
do
{
- pango_attr_iterator_range (iter, &start, &end);
+ pango2_attr_iterator_range (iter, &start, &end);
if (start >= item->offset + item->length)
break;
@@ -252,47 +252,47 @@ pango_item_apply_attrs (PangoItem *item,
{
GSList *list, *l;
- list = pango_attr_iterator_get_attrs (iter);
+ list = pango2_attr_iterator_get_attrs (iter);
for (l = list; l; l = l->next)
{
if (!g_slist_find_custom (attrs, l->data, compare_attr))
- attrs = g_slist_prepend (attrs, pango_attribute_copy (l->data));
+ attrs = g_slist_prepend (attrs, pango2_attribute_copy (l->data));
}
- g_slist_free_full (list, (GDestroyNotify)pango_attribute_destroy);
+ g_slist_free_full (list, (GDestroyNotify)pango2_attribute_destroy);
}
if (end >= item->offset + item->length)
break;
}
- while (pango_attr_iterator_next (iter));
+ while (pango2_attr_iterator_next (iter));
item->analysis.extra_attrs = g_slist_concat (item->analysis.extra_attrs, attrs);
}
void
-pango_analysis_collect_features (const PangoAnalysis *analysis,
- hb_feature_t *features,
- guint length,
- guint *num_features)
+pango2_analysis_collect_features (const Pango2Analysis *analysis,
+ hb_feature_t *features,
+ guint length,
+ guint *num_features)
{
GSList *l;
- if (PANGO_IS_HB_FONT (analysis->font))
+ if (PANGO2_IS_HB_FONT (analysis->font))
{
const hb_feature_t *font_features;
guint n_font_features;
- font_features = pango_hb_font_get_features (PANGO_HB_FONT (analysis->font),
- &n_font_features);
+ font_features = pango2_hb_font_get_features (PANGO2_HB_FONT (analysis->font),
+ &n_font_features);
*num_features = MIN (length, n_font_features);
memcpy (features, font_features, sizeof (hb_feature_t) * *num_features);
}
for (l = analysis->extra_attrs; l && *num_features < length; l = l->next)
{
- PangoAttribute *attr = l->data;
- if (attr->type == PANGO_ATTR_FONT_FEATURES)
+ Pango2Attribute *attr = l->data;
+ if (attr->type == PANGO2_ATTR_FONT_FEATURES)
{
const char *feat;
const char *end;
@@ -325,8 +325,8 @@ pango_analysis_collect_features (const PangoAnalysis *analysis,
/* Turn off ligatures when letterspacing */
for (l = analysis->extra_attrs; l && *num_features < length; l = l->next)
{
- PangoAttribute *attr = l->data;
- if (attr->type == PANGO_ATTR_LETTER_SPACING)
+ Pango2Attribute *attr = l->data;
+ if (attr->type == PANGO2_ATTR_LETTER_SPACING)
{
hb_tag_t tags[] = {
HB_TAG('l','i','g','a'),
@@ -348,9 +348,9 @@ pango_analysis_collect_features (const PangoAnalysis *analysis,
}
/*< private >
- * pango_analysis_set_size_font:
- * @analysis: a `PangoAnalysis`
- * @font: a `PangoFont`
+ * pango2_analysis_set_size_font:
+ * @analysis: a `Pango2Analysis`
+ * @font: a `Pango2Font`
*
* Sets the font to use for determining the line height.
*
@@ -358,8 +358,8 @@ pango_analysis_collect_features (const PangoAnalysis *analysis,
* to preserve the original line height.
*/
void
-pango_analysis_set_size_font (PangoAnalysis *analysis,
- PangoFont *font)
+pango2_analysis_set_size_font (Pango2Analysis *analysis,
+ Pango2Font *font)
{
if (analysis->size_font)
g_object_unref (analysis->size_font);
@@ -369,8 +369,8 @@ pango_analysis_set_size_font (PangoAnalysis *analysis,
}
/*< private >
- * pango_analysis_get_size_font:
- * @analysis: a `PangoAnalysis`
+ * pango2_analysis_get_size_font:
+ * @analysis: a `Pango2Analysis`
*
* Gets the font to use for determining line height.
*
@@ -378,15 +378,15 @@ pango_analysis_set_size_font (PangoAnalysis *analysis,
*
* Returns: (nullable) (transfer none): the font
*/
-PangoFont *
-pango_analysis_get_size_font (const PangoAnalysis *analysis)
+Pango2Font *
+pango2_analysis_get_size_font (const Pango2Analysis *analysis)
{
return analysis->size_font;
}
/*< private >
- * pango_item_get_properties:
- * @item: a `PangoItem`
+ * pango2_item_get_properties:
+ * @item: a `Pango2Item`
* @properties: `ItemProperties` struct to populate
*
* Extract useful information from the @item's attributes.
@@ -396,15 +396,15 @@ pango_analysis_get_size_font (const PangoAnalysis *analysis)
* an item, so we collect all the values that we find.
*/
void
-pango_item_get_properties (PangoItem *item,
- ItemProperties *properties)
+pango2_item_get_properties (Pango2Item *item,
+ ItemProperties *properties)
{
GSList *tmp_list = item->analysis.extra_attrs;
- properties->uline_style = PANGO_LINE_STYLE_NONE;
- properties->uline_position = PANGO_UNDERLINE_POSITION_NORMAL;
- properties->oline_style = PANGO_LINE_STYLE_NONE;
- properties->strikethrough_style = PANGO_LINE_STYLE_NONE;
+ properties->uline_style = PANGO2_LINE_STYLE_NONE;
+ properties->uline_position = PANGO2_UNDERLINE_POSITION_NORMAL;
+ properties->oline_style = PANGO2_LINE_STYLE_NONE;
+ properties->strikethrough_style = PANGO2_LINE_STYLE_NONE;
properties->showing_space = FALSE;
properties->no_paragraph_break = FALSE;
properties->letter_spacing = 0;
@@ -415,51 +415,51 @@ pango_item_get_properties (PangoItem *item,
while (tmp_list)
{
- PangoAttribute *attr = tmp_list->data;
+ Pango2Attribute *attr = tmp_list->data;
switch ((int) attr->type)
{
- case PANGO_ATTR_UNDERLINE:
+ case PANGO2_ATTR_UNDERLINE:
properties->uline_style = attr->int_value;
break;
- case PANGO_ATTR_UNDERLINE_POSITION:
+ case PANGO2_ATTR_UNDERLINE_POSITION:
properties->uline_position = attr->int_value;
break;
- case PANGO_ATTR_OVERLINE:
+ case PANGO2_ATTR_OVERLINE:
properties->oline_style = attr->int_value;
break;
- case PANGO_ATTR_STRIKETHROUGH:
+ case PANGO2_ATTR_STRIKETHROUGH:
properties->strikethrough_style = attr->int_value;
break;
- case PANGO_ATTR_LETTER_SPACING:
+ case PANGO2_ATTR_LETTER_SPACING:
properties->letter_spacing = attr->int_value;
break;
- case PANGO_ATTR_LINE_HEIGHT:
+ case PANGO2_ATTR_LINE_HEIGHT:
properties->line_height = attr->double_value;
break;
- case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT:
+ case PANGO2_ATTR_ABSOLUTE_LINE_HEIGHT:
properties->absolute_line_height = attr->int_value;
break;
- case PANGO_ATTR_LINE_SPACING:
+ case PANGO2_ATTR_LINE_SPACING:
properties->line_spacing = attr->int_value;
break;
- case PANGO_ATTR_SHOW:
- properties->showing_space = (attr->int_value & PANGO_SHOW_SPACES) != 0;
+ case PANGO2_ATTR_SHOW:
+ properties->showing_space = (attr->int_value & PANGO2_SHOW_SPACES) != 0;
break;
- case PANGO_ATTR_PARAGRAPH:
+ case PANGO2_ATTR_PARAGRAPH:
properties->no_paragraph_break = TRUE;
break;
- case PANGO_ATTR_SHAPE:
+ case PANGO2_ATTR_SHAPE:
properties->shape = attr;
break;
@@ -471,129 +471,129 @@ pango_item_get_properties (PangoItem *item,
}
/**
- * pango_analysis_get_font:
- * @analysis: a `PangoAnalysis`
+ * pango2_analysis_get_font:
+ * @analysis: a `Pango2Analysis`
*
* Returns the font that will be used for text
- * with this `PangoAnalysis`.
+ * with this `Pango2Analysis`.
*
- * Return value: (transfer none): the `PangoFont`
+ * Return value: (transfer none): the `Pango2Font`
*/
-PangoFont *
-pango_analysis_get_font (const PangoAnalysis *analysis)
+Pango2Font *
+pango2_analysis_get_font (const Pango2Analysis *analysis)
{
return analysis->font;
}
/**
- * pango_analysis_get_bidi_level:
- * @analysis: a `PangoAnalysis`
+ * pango2_analysis_get_bidi_level:
+ * @analysis: a `Pango2Analysis`
*
* Returns the bidi embedding level for text
- * with this `PangoAnalysis`.
+ * with this `Pango2Analysis`.
*
* Return value: the bidi embedding level
*/
int
-pango_analysis_get_bidi_level (const PangoAnalysis *analysis)
+pango2_analysis_get_bidi_level (const Pango2Analysis *analysis)
{
return analysis->level;
}
/**
- * pango_analysis_get_gravity:
- * @analysis: a `PangoAnalysis`
+ * pango2_analysis_get_gravity:
+ * @analysis: a `Pango2Analysis`
*
- * Returns the gravity for text with this `PangoAnalysis`.
+ * Returns the gravity for text with this `Pango2Analysis`.
*
* Return value: the gravity
*/
-PangoGravity
-pango_analysis_get_gravity (const PangoAnalysis *analysis)
+Pango2Gravity
+pango2_analysis_get_gravity (const Pango2Analysis *analysis)
{
- return (PangoGravity) analysis->gravity;
+ return (Pango2Gravity) analysis->gravity;
}
/**
- * pango_analysis_get_flags:
- * @analysis: a `PangoAnalysis`
+ * pango2_analysis_get_flags:
+ * @analysis: a `Pango2Analysis`
*
- * Returns flags for this `PangoAnalysis`.
+ * Returns flags for this `Pango2Analysis`.
*
* Possible flag values are
- * `PANGO_ANALYSIS_FLAG_CENTERED_BASELINE`,
- * `PANGO_ANALYSIS_FLAG_IS_ELLIPSIS` and
- * `PANGO_ANALYSIS_FLAG_NEED_HYPHEN`.
+ * `PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE`,
+ * `PANGO2_ANALYSIS_FLAG_IS_ELLIPSIS` and
+ * `PANGO2_ANALYSIS_FLAG_NEED_HYPHEN`.
*
* Return value: the flags
*/
guint
-pango_analysis_get_flags (const PangoAnalysis *analysis)
+pango2_analysis_get_flags (const Pango2Analysis *analysis)
{
return analysis->flags;
}
/**
- * pango_analysis_get_script:
- * @analysis: a `PangoAnalysis`
+ * pango2_analysis_get_script:
+ * @analysis: a `Pango2Analysis`
*
- * Returns the script for text with this `PangoAnalysis`.
+ * Returns the script for text with this `Pango2Analysis`.
*
* Return value: the script
*/
GUnicodeScript
-pango_analysis_get_script (const PangoAnalysis *analysis)
+pango2_analysis_get_script (const Pango2Analysis *analysis)
{
return (GUnicodeScript) analysis->script;
}
/**
- * pango_analysis_get_language:
- * @analysis: a `PangoAnalysis`
+ * pango2_analysis_get_language:
+ * @analysis: a `Pango2Analysis`
*
- * Returns the language for text with this `PangoAnalysis`.
+ * Returns the language for text with this `Pango2Analysis`.
*
* Return value: the script
*/
-PangoLanguage *
-pango_analysis_get_language (const PangoAnalysis *analysis)
+Pango2Language *
+pango2_analysis_get_language (const Pango2Analysis *analysis)
{
return analysis->language;
}
/**
- * pango_analysis_get_extra_attributes:
- * @analysis: a `PangoAnalysis`
+ * pango2_analysis_get_extra_attributes:
+ * @analysis: a `Pango2Analysis`
*
* Returns attributes to apply to text with this
- * `PangoAnalysis`.
+ * `Pango2Analysis`.
*
- * Return value: (transfer none) (element-type PangoAttribute):
- * a `GSList` with `PangoAttribute` values
+ * Return value: (transfer none) (element-type Pango2Attribute):
+ * a `GSList` with `Pango2Attribute` values
*/
GSList *
-pango_analysis_get_extra_attributes (const PangoAnalysis *analysis)
+pango2_analysis_get_extra_attributes (const Pango2Analysis *analysis)
{
return analysis->extra_attrs;
}
/**
- * pango_item_get_analysis:
- * @item: a `PangoItem`
+ * pango2_item_get_analysis:
+ * @item: a `Pango2Item`
*
- * Returns the `PangoAnalysis` of @item.
+ * Returns the `Pango2Analysis` of @item.
*
- * Return value: (transfer none): a `PangoAnalysis`
+ * Return value: (transfer none): a `Pango2Analysis`
*/
-const PangoAnalysis *
-pango_item_get_analysis (PangoItem *item)
+const Pango2Analysis *
+pango2_item_get_analysis (Pango2Item *item)
{
return &item->analysis;
}
/**
- * pango_item_get_byte_offset:
- * @item: a `PangoItem`
+ * pango2_item_get_byte_offset:
+ * @item: a `Pango2Item`
*
* Returns the byte offset of this items
* text in the overall paragraph text.
@@ -601,14 +601,14 @@ pango_item_get_analysis (PangoItem *item)
* Return value: the byte offset
*/
int
-pango_item_get_byte_offset (PangoItem *item)
+pango2_item_get_byte_offset (Pango2Item *item)
{
return item->offset;
}
/**
- * pango_item_get_byte_length:
- * @item: a `PangoItem`
+ * pango2_item_get_byte_length:
+ * @item: a `Pango2Item`
*
* Returns the length of this items
* text in bytes.
@@ -616,14 +616,14 @@ pango_item_get_byte_offset (PangoItem *item)
* Return value: the length of @item
*/
int
-pango_item_get_byte_length (PangoItem *item)
+pango2_item_get_byte_length (Pango2Item *item)
{
return item->length;
}
/**
- * pango_item_get_char_offset:
- * @item: a `PangoItem`
+ * pango2_item_get_char_offset:
+ * @item: a `Pango2Item`
*
* Returns the offset of this items text
* in the overall paragraph text, in characters.
@@ -631,14 +631,14 @@ pango_item_get_byte_length (PangoItem *item)
* Returns value: the character offset
*/
int
-pango_item_get_char_offset (PangoItem *item)
+pango2_item_get_char_offset (Pango2Item *item)
{
return item->char_offset;
}
/**
- * pango_item_get_char_length:
- * @item: a `PangoItem`
+ * pango2_item_get_char_length:
+ * @item: a `Pango2Item`
*
* Returns the number of characters in this
* items text.
@@ -646,7 +646,7 @@ pango_item_get_char_offset (PangoItem *item)
* Return value: the number of characters in @item
*/
int
-pango_item_get_char_length (PangoItem *item)
+pango2_item_get_char_length (Pango2Item *item)
{
return item->num_chars;
}
diff --git a/pango/pango-item.h b/pango/pango-item.h
index fe6f0a1b..09b8e76c 100644
--- a/pango/pango-item.h
+++ b/pango/pango-item.h
@@ -25,75 +25,75 @@
G_BEGIN_DECLS
-typedef struct _PangoAnalysis PangoAnalysis;
-typedef struct _PangoItem PangoItem;
+typedef struct _Pango2Analysis Pango2Analysis;
+typedef struct _Pango2Item Pango2Item;
/**
- * PANGO_ANALYSIS_FLAG_CENTERED_BASELINE:
+ * PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE:
*
* Whether the segment should be shifted to center around the baseline.
*
* This is mainly used in vertical writing directions.
*/
-#define PANGO_ANALYSIS_FLAG_CENTERED_BASELINE (1 << 0)
+#define PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE (1 << 0)
/**
- * PANGO_ANALYSIS_FLAG_IS_ELLIPSIS:
+ * PANGO2_ANALYSIS_FLAG_IS_ELLIPSIS:
*
* Whether this run holds ellipsized text.
*/
-#define PANGO_ANALYSIS_FLAG_IS_ELLIPSIS (1 << 1)
+#define PANGO2_ANALYSIS_FLAG_IS_ELLIPSIS (1 << 1)
/**
- * PANGO_ANALYSIS_FLAG_NEED_HYPHEN:
+ * PANGO2_ANALYSIS_FLAG_NEED_HYPHEN:
*
* Whether to add a hyphen at the end of the run during shaping.
*/
-#define PANGO_ANALYSIS_FLAG_NEED_HYPHEN (1 << 2)
+#define PANGO2_ANALYSIS_FLAG_NEED_HYPHEN (1 << 2)
-#define PANGO_TYPE_ITEM (pango_item_get_type ())
+#define PANGO2_TYPE_ITEM (pango2_item_get_type ())
-PANGO_AVAILABLE_IN_ALL
-GType pango_item_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_item_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoItem * pango_item_copy (PangoItem *item);
-PANGO_AVAILABLE_IN_ALL
-void pango_item_free (PangoItem *item);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Item * pango2_item_copy (Pango2Item *item);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_item_free (Pango2Item *item);
-PANGO_AVAILABLE_IN_ALL
-GList * pango_itemize (PangoContext *context,
- PangoDirection base_dir,
- const char *text,
- int start_index,
- int length,
- PangoAttrList *attrs);
+PANGO2_AVAILABLE_IN_ALL
+GList * pango2_itemize (Pango2Context *context,
+ Pango2Direction base_dir,
+ const char *text,
+ int start_index,
+ int length,
+ Pango2AttrList *attrs);
-PANGO_AVAILABLE_IN_ALL
-PangoFont * pango_analysis_get_font (const PangoAnalysis *analysis);
-PANGO_AVAILABLE_IN_ALL
-int pango_analysis_get_bidi_level (const PangoAnalysis *analysis);
-PANGO_AVAILABLE_IN_ALL
-PangoGravity pango_analysis_get_gravity (const PangoAnalysis *analysis);
-PANGO_AVAILABLE_IN_ALL
-guint pango_analysis_get_flags (const PangoAnalysis *analysis);
-PANGO_AVAILABLE_IN_ALL
-GUnicodeScript pango_analysis_get_script (const PangoAnalysis *analysis);
-PANGO_AVAILABLE_IN_ALL
-PangoLanguage * pango_analysis_get_language (const PangoAnalysis *analysis);
-PANGO_AVAILABLE_IN_ALL
-GSList * pango_analysis_get_extra_attributes (const PangoAnalysis *analysis);
-PANGO_AVAILABLE_IN_ALL
-const PangoAnalysis * pango_item_get_analysis (PangoItem *item);
-PANGO_AVAILABLE_IN_ALL
-int pango_item_get_byte_offset (PangoItem *item);
-PANGO_AVAILABLE_IN_ALL
-int pango_item_get_byte_length (PangoItem *item);
-PANGO_AVAILABLE_IN_ALL
-int pango_item_get_char_offset (PangoItem *item);
-PANGO_AVAILABLE_IN_ALL
-int pango_item_get_char_length (PangoItem *item);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Font * pango2_analysis_get_font (const Pango2Analysis *analysis);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_analysis_get_bidi_level (const Pango2Analysis *analysis);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Gravity pango2_analysis_get_gravity (const Pango2Analysis *analysis);
+PANGO2_AVAILABLE_IN_ALL
+guint pango2_analysis_get_flags (const Pango2Analysis *analysis);
+PANGO2_AVAILABLE_IN_ALL
+GUnicodeScript pango2_analysis_get_script (const Pango2Analysis *analysis);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Language * pango2_analysis_get_language (const Pango2Analysis *analysis);
+PANGO2_AVAILABLE_IN_ALL
+GSList * pango2_analysis_get_extra_attributes (const Pango2Analysis *analysis);
+PANGO2_AVAILABLE_IN_ALL
+const Pango2Analysis * pango2_item_get_analysis (Pango2Item *item);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_item_get_byte_offset (Pango2Item *item);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_item_get_byte_length (Pango2Item *item);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_item_get_char_offset (Pango2Item *item);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_item_get_char_length (Pango2Item *item);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoItem, pango_item_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2Item, pango2_item_free)
G_END_DECLS
diff --git a/pango/pango-language-sample-table.h b/pango/pango-language-sample-table.h
index e92427ba..59513209 100644
--- a/pango/pango-language-sample-table.h
+++ b/pango/pango-language-sample-table.h
@@ -1,4 +1,4 @@
-/* Pango Language Sample Table
+/* Pango2 Language Sample Table
*
* Each entry is of the form:
*
diff --git a/pango/pango-language-set-private.h b/pango/pango-language-set-private.h
index 7eb32b5c..53aac1cc 100644
--- a/pango/pango-language-set-private.h
+++ b/pango/pango-language-set-private.h
@@ -22,23 +22,23 @@
#include "pango-language.h"
-#define PANGO_TYPE_LANGUAGE_SET (pango_language_set_get_type ())
+#define PANGO2_TYPE_LANGUAGE_SET (pango2_language_set_get_type ())
-G_DECLARE_DERIVABLE_TYPE (PangoLanguageSet, pango_language_set, PANGO, LANGUAGE_SET, GObject)
+G_DECLARE_DERIVABLE_TYPE (Pango2LanguageSet, pango2_language_set, PANGO2, LANGUAGE_SET, GObject)
-struct _PangoLanguageSetClass
+struct _Pango2LanguageSetClass
{
GObjectClass parent_class;
- gboolean (* matches_language) (PangoLanguageSet *set,
- PangoLanguage *language);
+ gboolean (* matches_language) (Pango2LanguageSet *set,
+ Pango2Language *language);
- PangoLanguage ** (* get_languages) (PangoLanguageSet *set);
+ Pango2Language ** (* get_languages) (Pango2LanguageSet *set);
};
-gboolean pango_language_set_matches_language (PangoLanguageSet *set,
- PangoLanguage *language);
+gboolean pango2_language_set_matches_language (Pango2LanguageSet *set,
+ Pango2Language *language);
-PangoLanguage ** pango_language_set_get_languages (PangoLanguageSet *set);
+Pango2Language ** pango2_language_set_get_languages (Pango2LanguageSet *set);
-char * pango_language_set_to_string (PangoLanguageSet *set);
+char * pango2_language_set_to_string (Pango2LanguageSet *set);
diff --git a/pango/pango-language-set-simple-private.h b/pango/pango-language-set-simple-private.h
index 25d719da..c473d01e 100644
--- a/pango/pango-language-set-simple-private.h
+++ b/pango/pango-language-set-simple-private.h
@@ -22,11 +22,11 @@
#include "pango-language-set-private.h"
-#define PANGO_TYPE_LANGUAGE_SET_SIMPLE (pango_language_set_simple_get_type ())
+#define PANGO2_TYPE_LANGUAGE_SET_SIMPLE (pango2_language_set_simple_get_type ())
-G_DECLARE_FINAL_TYPE (PangoLanguageSetSimple, pango_language_set_simple, PANGO, LANGUAGE_SET_SIMPLE, PangoLanguageSet)
+G_DECLARE_FINAL_TYPE (Pango2LanguageSetSimple, pango2_language_set_simple, PANGO2, LANGUAGE_SET_SIMPLE, Pango2LanguageSet)
-PangoLanguageSetSimple *pango_language_set_simple_new (void);
+Pango2LanguageSetSimple *pango2_language_set_simple_new (void);
-void pango_language_set_simple_add_language (PangoLanguageSetSimple *self,
- PangoLanguage *language);
+void pango2_language_set_simple_add_language (Pango2LanguageSetSimple *self,
+ Pango2Language *language);
diff --git a/pango/pango-language-set-simple.c b/pango/pango-language-set-simple.c
index 3f1aa326..d117a0c1 100644
--- a/pango/pango-language-set-simple.c
+++ b/pango/pango-language-set-simple.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Red Hat, Inc.
*
@@ -24,47 +24,47 @@
#include "pango-language-set-simple-private.h"
-struct _PangoLanguageSetSimple
+struct _Pango2LanguageSetSimple
{
- PangoLanguageSet parent_instance;
+ Pango2LanguageSet parent_instance;
GHashTable *languages;
- PangoLanguage **list;
+ Pango2Language **list;
};
-G_DEFINE_TYPE (PangoLanguageSetSimple, pango_language_set_simple, PANGO_TYPE_LANGUAGE_SET)
+G_DEFINE_TYPE (Pango2LanguageSetSimple, pango2_language_set_simple, PANGO2_TYPE_LANGUAGE_SET)
static void
-pango_language_set_simple_init (PangoLanguageSetSimple *self)
+pango2_language_set_simple_init (Pango2LanguageSetSimple *self)
{
self->languages = g_hash_table_new (g_direct_hash, g_direct_equal);
}
static void
-pango_language_set_simple_finalize (GObject *object)
+pango2_language_set_simple_finalize (GObject *object)
{
- PangoLanguageSetSimple *self = PANGO_LANGUAGE_SET_SIMPLE (object);
+ Pango2LanguageSetSimple *self = PANGO2_LANGUAGE_SET_SIMPLE (object);
g_hash_table_unref (self->languages);
g_free (self->list);
- G_OBJECT_CLASS (pango_language_set_simple_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_language_set_simple_parent_class)->finalize (object);
}
static gboolean
-pango_language_set_simple_matches_language (PangoLanguageSet *set,
- PangoLanguage *language)
+pango2_language_set_simple_matches_language (Pango2LanguageSet *set,
+ Pango2Language *language)
{
- PangoLanguageSetSimple *self = PANGO_LANGUAGE_SET_SIMPLE (set);
+ Pango2LanguageSetSimple *self = PANGO2_LANGUAGE_SET_SIMPLE (set);
const char *s;
if (g_hash_table_contains (self->languages, language))
return TRUE;
- if (language == pango_language_from_string ("c"))
+ if (language == pango2_language_from_string ("c"))
return TRUE;
- s = pango_language_to_string (language);
+ s = pango2_language_to_string (language);
if (strchr (s, '-'))
{
char buf[10];
@@ -80,44 +80,44 @@ pango_language_set_simple_matches_language (PangoLanguageSet *set,
}
buf[9] = '\0';
- if (g_hash_table_contains (self->languages, pango_language_from_string (buf)))
+ if (g_hash_table_contains (self->languages, pango2_language_from_string (buf)))
return TRUE;
}
return FALSE;
}
-static PangoLanguage **
-pango_language_set_simple_get_languages (PangoLanguageSet *set)
+static Pango2Language **
+pango2_language_set_simple_get_languages (Pango2LanguageSet *set)
{
- PangoLanguageSetSimple *self = PANGO_LANGUAGE_SET_SIMPLE (set);
+ Pango2LanguageSetSimple *self = PANGO2_LANGUAGE_SET_SIMPLE (set);
if (!self->list)
- self->list = (PangoLanguage **) g_hash_table_get_keys_as_array (self->languages, NULL);
+ self->list = (Pango2Language **) g_hash_table_get_keys_as_array (self->languages, NULL);
return self->list;
}
static void
-pango_language_set_simple_class_init (PangoLanguageSetSimpleClass *class)
+pango2_language_set_simple_class_init (Pango2LanguageSetSimpleClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoLanguageSetClass *language_set_class = PANGO_LANGUAGE_SET_CLASS (class);
+ Pango2LanguageSetClass *language_set_class = PANGO2_LANGUAGE_SET_CLASS (class);
- object_class->finalize = pango_language_set_simple_finalize;
- language_set_class->matches_language = pango_language_set_simple_matches_language;
- language_set_class->get_languages = pango_language_set_simple_get_languages;
+ object_class->finalize = pango2_language_set_simple_finalize;
+ language_set_class->matches_language = pango2_language_set_simple_matches_language;
+ language_set_class->get_languages = pango2_language_set_simple_get_languages;
}
-PangoLanguageSetSimple *
-pango_language_set_simple_new (void)
+Pango2LanguageSetSimple *
+pango2_language_set_simple_new (void)
{
- return g_object_new (PANGO_TYPE_LANGUAGE_SET_SIMPLE, NULL);
+ return g_object_new (PANGO2_TYPE_LANGUAGE_SET_SIMPLE, NULL);
}
void
-pango_language_set_simple_add_language (PangoLanguageSetSimple *self,
- PangoLanguage *language)
+pango2_language_set_simple_add_language (Pango2LanguageSetSimple *self,
+ Pango2Language *language)
{
g_return_if_fail (self->list == NULL);
diff --git a/pango/pango-language-set.c b/pango/pango-language-set.c
index b0dc87a8..a96ba929 100644
--- a/pango/pango-language-set.c
+++ b/pango/pango-language-set.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Red Hat, Inc.
*
@@ -25,62 +25,62 @@
#include "pango-language-set-private.h"
-G_DEFINE_ABSTRACT_TYPE (PangoLanguageSet, pango_language_set, G_TYPE_OBJECT)
+G_DEFINE_ABSTRACT_TYPE (Pango2LanguageSet, pango2_language_set, G_TYPE_OBJECT)
static void
-pango_language_set_init (PangoLanguageSet *set)
+pango2_language_set_init (Pango2LanguageSet *set)
{
}
static gboolean
-pango_language_set_default_matches_language (PangoLanguageSet *set,
- PangoLanguage *language)
+pango2_language_set_default_matches_language (Pango2LanguageSet *set,
+ Pango2Language *language)
{
return FALSE;
}
-static PangoLanguage **
-pango_language_set_default_get_languages (PangoLanguageSet *set)
+static Pango2Language **
+pango2_language_set_default_get_languages (Pango2LanguageSet *set)
{
return NULL;
}
static void
-pango_language_set_class_init (PangoLanguageSetClass *class)
+pango2_language_set_class_init (Pango2LanguageSetClass *class)
{
- PangoLanguageSetClass *language_set_class = PANGO_LANGUAGE_SET_CLASS (class);
+ Pango2LanguageSetClass *language_set_class = PANGO2_LANGUAGE_SET_CLASS (class);
- language_set_class->matches_language = pango_language_set_default_matches_language;
- language_set_class->get_languages = pango_language_set_default_get_languages;
+ language_set_class->matches_language = pango2_language_set_default_matches_language;
+ language_set_class->get_languages = pango2_language_set_default_get_languages;
}
gboolean
-pango_language_set_matches_language (PangoLanguageSet *set,
- PangoLanguage *language)
+pango2_language_set_matches_language (Pango2LanguageSet *set,
+ Pango2Language *language)
{
- return PANGO_LANGUAGE_SET_GET_CLASS (set)->matches_language (set, language);
+ return PANGO2_LANGUAGE_SET_GET_CLASS (set)->matches_language (set, language);
}
-PangoLanguage **
-pango_language_set_get_languages (PangoLanguageSet *set)
+Pango2Language **
+pango2_language_set_get_languages (Pango2LanguageSet *set)
{
- return PANGO_LANGUAGE_SET_GET_CLASS (set)->get_languages (set);
+ return PANGO2_LANGUAGE_SET_GET_CLASS (set)->get_languages (set);
}
char *
-pango_language_set_to_string (PangoLanguageSet *set)
+pango2_language_set_to_string (Pango2LanguageSet *set)
{
- PangoLanguage **languages;
+ Pango2Language **languages;
GString *s;
s = g_string_new ("");
- languages = pango_language_set_get_languages (set);
+ languages = pango2_language_set_get_languages (set);
for (int i = 0; languages[i]; i++)
{
if (s->len > 0)
g_string_append (s, "|");
- g_string_append (s, pango_language_to_string (languages[i]));
+ g_string_append (s, pango2_language_to_string (languages[i]));
}
return g_string_free (s, FALSE);
diff --git a/pango/pango-language.c b/pango/pango-language.c
index eea32002..71af5a83 100644
--- a/pango/pango-language.c
+++ b/pango/pango-language.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-language.c: Language handling routines
*
* Copyright (C) 2000 Red Hat Software
@@ -10,7 +10,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -34,7 +34,7 @@
#endif /* HAVE_CORE_TEXT */
-/* We embed a private struct right *before* a where a PangoLanguage *
+/* We embed a private struct right *before* a where a Pango2Language *
* points to.
*/
@@ -43,34 +43,34 @@ typedef struct {
gconstpointer script_for_lang;
int magic; /* Used for verification */
-} PangoLanguagePrivate;
+} Pango2LanguagePrivate;
-#define PANGO_LANGUAGE_PRIVATE_MAGIC 0x0BE4DAD0
+#define PANGO2_LANGUAGE_PRIVATE_MAGIC 0x0BE4DAD0
static void
-pango_language_private_init (PangoLanguagePrivate *priv)
+pango2_language_private_init (Pango2LanguagePrivate *priv)
{
- priv->magic = PANGO_LANGUAGE_PRIVATE_MAGIC;
+ priv->magic = PANGO2_LANGUAGE_PRIVATE_MAGIC;
priv->lang_info = (gconstpointer) -1;
priv->script_for_lang = (gconstpointer) -1;
}
-static PangoLanguagePrivate * pango_language_get_private (PangoLanguage *language) G_GNUC_CONST;
+static Pango2LanguagePrivate * pango2_language_get_private (Pango2Language *language) G_GNUC_CONST;
-static PangoLanguagePrivate *
-pango_language_get_private (PangoLanguage *language)
+static Pango2LanguagePrivate *
+pango2_language_get_private (Pango2Language *language)
{
- PangoLanguagePrivate *priv;
+ Pango2LanguagePrivate *priv;
if (!language)
return NULL;
- priv = (PangoLanguagePrivate *)(void *)((char *)language - sizeof (PangoLanguagePrivate));
+ priv = (Pango2LanguagePrivate *)(void *)((char *)language - sizeof (Pango2LanguagePrivate));
- if (G_UNLIKELY (priv->magic != PANGO_LANGUAGE_PRIVATE_MAGIC))
+ if (G_UNLIKELY (priv->magic != PANGO2_LANGUAGE_PRIVATE_MAGIC))
{
- g_critical ("Invalid PangoLanguage. Did you pass in a straight string instead of calling pango_language_from_string()?");
+ g_critical ("Invalid Pango2Language. Did you pass in a straight string instead of calling pango2_language_from_string()?");
return NULL;
}
@@ -94,7 +94,7 @@ static const char canon_map[256] = {
static gboolean
lang_equal (gconstpointer v1,
- gconstpointer v2)
+ gconstpointer v2)
{
const guchar *p1 = v1;
const guchar *p2 = v2;
@@ -121,33 +121,33 @@ lang_hash (gconstpointer key)
return h;
}
-static PangoLanguage *
-pango_language_copy (PangoLanguage *language)
+static Pango2Language *
+pango2_language_copy (Pango2Language *language)
{
return language; /* language tags are const */
}
static void
-pango_language_free (PangoLanguage *language G_GNUC_UNUSED)
+pango2_language_free (Pango2Language *language G_GNUC_UNUSED)
{
return; /* nothing */
}
/**
- * PangoLanguage:
+ * Pango2Language:
*
- * The `PangoLanguage` structure is used to
+ * The `Pango2Language` structure is used to
* represent a language.
*
- * `PangoLanguage` pointers can be efficiently
+ * `Pango2Language` pointers can be efficiently
* copied and compared with each other.
*/
-G_DEFINE_BOXED_TYPE (PangoLanguage, pango_language,
- pango_language_copy,
- pango_language_free);
+G_DEFINE_BOXED_TYPE (Pango2Language, pango2_language,
+ pango2_language_copy,
+ pango2_language_free);
/**
- * _pango_get_lc_ctype:
+ * _pango2_get_lc_ctype:
*
* Return the Unix-style locale string for the language currently in
* effect. On Unix systems, this is the return value from
@@ -171,7 +171,7 @@ G_DEFINE_BOXED_TYPE (PangoLanguage, pango_language,
* Return value: a dynamically allocated string, free with [GLib.free]
*/
static char *
-_pango_get_lc_ctype (void)
+_pango2_get_lc_ctype (void)
{
#ifdef G_OS_WIN32
/* Somebody might try to set the locale for this process using the
@@ -179,8 +179,8 @@ _pango_get_lc_ctype (void)
* doesn't know anything about them. You set the locale in the
* Control Panel. Setting these env vars won't have any affect on
* locale-dependent C library functions like ctime(). But just for
- * kicks, do obey LC_ALL, LC_CTYPE and LANG in Pango. (This also makes
- * it easier to test GTK and Pango in various default languages, you
+ * kicks, do obey LC_ALL, LC_CTYPE and LANG in Pango2. (This also makes
+ * it easier to test GTK and Pango2 in various default languages, you
* don't have to clickety-click in the Control Panel, you can simply
* start the program with LC_ALL=something on the command line.)
*/
@@ -249,9 +249,9 @@ _pango_get_lc_ctype (void)
}
/**
- * pango_language_get_default:
+ * pango2_language_get_default:
*
- * Returns the `PangoLanguage` for the current locale of the process.
+ * Returns the `Pango2Language` for the current locale of the process.
*
* On Unix systems, this is the return value is derived from
* `setlocale (LC_CTYPE, NULL)`, and the user can
@@ -281,22 +281,22 @@ _pango_get_lc_ctype (void)
*
* Also note that this function will not do the right thing if you
* use per-thread locales with uselocale(). In that case, you should
- * just call [func@Pango.Language.from_string] yourself.
+ * just call [func@Pango2.Language.from_string] yourself.
*
- * Return value: (transfer none): the default language as a `PangoLanguage`
+ * Return value: (transfer none): the default language as a `Pango2Language`
**/
-PangoLanguage *
-pango_language_get_default (void)
+Pango2Language *
+pango2_language_get_default (void)
{
- static PangoLanguage *result = NULL; /* MT-safe */
+ static Pango2Language *result = NULL; /* MT-safe */
if (g_once_init_enter (&result))
{
char *lc_ctype;
- PangoLanguage *lang;
+ Pango2Language *lang;
- lc_ctype = _pango_get_lc_ctype ();
- lang = pango_language_from_string (lc_ctype);
+ lc_ctype = _pango2_get_lc_ctype ();
+ lang = pango2_language_from_string (lc_ctype);
g_free (lc_ctype);
g_once_init_leave (&result, lang);
@@ -306,12 +306,12 @@ pango_language_get_default (void)
}
/**
- * pango_language_from_string:
+ * pango2_language_from_string:
* @language: (nullable): a string representing a language tag
*
- * Convert a language tag to a `PangoLanguage`.
+ * Convert a language tag to a `Pango2Language`.
*
- * The language tag must be in a RFC-3066 format. `PangoLanguage` pointers
+ * The language tag must be in a RFC-3066 format. `Pango2Language` pointers
* can be efficiently copied (copy the pointer) and compared with other
* language tags (compare the pointer.)
*
@@ -319,17 +319,17 @@ pango_language_get_default (void)
* lowercase, mapping '_' to '-', and stripping all characters other
* than letters and '-'.
*
- * Use [func@Pango.Language.get_default] if you want to get the
- * `PangoLanguage` for the current locale of the process.
+ * Use [func@Pango2.Language.get_default] if you want to get the
+ * `Pango2Language` for the current locale of the process.
*
- * Return value: (transfer none) (nullable): a `PangoLanguage`
+ * Return value: (transfer none) (nullable): a `Pango2Language`
*/
-PangoLanguage *
-pango_language_from_string (const char *language)
+Pango2Language *
+pango2_language_from_string (const char *language)
{
G_LOCK_DEFINE_STATIC (lang_from_string);
static GHashTable *hash = NULL; /* MT-safe */
- PangoLanguagePrivate *priv;
+ Pango2LanguagePrivate *priv;
char *result;
int len;
char *p;
@@ -349,13 +349,13 @@ pango_language_from_string (const char *language)
}
len = strlen (language);
- priv = g_malloc0 (sizeof (PangoLanguagePrivate) + len + 1);
+ priv = g_malloc0 (sizeof (Pango2LanguagePrivate) + len + 1);
g_assert (priv);
result = (char *)priv;
- result += sizeof (PangoLanguagePrivate);
+ result += sizeof (Pango2LanguagePrivate);
- pango_language_private_init (priv);
+ pango2_language_private_init (priv);
p = result;
while ((*(p++) = canon_map[*(guchar *)language++]))
@@ -366,11 +366,11 @@ pango_language_from_string (const char *language)
out:
G_UNLOCK (lang_from_string);
- return (PangoLanguage *)result;
+ return (Pango2Language *)result;
}
/**
- * pango_language_to_string:
+ * pango2_language_to_string:
* @language: a language tag.
*
* Gets the RFC-3066 format string representing the given language tag.
@@ -378,19 +378,19 @@ out:
* Returns (transfer none): a string representing the language tag
*/
const char *
-(pango_language_to_string) (PangoLanguage *language)
+(pango2_language_to_string) (Pango2Language *language)
{
- return pango_language_to_string (language);
+ return pango2_language_to_string (language);
}
/**
- * pango_language_matches:
- * @language: (nullable): a language tag (see [func@Pango.Language.from_string]),
+ * pango2_language_matches:
+ * @language: (nullable): a language tag (see [func@Pango2.Language.from_string]),
* %NULL is allowed and matches nothing but '*'
* @range_list: a list of language ranges, separated by ';', ':',
* ',', or space characters.
* Each element must either be '*', or a RFC 3066 language range
- * canonicalized as by [func@Pango.Language.from_string]
+ * canonicalized as by [func@Pango2.Language.from_string]
*
* Checks if a language tag matches one of the elements in a list of
* language ranges.
@@ -402,10 +402,10 @@ const char *
* Return value: %TRUE if a match was found
*/
gboolean
-pango_language_matches (PangoLanguage *language,
- const char *range_list)
+pango2_language_matches (Pango2Language *language,
+ const char *range_list)
{
- const char *lang_str = pango_language_to_string (language);
+ const char *lang_str = pango2_language_to_string (language);
const char *p = range_list;
gboolean done = FALSE;
@@ -413,18 +413,18 @@ pango_language_matches (PangoLanguage *language,
{
const char *end = strpbrk (p, LANGUAGE_SEPARATORS);
if (!end)
- {
- end = p + strlen (p);
- done = TRUE;
- }
+ {
+ end = p + strlen (p);
+ done = TRUE;
+ }
if (strncmp (p, "*", 1) == 0 ||
- (lang_str && strncmp (lang_str, p, end - p) == 0 &&
- (lang_str[end - p] == '\0' || lang_str[end - p] == '-')))
- return TRUE;
+ (lang_str && strncmp (lang_str, p, end - p) == 0 &&
+ (lang_str[end - p] == '\0' || lang_str[end - p] == '-')))
+ return TRUE;
if (!done)
- p = end + 1;
+ p = end + 1;
}
return FALSE;
@@ -432,7 +432,7 @@ pango_language_matches (PangoLanguage *language,
static int
lang_compare_first_component (gconstpointer pa,
- gconstpointer pb)
+ gconstpointer pb)
{
const char *a = pa, *b = pb;
unsigned int da, db;
@@ -443,7 +443,7 @@ lang_compare_first_component (gconstpointer pa,
p = strstr (b, "-");
db = p ? (unsigned int) (p - b) : strlen (b);
-
+
return strncmp (a, b, MAX (da, db));
}
@@ -453,10 +453,10 @@ lang_compare_first_component (gconstpointer pa,
* sorted on language code.
*/
static gconstpointer
-find_best_lang_match (PangoLanguage *language,
- gconstpointer records,
- guint num_records,
- guint record_size)
+find_best_lang_match (Pango2Language *language,
+ gconstpointer records,
+ guint num_records,
+ guint record_size)
{
const char *lang_str;
const char *record, *start, *end;
@@ -464,11 +464,11 @@ find_best_lang_match (PangoLanguage *language,
if (language == NULL)
return NULL;
- lang_str = pango_language_to_string (language);
+ lang_str = pango2_language_to_string (language);
record = bsearch (lang_str,
- records, num_records, record_size,
- lang_compare_first_component);
+ records, num_records, record_size,
+ lang_compare_first_component);
if (!record)
return NULL;
@@ -479,14 +479,14 @@ find_best_lang_match (PangoLanguage *language,
/* go to the final one matching in the first component */
while (record < end - record_size &&
- lang_compare_first_component (lang_str, record + record_size) == 0)
+ lang_compare_first_component (lang_str, record + record_size) == 0)
record += record_size;
/* go back, find which one matches completely */
while (start <= record &&
- lang_compare_first_component (lang_str, record) == 0)
+ lang_compare_first_component (lang_str, record) == 0)
{
- if (pango_language_matches (language, record))
+ if (pango2_language_matches (language, record))
return record;
record -= record_size;
@@ -496,11 +496,11 @@ find_best_lang_match (PangoLanguage *language,
}
static gconstpointer
-find_best_lang_match_cached (PangoLanguage *language,
- gconstpointer *cache,
- gconstpointer records,
- guint num_records,
- guint record_size)
+find_best_lang_match_cached (Pango2Language *language,
+ gconstpointer *cache,
+ gconstpointer records,
+ guint num_records,
+ guint record_size)
{
gconstpointer result;
@@ -508,9 +508,9 @@ find_best_lang_match_cached (PangoLanguage *language,
return *cache;
result = find_best_lang_match (language,
- records,
- num_records,
- record_size);
+ records,
+ num_records,
+ record_size);
if (cache)
*cache = result;
@@ -519,12 +519,12 @@ find_best_lang_match_cached (PangoLanguage *language,
}
#define FIND_BEST_LANG_MATCH_CACHED(language, cache_key, records) \
- find_best_lang_match_cached ((language), \
- pango_language_get_private (language) ? \
- &(pango_language_get_private (language)->cache_key) : NULL, \
- records, \
- G_N_ELEMENTS (records), \
- sizeof (*records));
+ find_best_lang_match_cached ((language), \
+ pango2_language_get_private (language) ? \
+ &(pango2_language_get_private (language)->cache_key) : NULL, \
+ records, \
+ G_N_ELEMENTS (records), \
+ sizeof (*records));
typedef struct {
char lang[6];
@@ -551,16 +551,16 @@ static const union _LangPool {
#undef LANGUAGE
} };
static const LangInfo lang_texts[] = {
-#define LANGUAGE(id, source, sample) {G_STRINGIFY(id), G_STRUCT_OFFSET(struct _LangPoolStruct, POOLSTRFIELD(__LINE__))},
+#define LANGUAGE(id, source, sample) {G_STRINGIFY(id), G_STRUCT_OFFSET(struct _LangPoolStruct, POOLSTRFIELD(__LINE__))},
#include "pango-language-sample-table.h"
#undef LANGUAGE
/* One extra entry with no final comma, to make it C89-happy */
- {"~~", 0}
+ {"~~", 0}
};
/**
- * pango_language_get_sample_string:
- * @language: (nullable): a `PangoLanguage`
+ * pango2_language_get_sample_string:
+ * @language: (nullable): a `Pango2Language`
*
* Get a string that is representative of the characters needed to
* render a particular language.
@@ -571,30 +571,28 @@ static const LangInfo lang_texts[] = {
* as sample text in a font selection dialog.
*
* If @language is %NULL, the default language as found by
- * [func@Pango.Language.get_default] is used.
+ * [func@Pango2.Language.get_default] is used.
*
- * If Pango does not have a sample string for @language, the classic
+ * If Pango2 does not have a sample string for @language, the classic
* "The quick brown fox..." is returned. This can be detected by
* comparing the returned pointer value to that returned for (non-existent)
* language code "xx". That is, compare to:
*
* ```
- * pango_language_get_sample_string (pango_language_from_string ("xx"))
+ * pango2_language_get_sample_string (pango2_language_from_string ("xx"))
* ```
*
* Return value: (transfer none): the sample string
*/
const char *
-pango_language_get_sample_string (PangoLanguage *language)
+pango2_language_get_sample_string (Pango2Language *language)
{
const LangInfo *lang_info;
if (!language)
- language = pango_language_get_default ();
+ language = pango2_language_get_default ();
- lang_info = FIND_BEST_LANG_MATCH_CACHED (language,
- lang_info,
- lang_texts);
+ lang_info = FIND_BEST_LANG_MATCH_CACHED (language, lang_info, lang_texts);
if (lang_info)
return lang_pool.str + lang_info->offset;
@@ -613,8 +611,8 @@ pango_language_get_sample_string (PangoLanguage *language)
#include "pango-script-lang-table.h"
/**
- * pango_language_get_scripts:
- * @language: (nullable): a `PangoLanguage`
+ * pango2_language_get_scripts:
+ * @language: (nullable): a `Pango2Language`
* @num_scripts: (out caller-allocates) (optional): location to
* return number of scripts
*
@@ -635,30 +633,30 @@ pango_language_get_sample_string (PangoLanguage *language)
* though, except that it is positive if the return value is not
* %NULL, and it is a small number.
*
- * The [method@Pango.Language.includes_script] function uses this
+ * The [method@Pango2.Language.includes_script] function uses this
* function internally.
*
* Return value: (transfer none) (array length=num_scripts) (nullable):
* An array of `GUnicodeScript` values, with the number of entries in
- * the array stored in @num_scripts, or %NULL if Pango does not have
+ * the array stored in @num_scripts, or %NULL if Pango2 does not have
* any information about this particular language tag (also the case
* if @language is %NULL).
*/
const GUnicodeScript *
-pango_language_get_scripts (PangoLanguage *language,
- int *num_scripts)
+pango2_language_get_scripts (Pango2Language *language,
+ int *num_scripts)
{
- const PangoScriptForLang *script_for_lang;
+ const Pango2ScriptForLang *script_for_lang;
unsigned int j;
script_for_lang = FIND_BEST_LANG_MATCH_CACHED (language,
- script_for_lang,
- pango_script_for_lang);
+ script_for_lang,
+ pango2_script_for_lang);
if (!script_for_lang || script_for_lang->scripts[0] == 0)
{
if (num_scripts)
- *num_scripts = 0;
+ *num_scripts = 0;
return NULL;
}
@@ -666,8 +664,8 @@ pango_language_get_scripts (PangoLanguage *language,
if (num_scripts)
{
for (j = 0; j < G_N_ELEMENTS (script_for_lang->scripts); j++)
- if (script_for_lang->scripts[j] == 0)
- break;
+ if (script_for_lang->scripts[j] == 0)
+ break;
g_assert (j > 0);
@@ -678,8 +676,8 @@ pango_language_get_scripts (PangoLanguage *language,
}
/**
- * pango_language_includes_script:
- * @language: (nullable): a `PangoLanguage`
+ * pango2_language_includes_script:
+ * @language: (nullable): a `Pango2Language`
* @script: a `GUnicodeScript`
*
* Determines if @script is one of the scripts used to
@@ -687,22 +685,22 @@ pango_language_get_scripts (PangoLanguage *language,
*
* The returned value is conservative; if nothing is known about
* the language tag @language, %TRUE will be returned, since, as
- * far as Pango knows, @script might be used to write @language.
+ * far as Pango2 knows, @script might be used to write @language.
*
- * This routine is used in Pango's itemization process when
+ * This routine is used in Pango2's itemization process when
* determining if a supplied language tag is relevant to
* a particular section of text. It probably is not useful
* for applications in most circumstances.
*
- * This function uses [method@Pango.Language.get_scripts] internally.
+ * This function uses [method@Pango2.Language.get_scripts] internally.
*
* Return value: %TRUE if @script is one of the scripts used
* to write @language or if nothing is known about @language
* (including the case that @language is %NULL), %FALSE otherwise.
*/
gboolean
-pango_language_includes_script (PangoLanguage *language,
- GUnicodeScript script)
+pango2_language_includes_script (Pango2Language *language,
+ GUnicodeScript script)
{
const GUnicodeScript *scripts;
int num_scripts, j;
@@ -716,7 +714,7 @@ pango_language_includes_script (PangoLanguage *language,
#undef REAL_SCRIPT
- scripts = pango_language_get_scripts (language, &num_scripts);
+ scripts = pango2_language_get_scripts (language, &num_scripts);
if (!scripts)
return TRUE;
@@ -735,14 +733,14 @@ pango_language_includes_script (PangoLanguage *language,
*/
-static PangoLanguage **
+static Pango2Language **
parse_default_languages (void)
{
char *p, *p_copy;
gboolean done = FALSE;
GPtrArray *langs;
- p = getenv ("PANGO_LANGUAGE");
+ p = getenv ("PANGO2_LANGUAGE");
if (p == NULL)
p = getenv ("LANGUAGE");
@@ -758,41 +756,41 @@ parse_default_languages (void)
{
char *end = strpbrk (p, LANGUAGE_SEPARATORS);
if (!end)
- {
- end = p + strlen (p);
- done = TRUE;
- }
+ {
+ end = p + strlen (p);
+ done = TRUE;
+ }
else
*end = '\0';
/* skip empty languages, and skip the language 'C' */
if (p != end && !(p + 1 == end && *p == 'C'))
{
- PangoLanguage *l = pango_language_from_string (p);
-
- g_ptr_array_add (langs, l);
- }
+ Pango2Language *l = pango2_language_from_string (p);
+
+ g_ptr_array_add (langs, l);
+ }
if (!done)
- p = end + 1;
+ p = end + 1;
}
g_ptr_array_add (langs, NULL);
g_free (p_copy);
- return (PangoLanguage **) g_ptr_array_free (langs, FALSE);
+ return (Pango2Language **) g_ptr_array_free (langs, FALSE);
}
G_LOCK_DEFINE_STATIC (languages);
static gboolean initialized = FALSE; /* MT-safe */
-static PangoLanguage * const * languages = NULL; /* MT-safe */
+static Pango2Language * const * languages = NULL; /* MT-safe */
static GHashTable *hash = NULL; /* MT-safe */
-static PangoLanguage *
-_pango_script_get_default_language (GUnicodeScript script)
+static Pango2Language *
+_pango2_script_get_default_language (GUnicodeScript script)
{
- PangoLanguage *result, * const * p;
+ Pango2Language *result, * const * p;
G_LOCK (languages);
@@ -801,7 +799,7 @@ _pango_script_get_default_language (GUnicodeScript script)
languages = parse_default_languages ();
if (languages)
- hash = g_hash_table_new (NULL, NULL);
+ hash = g_hash_table_new (NULL, NULL);
initialized = TRUE;
}
@@ -816,7 +814,7 @@ _pango_script_get_default_language (GUnicodeScript script)
goto out;
for (p = languages; *p; p++)
- if (pango_language_includes_script (*p, script))
+ if (pango2_language_includes_script (*p, script))
break;
result = *p;
@@ -829,34 +827,34 @@ out:
}
/**
- * pango_language_get_preferred:
+ * pango2_language_get_preferred:
*
* Returns the list of languages that the user prefers.
*
- * The list is specified by the `PANGO_LANGUAGE` or `LANGUAGE`
+ * The list is specified by the `PANGO2_LANGUAGE` or `LANGUAGE`
* environment variables, in order of preference. Note that this
* list does not necessarily include the language returned by
- * [func@Pango.Language.get_default].
+ * [func@Pango2.Language.get_default].
*
* When choosing language-specific resources, such as the sample
- * text returned by [method@Pango.Language.get_sample_string],
+ * text returned by [method@Pango2.Language.get_sample_string],
* you should first try the default language, followed by the
* languages returned by this function.
*
* Returns: (transfer none) (nullable): a %NULL-terminated array
- * of `PangoLanguage`*
+ * of `Pango2Language`*
*/
-PangoLanguage **
-pango_language_get_preferred (void)
+Pango2Language **
+pango2_language_get_preferred (void)
{
/* We call this just for its side-effect of initializing languages */
- _pango_script_get_default_language (G_UNICODE_SCRIPT_COMMON);
+ _pango2_script_get_default_language (G_UNICODE_SCRIPT_COMMON);
- return (PangoLanguage **) languages;
+ return (Pango2Language **) languages;
}
/**
- * pango_script_get_sample_language:
+ * pango2_script_get_sample_language:
* @script: a `GUnicodeScript`
*
* Finds a language tag that is reasonably representative of @script.
@@ -875,28 +873,28 @@ pango_language_get_preferred (void)
* for many historical scripts as well.
*
* As of 1.18, this function checks the environment variables
- * `PANGO_LANGUAGE` and `LANGUAGE` (checked in that order) first.
+ * `PANGO2_LANGUAGE` and `LANGUAGE` (checked in that order) first.
* If one of them is set, it is parsed as a list of language tags
* separated by colons or other separators. This function
- * will return the first language in the parsed list that Pango
+ * will return the first language in the parsed list that Pango2
* believes may use @script for writing. This last predicate
- * is tested using [method@Pango.Language.includes_script]. This can
- * be used to control Pango's font selection for non-primary
- * languages. For example, a `PANGO_LANGUAGE` enviroment variable
- * set to "en:fa" makes Pango choose fonts suitable for Persian (fa)
+ * is tested using [method@Pango2.Language.includes_script]. This can
+ * be used to control Pango2's font selection for non-primary
+ * languages. For example, a `PANGO2_LANGUAGE` enviroment variable
+ * set to "en:fa" makes Pango2 choose fonts suitable for Persian (fa)
* instead of Arabic (ar) when a segment of Arabic text is found
* in an otherwise non-Arabic text. The same trick can be used to
* choose a default language for %G_UNICODE_SCRIPT_HAN when setting
* context language is not feasible.
*
- * Return value: (nullable): a `PangoLanguage` that is representative
+ * Return value: (nullable): a `Pango2Language` that is representative
* of the script
*/
-PangoLanguage *
-pango_script_get_sample_language (GUnicodeScript script)
+Pango2Language *
+pango2_script_get_sample_language (GUnicodeScript script)
{
/* Note that in the following, we want
- * pango_language_includes_script() for the sample language
+ * pango2_language_includes_script() for the sample language
* to include the script, so alternate orthographies
* (Shavian for English, Osmanya for Somali, etc), typically
* have no sample language
@@ -1011,14 +1009,14 @@ pango_script_get_sample_language (GUnicodeScript script)
"", /* G_UNICODE_SCRIPT_TAKRI */
};
const char *sample_language;
- PangoLanguage *result;
+ Pango2Language *result;
g_return_val_if_fail (script >= 0, NULL);
if ((guint)script >= G_N_ELEMENTS (sample_languages))
return NULL;
- result = _pango_script_get_default_language (script);
+ result = _pango2_script_get_default_language (script);
if (result)
return result;
@@ -1027,5 +1025,5 @@ pango_script_get_sample_language (GUnicodeScript script)
if (!sample_language[0])
return NULL;
else
- return pango_language_from_string (sample_language);
+ return pango2_language_from_string (sample_language);
}
diff --git a/pango/pango-language.h b/pango/pango-language.h
index fe84364c..760b9e8e 100644
--- a/pango/pango-language.h
+++ b/pango/pango-language.h
@@ -28,38 +28,38 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_LANGUAGE (pango_language_get_type ())
+#define PANGO2_TYPE_LANGUAGE (pango2_language_get_type ())
-PANGO_AVAILABLE_IN_ALL
-GType pango_language_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_language_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoLanguage * pango_language_get_default (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+Pango2Language * pango2_language_get_default (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoLanguage ** pango_language_get_preferred (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+Pango2Language ** pango2_language_get_preferred (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoLanguage * pango_language_from_string (const char *language);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Language * pango2_language_from_string (const char *language);
-PANGO_AVAILABLE_IN_ALL
-const char * pango_language_to_string (PangoLanguage *language) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_language_to_string (Pango2Language *language) G_GNUC_CONST;
/* For back compat. Will have to keep indefinitely. */
-#define pango_language_to_string(language) ((const char *)language)
+#define pango2_language_to_string(language) ((const char *)language)
-PANGO_AVAILABLE_IN_ALL
-const char * pango_language_get_sample_string (PangoLanguage *language) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_language_get_sample_string (Pango2Language *language) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_language_matches (PangoLanguage *language,
- const char *range_list) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_language_matches (Pango2Language *language,
+ const char *range_list) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_language_includes_script (PangoLanguage *language,
- GUnicodeScript script) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-const GUnicodeScript * pango_language_get_scripts (PangoLanguage *language,
- int *num_scripts);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_language_includes_script (Pango2Language *language,
+ GUnicodeScript script) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+const GUnicodeScript * pango2_language_get_scripts (Pango2Language *language,
+ int *num_scripts);
G_END_DECLS
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 5a2f50aa..9a01b490 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -8,34 +8,34 @@
#include "pango-context.h"
/**
- * PangoLayout:
+ * Pango2Layout:
*
- * A `PangoLayout` structure represents an entire paragraph of text.
+ * A `Pango2Layout` structure represents an entire paragraph of text.
*
- * While complete access to the layout capabilities of Pango is provided
+ * While complete access to the layout capabilities of Pango2 is provided
* using the detailed interfaces for itemization, segmentation and shaping,
* using that functionality directly involves writing a fairly large amount
- * of code. `PangoLayout` provides a high-level driver for formatting entire
+ * of code. `Pango2Layout` provides a high-level driver for formatting entire
* paragraphs of text at once. This includes paragraph-level functionality
* such as line breaking, justification, alignment and ellipsization.
*
- * A `PangoLayout` is initialized with a `PangoContext`, a UTF-8 string
+ * A `Pango2Layout` is initialized with a `Pango2Context`, a UTF-8 string
* and set of attributes for that string. Once that is done, the set of
- * formatted lines can be extracted in the form of a [class@Pango.Lines]
+ * formatted lines can be extracted in the form of a [class@Pango2.Lines]
* object, the layout can be rendered, and conversion between logical
* character positions within the layout's text, and the physical position
* of the resulting glyphs can be made.
*
* The most convenient way to access the visual extents and components
- * of a formatted layout is via a [struct@Pango.LineIter] iterator.
+ * of a formatted layout is via a [struct@Pango2.LineIter] iterator.
*
* There are a number of parameters to adjust the formatting of a
- * `PangoLayout`. The following image shows adjustable parameters
+ * `Pango2Layout`. The following image shows adjustable parameters
* (on the left) and font metrics (on the right):
*
* <picture>
* <source srcset="layout-dark.png" media="(prefers-color-scheme: dark)">
- * <img alt="Pango Layout Parameters" src="layout-light.png">
+ * <img alt="Pango2 Layout Parameters" src="layout-light.png">
* </picture>
*
* The following images demonstrate the effect of alignment and justification
@@ -47,44 +47,44 @@
* | ![align=justify](align-left-justify.png) | | |
*
* It is possible, as well, to ignore the 2-D setup, and simply treat the
- * resulting `PangoLines` object as a list of lines.
+ * resulting `Pango2Lines` object as a list of lines.
*
* If you have more complex line breaking needs, such as shaping text
- * to flow around images, or multi-column layout, the [class@Pango.LineBreaker]
+ * to flow around images, or multi-column layout, the [class@Pango2.LineBreaker]
* makes the underlying line-breaking functionality available outside of
- * `PangoLayout`.
+ * `Pango2Layout`.
*/
-/* {{{ PangoLayout implementation */
+/* {{{ Pango2Layout implementation */
-struct _PangoLayout
+struct _Pango2Layout
{
GObject parent_instance;
- PangoContext *context;
+ Pango2Context *context;
char *text;
int length;
- PangoAttrList *attrs;
- PangoFontDescription *font_desc;
+ Pango2AttrList *attrs;
+ Pango2FontDescription *font_desc;
float line_height;
int spacing;
int width;
int height;
- PangoTabArray *tabs;
+ Pango2TabArray *tabs;
gboolean single_paragraph;
- PangoWrapMode wrap;
+ Pango2WrapMode wrap;
int indent;
guint serial;
guint context_serial;
- PangoAlignment alignment;
- PangoEllipsizeMode ellipsize;
+ Pango2Alignment alignment;
+ Pango2EllipsizeMode ellipsize;
gboolean auto_dir;
- PangoLines *lines;
+ Pango2Lines *lines;
};
-struct _PangoLayoutClass
+struct _Pango2LayoutClass
{
GObjectClass parent_class;
};
@@ -112,18 +112,18 @@ enum
static GParamSpec *props[NUM_PROPERTIES] = { NULL, };
-G_DEFINE_FINAL_TYPE (PangoLayout, pango_layout, G_TYPE_OBJECT)
+G_DEFINE_FINAL_TYPE (Pango2Layout, pango2_layout, G_TYPE_OBJECT)
static void
-pango_layout_init (PangoLayout *layout)
+pango2_layout_init (Pango2Layout *layout)
{
layout->serial = 1;
layout->width = -1;
layout->height = -1;
layout->indent = 0;
- layout->wrap = PANGO_WRAP_WORD;
- layout->alignment = PANGO_ALIGN_NATURAL;
- layout->ellipsize = PANGO_ELLIPSIZE_NONE;
+ layout->wrap = PANGO2_WRAP_WORD;
+ layout->alignment = PANGO2_ALIGN_NATURAL;
+ layout->ellipsize = PANGO2_ELLIPSIZE_NONE;
layout->line_height = 0.0;
layout->spacing = 0;
layout->auto_dir = TRUE;
@@ -132,89 +132,89 @@ pango_layout_init (PangoLayout *layout)
}
static void
-pango_layout_finalize (GObject *object)
+pango2_layout_finalize (GObject *object)
{
- PangoLayout *layout = PANGO_LAYOUT (object);
+ Pango2Layout *layout = PANGO2_LAYOUT (object);
- g_clear_pointer (&layout->font_desc, pango_font_description_free);
+ g_clear_pointer (&layout->font_desc, pango2_font_description_free);
g_object_unref (layout->context);
g_free (layout->text);
- g_clear_pointer (&layout->attrs, pango_attr_list_unref);
- g_clear_pointer (&layout->tabs, pango_tab_array_free);
+ g_clear_pointer (&layout->attrs, pango2_attr_list_unref);
+ g_clear_pointer (&layout->tabs, pango2_tab_array_free);
g_clear_object (&layout->lines);
- G_OBJECT_CLASS (pango_layout_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_layout_parent_class)->finalize (object);
}
static void
-pango_layout_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+pango2_layout_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- PangoLayout *layout = PANGO_LAYOUT (object);
+ Pango2Layout *layout = PANGO2_LAYOUT (object);
switch (prop_id)
{
case PROP_CONTEXT:
layout->context = g_value_dup_object (value);
- layout->context_serial = pango_context_get_serial (layout->context);
+ layout->context_serial = pango2_context_get_serial (layout->context);
break;
case PROP_TEXT:
- pango_layout_set_text (layout, g_value_get_string (value), -1);
+ pango2_layout_set_text (layout, g_value_get_string (value), -1);
break;
case PROP_ATTRIBUTES:
- pango_layout_set_attributes (layout, g_value_get_boxed (value));
+ pango2_layout_set_attributes (layout, g_value_get_boxed (value));
break;
case PROP_FONT_DESCRIPTION:
- pango_layout_set_font_description (layout, g_value_get_boxed (value));
+ pango2_layout_set_font_description (layout, g_value_get_boxed (value));
break;
case PROP_LINE_HEIGHT:
- pango_layout_set_line_height (layout, g_value_get_float (value));
+ pango2_layout_set_line_height (layout, g_value_get_float (value));
break;
case PROP_SPACING:
- pango_layout_set_spacing (layout, g_value_get_int (value));
+ pango2_layout_set_spacing (layout, g_value_get_int (value));
break;
case PROP_WIDTH:
- pango_layout_set_width (layout, g_value_get_int (value));
+ pango2_layout_set_width (layout, g_value_get_int (value));
break;
case PROP_HEIGHT:
- pango_layout_set_height (layout, g_value_get_int (value));
+ pango2_layout_set_height (layout, g_value_get_int (value));
break;
case PROP_TABS:
- pango_layout_set_tabs (layout, g_value_get_boxed (value));
+ pango2_layout_set_tabs (layout, g_value_get_boxed (value));
break;
case PROP_SINGLE_PARAGRAPH:
- pango_layout_set_single_paragraph (layout, g_value_get_boolean (value));
+ pango2_layout_set_single_paragraph (layout, g_value_get_boolean (value));
break;
case PROP_WRAP:
- pango_layout_set_wrap (layout, g_value_get_enum (value));
+ pango2_layout_set_wrap (layout, g_value_get_enum (value));
break;
case PROP_INDENT:
- pango_layout_set_indent (layout, g_value_get_int (value));
+ pango2_layout_set_indent (layout, g_value_get_int (value));
break;
case PROP_ALIGNMENT:
- pango_layout_set_alignment (layout, g_value_get_enum (value));
+ pango2_layout_set_alignment (layout, g_value_get_enum (value));
break;
case PROP_ELLIPSIZE:
- pango_layout_set_ellipsize (layout, g_value_get_enum (value));
+ pango2_layout_set_ellipsize (layout, g_value_get_enum (value));
break;
case PROP_AUTO_DIR:
- pango_layout_set_auto_dir (layout, g_value_get_boolean (value));
+ pango2_layout_set_auto_dir (layout, g_value_get_boolean (value));
break;
default:
@@ -224,12 +224,12 @@ pango_layout_set_property (GObject *object,
}
static void
-pango_layout_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+pango2_layout_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- PangoLayout *layout = PANGO_LAYOUT (object);
+ Pango2Layout *layout = PANGO2_LAYOUT (object);
switch (prop_id)
{
@@ -294,7 +294,7 @@ pango_layout_get_property (GObject *object,
break;
case PROP_LINES:
- g_value_set_object (value, pango_layout_get_lines (layout));
+ g_value_set_object (value, pango2_layout_get_lines (layout));
break;
default:
@@ -304,56 +304,56 @@ pango_layout_get_property (GObject *object,
}
static void
-pango_layout_class_init (PangoLayoutClass *class)
+pango2_layout_class_init (Pango2LayoutClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = pango_layout_finalize;
- object_class->set_property = pango_layout_set_property;
- object_class->get_property = pango_layout_get_property;
+ object_class->finalize = pango2_layout_finalize;
+ object_class->set_property = pango2_layout_set_property;
+ object_class->get_property = pango2_layout_get_property;
/**
- * PangoLayout:context: (attributes org.gtk.Property.get=pango_layout_get_context)
+ * Pango2Layout:context: (attributes org.gtk.Property.get=pango2_layout_get_context)
*
- * The context for the `PangoLayout`.
+ * The context for the `Pango2Layout`.
*/
props[PROP_CONTEXT] = g_param_spec_object ("context", "context", "context",
- PANGO_TYPE_CONTEXT,
+ PANGO2_TYPE_CONTEXT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
/**
- * PangoLayout:text: (attributes org.gtk.Property.get=pango_layout_get_text org.gtk.Property.set=pango_layout_set_text)
+ * Pango2Layout:text: (attributes org.gtk.Property.get=pango2_layout_get_text org.gtk.Property.set=pango2_layout_set_text)
*
- * The text of the `PangoLayout`.
+ * The text of the `Pango2Layout`.
*/
props[PROP_TEXT] = g_param_spec_string ("text", "text", "text",
"",
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:attributes: (attributes org.gtk.Property.get=pango_layout_get_attributes org.gtk.Property.set=pango_layout_set_attributes)
+ * Pango2Layout:attributes: (attributes org.gtk.Property.get=pango2_layout_get_attributes org.gtk.Property.set=pango2_layout_set_attributes)
*
- * The attributes of the `PangoLayout`.
+ * The attributes of the `Pango2Layout`.
*
* Attributes can affect how the text is formatted.
*/
props[PROP_ATTRIBUTES] = g_param_spec_boxed ("attributes", "attributes", "attributes",
- PANGO_TYPE_ATTR_LIST,
+ PANGO2_TYPE_ATTR_LIST,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:font-description: (attributes org.gtk.Property.get=pango_layout_get_font_description org.gtk.Property.set=pango_layout_set_font_description)
+ * Pango2Layout:font-description: (attributes org.gtk.Property.get=pango2_layout_get_font_description org.gtk.Property.set=pango2_layout_set_font_description)
*
- * The font description of the `PangoLayout`.
+ * The font description of the `Pango2Layout`.
*/
props[PROP_FONT_DESCRIPTION] = g_param_spec_boxed ("font-description", "font-description", "font-description",
- PANGO_TYPE_FONT_DESCRIPTION,
+ PANGO2_TYPE_FONT_DESCRIPTION,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:line-height: (attributes org.gtk.Property.get=pango_layout_get_line_height org.gtk.Property.set=pango_layout_set_line_height)
+ * Pango2Layout:line-height: (attributes org.gtk.Property.get=pango2_layout_get_line_height org.gtk.Property.set=pango2_layout_set_line_height)
*
- * The line height factor of the `PangoLayout`.
+ * The line height factor of the `Pango2Layout`.
*
* If non-zero, the line height is multiplied by this factor to determine
* the logical extents of the text.
@@ -365,11 +365,11 @@ pango_layout_class_init (PangoLayoutClass *class)
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:spacing: (attributes org.gtk.Property.get=pango_layout_get_spacing org.gtk.Property.set=pango_layout_set_spacing)
+ * Pango2Layout:spacing: (attributes org.gtk.Property.get=pango2_layout_get_spacing org.gtk.Property.set=pango2_layout_set_spacing)
*
- * Spacing to add between the lines of the `PangoLayout`.
+ * Spacing to add between the lines of the `Pango2Layout`.
*
- * The spacing is specified in Pango units.
+ * The spacing is specified in Pango2 units.
*
* The default value is 0.
*/
@@ -378,11 +378,11 @@ pango_layout_class_init (PangoLayoutClass *class)
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:width: (attributes org.gtk.Property.get=pango_layout_get_width org.gtk.Property.set=pango_layout_set_width)
+ * Pango2Layout:width: (attributes org.gtk.Property.get=pango2_layout_get_width org.gtk.Property.set=pango2_layout_set_width)
*
- * The width to which the text of `PangoLayout` will be broken.
+ * The width to which the text of `Pango2Layout` will be broken.
*
- * The width is specified in Pango units, with -1 meaning unlimited.
+ * The width is specified in Pango2 units, with -1 meaning unlimited.
*
* The default value is -1.
*/
@@ -391,9 +391,9 @@ pango_layout_class_init (PangoLayoutClass *class)
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:height: (attributes org.gtk.Property.get=pango_layout_get_height org.gtk.Property.set=pango_layout_set_height)
+ * Pango2Layout:height: (attributes org.gtk.Property.get=pango2_layout_get_height org.gtk.Property.set=pango2_layout_set_height)
*
- * The height to which the `PangoLayout` will be ellipsized.
+ * The height to which the `Pango2Layout` will be ellipsized.
*
* If @height is positive, it will be the maximum height of the
* layout. Only lines would be shown that would fit, and if there
@@ -411,9 +411,9 @@ pango_layout_class_init (PangoLayoutClass *class)
* paragraph is ellipsized.
*
* Height setting only has effect if a positive width is set on the
- * layout and its ellipsization mode is not `PANGO_ELLIPSIZE_NONE`.
+ * layout and its ellipsization mode is not `PANGO2_ELLIPSIZE_NONE`.
* The behavior is undefined if a height other than -1 is set and
- * ellipsization mode is set to `PANGO_ELLIPSIZE_NONE`.
+ * ellipsization mode is set to `PANGO2_ELLIPSIZE_NONE`.
*
* The default value is -1.
*/
@@ -422,19 +422,19 @@ pango_layout_class_init (PangoLayoutClass *class)
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:tabs: (attributes org.gtk.Property.get=pango_layout_get_tabs org.gtk.Property.set=pango_layout_set_tabs)
+ * Pango2Layout:tabs: (attributes org.gtk.Property.get=pango2_layout_get_tabs org.gtk.Property.set=pango2_layout_set_tabs)
*
- * The tabs to use when formatting the text of `PangoLayout`.
+ * The tabs to use when formatting the text of `Pango2Layout`.
*
- * `PangoLayout` will place content at the next tab position
+ * `Pango2Layout` will place content at the next tab position
* whenever it meets a Tab character (U+0009).
*/
props[PROP_TABS] = g_param_spec_boxed ("tabs", "tabs", "tabs",
- PANGO_TYPE_TAB_ARRAY,
+ PANGO2_TYPE_TAB_ARRAY,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:single-paragraph: (attributes org.gtk.Property.get=pango_layout_get_single_paragraph org.gtk.Property.set=pango_layout_set_single_paragraph)
+ * Pango2Layout:single-paragraph: (attributes org.gtk.Property.get=pango2_layout_get_single_paragraph org.gtk.Property.set=pango2_layout_set_single_paragraph)
*
* Whether to treat newlines and similar characters as paragraph
* separators or not.
@@ -451,26 +451,26 @@ pango_layout_class_init (PangoLayoutClass *class)
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:wrap: (attributes org.gtk.Property.get=pango_layout_get_wrap org.gtk.Property.set=pango_layout_set_wrap)
+ * Pango2Layout:wrap: (attributes org.gtk.Property.get=pango2_layout_get_wrap org.gtk.Property.set=pango2_layout_set_wrap)
*
- * The wrap mode of this `PangoLayout`.
+ * The wrap mode of this `Pango2Layout`.
*
- * The wrap mode influences how Pango chooses line breaks
+ * The wrap mode influences how Pango2 chooses line breaks
* when text needs to be wrapped.
*
- * The default value is `PANGO_WRAP_WORD`.
+ * The default value is `PANGO2_WRAP_WORD`.
*/
props[PROP_WRAP] = g_param_spec_enum ("wrap", "wrap", "wrap",
- PANGO_TYPE_WRAP_MODE,
- PANGO_WRAP_WORD,
+ PANGO2_TYPE_WRAP_MODE,
+ PANGO2_WRAP_WORD,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:indent: (attributes org.gtk.Property.get=pango_layout_get_indent org.gtk.Property.set=pango_layout_set_indent)
+ * Pango2Layout:indent: (attributes org.gtk.Property.get=pango2_layout_get_indent org.gtk.Property.set=pango2_layout_set_indent)
*
- * The indent of this `PangoLayout`.
+ * The indent of this `Pango2Layout`.
*
- * The indent is specified in Pango units.
+ * The indent is specified in Pango2 units.
*
* A negative value of @indent will produce a hanging indentation.
* That is, the first line will have the full width, and subsequent
@@ -483,33 +483,33 @@ pango_layout_class_init (PangoLayoutClass *class)
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:alignment: (attributes org.gtk.Property.get=pango_layout_get_alignment org.gtk.Property.set=pango_layout_set_alignment)
+ * Pango2Layout:alignment: (attributes org.gtk.Property.get=pango2_layout_get_alignment org.gtk.Property.set=pango2_layout_set_alignment)
*
- * The alignment mode of this `PangoLayout`.
+ * The alignment mode of this `Pango2Layout`.
*
- * The default value is `PANGO_ALIGN_NATURAL`.
+ * The default value is `PANGO2_ALIGN_NATURAL`.
*/
props[PROP_ALIGNMENT] = g_param_spec_enum ("alignment", "alignment", "alignment",
- PANGO_TYPE_ALIGNMENT,
- PANGO_ALIGN_NATURAL,
+ PANGO2_TYPE_ALIGNMENT,
+ PANGO2_ALIGN_NATURAL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:ellipsize: (attributes org.gtk.Property.get=pango_layout_get_ellipsize org.gtk.Property.set=pango_layout_set_ellipsize)
+ * Pango2Layout:ellipsize: (attributes org.gtk.Property.get=pango2_layout_get_ellipsize org.gtk.Property.set=pango2_layout_set_ellipsize)
*
- * The ellipsization mode of this `PangoLayout`.
+ * The ellipsization mode of this `Pango2Layout`.
*
- * The default value is `PANGO_ELLIPSIZE_NONE`.
+ * The default value is `PANGO2_ELLIPSIZE_NONE`.
*/
props[PROP_ELLIPSIZE] = g_param_spec_enum ("ellipsize", "ellipsize", "ellipsize",
- PANGO_TYPE_ELLIPSIZE_MODE,
- PANGO_ELLIPSIZE_NONE,
+ PANGO2_TYPE_ELLIPSIZE_MODE,
+ PANGO2_ELLIPSIZE_NONE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:auto-dir: (attributes org.gtk.Property.get=pango_layout_get_auto_dir org.gtk.Property.set=pango_layout_set_auto_dir)
+ * Pango2Layout:auto-dir: (attributes org.gtk.Property.get=pango2_layout_get_auto_dir org.gtk.Property.set=pango2_layout_set_auto_dir)
*
- * Whether this `PangoLayout` determines the
+ * Whether this `Pango2Layout` determines the
* base direction from the content.
*
* The default value is `TRUE`.
@@ -519,12 +519,12 @@ pango_layout_class_init (PangoLayoutClass *class)
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLayout:lines: (attributes org.gtk.Property.get=pango_layout_get_lines)
+ * Pango2Layout:lines: (attributes org.gtk.Property.get=pango2_layout_get_lines)
*
- * The `PangoLines` object holding the formatted lines.
+ * The `Pango2Lines` object holding the formatted lines.
*/
props[PROP_LINES] = g_param_spec_object ("lines", "lines", "lines",
- PANGO_TYPE_LINES,
+ PANGO2_TYPE_LINES,
G_PARAM_READABLE);
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
@@ -534,7 +534,7 @@ pango_layout_class_init (PangoLayoutClass *class)
/* {{{ Utilities */
static void
-layout_changed (PangoLayout *layout)
+layout_changed (Pango2Layout *layout)
{
layout->serial++;
if (layout->serial == 0)
@@ -545,69 +545,69 @@ layout_changed (PangoLayout *layout)
}
static void
-check_context_changed (PangoLayout *layout)
+check_context_changed (Pango2Layout *layout)
{
guint old_serial = layout->context_serial;
- layout->context_serial = pango_context_get_serial (layout->context);
+ layout->context_serial = pango2_context_get_serial (layout->context);
if (old_serial != layout->context_serial)
- pango_layout_context_changed (layout);
+ pango2_layout_context_changed (layout);
}
-static PangoAttrList *
-ensure_attrs (PangoLayout *layout,
- PangoAttrList *attrs)
+static Pango2AttrList *
+ensure_attrs (Pango2Layout *layout,
+ Pango2AttrList *attrs)
{
if (attrs)
return attrs;
else if (layout->attrs)
- return pango_attr_list_copy (layout->attrs);
+ return pango2_attr_list_copy (layout->attrs);
else
- return pango_attr_list_new ();
+ return pango2_attr_list_new ();
}
-static PangoAttrList *
-get_effective_attributes (PangoLayout *layout)
+static Pango2AttrList *
+get_effective_attributes (Pango2Layout *layout)
{
- PangoAttrList *attrs = NULL;
+ Pango2AttrList *attrs = NULL;
if (layout->font_desc)
{
attrs = ensure_attrs (layout, attrs);
- pango_attr_list_insert_before (attrs,
- pango_attr_font_desc_new (layout->font_desc));
+ pango2_attr_list_insert_before (attrs,
+ pango2_attr_font_desc_new (layout->font_desc));
}
if (layout->line_height != 0.0)
{
attrs = ensure_attrs (layout, attrs);
- pango_attr_list_insert_before (attrs,
- pango_attr_line_height_new (layout->line_height));
+ pango2_attr_list_insert_before (attrs,
+ pango2_attr_line_height_new (layout->line_height));
}
if (layout->spacing != 0)
{
attrs = ensure_attrs (layout, attrs);
- pango_attr_list_insert_before (attrs,
- pango_attr_line_spacing_new (layout->spacing));
+ pango2_attr_list_insert_before (attrs,
+ pango2_attr_line_spacing_new (layout->spacing));
}
if (layout->single_paragraph)
{
attrs = ensure_attrs (layout, attrs);
- pango_attr_list_insert_before (attrs,
- pango_attr_paragraph_new ());
+ pango2_attr_list_insert_before (attrs,
+ pango2_attr_paragraph_new ());
}
if (attrs)
return attrs;
- return pango_attr_list_ref (layout->attrs);
+ return pango2_attr_list_ref (layout->attrs);
}
static gboolean
-ends_with_paragraph_separator (PangoLayout *layout)
+ends_with_paragraph_separator (Pango2Layout *layout)
{
if (layout->single_paragraph)
return FALSE;
@@ -619,10 +619,10 @@ ends_with_paragraph_separator (PangoLayout *layout)
}
static void
-ensure_lines (PangoLayout *layout)
+ensure_lines (Pango2Layout *layout)
{
- PangoLineBreaker *breaker;
- PangoAttrList *attrs;
+ Pango2LineBreaker *breaker;
+ Pango2AttrList *attrs;
int x, y, width;
int line_no;
@@ -631,30 +631,30 @@ ensure_lines (PangoLayout *layout)
if (layout->lines)
return;
- breaker = pango_line_breaker_new (layout->context);
+ breaker = pango2_line_breaker_new (layout->context);
- pango_line_breaker_set_tabs (breaker, layout->tabs);
- pango_line_breaker_set_base_dir (breaker,
- layout->auto_dir
- ? PANGO_DIRECTION_NEUTRAL
- : pango_context_get_base_dir (layout->context));
+ pango2_line_breaker_set_tabs (breaker, layout->tabs);
+ pango2_line_breaker_set_base_dir (breaker,
+ layout->auto_dir
+ ? PANGO2_DIRECTION_NEUTRAL
+ : pango2_context_get_base_dir (layout->context));
attrs = get_effective_attributes (layout);
- pango_line_breaker_add_text (breaker, layout->text ? layout->text : "", -1, attrs);
+ pango2_line_breaker_add_text (breaker, layout->text ? layout->text : "", -1, attrs);
if (attrs)
- pango_attr_list_unref (attrs);
+ pango2_attr_list_unref (attrs);
- layout->lines = pango_lines_new ();
+ layout->lines = pango2_lines_new ();
x = y = 0;
line_no = 0;
- while (pango_line_breaker_has_line (breaker))
+ while (pango2_line_breaker_has_line (breaker))
{
- PangoLine *line;
- PangoRectangle ext;
+ Pango2Line *line;
+ Pango2Rectangle ext;
int offset;
- PangoEllipsizeMode ellipsize = PANGO_ELLIPSIZE_NONE;
- PangoLeadingTrim trim = PANGO_LEADING_TRIM_NONE;
+ Pango2EllipsizeMode ellipsize = PANGO2_ELLIPSIZE_NONE;
+ Pango2LeadingTrim trim = PANGO2_LEADING_TRIM_NONE;
if ((line_no == 0) == (layout->indent > 0))
{
@@ -671,21 +671,21 @@ ensure_lines (PangoLayout *layout)
ellipsize = layout->ellipsize;
retry:
- line = pango_line_breaker_next_line (breaker, x, width, layout->wrap, ellipsize);
+ line = pango2_line_breaker_next_line (breaker, x, width, layout->wrap, ellipsize);
if (line->starts_paragraph)
- trim |= PANGO_LEADING_TRIM_START;
+ trim |= PANGO2_LEADING_TRIM_START;
if (line->ends_paragraph)
- trim |= PANGO_LEADING_TRIM_END;
+ trim |= PANGO2_LEADING_TRIM_END;
- pango_line_get_trimmed_extents (line, trim, &ext);
+ pango2_line_get_trimmed_extents (line, trim, &ext);
if (layout->height >= 0 && y + 2 * ext.height >= layout->height &&
ellipsize != layout->ellipsize)
{
- if (pango_line_breaker_undo_line (breaker, line))
+ if (pango2_line_breaker_undo_line (breaker, line))
{
- g_clear_pointer (&line, pango_line_free);
+ g_clear_pointer (&line, pango2_line_free);
ellipsize = layout->ellipsize;
goto retry;
}
@@ -696,35 +696,35 @@ retry:
switch (layout->alignment)
{
- case PANGO_ALIGN_LEFT:
+ case PANGO2_ALIGN_LEFT:
break;
- case PANGO_ALIGN_CENTER:
+ case PANGO2_ALIGN_CENTER:
if (ext.width < width)
offset = (width - ext.width) / 2;
break;
- case PANGO_ALIGN_JUSTIFY:
- if (!pango_line_is_paragraph_end (line))
+ case PANGO2_ALIGN_JUSTIFY:
+ if (!pango2_line_is_paragraph_end (line))
{
- line = pango_line_justify (line, width);
+ line = pango2_line_justify (line, width);
break;
}
G_GNUC_FALLTHROUGH;
- case PANGO_ALIGN_NATURAL:
+ case PANGO2_ALIGN_NATURAL:
{
- PangoLine *first_line;
- if (pango_lines_get_line_count (layout->lines) > 0)
- first_line = pango_lines_get_lines (layout->lines)[0];
+ Pango2Line *first_line;
+ if (pango2_lines_get_line_count (layout->lines) > 0)
+ first_line = pango2_lines_get_lines (layout->lines)[0];
else
first_line = line;
- if (pango_line_get_resolved_direction (first_line) == PANGO_DIRECTION_LTR)
+ if (pango2_line_get_resolved_direction (first_line) == PANGO2_DIRECTION_LTR)
break;
}
G_GNUC_FALLTHROUGH;
- case PANGO_ALIGN_RIGHT:
+ case PANGO2_ALIGN_RIGHT:
if (ext.width < width)
offset = width - ext.width;
break;
@@ -733,7 +733,7 @@ retry:
g_assert_not_reached ();
}
- pango_lines_add_line (layout->lines, line, x + offset, y - ext.y);
+ pango2_lines_add_line (layout->lines, line, x + offset, y - ext.y);
y += ext.height;
line_no++;
@@ -742,21 +742,21 @@ retry:
/* Append an empty line if we end with a newline.
* And always provide at least one line
*/
- if (pango_lines_get_line_count (layout->lines) == 0 ||
+ if (pango2_lines_get_line_count (layout->lines) == 0 ||
ends_with_paragraph_separator (layout))
{
LineData *data;
int start_index;
int start_offset;
int offset;
- PangoLine *line;
- PangoRectangle ext;
+ Pango2Line *line;
+ Pango2Rectangle ext;
- if (pango_lines_get_line_count (layout->lines) > 0)
+ if (pango2_lines_get_line_count (layout->lines) > 0)
{
- PangoLine *last;
+ Pango2Line *last;
- last = pango_lines_get_lines (layout->lines)[pango_lines_get_line_count (layout->lines) - 1];
+ last = pango2_lines_get_lines (layout->lines)[pango2_lines_get_line_count (layout->lines) - 1];
data = line_data_ref (last->data);
start_index = data->length;
start_offset = last->data->n_chars;
@@ -768,14 +768,14 @@ retry:
data->text = g_strdup ("");
data->length = 0;
data->attrs = get_effective_attributes (layout);
- data->log_attrs = g_new0 (PangoLogAttr, 1);
+ data->log_attrs = g_new0 (Pango2LogAttr, 1);
data->log_attrs[0].is_cursor_position = TRUE;
start_index = 0;
start_offset = 0;
offset = 0;
}
- line = pango_line_new (layout->context, data);
+ line = pango2_line_new (layout->context, data);
line->starts_paragraph = TRUE;
line->ends_paragraph = TRUE;
line->start_index = start_index;
@@ -783,9 +783,9 @@ retry:
line->start_offset = start_offset;
line->n_chars = 0;
- pango_line_get_extents (line, NULL, &ext);
+ pango2_line_get_extents (line, NULL, &ext);
- pango_lines_add_line (layout->lines, line, x + offset, y - ext.y);
+ pango2_lines_add_line (layout->lines, line, x + offset, y - ext.y);
line_data_unref (data);
}
@@ -797,54 +797,54 @@ retry:
/* {{{ Public API */
/**
- * pango_layout_new:
- * @context: a `PangoContext`
+ * pango2_layout_new:
+ * @context: a `Pango2Context`
*
- * Creates a new `PangoLayout` with attribute initialized to
- * default values for a particular `PangoContext`
+ * Creates a new `Pango2Layout` with attribute initialized to
+ * default values for a particular `Pango2Context`
*
- * Return value: a newly allocated `PangoLayout`
+ * Return value: a newly allocated `Pango2Layout`
*/
-PangoLayout *
-pango_layout_new (PangoContext *context)
+Pango2Layout *
+pango2_layout_new (Pango2Context *context)
{
- g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL);
- return g_object_new (PANGO_TYPE_LAYOUT, "context", context, NULL);
+ return g_object_new (PANGO2_TYPE_LAYOUT, "context", context, NULL);
}
/**
- * pango_layout_copy:
- * @layout: a `PangoLayout`
+ * pango2_layout_copy:
+ * @layout: a `Pango2Layout`
*
* Creates a deep copy-by-value of the layout.
*
* The attribute list, tab array, and text from the original layout
* are all copied by value.
*
- * Return value: (transfer full): the newly allocated `PangoLayout`
+ * Return value: (transfer full): the newly allocated `Pango2Layout`
*/
-PangoLayout *
-pango_layout_copy (PangoLayout *layout)
+Pango2Layout *
+pango2_layout_copy (Pango2Layout *layout)
{
- PangoLayout *copy;
+ Pango2Layout *copy;
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), NULL);
- copy = pango_layout_new (layout->context);
+ copy = pango2_layout_new (layout->context);
copy->text = g_strdup (layout->text);
copy->length = layout->length;
if (layout->attrs)
- copy->attrs = pango_attr_list_copy (layout->attrs);
+ copy->attrs = pango2_attr_list_copy (layout->attrs);
if (layout->font_desc)
- copy->font_desc = pango_font_description_copy (layout->font_desc);
+ copy->font_desc = pango2_font_description_copy (layout->font_desc);
copy->line_height = layout->line_height;
copy->spacing = layout->spacing;
copy->width = layout->width;
copy->height = layout->height;
if (layout->tabs)
- copy->tabs = pango_tab_array_copy (layout->tabs);
+ copy->tabs = pango2_tab_array_copy (layout->tabs);
copy->single_paragraph = layout->single_paragraph;
copy->wrap = layout->wrap;
copy->indent = layout->indent;
@@ -858,26 +858,26 @@ pango_layout_copy (PangoLayout *layout)
}
/**
- * pango_layout_get_serial:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_serial:
+ * @layout: a `Pango2Layout`
*
* Returns the current serial number of the layout.
*
* The serial number is initialized to an small number larger than zero
* when a new layout is created and is increased whenever the layout is
- * changed using any of the setter functions, or the `PangoContext` it
+ * changed using any of the setter functions, or the `Pango2Context` it
* uses has changed.
*
* The serial may wrap, but will never have the value 0. Since it can
* wrap, never compare it with "less than", always use "not equals".
*
- * This can be used to automatically detect changes to a `PangoLayout`,
+ * This can be used to automatically detect changes to a `Pango2Layout`,
* and is useful for example to decide whether a layout needs redrawing.
*
* Return value: The current serial number of @layout
*/
guint
-pango_layout_get_serial (PangoLayout *layout)
+pango2_layout_get_serial (Pango2Layout *layout)
{
check_context_changed (layout);
@@ -885,8 +885,8 @@ pango_layout_get_serial (PangoLayout *layout)
}
/**
- * pango_layout_context_changed:
- * @layout: a `PangoLayout`
+ * pango2_layout_context_changed:
+ * @layout: a `Pango2Layout`
*
* Forces recomputation of any state in the layout that
* might depend on the layout's context.
@@ -895,9 +895,9 @@ pango_layout_get_serial (PangoLayout *layout)
* context subsequent to creating the layout.
*/
void
-pango_layout_context_changed (PangoLayout *layout)
+pango2_layout_context_changed (Pango2Layout *layout)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
layout_changed (layout);
}
@@ -905,24 +905,24 @@ pango_layout_context_changed (PangoLayout *layout)
/* {{{ Property getters and setters */
/**
- * pango_layout_get_context:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_context:
+ * @layout: a `Pango2Layout`
*
- * Retrieves the `PangoContext` used for this layout.
+ * Retrieves the `Pango2Context` used for this layout.
*
- * Return value: (transfer none): the `PangoContext` for the layout
+ * Return value: (transfer none): the `Pango2Context` for the layout
*/
-PangoContext *
-pango_layout_get_context (PangoLayout *layout)
+Pango2Context *
+pango2_layout_get_context (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), NULL);
return layout->context;
}
/**
- * pango_layout_set_text:
- * @layout: a `PangoLayout`
+ * pango2_layout_set_text:
+ * @layout: a `Pango2Layout`
* @text: the text
* @length: maximum length of @text, in bytes. -1 indicates that
* the string is nul-terminated
@@ -930,11 +930,11 @@ pango_layout_get_context (PangoLayout *layout)
* Sets the text of the layout.
*/
void
-pango_layout_set_text (PangoLayout *layout,
- const char *text,
- int length)
+pango2_layout_set_text (Pango2Layout *layout,
+ const char *text,
+ int length)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (length < 0)
length = strlen (text);
@@ -948,8 +948,8 @@ pango_layout_set_text (PangoLayout *layout,
}
/**
- * pango_layout_get_text:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_text:
+ * @layout: a `Pango2Layout`
*
* Gets the text in the layout.
*
@@ -958,57 +958,57 @@ pango_layout_set_text (PangoLayout *layout,
* Return value: (transfer none): the text in the @layout
*/
const char *
-pango_layout_get_text (PangoLayout *layout)
+pango2_layout_get_text (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), NULL);
return layout->text;
}
/**
- * pango_layout_set_attributes:
- * @layout: a `PangoLayout`
- * @attrs: (nullable) (transfer none): a `PangoAttrList`
+ * pango2_layout_set_attributes:
+ * @layout: a `Pango2Layout`
+ * @attrs: (nullable) (transfer none): a `Pango2AttrList`
*
* Sets the attributes for a layout object.
*
* References @attrs, so the caller can unref its reference.
*/
void
-pango_layout_set_attributes (PangoLayout *layout,
- PangoAttrList *attrs)
+pango2_layout_set_attributes (Pango2Layout *layout,
+ Pango2AttrList *attrs)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
- g_clear_pointer (&layout->attrs, pango_attr_list_unref);
+ g_clear_pointer (&layout->attrs, pango2_attr_list_unref);
layout->attrs = attrs;
if (layout->attrs)
- pango_attr_list_ref (layout->attrs);
+ pango2_attr_list_ref (layout->attrs);
g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_ATTRIBUTES]);
layout_changed (layout);
}
/**
- * pango_layout_get_attributes:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_attributes:
+ * @layout: a `Pango2Layout`
*
* Gets the attribute list for the layout, if any.
*
- * Return value: (transfer none) (nullable): a `PangoAttrList`
+ * Return value: (transfer none) (nullable): a `Pango2AttrList`
*/
-PangoAttrList *
-pango_layout_get_attributes (PangoLayout *layout)
+Pango2AttrList *
+pango2_layout_get_attributes (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), NULL);
return layout->attrs;
}
/**
- * pango_layout_set_font_description:
- * @layout: a `PangoLayout`
- * @desc: (nullable): the new `PangoFontDescription`
+ * pango2_layout_set_font_description:
+ * @layout: a `Pango2Layout`
+ * @desc: (nullable): the new `Pango2FontDescription`
*
* Sets the default font description for the layout.
*
@@ -1018,18 +1018,18 @@ pango_layout_get_attributes (PangoLayout *layout)
* This method is a shorthand for adding a font-desc attribute.
*/
void
-pango_layout_set_font_description (PangoLayout *layout,
- const PangoFontDescription *desc)
+pango2_layout_set_font_description (Pango2Layout *layout,
+ const Pango2FontDescription *desc)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (desc != layout->font_desc &&
- (!desc || !layout->font_desc || !pango_font_description_equal (desc, layout->font_desc)))
+ (!desc || !layout->font_desc || !pango2_font_description_equal (desc, layout->font_desc)))
{
if (layout->font_desc)
- pango_font_description_free (layout->font_desc);
+ pango2_font_description_free (layout->font_desc);
- layout->font_desc = desc ? pango_font_description_copy (desc) : NULL;
+ layout->font_desc = desc ? pango2_font_description_copy (desc) : NULL;
g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_FONT_DESCRIPTION]);
layout_changed (layout);
@@ -1037,8 +1037,8 @@ pango_layout_set_font_description (PangoLayout *layout,
}
/**
- * pango_layout_get_font_description:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_font_description:
+ * @layout: a `Pango2Layout`
*
* Gets the font description for the layout, if any.
*
@@ -1046,17 +1046,17 @@ pango_layout_set_font_description (PangoLayout *layout,
* layout's font description, or %NULL if the font description
* from the layout's context is inherited.
*/
-const PangoFontDescription *
-pango_layout_get_font_description (PangoLayout *layout)
+const Pango2FontDescription *
+pango2_layout_get_font_description (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), NULL);
return layout->font_desc;
}
/**
- * pango_layout_set_line_height:
- * @layout: a `PangoLayout`
+ * pango2_layout_set_line_height:
+ * @layout: a `Pango2Layout`
* @line_height: the new line height factor
*
* Sets a factor for line height.
@@ -1073,10 +1073,10 @@ pango_layout_get_font_description (PangoLayout *layout)
* This method is a shorthand for adding a line-height attribute.
*/
void
-pango_layout_set_line_height (PangoLayout *layout,
- float line_height)
+pango2_layout_set_line_height (Pango2Layout *layout,
+ float line_height)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (layout->line_height == line_height)
return;
@@ -1088,42 +1088,42 @@ pango_layout_set_line_height (PangoLayout *layout,
}
/**
- * pango_layout_get_line_height:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_line_height:
+ * @layout: a `Pango2Layout`
*
* Gets the line height factor of the layout.
*
- * See [method@Pango.Layout.set_line_height].
+ * See [method@Pango2.Layout.set_line_height].
*/
float
-pango_layout_get_line_height (PangoLayout *layout)
+pango2_layout_get_line_height (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), 0.0);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), 0.0);
return layout->line_height;
}
/**
- * pango_layout_set_spacing:
- * @layout: a `PangoLayout`
- * @spacing: the amount of spacing, in Pango units
+ * pango2_layout_set_spacing:
+ * @layout: a `Pango2Layout`
+ * @spacing: the amount of spacing, in Pango2 units
*
* Sets the amount of spacing between the lines of the layout.
*
- * When placing lines with spacing, Pango arranges things so that
+ * When placing lines with spacing, Pango2 arranges things so that
*
* line2.top = line1.bottom + spacing
*
* The default value is 0.
*
* Spacing only takes effect if the line height is not
- * overridden via [method@Pango.Layout.set_line_height].
+ * overridden via [method@Pango2.Layout.set_line_height].
*/
void
-pango_layout_set_spacing (PangoLayout *layout,
- int spacing)
+pango2_layout_set_spacing (Pango2Layout *layout,
+ int spacing)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (layout->spacing == spacing)
return;
@@ -1135,25 +1135,25 @@ pango_layout_set_spacing (PangoLayout *layout,
}
/**
- * pango_layout_get_spacing:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_spacing:
+ * @layout: a `Pango2Layout`
*
* Gets the amount of spacing between the lines of the layout.
*
- * Return value: the spacing in Pango units
+ * Return value: the spacing in Pango2 units
*/
int
-pango_layout_get_spacing (PangoLayout *layout)
+pango2_layout_get_spacing (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), 0);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), 0);
return layout->spacing;
}
/**
- * pango_layout_set_width:
- * @layout: a `PangoLayout`.
- * @width: the desired width in Pango units, or -1 to indicate that no
+ * pango2_layout_set_width:
+ * @layout: a `Pango2Layout`.
+ * @width: the desired width in Pango2 units, or -1 to indicate that no
* wrapping or ellipsization should be performed
*
* Sets the width to which the lines of the layout should
@@ -1162,10 +1162,10 @@ pango_layout_get_spacing (PangoLayout *layout)
* The default value is -1: no width set.
*/
void
-pango_layout_set_width (PangoLayout *layout,
- int width)
+pango2_layout_set_width (Pango2Layout *layout,
+ int width)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (width < -1)
width = -1;
@@ -1180,38 +1180,38 @@ pango_layout_set_width (PangoLayout *layout,
}
/**
- * pango_layout_get_width:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_width:
+ * @layout: a `Pango2Layout`
*
* Gets the width to which the lines of the layout should wrap.
*
- * Return value: the width in Pango units, or -1 if no width set.
+ * Return value: the width in Pango2 units, or -1 if no width set.
*/
int
-pango_layout_get_width (PangoLayout *layout)
+pango2_layout_get_width (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), -1);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), -1);
return layout->width;
}
/**
- * pango_layout_set_height:
- * @layout: a `PangoLayout`.
+ * pango2_layout_set_height:
+ * @layout: a `Pango2Layout`.
* @height: the desired height
*
- * Sets the height to which the `PangoLayout` should be ellipsized at.
+ * Sets the height to which the `Pango2Layout` should be ellipsized at.
*
* There are two different behaviors, based on whether @height is positive
* or negative.
*
- * See [property@Pango.Layout:height] for details.
+ * See [property@Pango2.Layout:height] for details.
*/
void
-pango_layout_set_height (PangoLayout *layout,
- int height)
+pango2_layout_set_height (Pango2Layout *layout,
+ int height)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (layout->height == height)
return;
@@ -1223,27 +1223,27 @@ pango_layout_set_height (PangoLayout *layout,
}
/**
- * pango_layout_get_height:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_height:
+ * @layout: a `Pango2Layout`
*
* Gets the height to which the lines of the layout should ellipsize.
*
- * See [property@Pango.Layout:height] for details.
+ * See [property@Pango2.Layout:height] for details.
*
* Return value: the height
*/
int
-pango_layout_get_height (PangoLayout *layout)
+pango2_layout_get_height (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), -1);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), -1);
return layout->height;
}
/**
- * pango_layout_set_tabs:
- * @layout: a `PangoLayout`
- * @tabs: (nullable): a `PangoTabArray`
+ * pango2_layout_set_tabs:
+ * @layout: a `Pango2Layout`
+ * @tabs: (nullable): a `Pango2TabArray`
*
* Sets the tabs to use for the layout, overriding the
* default tabs.
@@ -1251,47 +1251,47 @@ pango_layout_get_height (PangoLayout *layout)
* Setting the tabs to `NULL` reinstates the default
* tabs.
*
- * See [method@Pango.LineBreaker.set_tabs] for details.
+ * See [method@Pango2.LineBreaker.set_tabs] for details.
*/
void
-pango_layout_set_tabs (PangoLayout *layout,
- PangoTabArray *tabs)
+pango2_layout_set_tabs (Pango2Layout *layout,
+ Pango2TabArray *tabs)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (layout->tabs == tabs)
return;
- g_clear_pointer (&layout->tabs, pango_tab_array_free);
+ g_clear_pointer (&layout->tabs, pango2_tab_array_free);
if (tabs)
- layout->tabs = pango_tab_array_copy (tabs);
+ layout->tabs = pango2_tab_array_copy (tabs);
g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_TABS]);
layout_changed (layout);
}
/**
- * pango_layout_get_tabs:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_tabs:
+ * @layout: a `Pango2Layout`
*
- * Gets the current `PangoTabArray` used by this layout.
+ * Gets the current `Pango2TabArray` used by this layout.
*
- * If no `PangoTabArray` has been set, then the default tabs are
+ * If no `Pango2TabArray` has been set, then the default tabs are
* in use and %NULL is returned. Default tabs are every 8 spaces.
*
* Return value: (transfer none) (nullable): the tabs for this layout
*/
-PangoTabArray *
-pango_layout_get_tabs (PangoLayout *layout)
+Pango2TabArray *
+pango2_layout_get_tabs (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), NULL);
return layout->tabs;
}
/**
- * pango_layout_set_single_paragraph:
- * @layout: a `PangoLayout`
+ * pango2_layout_set_single_paragraph:
+ * @layout: a `Pango2Layout`
* @single_paragraph: the new setting
*
* Sets the single paragraph mode of the layout.
@@ -1306,10 +1306,10 @@ pango_layout_get_tabs (PangoLayout *layout)
* The default value is %FALSE.
*/
void
-pango_layout_set_single_paragraph (PangoLayout *layout,
- gboolean single_paragraph)
+pango2_layout_set_single_paragraph (Pango2Layout *layout,
+ gboolean single_paragraph)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (layout->single_paragraph == single_paragraph)
return;
@@ -1321,42 +1321,42 @@ pango_layout_set_single_paragraph (PangoLayout *layout,
}
/**
- * pango_layout_get_single_paragraph:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_single_paragraph:
+ * @layout: a `Pango2Layout`
*
* Obtains whether this layout is in single paragraph mode.
*
- * See [method@Pango.Layout.set_single_paragraph].
+ * See [method@Pango2.Layout.set_single_paragraph].
*
* Return value: `TRUE` if the layout does not break paragraphs
* at paragraph separator characters, %FALSE otherwise
*/
gboolean
-pango_layout_get_single_paragraph (PangoLayout *layout)
+pango2_layout_get_single_paragraph (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), FALSE);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), FALSE);
return layout->single_paragraph;
}
/**
- * pango_layout_set_wrap:
- * @layout: a `PangoLayout`
+ * pango2_layout_set_wrap:
+ * @layout: a `Pango2Layout`
* @wrap: the wrap mode
*
* Sets the wrap mode.
*
* The wrap mode only has effect if a width is set on the layout
- * with [method@Pango.Layout.set_width]. To turn off wrapping,
+ * with [method@Pango2.Layout.set_width]. To turn off wrapping,
* set the width to -1.
*
- * The default value is %PANGO_WRAP_WORD.
+ * The default value is %PANGO2_WRAP_WORD.
*/
void
-pango_layout_set_wrap (PangoLayout *layout,
- PangoWrapMode wrap)
+pango2_layout_set_wrap (Pango2Layout *layout,
+ Pango2WrapMode wrap)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (layout->wrap == wrap)
return;
@@ -1368,27 +1368,27 @@ pango_layout_set_wrap (PangoLayout *layout,
}
/**
- * pango_layout_get_wrap:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_wrap:
+ * @layout: a `Pango2Layout`
*
* Gets the wrap mode for the layout.
*
* Return value: active wrap mode.
*/
-PangoWrapMode
-pango_layout_get_wrap (PangoLayout *layout)
+Pango2WrapMode
+pango2_layout_get_wrap (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), PANGO_WRAP_WORD);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), PANGO2_WRAP_WORD);
return layout->wrap;
}
/**
- * pango_layout_set_indent:
- * @layout: a `PangoLayout`
+ * pango2_layout_set_indent:
+ * @layout: a `Pango2Layout`
* @indent: the amount by which to indent
*
- * Sets the width in Pango units to indent each paragraph.
+ * Sets the width in Pango2 units to indent each paragraph.
*
* A negative value of @indent will produce a hanging indentation.
* That is, the first line will have the full width, and subsequent
@@ -1397,10 +1397,10 @@ pango_layout_get_wrap (PangoLayout *layout)
* The default value is 0.
*/
void
-pango_layout_set_indent (PangoLayout *layout,
- int indent)
+pango2_layout_set_indent (Pango2Layout *layout,
+ int indent)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (layout->indent == indent)
return;
@@ -1412,26 +1412,26 @@ pango_layout_set_indent (PangoLayout *layout,
}
/**
- * pango_layout_get_indent:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_indent:
+ * @layout: a `Pango2Layout`
*
- * Gets the paragraph indent width in Pango units.
+ * Gets the paragraph indent width in Pango2 units.
*
* A negative value indicates a hanging indentation.
*
- * Return value: the indent in Pango units
+ * Return value: the indent in Pango2 units
*/
int
-pango_layout_get_indent (PangoLayout *layout)
+pango2_layout_get_indent (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), 0);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), 0);
return layout->indent;
}
/**
- * pango_layout_set_alignment:
- * @layout: a `PangoLayout`
+ * pango2_layout_set_alignment:
+ * @layout: a `Pango2Layout`
* @alignment: the alignment
*
* Sets the alignment for the layout.
@@ -1439,13 +1439,13 @@ pango_layout_get_indent (PangoLayout *layout)
* The alignment determines how short lines are
* positioned within the available horizontal space.
*
- * The default alignment is `PANGO_ALIGN_NATURAL`.
+ * The default alignment is `PANGO2_ALIGN_NATURAL`.
*/
void
-pango_layout_set_alignment (PangoLayout *layout,
- PangoAlignment alignment)
+pango2_layout_set_alignment (Pango2Layout *layout,
+ Pango2Alignment alignment)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (layout->alignment == alignment)
return;
@@ -1457,8 +1457,8 @@ pango_layout_set_alignment (PangoLayout *layout,
}
/**
- * pango_layout_get_alignment:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_alignment:
+ * @layout: a `Pango2Layout`
*
* Gets the alignment for the layout.
*
@@ -1467,32 +1467,32 @@ pango_layout_set_alignment (PangoLayout *layout,
*
* Return value: the alignment
*/
-PangoAlignment
-pango_layout_get_alignment (PangoLayout *layout)
+Pango2Alignment
+pango2_layout_get_alignment (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), PANGO_ALIGN_NATURAL);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), PANGO2_ALIGN_NATURAL);
return layout->alignment;
}
/**
- * pango_layout_set_ellipsize:
- * @layout: a `PangoLayout`
+ * pango2_layout_set_ellipsize:
+ * @layout: a `Pango2Layout`
* @ellipsize: the new ellipsization mode for @layout
*
* Sets the type of ellipsization to use for this layout.
*
* Depending on the ellipsization mode @ellipsize text is removed
* from the start, middle, or end of text so they fit within the
- * width of layout set with [method@Pango.Layout.set_width].
+ * width of layout set with [method@Pango2.Layout.set_width].
*
- * The default value is `PANGO_ELLIPSIZE_NONE`.
+ * The default value is `PANGO2_ELLIPSIZE_NONE`.
*/
void
-pango_layout_set_ellipsize (PangoLayout *layout,
- PangoEllipsizeMode ellipsize)
+pango2_layout_set_ellipsize (Pango2Layout *layout,
+ Pango2EllipsizeMode ellipsize)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (layout->ellipsize == ellipsize)
return;
@@ -1504,26 +1504,26 @@ pango_layout_set_ellipsize (PangoLayout *layout,
}
/**
- * pango_layout_get_ellipsize:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_ellipsize:
+ * @layout: a `Pango2Layout`
*
* Gets the type of ellipsization being performed for the layout.
*
- * See [method@Pango.Layout.set_ellipsize].
+ * See [method@Pango2.Layout.set_ellipsize].
*
* Return value: the current ellipsization mode for @layout
*/
-PangoEllipsizeMode
-pango_layout_get_ellipsize (PangoLayout *layout)
+Pango2EllipsizeMode
+pango2_layout_get_ellipsize (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), PANGO_ELLIPSIZE_NONE);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), PANGO2_ELLIPSIZE_NONE);
return layout->ellipsize;
}
/**
- * pango_layout_set_auto_dir:
- * @layout: a `PangoLayout`
+ * pango2_layout_set_auto_dir:
+ * @layout: a `Pango2Layout`
* @auto_dir: if %TRUE, compute the bidirectional base direction
* from the layout's contents
*
@@ -1540,17 +1540,17 @@ pango_layout_get_ellipsize (PangoLayout *layout)
*
* When `FALSE`, the choice between left-to-right and right-to-left
* layout is done according to the base direction of the layout's
- * `PangoContext`. (See [method@Pango.Context.set_base_dir]).
+ * `Pango2Context`. (See [method@Pango2.Context.set_base_dir]).
*
* When the auto-computed direction of a paragraph differs
* from the base direction of the context, the interpretation
- * of `PANGO_ALIGN_LEFT` and `PANGO_ALIGN_RIGHT` are swapped.
+ * of `PANGO2_ALIGN_LEFT` and `PANGO2_ALIGN_RIGHT` are swapped.
*/
void
-pango_layout_set_auto_dir (PangoLayout *layout,
- gboolean auto_dir)
+pango2_layout_set_auto_dir (Pango2Layout *layout,
+ gboolean auto_dir)
{
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
if (auto_dir == layout->auto_dir)
return;
@@ -1562,21 +1562,21 @@ pango_layout_set_auto_dir (PangoLayout *layout,
}
/**
- * pango_layout_get_auto_dir:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_auto_dir:
+ * @layout: a `Pango2Layout`
*
* Gets whether to calculate the base direction for the layout
* according to its contents.
*
- * See [method@Pango.Layout.set_auto_dir].
+ * See [method@Pango2.Layout.set_auto_dir].
*
* Return value: `TRUE` if the bidirectional base direction
* is computed from the layout's contents, `FALSE` otherwise
*/
gboolean
-pango_layout_get_auto_dir (PangoLayout *layout)
+pango2_layout_get_auto_dir (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), TRUE);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), TRUE);
return layout->auto_dir;
}
@@ -1585,32 +1585,32 @@ pango_layout_get_auto_dir (PangoLayout *layout)
/* {{{ Miscellaneous */
/**
- * pango_layout_set_markup:
- * @layout: a `PangoLayout`
+ * pango2_layout_set_markup:
+ * @layout: a `Pango2Layout`
* @markup: marked-up text
* @length: length of @markup in bytes, or -1 if it is `NUL`-terminated
*
* Sets the layout text and attribute list from marked-up text.
*
- * See [Pango Markup](pango_markup.html)).
+ * See [Pango2 Markup](pango2_markup.html)).
*
* Replaces the current text and attributes.
*/
void
-pango_layout_set_markup (PangoLayout *layout,
- const char *markup,
- int length)
+pango2_layout_set_markup (Pango2Layout *layout,
+ const char *markup,
+ int length)
{
- PangoAttrList *attrs;
+ Pango2AttrList *attrs;
char *text;
GError *error = NULL;
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
g_return_if_fail (markup != NULL);
- if (!pango_parse_markup (markup, length, 0, &attrs, &text, NULL, &error))
+ if (!pango2_parse_markup (markup, length, 0, &attrs, &text, NULL, &error))
{
- g_warning ("pango_layout_set_markup_with_accel: %s", error->message);
+ g_warning ("pango2_layout_set_markup_with_accel: %s", error->message);
g_error_free (error);
return;
}
@@ -1619,7 +1619,7 @@ pango_layout_set_markup (PangoLayout *layout,
layout->text = text;
layout->length = strlen (text);
- g_clear_pointer (&layout->attrs, pango_attr_list_unref);
+ g_clear_pointer (&layout->attrs, pango2_attr_list_unref);
layout->attrs = attrs;
g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_TEXT]);
@@ -1628,8 +1628,8 @@ pango_layout_set_markup (PangoLayout *layout,
}
/**
- * pango_layout_get_character_count:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_character_count:
+ * @layout: a `Pango2Layout`
*
* Returns the number of Unicode characters in the
* the text of the layout.
@@ -1637,15 +1637,15 @@ pango_layout_set_markup (PangoLayout *layout,
* Return value: the number of Unicode characters in @layout
*/
int
-pango_layout_get_character_count (PangoLayout *layout)
+pango2_layout_get_character_count (Pango2Layout *layout)
{
- PangoLine *line;
+ Pango2Line *line;
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), 0);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), 0);
ensure_lines (layout);
- line = pango_lines_get_lines (layout->lines)[0];
+ line = pango2_lines_get_lines (layout->lines)[0];
return line->data->n_chars;
}
@@ -1654,8 +1654,8 @@ pango_layout_get_character_count (PangoLayout *layout)
/* {{{ Output getters */
/**
- * pango_layout_get_lines:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_lines:
+ * @layout: a `Pango2Layout`
*
* Gets the lines of the layout.
*
@@ -1663,13 +1663,13 @@ pango_layout_get_character_count (PangoLayout *layout)
* property of @layout is changed. Take a reference
* to keep it.
*
- * Return value: (transfer none): a `PangoLines` object
+ * Return value: (transfer none): a `Pango2Lines` object
* with the lines of @layout
*/
-PangoLines *
-pango_layout_get_lines (PangoLayout *layout)
+Pango2Lines *
+pango2_layout_get_lines (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), NULL);
ensure_lines (layout);
@@ -1677,29 +1677,29 @@ pango_layout_get_lines (PangoLayout *layout)
}
/**
- * pango_layout_get_log_attrs:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_log_attrs:
+ * @layout: a `Pango2Layout`
* @n_attrs: (out): return location for the length of the array
*
- * Gets the `PangoLogAttr` array for the content of layout.
+ * Gets the `Pango2LogAttr` array for the content of layout.
*
* The returned array becomes invalid when
* any properties of @layout change. Make a
* copy if you want to keep it.
*
- * Returns: (transfer none): the `PangoLogAttr` array
+ * Returns: (transfer none): the `Pango2LogAttr` array
*/
-const PangoLogAttr *
-pango_layout_get_log_attrs (PangoLayout *layout,
- int *n_attrs)
+const Pango2LogAttr *
+pango2_layout_get_log_attrs (Pango2Layout *layout,
+ int *n_attrs)
{
- PangoLine *line;
+ Pango2Line *line;
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), NULL);
ensure_lines (layout);
- line = pango_lines_get_lines (layout->lines)[0];
+ line = pango2_lines_get_lines (layout->lines)[0];
if (n_attrs)
*n_attrs = line->data->n_chars + 1;
@@ -1708,24 +1708,24 @@ pango_layout_get_log_attrs (PangoLayout *layout,
}
/**
- * pango_layout_get_iter:
- * @layout: a `PangoLayout`
+ * pango2_layout_get_iter:
+ * @layout: a `Pango2Layout`
*
* Returns an iterator to iterate over the visual extents
* of the layout.
*
- * This is a convenience wrapper for [method@Pango.Lines.get_iter].
+ * This is a convenience wrapper for [method@Pango2.Lines.get_iter].
*
- * Returns: the new `PangoLineIter`
+ * Returns: the new `Pango2LineIter`
*/
-PangoLineIter *
-pango_layout_get_iter (PangoLayout *layout)
+Pango2LineIter *
+pango2_layout_get_iter (Pango2Layout *layout)
{
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), NULL);
ensure_lines (layout);
- return pango_lines_get_iter (layout->lines);
+ return pango2_lines_get_iter (layout->lines);
}
/* }}} */
diff --git a/pango/pango-layout.h b/pango/pango-layout.h
index aa16a053..38b3cd1a 100644
--- a/pango/pango-layout.h
+++ b/pango/pango-layout.h
@@ -27,193 +27,193 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_LAYOUT pango_layout_get_type ()
+#define PANGO2_TYPE_LAYOUT pango2_layout_get_type ()
-PANGO_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (PangoLayout, pango_layout, PANGO, LAYOUT, GObject);
+PANGO2_AVAILABLE_IN_ALL
+G_DECLARE_FINAL_TYPE (Pango2Layout, pango2_layout, PANGO2, LAYOUT, GObject);
-PANGO_AVAILABLE_IN_ALL
-PangoLayout * pango_layout_new (PangoContext *context);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Layout * pango2_layout_new (Pango2Context *context);
-PANGO_AVAILABLE_IN_ALL
-PangoLayout * pango_layout_copy (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Layout * pango2_layout_copy (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-guint pango_layout_get_serial (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+guint pango2_layout_get_serial (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-PangoContext * pango_layout_get_context (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Context * pango2_layout_get_context (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_context_changed (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_context_changed (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_text (PangoLayout *layout,
- const char *text,
- int length);
-PANGO_AVAILABLE_IN_ALL
-const char * pango_layout_get_text (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_text (Pango2Layout *layout,
+ const char *text,
+ int length);
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_layout_get_text (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_markup (PangoLayout *layout,
- const char *markup,
- int length);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_markup (Pango2Layout *layout,
+ const char *markup,
+ int length);
-PANGO_AVAILABLE_IN_ALL
-int pango_layout_get_character_count
- (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_layout_get_character_count
+ (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_attributes (PangoLayout *layout,
- PangoAttrList *attrs);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_attributes (Pango2Layout *layout,
+ Pango2AttrList *attrs);
-PANGO_AVAILABLE_IN_ALL
-PangoAttrList * pango_layout_get_attributes (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+Pango2AttrList * pango2_layout_get_attributes (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_font_description
- (PangoLayout *layout,
- const PangoFontDescription *desc);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_font_description
+ (Pango2Layout *layout,
+ const Pango2FontDescription *desc);
-PANGO_AVAILABLE_IN_ALL
-const PangoFontDescription *
- pango_layout_get_font_description
- (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+const Pango2FontDescription *
+ pango2_layout_get_font_description
+ (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_line_height
- (PangoLayout *layout,
- float line_height);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_line_height
+ (Pango2Layout *layout,
+ float line_height);
-PANGO_AVAILABLE_IN_ALL
-float pango_layout_get_line_height
- (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+float pango2_layout_get_line_height
+ (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_spacing (PangoLayout *layout,
- int spacing);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_spacing (Pango2Layout *layout,
+ int spacing);
-PANGO_AVAILABLE_IN_ALL
-int pango_layout_get_spacing (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_layout_get_spacing (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_width (PangoLayout *layout,
- int width);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_width (Pango2Layout *layout,
+ int width);
-PANGO_AVAILABLE_IN_ALL
-int pango_layout_get_width (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_layout_get_width (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_height (PangoLayout *layout,
- int height);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_height (Pango2Layout *layout,
+ int height);
-PANGO_AVAILABLE_IN_ALL
-int pango_layout_get_height (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_layout_get_height (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_tabs (PangoLayout *layout,
- PangoTabArray *tabs);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_tabs (Pango2Layout *layout,
+ Pango2TabArray *tabs);
-PANGO_AVAILABLE_IN_ALL
-PangoTabArray * pango_layout_get_tabs (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+Pango2TabArray * pango2_layout_get_tabs (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_single_paragraph
- (PangoLayout *layout,
- gboolean single_paragraph);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_layout_get_single_paragraph
- (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_single_paragraph
+ (Pango2Layout *layout,
+ gboolean single_paragraph);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_layout_get_single_paragraph
+ (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_wrap (PangoLayout *layout,
- PangoWrapMode wrap);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_wrap (Pango2Layout *layout,
+ Pango2WrapMode wrap);
-PANGO_AVAILABLE_IN_ALL
-PangoWrapMode pango_layout_get_wrap (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+Pango2WrapMode pango2_layout_get_wrap (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_indent (PangoLayout *layout,
- int indent);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_indent (Pango2Layout *layout,
+ int indent);
-PANGO_AVAILABLE_IN_ALL
-int pango_layout_get_indent (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_layout_get_indent (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_alignment (PangoLayout *layout,
- PangoAlignment alignment);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_alignment (Pango2Layout *layout,
+ Pango2Alignment alignment);
-PANGO_AVAILABLE_IN_ALL
-PangoAlignment pango_layout_get_alignment (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Alignment pango2_layout_get_alignment (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_ellipsize (PangoLayout *layout,
- PangoEllipsizeMode ellipsize);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_ellipsize (Pango2Layout *layout,
+ Pango2EllipsizeMode ellipsize);
-PANGO_AVAILABLE_IN_ALL
-PangoEllipsizeMode pango_layout_get_ellipsize (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+Pango2EllipsizeMode pango2_layout_get_ellipsize (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_layout_set_auto_dir (PangoLayout *layout,
- gboolean auto_dir);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_layout_set_auto_dir (Pango2Layout *layout,
+ gboolean auto_dir);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_layout_get_auto_dir (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_layout_get_auto_dir (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-PangoLines * pango_layout_get_lines (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Lines * pango2_layout_get_lines (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-PangoLineIter * pango_layout_get_iter (PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+Pango2LineIter * pango2_layout_get_iter (Pango2Layout *layout);
-PANGO_AVAILABLE_IN_ALL
-const PangoLogAttr * pango_layout_get_log_attrs (PangoLayout *layout,
- int *n_attrs);
+PANGO2_AVAILABLE_IN_ALL
+const Pango2LogAttr * pango2_layout_get_log_attrs (Pango2Layout *layout,
+ int *n_attrs);
typedef enum {
- PANGO_LAYOUT_SERIALIZE_DEFAULT = 0,
- PANGO_LAYOUT_SERIALIZE_CONTEXT = 1 << 0,
- PANGO_LAYOUT_SERIALIZE_OUTPUT = 1 << 1,
-} PangoLayoutSerializeFlags;
+ PANGO2_LAYOUT_SERIALIZE_DEFAULT = 0,
+ PANGO2_LAYOUT_SERIALIZE_CONTEXT = 1 << 0,
+ PANGO2_LAYOUT_SERIALIZE_OUTPUT = 1 << 1,
+} Pango2LayoutSerializeFlags;
-PANGO_AVAILABLE_IN_ALL
-GBytes * pango_layout_serialize (PangoLayout *layout,
- PangoLayoutSerializeFlags flags);
+PANGO2_AVAILABLE_IN_ALL
+GBytes * pango2_layout_serialize (Pango2Layout *layout,
+ Pango2LayoutSerializeFlags flags);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_layout_write_to_file (PangoLayout *layout,
- const char *filename);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_layout_write_to_file (Pango2Layout *layout,
+ const char *filename);
-#define PANGO_LAYOUT_DESERIALIZE_ERROR (pango_layout_deserialize_error_quark ())
+#define PANGO2_LAYOUT_DESERIALIZE_ERROR (pango2_layout_deserialize_error_quark ())
/**
- * PangoLayoutDeserializeError:
- * @PANGO_LAYOUT_DESERIALIZE_INVALID: Unspecified error
- * @PANGO_LAYOUT_DESERIALIZE_INVALID_VALUE: A JSon value could not be
+ * Pango2LayoutDeserializeError:
+ * @PANGO2_LAYOUT_DESERIALIZE_INVALID: Unspecified error
+ * @PANGO2_LAYOUT_DESERIALIZE_INVALID_VALUE: A JSon value could not be
* interpreted
- * @PANGO_LAYOUT_DESERIALIZE_MISSING_VALUE: A required JSon member was
+ * @PANGO2_LAYOUT_DESERIALIZE_MISSING_VALUE: A required JSon member was
* not found
*
- * Errors that can be returned by [func@Pango.Layout.deserialize].
+ * Errors that can be returned by [func@Pango2.Layout.deserialize].
*/
typedef enum {
- PANGO_LAYOUT_DESERIALIZE_INVALID,
- PANGO_LAYOUT_DESERIALIZE_INVALID_VALUE,
- PANGO_LAYOUT_DESERIALIZE_MISSING_VALUE,
-} PangoLayoutDeserializeError;
+ PANGO2_LAYOUT_DESERIALIZE_INVALID,
+ PANGO2_LAYOUT_DESERIALIZE_INVALID_VALUE,
+ PANGO2_LAYOUT_DESERIALIZE_MISSING_VALUE,
+} Pango2LayoutDeserializeError;
typedef enum {
- PANGO_LAYOUT_DESERIALIZE_DEFAULT = 0,
- PANGO_LAYOUT_DESERIALIZE_CONTEXT = 1 << 0,
-} PangoLayoutDeserializeFlags;
-
-PANGO_AVAILABLE_IN_ALL
-GQuark pango_layout_deserialize_error_quark (void);
-
-PANGO_AVAILABLE_IN_ALL
-PangoLayout * pango_layout_deserialize (PangoContext *context,
- GBytes *bytes,
- PangoLayoutDeserializeFlags flags,
- GError **error);
+ PANGO2_LAYOUT_DESERIALIZE_DEFAULT = 0,
+ PANGO2_LAYOUT_DESERIALIZE_CONTEXT = 1 << 0,
+} Pango2LayoutDeserializeFlags;
+
+PANGO2_AVAILABLE_IN_ALL
+GQuark pango2_layout_deserialize_error_quark (void);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Layout * pango2_layout_deserialize (Pango2Context *context,
+ GBytes *bytes,
+ Pango2LayoutDeserializeFlags flags,
+ GError **error);
G_END_DECLS
diff --git a/pango/pango-line-breaker.c b/pango/pango-line-breaker.c
index 9d906a08..1049fe5e 100644
--- a/pango/pango-line-breaker.c
+++ b/pango/pango-line-breaker.c
@@ -23,52 +23,52 @@
#endif
/**
- * PangoLineBreaker:
+ * Pango2LineBreaker:
*
- * A `PangoLineBreaker` breaks text into lines.
+ * A `Pango2LineBreaker` breaks text into lines.
*
- * To use a `PangoLineBreaker`, you must call [method@Pango.LineBreaker.add_text]
+ * To use a `Pango2LineBreaker`, you must call [method@Pango2.LineBreaker.add_text]
* to provide text that you want to break into lines, plus possibly attributes
* to influence the formatting.
*
- * Then you can call [method@Pango.LineBreaker.next_line] repeatedly to obtain
- * `PangoLine` objects for the text, one by one.
+ * Then you can call [method@Pango2.LineBreaker.next_line] repeatedly to obtain
+ * `Pango2Line` objects for the text, one by one.
*
- * `PangoLineBreaker` is meant to enable use cases like flowing text around images,
- * or shaped paragraphs. For simple formatting needs, [class@Pango.Layout]
+ * `Pango2LineBreaker` is meant to enable use cases like flowing text around images,
+ * or shaped paragraphs. For simple formatting needs, [class@Pango2.Layout]
* is probably more convenient to use.
*/
typedef struct _LastTabState LastTabState;
struct _LastTabState
{
- PangoGlyphString *glyphs;
+ Pango2GlyphString *glyphs;
int index;
int width;
int pos;
- PangoTabAlign align;
+ Pango2TabAlign align;
gunichar decimal;
};
-struct _PangoLineBreaker
+struct _Pango2LineBreaker
{
GObject parent_instance;
/* Properties */
- PangoContext *context;
- PangoDirection base_dir;
- PangoTabArray *tabs;
+ Pango2Context *context;
+ Pango2Direction base_dir;
+ Pango2TabArray *tabs;
/* Data that we're building lines from, shared among all the lines */
GSList *datas; /* Queued up LineData */
LineData *data; /* The LineData we're currently processing */
GList *data_items; /* Original items for data (only used for undoing) */
GList *items; /* The remaining unprocessed items for data */
- PangoAttrList *render_attrs; /* Attributes to be re-added after line breaking */
+ Pango2AttrList *render_attrs; /* Attributes to be re-added after line breaking */
/* Arguments to next_line, for use while processing the next line */
- PangoWrapMode line_wrap;
- PangoEllipsizeMode line_ellipsize;
+ Pango2WrapMode line_wrap;
+ Pango2EllipsizeMode line_ellipsize;
int tab_width; /* Cached width of a tab. -1 == not yet calculated */
int hyphen_width; /* Cached width of a hyphen. -1 == not yet calculated */
@@ -76,7 +76,7 @@ struct _PangoLineBreaker
/* State for line breaking */
int n_lines; /* Line count, starting from 0 */
- PangoGlyphString *glyphs; /* Glyphs for the first item in self->items */
+ Pango2GlyphString *glyphs; /* Glyphs for the first item in self->items */
int start_offset; /* Character offset of first item in self->items in self->data->text */
ItemProperties properties; /* Properties of the first item in self->items */
int *log_widths; /* Logical widths for th efirst item in self->items */
@@ -98,7 +98,7 @@ struct _PangoLineBreaker
LastTabState last_tab;
};
-struct _PangoLineBreakerClass
+struct _Pango2LineBreakerClass
{
GObjectClass parent_class;
};
@@ -106,10 +106,10 @@ struct _PangoLineBreakerClass
/* {{{ Utilities */
static LineData *
-make_line_data (PangoLineBreaker *self,
- const char *text,
- int length,
- PangoAttrList *attrs)
+make_line_data (Pango2LineBreaker *self,
+ const char *text,
+ int length,
+ Pango2AttrList *attrs)
{
LineData *data;
@@ -118,12 +118,12 @@ make_line_data (PangoLineBreaker *self,
data = line_data_new ();
- if (self->base_dir == PANGO_DIRECTION_NEUTRAL)
+ if (self->base_dir == PANGO2_DIRECTION_NEUTRAL)
{
- data->direction = pango_find_base_dir (text, length);
+ data->direction = pango2_find_base_dir (text, length);
- if (data->direction == PANGO_DIRECTION_NEUTRAL)
- data->direction = pango_context_get_base_dir (self->context);
+ if (data->direction == PANGO2_DIRECTION_NEUTRAL)
+ data->direction = pango2_context_get_base_dir (self->context);
}
else
data->direction = self->base_dir;
@@ -132,14 +132,14 @@ make_line_data (PangoLineBreaker *self,
data->length = length;
data->n_chars = g_utf8_strlen (text, length);
if (attrs)
- data->attrs = pango_attr_list_copy (attrs);
+ data->attrs = pango2_attr_list_copy (attrs);
return data;
}
static gboolean
-item_is_paragraph_separator (PangoLineBreaker *self,
- PangoItem *item)
+item_is_paragraph_separator (Pango2LineBreaker *self,
+ Pango2Item *item)
{
gunichar ch;
@@ -152,71 +152,71 @@ item_is_paragraph_separator (PangoLineBreaker *self,
}
static void
-apply_attributes_to_items (GList *items,
- PangoAttrList *attrs)
+apply_attributes_to_items (GList *items,
+ Pango2AttrList *attrs)
{
GList *l;
- PangoAttrIterator iter;
+ Pango2AttrIterator iter;
if (!attrs)
return;
- pango_attr_list_init_iterator (attrs, &iter);
+ pango2_attr_list_init_iterator (attrs, &iter);
for (l = items; l; l = l->next)
{
- PangoItem *item = l->data;
- pango_item_apply_attrs (item, &iter);
+ Pango2Item *item = l->data;
+ pango2_item_apply_attrs (item, &iter);
}
- pango_attr_iterator_clear (&iter);
+ pango2_attr_iterator_clear (&iter);
}
-static PangoLogAttr *
+static Pango2LogAttr *
get_log_attrs (LineData *data,
GList *items)
{
- PangoLogAttr *log_attrs;
+ Pango2LogAttr *log_attrs;
int offset;
- log_attrs = g_new0 (PangoLogAttr, (data->n_chars + 1));
+ log_attrs = g_new0 (Pango2LogAttr, (data->n_chars + 1));
- pango_default_break (data->text,
- data->length,
- log_attrs,
- data->n_chars + 1);
+ pango2_default_break (data->text,
+ data->length,
+ log_attrs,
+ data->n_chars + 1);
offset = 0;
for (GList *l = items; l; l = l->next)
{
- PangoItem *item = l->data;
+ Pango2Item *item = l->data;
- pango_tailor_break (data->text + item->offset,
- item->length,
- &item->analysis,
- item->offset,
- log_attrs + offset,
- item->num_chars + 1);
+ pango2_tailor_break (data->text + item->offset,
+ item->length,
+ &item->analysis,
+ item->offset,
+ log_attrs + offset,
+ item->num_chars + 1);
offset += item->num_chars;
}
if (data->attrs)
- pango_attr_break (data->text,
- data->length,
- data->attrs,
- 0,
- log_attrs,
- data->n_chars + 1);
+ pango2_attr_break (data->text,
+ data->length,
+ data->attrs,
+ 0,
+ log_attrs,
+ data->n_chars + 1);
return log_attrs;
}
static void
-ensure_items (PangoLineBreaker *self)
+ensure_items (Pango2LineBreaker *self)
{
- PangoAttrList *itemize_attrs = NULL;
- PangoAttrList *shape_attrs = NULL;
+ Pango2AttrList *itemize_attrs = NULL;
+ Pango2AttrList *shape_attrs = NULL;
if (self->items)
return;
@@ -230,36 +230,36 @@ ensure_items (PangoLineBreaker *self)
if (!self->data)
return;
- self->render_attrs = pango_attr_list_copy (self->data->attrs);
+ self->render_attrs = pango2_attr_list_copy (self->data->attrs);
if (self->render_attrs)
{
- itemize_attrs = pango_attr_list_filter (self->render_attrs, pango_attribute_affects_itemization, NULL);
- shape_attrs = pango_attr_list_filter (self->render_attrs, pango_attribute_affects_break_or_shape, NULL);
+ itemize_attrs = pango2_attr_list_filter (self->render_attrs, pango2_attribute_affects_itemization, NULL);
+ shape_attrs = pango2_attr_list_filter (self->render_attrs, pango2_attribute_affects_break_or_shape, NULL);
}
- self->items = pango_itemize_with_font (self->context,
- self->data->direction,
- self->data->text,
- 0,
- self->data->length,
- itemize_attrs,
- NULL,
- NULL);
+ self->items = pango2_itemize_with_font (self->context,
+ self->data->direction,
+ self->data->text,
+ 0,
+ self->data->length,
+ itemize_attrs,
+ NULL,
+ NULL);
apply_attributes_to_items (self->items, shape_attrs);
- pango_attr_list_unref (itemize_attrs);
- pango_attr_list_unref (shape_attrs);
+ pango2_attr_list_unref (itemize_attrs);
+ pango2_attr_list_unref (shape_attrs);
self->data->log_attrs = get_log_attrs (self->data, self->items);
- self->items = pango_itemize_post_process_items (self->context,
- self->data->text,
- self->data->log_attrs,
- self->items);
+ self->items = pango2_itemize_post_process_items (self->context,
+ self->data->text,
+ self->data->log_attrs,
+ self->items);
g_assert (self->data_items == NULL);
- self->data_items = g_list_copy_deep (self->items, (GCopyFunc) pango_item_copy, NULL);
+ self->data_items = g_list_copy_deep (self->items, (GCopyFunc) pango2_item_copy, NULL);
self->hyphen_width = -1;
self->tab_width = -1;
@@ -270,7 +270,7 @@ ensure_items (PangoLineBreaker *self)
g_list_free_full (self->baseline_shifts, g_free);
self->baseline_shifts = NULL;
- g_clear_pointer (&self->glyphs, pango_glyph_string_free);
+ g_clear_pointer (&self->glyphs, pango2_glyph_string_free);
g_clear_pointer (&self->log_widths, g_free);
self->num_log_widths = 0;
self->log_widths_offset = 0;
@@ -282,27 +282,27 @@ ensure_items (PangoLineBreaker *self)
/* The resolved direction for the line is always one
* of LTR/RTL; not a week or neutral directions
*/
-static PangoDirection
-get_resolved_dir (PangoLineBreaker *self)
+static Pango2Direction
+get_resolved_dir (Pango2LineBreaker *self)
{
- PangoDirection dir;
+ Pango2Direction dir;
ensure_items (self);
if (!self->data)
- return PANGO_DIRECTION_NEUTRAL;
+ return PANGO2_DIRECTION_NEUTRAL;
switch (self->data->direction)
{
default:
- case PANGO_DIRECTION_LTR:
- case PANGO_DIRECTION_WEAK_LTR:
- case PANGO_DIRECTION_NEUTRAL:
- dir = PANGO_DIRECTION_LTR;
+ case PANGO2_DIRECTION_LTR:
+ case PANGO2_DIRECTION_WEAK_LTR:
+ case PANGO2_DIRECTION_NEUTRAL:
+ dir = PANGO2_DIRECTION_LTR;
break;
- case PANGO_DIRECTION_RTL:
- case PANGO_DIRECTION_WEAK_RTL:
- dir = PANGO_DIRECTION_RTL;
+ case PANGO2_DIRECTION_RTL:
+ case PANGO2_DIRECTION_WEAK_RTL:
+ dir = PANGO2_DIRECTION_RTL;
break;
}
@@ -320,20 +320,20 @@ get_resolved_dir (PangoLineBreaker *self)
* itemize_state_add_character(). Keep in synch.
*/
- switch (pango_context_get_gravity (self->context))
+ switch (pango2_context_get_gravity (self->context))
{
default:
- case PANGO_GRAVITY_AUTO:
- case PANGO_GRAVITY_SOUTH:
+ case PANGO2_GRAVITY_AUTO:
+ case PANGO2_GRAVITY_SOUTH:
break;
- case PANGO_GRAVITY_NORTH:
- dir = PANGO_DIRECTION_LTR + PANGO_DIRECTION_RTL - dir;
+ case PANGO2_GRAVITY_NORTH:
+ dir = PANGO2_DIRECTION_LTR + PANGO2_DIRECTION_RTL - dir;
break;
- case PANGO_GRAVITY_EAST:
- dir = PANGO_DIRECTION_LTR;
+ case PANGO2_GRAVITY_EAST:
+ dir = PANGO2_DIRECTION_LTR;
break;
- case PANGO_GRAVITY_WEST:
- dir = PANGO_DIRECTION_RTL;
+ case PANGO2_GRAVITY_WEST:
+ dir = PANGO2_DIRECTION_RTL;
break;
}
@@ -341,28 +341,28 @@ get_resolved_dir (PangoLineBreaker *self)
}
static gboolean
-should_ellipsize_current_line (PangoLineBreaker *self,
- PangoLine *line)
+should_ellipsize_current_line (Pango2LineBreaker *self,
+ Pango2Line *line)
{
- return self->line_ellipsize != PANGO_ELLIPSIZE_NONE && self->line_width >= 0;
+ return self->line_ellipsize != PANGO2_ELLIPSIZE_NONE && self->line_width >= 0;
}
static void
-get_decimal_prefix_width (PangoItem *item,
- PangoGlyphString *glyphs,
- const char *text,
- gunichar decimal,
- int *width,
- gboolean *found)
-{
- PangoGlyphItem glyph_item = { item, glyphs, 0, 0, 0 };
+get_decimal_prefix_width (Pango2Item *item,
+ Pango2GlyphString *glyphs,
+ const char *text,
+ gunichar decimal,
+ int *width,
+ gboolean *found)
+{
+ Pango2GlyphItem glyph_item = { item, glyphs, 0, 0, 0 };
int *log_widths;
int i;
const char *p;
log_widths = g_new (int, item->num_chars);
- pango_glyph_item_get_logical_widths (&glyph_item, text, log_widths);
+ pango2_glyph_item_get_logical_widths (&glyph_item, text, log_widths);
*width = 0;
*found = FALSE;
@@ -383,7 +383,7 @@ get_decimal_prefix_width (PangoItem *item,
}
static int
-pango_line_compute_width (PangoLine *line)
+pango2_line_compute_width (Pango2Line *line)
{
int width = 0;
@@ -392,117 +392,117 @@ pango_line_compute_width (PangoLine *line)
*/
for (GSList *l = line->runs; l; l = l->next)
{
- PangoGlyphItem *run = l->data;
- width += pango_glyph_string_get_width (run->glyphs);
+ Pango2GlyphItem *run = l->data;
+ width += pango2_glyph_string_get_width (run->glyphs);
}
return width;
}
static inline int
-get_line_width (PangoLineBreaker *self,
- PangoLine *line)
+get_line_width (Pango2LineBreaker *self,
+ Pango2Line *line)
{
if (self->remaining_width > -1)
return self->line_width - self->remaining_width;
- return pango_line_compute_width (line);
+ return pango2_line_compute_width (line);
}
static inline void
-ensure_decimal (PangoLineBreaker *self)
+ensure_decimal (Pango2LineBreaker *self)
{
if (self->decimal == 0)
self->decimal = g_utf8_get_char (localeconv ()->decimal_point);
}
static void
-ensure_tab_width (PangoLineBreaker *self)
+ensure_tab_width (Pango2LineBreaker *self)
{
if (self->tab_width == -1)
{
/* Find out how wide 8 spaces are in the context's default
* font. Utter performance killer. :-(
*/
- PangoGlyphString *glyphs = pango_glyph_string_new ();
- PangoItem *item;
+ Pango2GlyphString *glyphs = pango2_glyph_string_new ();
+ Pango2Item *item;
GList *items;
- PangoAttribute *attr;
- PangoAttrList *attrs;
- PangoAttrList tmp_attrs;
- PangoFontDescription *font_desc = pango_font_description_copy_static (pango_context_get_font_description (self->context));
- PangoLanguage *language = NULL;
- PangoShapeFlags shape_flags = PANGO_SHAPE_NONE;
- PangoDirection dir;
+ Pango2Attribute *attr;
+ Pango2AttrList *attrs;
+ Pango2AttrList tmp_attrs;
+ Pango2FontDescription *font_desc = pango2_font_description_copy_static (pango2_context_get_font_description (self->context));
+ Pango2Language *language = NULL;
+ Pango2ShapeFlags shape_flags = PANGO2_SHAPE_NONE;
+ Pango2Direction dir;
- if (pango_context_get_round_glyph_positions (self->context))
- shape_flags |= PANGO_SHAPE_ROUND_POSITIONS;
+ if (pango2_context_get_round_glyph_positions (self->context))
+ shape_flags |= PANGO2_SHAPE_ROUND_POSITIONS;
attrs = self->data->attrs;
if (attrs)
{
- PangoAttrIterator iter;
+ Pango2AttrIterator iter;
- pango_attr_list_init_iterator (attrs, &iter);
- pango_attr_iterator_get_font (&iter, font_desc, &language, NULL);
- pango_attr_iterator_clear (&iter);
+ pango2_attr_list_init_iterator (attrs, &iter);
+ pango2_attr_iterator_get_font (&iter, font_desc, &language, NULL);
+ pango2_attr_iterator_clear (&iter);
}
- pango_attr_list_init (&tmp_attrs);
- attr = pango_attr_font_desc_new (font_desc);
- pango_font_description_free (font_desc);
- pango_attr_list_insert_before (&tmp_attrs, attr);
+ pango2_attr_list_init (&tmp_attrs);
+ attr = pango2_attr_font_desc_new (font_desc);
+ pango2_font_description_free (font_desc);
+ pango2_attr_list_insert_before (&tmp_attrs, attr);
if (language)
{
- attr = pango_attr_language_new (language);
- pango_attr_list_insert_before (&tmp_attrs, attr);
+ attr = pango2_attr_language_new (language);
+ pango2_attr_list_insert_before (&tmp_attrs, attr);
}
- dir = pango_context_get_base_dir (self->context);
- items = pango_itemize (self->context, dir, " ", 0, 1, &tmp_attrs);
+ dir = pango2_context_get_base_dir (self->context);
+ items = pango2_itemize (self->context, dir, " ", 0, 1, &tmp_attrs);
if (attrs != self->data->attrs)
{
- pango_attr_list_unref (attrs);
+ pango2_attr_list_unref (attrs);
attrs = NULL;
}
- pango_attr_list_destroy (&tmp_attrs);
+ pango2_attr_list_destroy (&tmp_attrs);
item = items->data;
- pango_shape (" ", 8, " ", 8, &item->analysis, glyphs, shape_flags);
+ pango2_shape (" ", 8, " ", 8, &item->analysis, glyphs, shape_flags);
- pango_item_free (item);
+ pango2_item_free (item);
g_list_free (items);
- self->tab_width = pango_glyph_string_get_width (glyphs);
+ self->tab_width = pango2_glyph_string_get_width (glyphs);
- pango_glyph_string_free (glyphs);
+ pango2_glyph_string_free (glyphs);
/* We need to make sure the tab_width is > 0 so finding tab positions
* terminates. This check should be necessary only under extreme
* problems with the font.
*/
if (self->tab_width <= 0)
- self->tab_width = 50 * PANGO_SCALE; /* pretty much arbitrary */
+ self->tab_width = 50 * PANGO2_SCALE; /* pretty much arbitrary */
}
}
static int
-get_item_letter_spacing (PangoItem *item)
+get_item_letter_spacing (Pango2Item *item)
{
ItemProperties properties;
- pango_item_get_properties (item, &properties);
+ pango2_item_get_properties (item, &properties);
return properties.letter_spacing;
}
static void
-pad_glyphstring_right (PangoLineBreaker *self,
- PangoGlyphString *glyphs,
- int adjustment)
+pad_glyphstring_right (Pango2LineBreaker *self,
+ Pango2GlyphString *glyphs,
+ int adjustment)
{
int glyph = glyphs->num_glyphs - 1;
@@ -523,9 +523,9 @@ pad_glyphstring_right (PangoLineBreaker *self,
}
static void
-pad_glyphstring_left (PangoLineBreaker *self,
- PangoGlyphString *glyphs,
- int adjustment)
+pad_glyphstring_left (Pango2LineBreaker *self,
+ Pango2GlyphString *glyphs,
+ int adjustment)
{
int glyph = 0;
@@ -542,8 +542,8 @@ pad_glyphstring_left (PangoLineBreaker *self,
}
static gboolean
-is_tab_run (PangoLine *line,
- PangoGlyphItem *run)
+is_tab_run (Pango2Line *line,
+ Pango2GlyphItem *run)
{
return line->data->text[run->item->offset] == '\t';
}
@@ -561,9 +561,9 @@ reorder_runs_recurse (GSList *items,
return NULL;
tmp_list = items;
- for (i=0; i<n_items; i++)
+ for (i = 0; i < n_items; i++)
{
- PangoGlyphItem *run = tmp_list->data;
+ Pango2GlyphItem *run = tmp_list->data;
min_level = MIN (min_level, run->item->analysis.level);
@@ -575,7 +575,7 @@ reorder_runs_recurse (GSList *items,
tmp_list = items;
for (i=0; i<n_items; i++)
{
- PangoGlyphItem *run = tmp_list->data;
+ Pango2GlyphItem *run = tmp_list->data;
if (run->item->analysis.level == min_level)
{
@@ -614,7 +614,7 @@ reorder_runs_recurse (GSList *items,
}
static void
-pango_line_reorder (PangoLine *line)
+pango2_line_reorder (Pango2Line *line)
{
GSList *logical_runs = line->runs;
GSList *tmp_list;
@@ -628,7 +628,7 @@ pango_line_reorder (PangoLine *line)
*/
for (tmp_list = logical_runs; tmp_list != NULL; tmp_list = tmp_list->next)
{
- PangoGlyphItem *run = tmp_list->data;
+ Pango2GlyphItem *run = tmp_list->data;
level_or |= run->item->analysis.level;
level_and &= run->item->analysis.level;
@@ -652,13 +652,13 @@ pango_line_reorder (PangoLine *line)
}
static int
-compute_n_chars (PangoLine *line)
+compute_n_chars (Pango2Line *line)
{
int n_chars = 0;
for (GSList *l = line->runs; l; l = l->next)
{
- PangoGlyphItem *run = l->data;
+ Pango2GlyphItem *run = l->data;
n_chars += run->item->num_chars;
}
@@ -669,13 +669,13 @@ compute_n_chars (PangoLine *line)
/* {{{ Line Breaking */
static void
-get_tab_pos (PangoLineBreaker *self,
- PangoLine *line,
- int index,
- int *tab_pos,
- PangoTabAlign *alignment,
- gunichar *decimal,
- gboolean *is_default)
+get_tab_pos (Pango2LineBreaker *self,
+ Pango2Line *line,
+ int index,
+ int *tab_pos,
+ Pango2TabAlign *alignment,
+ gunichar *decimal,
+ gboolean *is_default)
{
int n_tabs;
gboolean in_pixels;
@@ -685,8 +685,8 @@ get_tab_pos (PangoLineBreaker *self,
if (self->tabs)
{
- n_tabs = pango_tab_array_get_size (self->tabs);
- in_pixels = pango_tab_array_get_positions_in_pixels (self->tabs);
+ n_tabs = pango2_tab_array_get_size (self->tabs);
+ in_pixels = pango2_tab_array_get_positions_in_pixels (self->tabs);
*is_default = FALSE;
}
else
@@ -698,12 +698,12 @@ get_tab_pos (PangoLineBreaker *self,
if (index < n_tabs)
{
- pango_tab_array_get_tab (self->tabs, index, alignment, tab_pos);
+ pango2_tab_array_get_tab (self->tabs, index, alignment, tab_pos);
if (in_pixels)
- *tab_pos *= PANGO_SCALE;
+ *tab_pos *= PANGO2_SCALE;
- *decimal = pango_tab_array_get_decimal_point (self->tabs, index);
+ *decimal = pango2_tab_array_get_decimal_point (self->tabs, index);
}
else if (n_tabs > 0)
{
@@ -712,18 +712,18 @@ get_tab_pos (PangoLineBreaker *self,
int next_to_last_pos = 0;
int tab_width;
- pango_tab_array_get_tab (self->tabs, n_tabs - 1, alignment, &last_pos);
- *decimal = pango_tab_array_get_decimal_point (self->tabs, n_tabs - 1);
+ pango2_tab_array_get_tab (self->tabs, n_tabs - 1, alignment, &last_pos);
+ *decimal = pango2_tab_array_get_decimal_point (self->tabs, n_tabs - 1);
if (n_tabs > 1)
- pango_tab_array_get_tab (self->tabs, n_tabs - 2, NULL, &next_to_last_pos);
+ pango2_tab_array_get_tab (self->tabs, n_tabs - 2, NULL, &next_to_last_pos);
else
next_to_last_pos = 0;
if (in_pixels)
{
- next_to_last_pos *= PANGO_SCALE;
- last_pos *= PANGO_SCALE;
+ next_to_last_pos *= PANGO2_SCALE;
+ last_pos *= PANGO2_SCALE;
}
if (last_pos > next_to_last_pos)
@@ -737,7 +737,7 @@ get_tab_pos (PangoLineBreaker *self,
{
/* No tab array set, so use default tab width */
*tab_pos = self->tab_width * index;
- *alignment = PANGO_TAB_LEFT;
+ *alignment = PANGO2_TAB_LEFT;
*decimal = 0;
}
@@ -745,23 +745,23 @@ get_tab_pos (PangoLineBreaker *self,
}
static void
-shape_tab (PangoLineBreaker *self,
- PangoLine *line,
- int current_width,
- PangoItem *item,
- PangoGlyphString *glyphs)
+shape_tab (Pango2LineBreaker *self,
+ Pango2Line *line,
+ int current_width,
+ Pango2Item *item,
+ Pango2GlyphString *glyphs)
{
int i, space_width;
int tab_pos;
- PangoTabAlign tab_align;
+ Pango2TabAlign tab_align;
gunichar tab_decimal;
- pango_glyph_string_set_size (glyphs, 1);
+ pango2_glyph_string_set_size (glyphs, 1);
if (self->properties.showing_space)
- glyphs->glyphs[0].glyph = PANGO_GET_UNKNOWN_GLYPH ('\t');
+ glyphs->glyphs[0].glyph = PANGO2_GET_UNKNOWN_GLYPH ('\t');
else
- glyphs->glyphs[0].glyph = PANGO_GLYPH_EMPTY;
+ glyphs->glyphs[0].glyph = PANGO2_GLYPH_EMPTY;
glyphs->glyphs[0].geometry.x_offset = 0;
glyphs->glyphs[0].geometry.y_offset = 0;
@@ -807,23 +807,23 @@ shape_tab (PangoLineBreaker *self,
}
static inline gboolean
-can_break_at (PangoLineBreaker *self,
- int offset,
- PangoWrapMode wrap)
+can_break_at (Pango2LineBreaker *self,
+ int offset,
+ Pango2WrapMode wrap)
{
if (offset == self->data->n_chars)
return TRUE;
- else if (wrap == PANGO_WRAP_CHAR)
+ else if (wrap == PANGO2_WRAP_CHAR)
return self->data->log_attrs[offset].is_char_break;
else
return self->data->log_attrs[offset].is_line_break;
}
static inline gboolean
-can_break_in (PangoLineBreaker *self,
- int start_offset,
- int num_chars,
- gboolean allow_break_at_start)
+can_break_in (Pango2LineBreaker *self,
+ int start_offset,
+ int num_chars,
+ gboolean allow_break_at_start)
{
for (int i = allow_break_at_start ? 0 : 1; i < num_chars; i++)
{
@@ -841,25 +841,25 @@ distribute_letter_spacing (int letter_spacing,
*space_left = letter_spacing / 2;
/* hinting */
- if ((letter_spacing & (PANGO_SCALE - 1)) == 0)
- *space_left = PANGO_UNITS_ROUND (*space_left);
+ if ((letter_spacing & (PANGO2_SCALE - 1)) == 0)
+ *space_left = PANGO2_UNITS_ROUND (*space_left);
*space_right = letter_spacing - *space_left;
}
static void
-pango_shape_shape (const char *text,
- unsigned int n_chars,
- ShapeData *shape,
- PangoGlyphString *glyphs)
+pango2_shape_shape (const char *text,
+ unsigned int n_chars,
+ ShapeData *shape,
+ Pango2GlyphString *glyphs)
{
unsigned int i;
const char *p;
- pango_glyph_string_set_size (glyphs, n_chars);
+ pango2_glyph_string_set_size (glyphs, n_chars);
for (i = 0, p = text; i < n_chars; i++, p = g_utf8_next_char (p))
{
- glyphs->glyphs[i].glyph = PANGO_GLYPH_EMPTY;
+ glyphs->glyphs[i].glyph = PANGO2_GLYPH_EMPTY;
glyphs->glyphs[i].geometry.x_offset = 0;
glyphs->glyphs[i].geometry.y_offset = 0;
glyphs->glyphs[i].geometry.width = shape->logical_rect.width;
@@ -869,45 +869,45 @@ pango_shape_shape (const char *text,
}
}
-static PangoGlyphString *
-shape_run (PangoLineBreaker *self,
- PangoLine *line,
- PangoItem *item)
+static Pango2GlyphString *
+shape_run (Pango2LineBreaker *self,
+ Pango2Line *line,
+ Pango2Item *item)
{
- PangoGlyphString *glyphs = pango_glyph_string_new ();
+ Pango2GlyphString *glyphs = pango2_glyph_string_new ();
if (self->data->text[item->offset] == '\t')
shape_tab (self, line, get_line_width (self, line), item, glyphs);
else
{
- PangoShapeFlags shape_flags = PANGO_SHAPE_NONE;
+ Pango2ShapeFlags shape_flags = PANGO2_SHAPE_NONE;
- if (pango_context_get_round_glyph_positions (self->context))
- shape_flags |= PANGO_SHAPE_ROUND_POSITIONS;
+ if (pango2_context_get_round_glyph_positions (self->context))
+ shape_flags |= PANGO2_SHAPE_ROUND_POSITIONS;
if (self->properties.shape)
- pango_shape_shape (self->data->text + item->offset, item->num_chars,
- (ShapeData *)self->properties.shape->pointer_value,
- glyphs);
+ pango2_shape_shape (self->data->text + item->offset, item->num_chars,
+ (ShapeData *)self->properties.shape->pointer_value,
+ glyphs);
else
- pango_shape_item (item,
- self->data->text, self->data->length,
- self->data->log_attrs + self->start_offset,
- glyphs,
- shape_flags);
+ pango2_shape_item (item,
+ self->data->text, self->data->length,
+ self->data->log_attrs + self->start_offset,
+ glyphs,
+ shape_flags);
if (self->properties.letter_spacing)
{
- PangoGlyphItem glyph_item;
+ Pango2GlyphItem glyph_item;
int space_left, space_right;
glyph_item.item = item;
glyph_item.glyphs = glyphs;
- pango_glyph_item_letter_space (&glyph_item,
- self->data->text,
- self->data->log_attrs + self->start_offset,
- self->properties.letter_spacing);
+ pango2_glyph_item_letter_space (&glyph_item,
+ self->data->text,
+ self->data->log_attrs + self->start_offset,
+ self->properties.letter_spacing);
distribute_letter_spacing (self->properties.letter_spacing, &space_left, &space_right);
@@ -926,11 +926,11 @@ shape_run (PangoLineBreaker *self,
w = self->last_tab.pos - self->last_tab.width;
- if (self->last_tab.align == PANGO_TAB_RIGHT)
- w -= pango_glyph_string_get_width (glyphs);
- else if (self->last_tab.align == PANGO_TAB_CENTER)
- w -= pango_glyph_string_get_width (glyphs) / 2;
- else if (self->last_tab.align == PANGO_TAB_DECIMAL)
+ if (self->last_tab.align == PANGO2_TAB_RIGHT)
+ w -= pango2_glyph_string_get_width (glyphs);
+ else if (self->last_tab.align == PANGO2_TAB_CENTER)
+ w -= pango2_glyph_string_get_width (glyphs) / 2;
+ else if (self->last_tab.align == PANGO2_TAB_DECIMAL)
{
int width;
gboolean found;
@@ -948,22 +948,22 @@ shape_run (PangoLineBreaker *self,
}
static void
-free_run (PangoGlyphItem *run,
- gpointer data)
+free_run (Pango2GlyphItem *run,
+ gpointer data)
{
gboolean free_item = data != NULL;
if (free_item)
- pango_item_free (run->item);
+ pango2_item_free (run->item);
- pango_glyph_string_free (run->glyphs);
- g_slice_free (PangoGlyphItem, run);
+ pango2_glyph_string_free (run->glyphs);
+ g_slice_free (Pango2GlyphItem, run);
}
-static PangoItem *
-uninsert_run (PangoLine *line)
+static Pango2Item *
+uninsert_run (Pango2Line *line)
{
- PangoGlyphItem *run;
- PangoItem *item;
+ Pango2GlyphItem *run;
+ Pango2Item *item;
GSList *tmp_node = line->runs;
@@ -980,13 +980,13 @@ uninsert_run (PangoLine *line)
}
static void
-insert_run (PangoLineBreaker *self,
- PangoLine *line,
- PangoItem *run_item,
- PangoGlyphString *glyphs,
- gboolean last_run)
+insert_run (Pango2LineBreaker *self,
+ Pango2Line *line,
+ Pango2Item *run_item,
+ Pango2GlyphString *glyphs,
+ gboolean last_run)
{
- PangoGlyphItem *run = g_slice_new (PangoGlyphItem);
+ Pango2GlyphItem *run = g_slice_new (Pango2GlyphItem);
run->item = run_item;
@@ -994,7 +994,7 @@ insert_run (PangoLineBreaker *self,
run->glyphs = glyphs;
else if (last_run &&
self->log_widths_offset == 0 &&
- !(run_item->analysis.flags & PANGO_ANALYSIS_FLAG_NEED_HYPHEN))
+ !(run_item->analysis.flags & PANGO2_ANALYSIS_FLAG_NEED_HYPHEN))
{
run->glyphs = self->glyphs;
self->glyphs = NULL;
@@ -1004,7 +1004,7 @@ insert_run (PangoLineBreaker *self,
if (last_run && self->glyphs)
{
- pango_glyph_string_free (self->glyphs);
+ pango2_glyph_string_free (self->glyphs);
self->glyphs = NULL;
}
@@ -1021,11 +1021,11 @@ insert_run (PangoLineBreaker *self,
* done once we've placed the run with the decimal point.
*/
- if (self->last_tab.align == PANGO_TAB_RIGHT)
- self->last_tab.width += pango_glyph_string_get_width (run->glyphs);
- else if (self->last_tab.align == PANGO_TAB_CENTER)
- self->last_tab.width += pango_glyph_string_get_width (run->glyphs) / 2;
- else if (self->last_tab.align == PANGO_TAB_DECIMAL)
+ if (self->last_tab.align == PANGO2_TAB_RIGHT)
+ self->last_tab.width += pango2_glyph_string_get_width (run->glyphs);
+ else if (self->last_tab.align == PANGO2_TAB_CENTER)
+ self->last_tab.width += pango2_glyph_string_get_width (run->glyphs) / 2;
+ else if (self->last_tab.align == PANGO2_TAB_DECIMAL)
{
int width;
@@ -1043,8 +1043,8 @@ insert_run (PangoLineBreaker *self,
}
static gboolean
-break_needs_hyphen (PangoLineBreaker *self,
- int pos)
+break_needs_hyphen (Pango2LineBreaker *self,
+ int pos)
{
return self->data->log_attrs[self->start_offset + pos].break_inserts_hyphen ||
self->data->log_attrs[self->start_offset + pos].break_removes_preceding;
@@ -1052,7 +1052,7 @@ break_needs_hyphen (PangoLineBreaker *self,
static int
-find_hyphen_width (PangoItem *item)
+find_hyphen_width (Pango2Item *item)
{
hb_font_t *hb_font;
hb_codepoint_t glyph;
@@ -1065,7 +1065,7 @@ find_hyphen_width (PangoItem *item)
* b) we should reshape the entire run
* But it is close enough in practice
*/
- hb_font = pango_font_get_hb_font (item->analysis.font);
+ hb_font = pango2_font_get_hb_font (item->analysis.font);
if (hb_font_get_nominal_glyph (hb_font, 0x2010, &glyph) ||
hb_font_get_nominal_glyph (hb_font, '-', &glyph))
return hb_font_get_glyph_h_advance (hb_font, glyph);
@@ -1074,18 +1074,18 @@ find_hyphen_width (PangoItem *item)
}
static inline void
-ensure_hyphen_width (PangoLineBreaker *self)
+ensure_hyphen_width (Pango2LineBreaker *self)
{
if (self ->hyphen_width < 0)
{
- PangoItem *item = self->items->data;
+ Pango2Item *item = self->items->data;
self->hyphen_width = find_hyphen_width (item);
}
}
static int
-find_break_extra_width (PangoLineBreaker *self,
- int pos)
+find_break_extra_width (Pango2LineBreaker *self,
+ int pos)
{
/* Check whether to insert a hyphen,
* or whether we are breaking after one of those
@@ -1111,10 +1111,10 @@ find_break_extra_width (PangoLineBreaker *self,
}
static inline void
-compute_log_widths (PangoLineBreaker *self)
+compute_log_widths (Pango2LineBreaker *self)
{
- PangoItem *item = self->items->data;
- PangoGlyphItem glyph_item = { item, self->glyphs };
+ Pango2Item *item = self->items->data;
+ Pango2GlyphItem glyph_item = { item, self->glyphs };
if (item->num_chars > self->num_log_widths)
{
@@ -1123,7 +1123,7 @@ compute_log_widths (PangoLineBreaker *self)
}
g_assert (self->log_widths_offset == 0);
- pango_glyph_item_get_logical_widths (&glyph_item, self->data->text, self->log_widths);
+ pango2_glyph_item_get_logical_widths (&glyph_item, self->data->text, self->log_widths);
}
/* If last_tab is set, we've added a tab and remaining_width has been updated to
@@ -1132,7 +1132,7 @@ compute_log_widths (PangoLineBreaker *self)
* against remaining_width.
*/
static int
-tab_width_change (PangoLineBreaker *self)
+tab_width_change (Pango2LineBreaker *self)
{
if (self->last_tab.glyphs)
return self->last_tab.glyphs->glyphs[0].geometry.width - (self->last_tab.pos - self->last_tab.width);
@@ -1200,13 +1200,13 @@ typedef enum
*/
static BreakResult
-process_item (PangoLineBreaker *self,
- PangoLine *line,
- gboolean force_fit,
- gboolean no_break_at_end,
- gboolean is_last_item)
+process_item (Pango2LineBreaker *self,
+ Pango2Line *line,
+ gboolean force_fit,
+ gboolean no_break_at_end,
+ gboolean is_last_item)
{
- PangoItem *item = self->items->data;
+ Pango2Item *item = self->items->data;
int width;
int extra_width;
int orig_extra_width;
@@ -1215,12 +1215,12 @@ process_item (PangoLineBreaker *self,
int processing_new_item;
int num_chars;
int orig_width;
- PangoWrapMode wrap;
+ Pango2WrapMode wrap;
int break_num_chars;
int break_width;
int break_extra_width;
- PangoGlyphString *break_glyphs;
- PangoFontMetrics *metrics;
+ Pango2GlyphString *break_glyphs;
+ Pango2FontMetrics *metrics;
int safe_distance;
DEBUG1 ("process item '%.*s'. Remaining width %d",
@@ -1240,7 +1240,7 @@ process_item (PangoLineBreaker *self,
*/
if (!self->glyphs)
{
- pango_item_get_properties (item, &self->properties);
+ pango2_item_get_properties (item, &self->properties);
self->glyphs = shape_run (self, line, item);
self->log_widths_offset = 0;
processing_new_item = TRUE;
@@ -1250,7 +1250,7 @@ process_item (PangoLineBreaker *self,
if (item_is_paragraph_separator (self, item))
{
- g_clear_pointer (&self->glyphs, pango_glyph_string_free);
+ g_clear_pointer (&self->glyphs, pango2_glyph_string_free);
return BREAK_PARAGRAPH_SEPARATOR;
}
@@ -1306,15 +1306,15 @@ process_item (PangoLineBreaker *self,
extra_width = 0;
if ((width + extra_width <= self->remaining_width || (item->num_chars == 1 && !line->runs) ||
- (self->last_tab.glyphs && self->last_tab.align != PANGO_TAB_LEFT)) &&
+ (self->last_tab.glyphs && self->last_tab.align != PANGO2_TAB_LEFT)) &&
!no_break_at_end)
{
- PangoGlyphString *glyphs;
+ Pango2GlyphString *glyphs;
DEBUG1 ("%d + %d <= %d", width, extra_width, self->remaining_width);
glyphs = shape_run (self, line, item);
- width = pango_glyph_string_get_width (glyphs) + tab_width_change (self);
+ width = pango2_glyph_string_get_width (glyphs) + tab_width_change (self);
if (width + extra_width <= self->remaining_width || (item->num_chars == 1 && !line->runs))
{
@@ -1330,7 +1330,7 @@ process_item (PangoLineBreaker *self,
}
/* if it doesn't fit after shaping, discard and proceed to break the item */
- pango_glyph_string_free (glyphs);
+ pango2_glyph_string_free (glyphs);
}
/*** From here on, we look for a way to break item ***/
@@ -1346,9 +1346,9 @@ process_item (PangoLineBreaker *self,
/* Add some safety margin here. If we are farther away from the end of the
* line than this, we don't look carefully at a break possibility.
*/
- metrics = pango_font_get_metrics (item->analysis.font, item->analysis.language);
- safe_distance = pango_font_metrics_get_approximate_char_width (metrics) * 3;
- pango_font_metrics_free (metrics);
+ metrics = pango2_font_get_metrics (item->analysis.font, item->analysis.language);
+ safe_distance = pango2_font_metrics_get_approximate_char_width (metrics) * 3;
+ pango2_font_metrics_free (metrics);
if (processing_new_item)
{
@@ -1396,26 +1396,26 @@ retry_break:
{
int length;
int new_break_width;
- PangoItem *new_item;
- PangoGlyphString *glyphs;
+ Pango2Item *new_item;
+ Pango2GlyphString *glyphs;
length = g_utf8_offset_to_pointer (self->data->text + item->offset, num_chars) - (self->data->text + item->offset);
if (num_chars < item->num_chars)
{
- new_item = pango_item_split (item, length, num_chars);
+ new_item = pango2_item_split (item, length, num_chars);
if (break_needs_hyphen (self, num_chars))
- new_item->analysis.flags |= PANGO_ANALYSIS_FLAG_NEED_HYPHEN;
+ new_item->analysis.flags |= PANGO2_ANALYSIS_FLAG_NEED_HYPHEN;
else
- new_item->analysis.flags &= ~PANGO_ANALYSIS_FLAG_NEED_HYPHEN;
+ new_item->analysis.flags &= ~PANGO2_ANALYSIS_FLAG_NEED_HYPHEN;
}
else
new_item = item;
glyphs = shape_run (self, line, new_item);
- new_break_width = pango_glyph_string_get_width (glyphs) + tab_width_change (self);
+ new_break_width = pango2_glyph_string_get_width (glyphs) + tab_width_change (self);
if (num_chars > 0 &&
(item != new_item || !is_last_item) && /* We don't collapse space at the very end */
@@ -1431,8 +1431,8 @@ retry_break:
if (new_item != item)
{
- pango_item_free (new_item);
- pango_item_unsplit (item, length, num_chars);
+ pango2_item_free (new_item);
+ pango2_item_unsplit (item, length, num_chars);
}
if (break_num_chars == item->num_chars ||
@@ -1447,13 +1447,13 @@ retry_break:
break_extra_width = extra_width;
if (break_glyphs)
- pango_glyph_string_free (break_glyphs);
+ pango2_glyph_string_free (break_glyphs);
break_glyphs = glyphs;
}
else
{
DEBUG1 ("ignore breakpoint %d", num_chars);
- pango_glyph_string_free (glyphs);
+ pango2_glyph_string_free (glyphs);
}
}
}
@@ -1463,18 +1463,18 @@ retry_break:
width += self->log_widths[self->log_widths_offset + num_chars];
}
- if (wrap == PANGO_WRAP_WORD_CHAR &&
+ if (wrap == PANGO2_WRAP_WORD_CHAR &&
force_fit &&
break_width + break_extra_width > self->remaining_width)
{
/* Try again, with looser conditions */
DEBUG1 ("does not fit, try again with wrap-char");
- wrap = PANGO_WRAP_CHAR;
+ wrap = PANGO2_WRAP_CHAR;
break_num_chars = item->num_chars;
break_width = orig_width;
break_extra_width = orig_extra_width;
if (break_glyphs)
- pango_glyph_string_free (break_glyphs);
+ pango2_glyph_string_free (break_glyphs);
break_glyphs = NULL;
goto retry_break;
}
@@ -1491,12 +1491,12 @@ retry_break:
{
if (can_break_at (self, self->start_offset + break_num_chars, wrap) &&
break_needs_hyphen (self, break_num_chars))
- item->analysis.flags |= PANGO_ANALYSIS_FLAG_NEED_HYPHEN;
+ item->analysis.flags |= PANGO2_ANALYSIS_FLAG_NEED_HYPHEN;
insert_run (self, line, item, NULL, TRUE);
if (break_glyphs)
- pango_glyph_string_free (break_glyphs);
+ pango2_glyph_string_free (break_glyphs);
DEBUG1 ("all-fit '%.*s', remaining %d",
item->length, self->data->text + item->offset,
@@ -1506,18 +1506,18 @@ retry_break:
else if (break_num_chars == 0)
{
if (break_glyphs)
- pango_glyph_string_free (break_glyphs);
+ pango2_glyph_string_free (break_glyphs);
DEBUG1 ("empty-fit, remaining %d", self->remaining_width);
return BREAK_EMPTY_FIT;
}
else
{
- PangoItem *new_item;
+ Pango2Item *new_item;
length = g_utf8_offset_to_pointer (self->data->text + item->offset, break_num_chars) - (self->data->text + item->offset);
- new_item = pango_item_split (item, length, break_num_chars);
+ new_item = pango2_item_split (item, length, break_num_chars);
insert_run (self, line, new_item, break_glyphs, FALSE);
@@ -1531,11 +1531,11 @@ retry_break:
}
else
{
- pango_glyph_string_free (self->glyphs);
+ pango2_glyph_string_free (self->glyphs);
self->glyphs = NULL;
if (break_glyphs)
- pango_glyph_string_free (break_glyphs);
+ pango2_glyph_string_free (break_glyphs);
DEBUG1 ("none-fit, remaining %d", self->remaining_width);
return BREAK_NONE_FIT;
@@ -1543,8 +1543,8 @@ retry_break:
}
static void
-process_line (PangoLineBreaker *self,
- PangoLine *line)
+process_line (Pango2LineBreaker *self,
+ Pango2Line *line)
{
gboolean have_break = FALSE; /* If we've seen a possible break yet */
int break_remaining_width = 0; /* Remaining width before adding run with break */
@@ -1554,7 +1554,7 @@ process_line (PangoLineBreaker *self,
while (self->items)
{
- PangoItem *item = self->items->data;
+ Pango2Item *item = self->items->data;
BreakResult result;
int old_num_chars;
int old_remaining_width;
@@ -1597,14 +1597,14 @@ process_line (PangoLineBreaker *self,
/* Back up over unused runs to run where there is a break */
while (line->runs && line->runs != break_link)
{
- PangoGlyphItem *run = line->runs->data;
+ Pango2GlyphItem *run = line->runs->data;
/* Reset tab stat if we uninsert the current tab run */
if (run->glyphs == self->last_tab.glyphs)
{
self->last_tab.glyphs = NULL;
self->last_tab.index = 0;
- self->last_tab.align = PANGO_TAB_LEFT;
+ self->last_tab.align = PANGO2_TAB_LEFT;
}
self->items = g_list_prepend (self->items, uninsert_run (line));
@@ -1643,7 +1643,7 @@ process_line (PangoLineBreaker *self,
self->line_start_index += item->length;
self->start_offset += item->num_chars;
self->items = g_list_delete_link (self->items, self->items);
- pango_item_free (item);
+ pango2_item_free (item);
goto done;
default:
@@ -1658,11 +1658,11 @@ done:
/* {{{ Post-processing */
static void
-add_missing_hyphen (PangoLineBreaker *self,
- PangoLine *line)
+add_missing_hyphen (Pango2LineBreaker *self,
+ Pango2Line *line)
{
- PangoGlyphItem *run;
- PangoItem *item;
+ Pango2GlyphItem *run;
+ Pango2Item *item;
if (!line->runs)
return;
@@ -1671,7 +1671,7 @@ add_missing_hyphen (PangoLineBreaker *self,
item = run->item;
if (self->data->log_attrs[self->line_start_offset + line->n_chars].break_inserts_hyphen &&
- !(item->analysis.flags & PANGO_ANALYSIS_FLAG_NEED_HYPHEN))
+ !(item->analysis.flags & PANGO2_ANALYSIS_FLAG_NEED_HYPHEN))
{
int width;
int start_offset;
@@ -1679,7 +1679,7 @@ add_missing_hyphen (PangoLineBreaker *self,
DEBUG1 ("add a missing hyphen");
/* The last run fit onto the line without breaking it, but it still needs a hyphen */
- width = pango_glyph_string_get_width (run->glyphs);
+ width = pango2_glyph_string_get_width (run->glyphs);
/* Ugly, shape_run uses self->start_offset, so temporarily rewind things
* to the state before the run was inserted. Otherwise, we end up passing
@@ -1688,25 +1688,25 @@ add_missing_hyphen (PangoLineBreaker *self,
start_offset = self->start_offset;
self->start_offset = self->line_start_offset + line->n_chars - item->num_chars;
- pango_glyph_string_free (run->glyphs);
- item->analysis.flags |= PANGO_ANALYSIS_FLAG_NEED_HYPHEN;
+ pango2_glyph_string_free (run->glyphs);
+ item->analysis.flags |= PANGO2_ANALYSIS_FLAG_NEED_HYPHEN;
run->glyphs = shape_run (self, line, item);
self->start_offset = start_offset;
- self->remaining_width += pango_glyph_string_get_width (run->glyphs) - width;
+ self->remaining_width += pango2_glyph_string_get_width (run->glyphs) - width;
}
- line->hyphenated = (item->analysis.flags & PANGO_ANALYSIS_FLAG_NEED_HYPHEN) != 0;
+ line->hyphenated = (item->analysis.flags & PANGO2_ANALYSIS_FLAG_NEED_HYPHEN) != 0;
}
static void
-zero_line_final_space (PangoLineBreaker *self,
- PangoLine *line)
+zero_line_final_space (Pango2LineBreaker *self,
+ Pango2Line *line)
{
- PangoGlyphItem *run;
- PangoItem *item;
- PangoGlyphString *glyphs;
+ Pango2GlyphItem *run;
+ Pango2Item *item;
+ Pango2GlyphString *glyphs;
int glyph;
if (!line->runs)
@@ -1718,7 +1718,7 @@ zero_line_final_space (PangoLineBreaker *self,
glyphs = run->glyphs;
glyph = item->analysis.level % 2 ? 0 : glyphs->num_glyphs - 1;
- if (glyphs->glyphs[glyph].glyph == PANGO_GET_UNKNOWN_GLYPH (0x2028))
+ if (glyphs->glyphs[glyph].glyph == PANGO2_GET_UNKNOWN_GLYPH (0x2028))
{
DEBUG1 ("zero final space: visible space");
return; /* this LS is visible */
@@ -1744,7 +1744,7 @@ zero_line_final_space (PangoLineBreaker *self,
DEBUG1 ("zero line final space: collapsing the space");
glyphs->glyphs[glyph].geometry.width = 0;
- glyphs->glyphs[glyph].glyph = PANGO_GLYPH_EMPTY;
+ glyphs->glyphs[glyph].glyph = PANGO2_GLYPH_EMPTY;
}
/* When doing shaping, we add the letter spacing value for a
@@ -1760,11 +1760,11 @@ zero_line_final_space (PangoLineBreaker *self,
* cases.
*/
static void
-adjust_line_letter_spacing (PangoLineBreaker *self,
- PangoLine *line)
+adjust_line_letter_spacing (Pango2LineBreaker *self,
+ Pango2Line *line)
{
gboolean reversed;
- PangoGlyphItem *last_run;
+ Pango2GlyphItem *last_run;
int tab_adjustment;
GSList *l;
@@ -1774,7 +1774,7 @@ adjust_line_letter_spacing (PangoLineBreaker *self,
* tab stops.
*/
reversed = FALSE;
- if (line->direction == PANGO_DIRECTION_RTL)
+ if (line->direction == PANGO2_DIRECTION_RTL)
{
for (l = line->runs; l; l = l->next)
if (is_tab_run (line, l->data))
@@ -1797,8 +1797,8 @@ adjust_line_letter_spacing (PangoLineBreaker *self,
tab_adjustment = 0;
for (l = line->runs; l; l = l->next)
{
- PangoGlyphItem *run = l->data;
- PangoGlyphItem *next_run = l->next ? l->next->data : NULL;
+ Pango2GlyphItem *run = l->data;
+ Pango2GlyphItem *next_run = l->next ? l->next->data : NULL;
if (is_tab_run (line, run))
{
@@ -1807,8 +1807,8 @@ adjust_line_letter_spacing (PangoLineBreaker *self,
}
else
{
- PangoGlyphItem *visual_next_run = reversed ? last_run : next_run;
- PangoGlyphItem *visual_last_run = reversed ? next_run : last_run;
+ Pango2GlyphItem *visual_next_run = reversed ? last_run : next_run;
+ Pango2GlyphItem *visual_last_run = reversed ? next_run : last_run;
int run_spacing = get_item_letter_spacing (run->item);
int space_left, space_right;
@@ -1850,19 +1850,19 @@ adjust_line_letter_spacing (PangoLineBreaker *self,
}
typedef struct {
- PangoAttribute *attr;
+ Pango2Attribute *attr;
int x_offset;
int y_offset;
} BaselineItem;
static void
-collect_baseline_shift (PangoLineBreaker *self,
- PangoItem *item,
- PangoItem *prev,
- int *start_x_offset,
- int *start_y_offset,
- int *end_x_offset,
- int *end_y_offset)
+collect_baseline_shift (Pango2LineBreaker *self,
+ Pango2Item *item,
+ Pango2Item *prev,
+ int *start_x_offset,
+ int *start_y_offset,
+ int *end_x_offset,
+ int *end_y_offset)
{
*start_x_offset = 0;
*start_y_offset = 0;
@@ -1871,16 +1871,16 @@ collect_baseline_shift (PangoLineBreaker *self,
for (GSList *l = item->analysis.extra_attrs; l; l = l->next)
{
- PangoAttribute *attr = l->data;
+ Pango2Attribute *attr = l->data;
- if (attr->type == PANGO_ATTR_RISE)
+ if (attr->type == PANGO2_ATTR_RISE)
{
int value = attr->int_value;
*start_y_offset += value;
*end_y_offset -= value;
}
- else if (attr->type == PANGO_ATTR_BASELINE_SHIFT)
+ else if (attr->type == PANGO2_ATTR_BASELINE_SHIFT)
{
if (attr->start_index == item->offset)
{
@@ -1908,7 +1908,7 @@ collect_baseline_shift (PangoLineBreaker *self,
if (prev)
{
- hb_font_t *hb_font = pango_font_get_hb_font (prev->analysis.font);
+ hb_font_t *hb_font = pango2_font_get_hb_font (prev->analysis.font);
hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_TAG_SUPERSCRIPT_EM_Y_OFFSET, &superscript_y_offset);
hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_TAG_SUPERSCRIPT_EM_X_OFFSET, &superscript_x_offset);
hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_TAG_SUBSCRIPT_EM_Y_OFFSET, &subscript_y_offset);
@@ -1922,15 +1922,15 @@ collect_baseline_shift (PangoLineBreaker *self,
switch (value)
{
- case PANGO_BASELINE_SHIFT_NONE:
+ case PANGO2_BASELINE_SHIFT_NONE:
entry->x_offset = 0;
entry->y_offset = 0;
break;
- case PANGO_BASELINE_SHIFT_SUPERSCRIPT:
+ case PANGO2_BASELINE_SHIFT_SUPERSCRIPT:
entry->x_offset = superscript_x_offset;
entry->y_offset = superscript_y_offset;
break;
- case PANGO_BASELINE_SHIFT_SUBSCRIPT:
+ case PANGO2_BASELINE_SHIFT_SUBSCRIPT:
entry->x_offset = subscript_x_offset;
entry->y_offset = -subscript_y_offset;
break;
@@ -1971,11 +1971,11 @@ collect_baseline_shift (PangoLineBreaker *self,
}
static void
-apply_baseline_shift (PangoLineBreaker *self,
- PangoLine *line)
+apply_baseline_shift (Pango2LineBreaker *self,
+ Pango2Line *line)
{
int y_offset = 0;
- PangoItem *prev = NULL;
+ Pango2Item *prev = NULL;
hb_position_t baseline_adjustment = 0;
#if HB_VERSION_ATLEAST(4,0,0)
hb_ot_layout_baseline_tag_t baseline_tag = 0;
@@ -1985,8 +1985,8 @@ apply_baseline_shift (PangoLineBreaker *self,
for (GSList *l = line->runs; l; l = l->next)
{
- PangoGlyphItem *run = l->data;
- PangoItem *item = run->item;
+ Pango2GlyphItem *run = l->data;
+ Pango2Item *item = run->item;
int start_x_offset, end_x_offset;
int start_y_offset, end_y_offset;
#if HB_VERSION_ATLEAST(4,0,0)
@@ -2004,22 +2004,22 @@ apply_baseline_shift (PangoLineBreaker *self,
continue;
#if HB_VERSION_ATLEAST(4,0,0)
- hb_font = pango_font_get_hb_font (item->analysis.font);
+ hb_font = pango2_font_get_hb_font (item->analysis.font);
script = (hb_script_t) g_unicode_script_to_iso15924 (item->analysis.script);
- language = hb_language_from_string (pango_language_to_string (item->analysis.language), -1);
+ language = hb_language_from_string (pango2_language_to_string (item->analysis.language), -1);
hb_ot_tags_from_script_and_language (script, language,
&script_count, script_tags,
&lang_count, lang_tags);
- if (item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
+ if (item->analysis.flags & PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE)
direction = HB_DIRECTION_TTB;
else
direction = HB_DIRECTION_LTR;
if (baseline_tag == 0)
{
- if (item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
+ if (item->analysis.flags & PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE)
baseline_tag = HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_CENTRAL;
else
baseline_tag = hb_ot_layout_get_horizontal_baseline_tag_for_script (script);
@@ -2044,7 +2044,7 @@ apply_baseline_shift (PangoLineBreaker *self,
/* Don't do baseline adjustment in vertical, since the renderer
* is still doing its own baseline shifting there
*/
- if (item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
+ if (item->analysis.flags & PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE)
baseline_adjustment = 0;
else
baseline_adjustment = baseline - run_baseline;
@@ -2065,8 +2065,8 @@ apply_baseline_shift (PangoLineBreaker *self,
}
static void
-apply_render_attributes (PangoLineBreaker *self,
- PangoLine *line)
+apply_render_attributes (Pango2LineBreaker *self,
+ Pango2Line *line)
{
GSList *runs;
@@ -2078,12 +2078,12 @@ apply_render_attributes (PangoLineBreaker *self,
for (GSList *l = runs; l; l = l->next)
{
- PangoGlyphItem *glyph_item = l->data;
+ Pango2GlyphItem *glyph_item = l->data;
GSList *new_runs;
- new_runs = pango_glyph_item_apply_attrs (glyph_item,
- line->data->text,
- self->render_attrs);
+ new_runs = pango2_glyph_item_apply_attrs (glyph_item,
+ line->data->text,
+ self->render_attrs);
line->runs = g_slist_concat (new_runs, line->runs);
}
@@ -2092,8 +2092,8 @@ apply_render_attributes (PangoLineBreaker *self,
}
static void
-postprocess_line (PangoLineBreaker *self,
- PangoLine *line)
+postprocess_line (Pango2LineBreaker *self,
+ Pango2Line *line)
{
add_missing_hyphen (self, line);
@@ -2106,10 +2106,10 @@ postprocess_line (PangoLineBreaker *self,
apply_baseline_shift (self, line);
if (should_ellipsize_current_line (self, line))
- pango_line_ellipsize (line, self->context, self->line_ellipsize, self->line_width);
+ pango2_line_ellipsize (line, self->context, self->line_ellipsize, self->line_width);
/* Now convert logical to visual order */
- pango_line_reorder (line);
+ pango2_line_reorder (line);
/* Fixup letter spacing between runs */
adjust_line_letter_spacing (self, line);
@@ -2119,9 +2119,9 @@ postprocess_line (PangoLineBreaker *self,
/* }}} */
/* }}} */
-/* {{{ PangoLineBreaker implementation */
+/* {{{ Pango2LineBreaker implementation */
-G_DEFINE_FINAL_TYPE (PangoLineBreaker, pango_line_breaker, G_TYPE_OBJECT)
+G_DEFINE_FINAL_TYPE (Pango2LineBreaker, pango2_line_breaker, G_TYPE_OBJECT)
enum {
PROP_CONTEXT = 1,
@@ -2133,7 +2133,7 @@ enum {
static GParamSpec *properties[N_PROPERTIES];
static void
-pango_line_breaker_init (PangoLineBreaker *self)
+pango2_line_breaker_init (Pango2LineBreaker *self)
{
self->tabs = NULL;
self->tab_width = -1;
@@ -2142,31 +2142,31 @@ pango_line_breaker_init (PangoLineBreaker *self)
}
static void
-pango_line_breaker_finalize (GObject *object)
+pango2_line_breaker_finalize (GObject *object)
{
- PangoLineBreaker *self = PANGO_LINE_BREAKER (object);
+ Pango2LineBreaker *self = PANGO2_LINE_BREAKER (object);
g_list_free_full (self->baseline_shifts, g_free);
- g_clear_pointer (&self->glyphs, pango_glyph_string_free);
+ g_clear_pointer (&self->glyphs, pango2_glyph_string_free);
g_clear_pointer (&self->log_widths, g_free);
- g_list_free_full (self->items, (GDestroyNotify) pango_item_free);
+ g_list_free_full (self->items, (GDestroyNotify) pango2_item_free);
g_clear_pointer (&self->data, line_data_unref);
- g_list_free_full (self->data_items, (GDestroyNotify) pango_item_free);
- g_clear_pointer (&self->render_attrs, pango_attr_list_unref);
+ g_list_free_full (self->data_items, (GDestroyNotify) pango2_item_free);
+ g_clear_pointer (&self->render_attrs, pango2_attr_list_unref);
g_slist_free_full (self->datas, (GDestroyNotify) line_data_unref);
- g_clear_pointer (&self->tabs, pango_tab_array_free);
+ g_clear_pointer (&self->tabs, pango2_tab_array_free);
g_object_unref (self->context);
- G_OBJECT_CLASS (pango_line_breaker_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_line_breaker_parent_class)->finalize (object);
}
static void
-pango_line_breaker_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+pango2_line_breaker_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- PangoLineBreaker *self = PANGO_LINE_BREAKER (object);
+ Pango2LineBreaker *self = PANGO2_LINE_BREAKER (object);
switch (prop_id)
{
@@ -2176,11 +2176,11 @@ pango_line_breaker_set_property (GObject *object,
break;
case PROP_BASE_DIR:
- pango_line_breaker_set_base_dir (self, g_value_get_enum (value));
+ pango2_line_breaker_set_base_dir (self, g_value_get_enum (value));
break;
case PROP_TABS:
- pango_line_breaker_set_tabs (self, g_value_get_boxed (value));
+ pango2_line_breaker_set_tabs (self, g_value_get_boxed (value));
break;
default:
@@ -2190,12 +2190,12 @@ pango_line_breaker_set_property (GObject *object,
}
static void
-pango_line_breaker_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+pango2_line_breaker_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- PangoLineBreaker *self = PANGO_LINE_BREAKER (object);
+ Pango2LineBreaker *self = PANGO2_LINE_BREAKER (object);
switch (prop_id)
{
@@ -2204,11 +2204,11 @@ pango_line_breaker_get_property (GObject *object,
break;
case PROP_BASE_DIR:
- g_value_set_enum (value, pango_line_breaker_get_base_dir (self));
+ g_value_set_enum (value, pango2_line_breaker_get_base_dir (self));
break;
case PROP_TABS:
- g_value_set_boxed (value, pango_line_breaker_get_tabs (self));
+ g_value_set_boxed (value, pango2_line_breaker_get_tabs (self));
break;
default:
@@ -2218,48 +2218,48 @@ pango_line_breaker_get_property (GObject *object,
}
static void
-pango_line_breaker_class_init (PangoLineBreakerClass *class)
+pango2_line_breaker_class_init (Pango2LineBreakerClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = pango_line_breaker_finalize;
- object_class->set_property = pango_line_breaker_set_property;
- object_class->get_property = pango_line_breaker_get_property;
+ object_class->finalize = pango2_line_breaker_finalize;
+ object_class->set_property = pango2_line_breaker_set_property;
+ object_class->get_property = pango2_line_breaker_get_property;
/**
- * PangoLineBreaker:context: (attributes org.gtk.Property.get=pango_line_breaker_get_context)
+ * Pango2LineBreaker:context: (attributes org.gtk.Property.get=pango2_line_breaker_get_context)
*
- * The context for the `PangoLineBreaker`.
+ * The context for the `Pango2LineBreaker`.
*/
properties[PROP_CONTEXT] =
g_param_spec_object ("context", "context", "context",
- PANGO_TYPE_CONTEXT,
+ PANGO2_TYPE_CONTEXT,
G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY|G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLineBreaker:base-dir: (attributes org.gtk.Property.get=pango_line_breaker_get_base_dir org.gtk.Property.set=pango_line_breaker_set_base_dir)
+ * Pango2LineBreaker:base-dir: (attributes org.gtk.Property.get=pango2_line_breaker_get_base_dir org.gtk.Property.set=pango2_line_breaker_set_base_dir)
*
- * The base direction for the `PangoLineBreaker`.
+ * The base direction for the `Pango2LineBreaker`.
*
- * The default value is `PANGO_DIRECTION_NEUTRAL`.
+ * The default value is `PANGO2_DIRECTION_NEUTRAL`.
*/
properties[PROP_BASE_DIR] =
g_param_spec_enum ("base-dir", "base-dir", "base-dir",
- PANGO_TYPE_DIRECTION,
- PANGO_DIRECTION_NEUTRAL,
+ PANGO2_TYPE_DIRECTION,
+ PANGO2_DIRECTION_NEUTRAL,
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
- * PangoLineBreaker:tabs: (attributes org.gtk.Property.get=pango_line_breaker_get_tabs org.gtk.Property.set=pango_line_breaker_set_tabs)
+ * Pango2LineBreaker:tabs: (attributes org.gtk.Property.get=pango2_line_breaker_get_tabs org.gtk.Property.set=pango2_line_breaker_set_tabs)
*
- * The tabs to use when formatting the next line of the `PangoLineBreaker`.
+ * The tabs to use when formatting the next line of the `Pango2LineBreaker`.
*
- * `PangoLineBreaker` will place content at the next tab position
+ * `Pango2LineBreaker` will place content at the next tab position
* whenever it meets a Tab character (U+0009).
*/
properties[PROP_TABS] =
g_param_spec_boxed ("tabs", "tabs", "tabs",
- PANGO_TYPE_TAB_ARRAY,
+ PANGO2_TYPE_TAB_ARRAY,
G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
@@ -2269,45 +2269,45 @@ pango_line_breaker_class_init (PangoLineBreakerClass *class)
/* {{{ Public API */
/**
- * pango_line_breaker_new:
- * @context: a `PangoContext`
+ * pango2_line_breaker_new:
+ * @context: a `Pango2Context`
*
- * Creates a new `PangoLineBreaker`.
+ * Creates a new `Pango2LineBreaker`.
*
- * Returns: a newly created `PangoLineBreaker`
+ * Returns: a newly created `Pango2LineBreaker`
*/
-PangoLineBreaker *
-pango_line_breaker_new (PangoContext *context)
+Pango2LineBreaker *
+pango2_line_breaker_new (Pango2Context *context)
{
- g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL);
- return g_object_new (PANGO_TYPE_LINE_BREAKER, "context", context, NULL);
+ return g_object_new (PANGO2_TYPE_LINE_BREAKER, "context", context, NULL);
}
/**
- * pango_line_breaker_get_context:
- * @self: a `PangoLineBreaker`
+ * pango2_line_breaker_get_context:
+ * @self: a `Pango2LineBreaker`
*
- * Retrieves the context used for the `PangoLineBreaker`.
+ * Retrieves the context used for the `Pango2LineBreaker`.
*
- * Returns: (transfer none): the `PangoContext` for @self
+ * Returns: (transfer none): the `Pango2Context` for @self
*/
-PangoContext *
-pango_line_breaker_get_context (PangoLineBreaker *self)
+Pango2Context *
+pango2_line_breaker_get_context (Pango2LineBreaker *self)
{
- g_return_val_if_fail (PANGO_IS_LINE_BREAKER (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_LINE_BREAKER (self), NULL);
return self->context;
}
/**
- * pango_line_breaker_set_tabs:
- * @self: a `PangoLineBreaker`
- * @tabs: (nullable): a `PangoTabArray`
+ * pango2_line_breaker_set_tabs:
+ * @self: a `Pango2LineBreaker`
+ * @tabs: (nullable): a `Pango2TabArray`
*
* Sets the tab positions to use for lines.
*
- * `PangoLineBreaker` will place content at the next tab position
+ * `Pango2LineBreaker` will place content at the next tab position
* whenever it meets a Tab character (U+0009).
*
* By default, tabs are every 8 spaces. If @tabs is %NULL, the
@@ -2317,44 +2317,44 @@ pango_line_breaker_get_context (PangoLineBreaker *self)
* Note that tabs and justification conflict with each other:
* Justification will move content away from its tab-aligned
* positions. The same is true for alignments other than
- * %PANGO_ALIGNMENT_LEFT.
+ * %PANGO2_ALIGNMENT_LEFT.
*/
void
-pango_line_breaker_set_tabs (PangoLineBreaker *self,
- PangoTabArray *tabs)
+pango2_line_breaker_set_tabs (Pango2LineBreaker *self,
+ Pango2TabArray *tabs)
{
- g_return_if_fail (PANGO_IS_LINE_BREAKER (self));
+ g_return_if_fail (PANGO2_IS_LINE_BREAKER (self));
if (self->tabs)
{
- pango_tab_array_free (self->tabs);
+ pango2_tab_array_free (self->tabs);
self->tabs = NULL;
}
if (tabs)
{
- self->tabs = pango_tab_array_copy (tabs);
- pango_tab_array_sort (self->tabs);
+ self->tabs = pango2_tab_array_copy (tabs);
+ pango2_tab_array_sort (self->tabs);
}
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TABS]);
}
/**
- * pango_line_breaker_get_tabs:
- * @self: a `PangoLineBreaker`
+ * pango2_line_breaker_get_tabs:
+ * @self: a `Pango2LineBreaker`
*
- * Gets the current `PangoTabArray` used by the `PangoLineBreaker`.
+ * Gets the current `Pango2TabArray` used by the `Pango2LineBreaker`.
*
- * If no `PangoTabArray` has been set, then the default tabs are
+ * If no `Pango2TabArray` has been set, then the default tabs are
* in use and %NULL is returned. Default tabs are every 8 spaces.
*
* Return value: (transfer none) (nullable): the tabs for @self
*/
-PangoTabArray *
-pango_line_breaker_get_tabs (PangoLineBreaker *self)
+Pango2TabArray *
+pango2_line_breaker_get_tabs (Pango2LineBreaker *self)
{
- g_return_val_if_fail (PANGO_IS_LINE_BREAKER (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_LINE_BREAKER (self), NULL);
if (self->tabs)
return self->tabs;
@@ -2363,20 +2363,20 @@ pango_line_breaker_get_tabs (PangoLineBreaker *self)
}
/**
- * pango_line_breaker_set_base_dir:
- * @self: a `PangoLineBreaker`
+ * pango2_line_breaker_set_base_dir:
+ * @self: a `Pango2LineBreaker`
* @direction: the direction
*
- * Sets the base direction for lines produced by the `PangoLineBreaker`.
+ * Sets the base direction for lines produced by the `Pango2LineBreaker`.
*
- * If @direction is `PANGO_DIRECTION_NEUTRAL`, the direction is determined
+ * If @direction is `PANGO2_DIRECTION_NEUTRAL`, the direction is determined
* from the content. This is the default behavior.
*/
void
-pango_line_breaker_set_base_dir (PangoLineBreaker *self,
- PangoDirection direction)
+pango2_line_breaker_set_base_dir (Pango2LineBreaker *self,
+ Pango2Direction direction)
{
- g_return_if_fail (PANGO_IS_LINE_BREAKER (self));
+ g_return_if_fail (PANGO2_IS_LINE_BREAKER (self));
if (self->base_dir == direction)
return;
@@ -2387,77 +2387,77 @@ pango_line_breaker_set_base_dir (PangoLineBreaker *self,
}
/**
- * pango_line_breaker_get_base_dir:
- * @self: a `PangoLineBreaker`
+ * pango2_line_breaker_get_base_dir:
+ * @self: a `Pango2LineBreaker`
*
- * Gets the base direction for lines produced by the `PangoLineBreaker`.
+ * Gets the base direction for lines produced by the `Pango2LineBreaker`.
*
- * See [method@Pango.LineBreaker.set_base_dir].
+ * See [method@Pango2.LineBreaker.set_base_dir].
*/
-PangoDirection
-pango_line_breaker_get_base_dir (PangoLineBreaker *self)
+Pango2Direction
+pango2_line_breaker_get_base_dir (Pango2LineBreaker *self)
{
- g_return_val_if_fail (PANGO_IS_LINE_BREAKER (self), PANGO_DIRECTION_NEUTRAL);
+ g_return_val_if_fail (PANGO2_IS_LINE_BREAKER (self), PANGO2_DIRECTION_NEUTRAL);
return self->base_dir;
}
/**
- * pango_line_breaker_add_text:
+ * pango2_line_breaker_add_text:
* @text: the text to break into lines
* @length: length of @text in bytes, or -1 if @text is nul-terminated
- * @attrs: (nullable): a `PangoAttrList` with attributes for @text, or `NULL`
+ * @attrs: (nullable): a `Pango2AttrList` with attributes for @text, or `NULL`
*
- * Provides input that the `PangoLineBreaker` should break into lines.
+ * Provides input that the `Pango2LineBreaker` should break into lines.
*
* It is possible to call this function repeatedly to add more
- * input to an existing `PangoLineBreaker`.
+ * input to an existing `Pango2LineBreaker`.
*
* The end of @text is treated as a paragraph break.
*/
void
-pango_line_breaker_add_text (PangoLineBreaker *self,
- const char *text,
- int length,
- PangoAttrList *attrs)
+pango2_line_breaker_add_text (Pango2LineBreaker *self,
+ const char *text,
+ int length,
+ Pango2AttrList *attrs)
{
- g_return_if_fail (PANGO_IS_LINE_BREAKER (self));
+ g_return_if_fail (PANGO2_IS_LINE_BREAKER (self));
g_return_if_fail (text != NULL);
self->datas = g_slist_append (self->datas, make_line_data (self, text, length, attrs));
}
/**
- * pango_line_breaker_get_direction:
- * @self: a `PangoLineBreaker`
+ * pango2_line_breaker_get_direction:
+ * @self: a `Pango2LineBreaker`
*
* Obtains the resolved direction for the next line.
*
- * If the `PangoLineBreaker` has no more input, then
- * `PANGO_DIRECTION_NEUTRAL` is returned.
+ * If the `Pango2LineBreaker` has no more input, then
+ * `PANGO2_DIRECTION_NEUTRAL` is returned.
*
* Returns: the resolved direction of the next line.
*/
-PangoDirection
-pango_line_breaker_get_direction (PangoLineBreaker *self)
+Pango2Direction
+pango2_line_breaker_get_direction (Pango2LineBreaker *self)
{
- g_return_val_if_fail (PANGO_IS_LINE_BREAKER (self), PANGO_DIRECTION_NEUTRAL);
+ g_return_val_if_fail (PANGO2_IS_LINE_BREAKER (self), PANGO2_DIRECTION_NEUTRAL);
return get_resolved_dir (self);
}
/**
- * pango_line_breaker_has_line:
- * @self: a `PangoLineBreaker`
+ * pango2_line_breaker_has_line:
+ * @self: a `Pango2LineBreaker`
*
- * Returns whether the `PangoLineBreaker` has any text left to process.
+ * Returns whether the `Pango2LineBreaker` has any text left to process.
*
* Returns: TRUE if there are more lines.
*/
gboolean
-pango_line_breaker_has_line (PangoLineBreaker *self)
+pango2_line_breaker_has_line (Pango2LineBreaker *self)
{
- g_return_val_if_fail (PANGO_IS_LINE_BREAKER (self), FALSE);
+ g_return_val_if_fail (PANGO2_IS_LINE_BREAKER (self), FALSE);
ensure_items (self);
@@ -2465,54 +2465,54 @@ pango_line_breaker_has_line (PangoLineBreaker *self)
}
/**
- * pango_line_breaker_next_line:
- * @self: a `PangoLineBreaker`
- * @x: the X position for the line, in Pango units
- * @width: the width for the line, or -1 for no limit, in Pango units
+ * pango2_line_breaker_next_line:
+ * @self: a `Pango2LineBreaker`
+ * @x: the X position for the line, in Pango2 units
+ * @width: the width for the line, or -1 for no limit, in Pango2 units
* @wrap: how to wrap the text
* @ellipsize: whether to ellipsize the text
*
* Gets the next line.
*
- * The `PangoLineBreaker` will use as much of its unprocessed text
+ * The `Pango2LineBreaker` will use as much of its unprocessed text
* as will fit into @width. The @x position is used to determine
* where tabs are located are.
*
- * If @ellipsize is not `PANGO_ELLIPSIZE_NONE`, then all unprocessed
+ * If @ellipsize is not `PANGO2_ELLIPSIZE_NONE`, then all unprocessed
* text will be made to fit by ellipsizing.
*
* Note that the line is not positioned - the leftmost point of its baseline
- * is at 0, 0. See [class@Pango.Lines] for a way to hold a list of positioned
- * `PangoLine` objects.
+ * is at 0, 0. See [class@Pango2.Lines] for a way to hold a list of positioned
+ * `Pango2Line` objects.
*
- * line = pango_line_breaker_next_line (breaker,
- * x, width,
- * PANGO_WRAP_MODE,
- * PANGO_ELLIPSIZE_NONE);
- * pango_line_get_extents (line, &ext);
- * line = pango_line_justify (line, width);
- * pango_lines_add_line (lines, line, x, y - ext.y);
+ * line = pango2_line_breaker_next_line (breaker,
+ * x, width,
+ * PANGO2_WRAP_MODE,
+ * PANGO2_ELLIPSIZE_NONE);
+ * pango2_line_get_extents (line, &ext);
+ * line = pango2_line_justify (line, width);
+ * pango2_lines_add_line (lines, line, x, y - ext.y);
*
* Returns: (transfer full) (nullable): the next line, or `NULL`
* if @self has no more input
*/
-PangoLine *
-pango_line_breaker_next_line (PangoLineBreaker *self,
- int x,
- int width,
- PangoWrapMode wrap,
- PangoEllipsizeMode ellipsize)
+Pango2Line *
+pango2_line_breaker_next_line (Pango2LineBreaker *self,
+ int x,
+ int width,
+ Pango2WrapMode wrap,
+ Pango2EllipsizeMode ellipsize)
{
- PangoLine *line;
+ Pango2Line *line;
- g_return_val_if_fail (PANGO_IS_LINE_BREAKER (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_LINE_BREAKER (self), NULL);
ensure_items (self);
if (!self->items)
return NULL;
- line = pango_line_new (self->context, self->data);
+ line = pango2_line_new (self->context, self->data);
line->start_index = self->line_start_index;
line->start_offset = self->line_start_offset;
@@ -2526,7 +2526,7 @@ pango_line_breaker_next_line (PangoLineBreaker *self,
self->last_tab.glyphs = NULL;
self->last_tab.index = 0;
- self->last_tab.align = PANGO_TAB_LEFT;
+ self->last_tab.align = PANGO2_TAB_LEFT;
if (should_ellipsize_current_line (self, line))
self->remaining_width = -1;
@@ -2550,38 +2550,38 @@ pango_line_breaker_next_line (PangoLineBreaker *self,
if (self->items == NULL)
{
g_clear_pointer (&self->data, line_data_unref);
- g_list_free_full (self->data_items, (GDestroyNotify) pango_item_free);
+ g_list_free_full (self->data_items, (GDestroyNotify) pango2_item_free);
self->data_items = NULL;
- g_clear_pointer (&self->render_attrs, pango_attr_list_unref);
+ g_clear_pointer (&self->render_attrs, pango2_attr_list_unref);
}
- pango_line_check_invariants (line);
+ pango2_line_check_invariants (line);
return line;
}
/**
- * pango_line_breaker_undo_line:
- * @self: a `PangoLineBreaker`
+ * pango2_line_breaker_undo_line:
+ * @self: a `Pango2LineBreaker`
* @line: (transfer none): the most recent line produced by @self
*
* Re-adds the content of a line to the unprocessed
- * input of the `PangoLineBreaker`.
+ * input of the `Pango2LineBreaker`.
*
* This can be used to try this line again with
* different parameters passed to
- * [method@Pango.LineBreaker.next_line].
+ * [method@Pango2.LineBreaker.next_line].
*
* When undoing multiple lines, they have to be
* undone in the reverse order in which they
* were produced.
*
- * Returns: `TRUE` on success, `FALSE` if Pango
+ * Returns: `TRUE` on success, `FALSE` if Pango2
* determines that the line can't be undone
*/
gboolean
-pango_line_breaker_undo_line (PangoLineBreaker *self,
- PangoLine *line)
+pango2_line_breaker_undo_line (Pango2LineBreaker *self,
+ Pango2Line *line)
{
if (self->data == NULL &&
line->start_index == 0 && line->length == line->data->length)
@@ -2593,7 +2593,7 @@ pango_line_breaker_undo_line (PangoLineBreaker *self,
/* ensure_items will set up everything else */
- g_clear_pointer (&self->glyphs, pango_glyph_string_free);
+ g_clear_pointer (&self->glyphs, pango2_glyph_string_free);
return TRUE;
}
@@ -2606,7 +2606,7 @@ pango_line_breaker_undo_line (PangoLineBreaker *self,
/* recover the original items */
for (GList *l = self->data_items; l; l = l->next)
{
- PangoItem *item = l->data;
+ Pango2Item *item = l->data;
if (item->offset + item->length < line->start_index)
continue;
@@ -2614,26 +2614,26 @@ pango_line_breaker_undo_line (PangoLineBreaker *self,
if (item->offset > self->line_start_index)
break;
- item = pango_item_copy (item);
+ item = pango2_item_copy (item);
if (item->offset < line->start_index)
{
- PangoItem *new_item;
+ Pango2Item *new_item;
int n_chars;
n_chars = g_utf8_strlen (self->data->text + item->offset, line->start_index - item->offset);
- new_item = pango_item_split (item, line->start_index - item->offset, n_chars);
- pango_item_free (new_item);
+ new_item = pango2_item_split (item, line->start_index - item->offset, n_chars);
+ pango2_item_free (new_item);
}
if (item->offset + item->length > self->line_start_index)
{
- PangoItem *new_item;
+ Pango2Item *new_item;
int n_chars;
n_chars = g_utf8_strlen (self->data->text + item->offset, self->line_start_index - item->offset);
- new_item = pango_item_split (item, self->line_start_index - item->offset, n_chars);
- pango_item_free (item);
+ new_item = pango2_item_split (item, self->line_start_index - item->offset, n_chars);
+ pango2_item_free (item);
item = new_item;
}
@@ -2648,7 +2648,7 @@ pango_line_breaker_undo_line (PangoLineBreaker *self,
self->line_start_index = line->start_index;
self->line_start_offset = line->start_offset;
- g_clear_pointer (&self->glyphs, pango_glyph_string_free);
+ g_clear_pointer (&self->glyphs, pango2_glyph_string_free);
self->start_offset = line->start_offset;
self->log_widths_offset = 0;
diff --git a/pango/pango-line-breaker.h b/pango/pango-line-breaker.h
index 4d2f1ccc..c7e362bb 100644
--- a/pango/pango-line-breaker.h
+++ b/pango/pango-line-breaker.h
@@ -27,50 +27,50 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_LINE_BREAKER pango_line_breaker_get_type ()
+#define PANGO2_TYPE_LINE_BREAKER pango2_line_breaker_get_type ()
-PANGO_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (PangoLineBreaker, pango_line_breaker, PANGO, LINE_BREAKER, GObject);
+PANGO2_AVAILABLE_IN_ALL
+G_DECLARE_FINAL_TYPE (Pango2LineBreaker, pango2_line_breaker, PANGO2, LINE_BREAKER, GObject);
-PANGO_AVAILABLE_IN_ALL
-PangoLineBreaker * pango_line_breaker_new (PangoContext *context);
+PANGO2_AVAILABLE_IN_ALL
+Pango2LineBreaker * pango2_line_breaker_new (Pango2Context *context);
-PANGO_AVAILABLE_IN_ALL
-PangoContext * pango_line_breaker_get_context (PangoLineBreaker *self);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Context * pango2_line_breaker_get_context (Pango2LineBreaker *self);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_breaker_set_tabs (PangoLineBreaker *self,
- PangoTabArray *tabs);
-PANGO_AVAILABLE_IN_ALL
-PangoTabArray * pango_line_breaker_get_tabs (PangoLineBreaker *self);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_breaker_set_tabs (Pango2LineBreaker *self,
+ Pango2TabArray *tabs);
+PANGO2_AVAILABLE_IN_ALL
+Pango2TabArray * pango2_line_breaker_get_tabs (Pango2LineBreaker *self);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_breaker_set_base_dir (PangoLineBreaker *self,
- PangoDirection direction);
-PANGO_AVAILABLE_IN_ALL
-PangoDirection pango_line_breaker_get_base_dir (PangoLineBreaker *self);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_breaker_set_base_dir (Pango2LineBreaker *self,
+ Pango2Direction direction);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Direction pango2_line_breaker_get_base_dir (Pango2LineBreaker *self);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_breaker_add_text (PangoLineBreaker *self,
- const char *text,
- int length,
- PangoAttrList *attrs);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_breaker_add_text (Pango2LineBreaker *self,
+ const char *text,
+ int length,
+ Pango2AttrList *attrs);
-PANGO_AVAILABLE_IN_ALL
-PangoDirection pango_line_breaker_get_direction (PangoLineBreaker *self);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Direction pango2_line_breaker_get_direction (Pango2LineBreaker *self);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_breaker_has_line (PangoLineBreaker *self);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_breaker_has_line (Pango2LineBreaker *self);
-PANGO_AVAILABLE_IN_ALL
-PangoLine * pango_line_breaker_next_line (PangoLineBreaker *self,
- int x,
- int width,
- PangoWrapMode wrap,
- PangoEllipsizeMode ellipsize);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Line * pango2_line_breaker_next_line (Pango2LineBreaker *self,
+ int x,
+ int width,
+ Pango2WrapMode wrap,
+ Pango2EllipsizeMode ellipsize);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_breaker_undo_line (PangoLineBreaker *self,
- PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_breaker_undo_line (Pango2LineBreaker *self,
+ Pango2Line *line);
G_END_DECLS
diff --git a/pango/pango-line-iter-private.h b/pango/pango-line-iter-private.h
index f5f4b9a6..1aba2956 100644
--- a/pango/pango-line-iter-private.h
+++ b/pango/pango-line-iter-private.h
@@ -22,4 +22,4 @@
#include "pango-line-iter.h"
-PangoLineIter * pango_line_iter_new (PangoLines *lines);
+Pango2LineIter * pango2_line_iter_new (Pango2Lines *lines);
diff --git a/pango/pango-line-iter.c b/pango/pango-line-iter.c
index e4c66051..8139e4ef 100644
--- a/pango/pango-line-iter.c
+++ b/pango/pango-line-iter.c
@@ -6,31 +6,31 @@
#include "pango-run-private.h"
/**
- * PangoLineIter:
+ * Pango2LineIter:
*
- * A `PangoLineIter` can be used to iterate over the visual
- * extents of a `PangoLayout` or `PangoLines`.
+ * A `Pango2LineIter` can be used to iterate over the visual
+ * extents of a `Pango2Layout` or `Pango2Lines`.
*
- * To obtain a `PangoLineIter`, use [method@Pango.Layout.get_iter]
- * or [method@Pango.Lines.get_iter].
+ * To obtain a `Pango2LineIter`, use [method@Pango2.Layout.get_iter]
+ * or [method@Pango2.Lines.get_iter].
*
- * The `PangoLineIter` structure is opaque, and has no user-visible
+ * The `Pango2LineIter` structure is opaque, and has no user-visible
* fields.
*/
-/* {{{ PangoLineIter implementation */
+/* {{{ Pango2LineIter implementation */
-struct _PangoLineIter
+struct _Pango2LineIter
{
- PangoLines *lines;
+ Pango2Lines *lines;
guint serial;
int line_no;
Position line_pos;
- PangoLine *line;
+ Pango2Line *line;
GSList *run_link;
- PangoRun *run;
+ Pango2Run *run;
int index;
/* run handling */
@@ -49,8 +49,8 @@ struct _PangoLineIter
int character_position;
};
-G_DEFINE_BOXED_TYPE (PangoLineIter, pango_line_iter,
- pango_line_iter_copy, pango_line_iter_free);
+G_DEFINE_BOXED_TYPE (Pango2LineIter, pango2_line_iter,
+ pango2_line_iter_copy, pango2_line_iter_free);
/* }}} */
@@ -59,18 +59,18 @@ G_DEFINE_BOXED_TYPE (PangoLineIter, pango_line_iter,
#define ITER_IS_VALID(iter) ((iter)->serial == (iter)->lines->serial)
static gboolean
-line_is_terminated (PangoLineIter *iter)
+line_is_terminated (Pango2LineIter *iter)
{
- if (iter->line_no + 1 < pango_lines_get_line_count (iter->lines))
- return pango_line_is_paragraph_end (iter->line);
+ if (iter->line_no + 1 < pango2_lines_get_line_count (iter->lines))
+ return pango2_line_is_paragraph_end (iter->line);
return FALSE;
}
static int
-next_cluster_start (PangoGlyphString *glyphs,
- int cluster_start)
+next_cluster_start (Pango2GlyphString *glyphs,
+ int cluster_start)
{
int i;
@@ -87,8 +87,8 @@ next_cluster_start (PangoGlyphString *glyphs,
}
static int
-cluster_width (PangoGlyphString *glyphs,
- int cluster_start)
+cluster_width (Pango2GlyphString *glyphs,
+ int cluster_start)
{
int i;
int width;
@@ -111,15 +111,15 @@ cluster_width (PangoGlyphString *glyphs,
* is the byte index of the cluster start relative to the run.
*/
static void
-update_cluster (PangoLineIter *iter,
- int cluster_start_index)
+update_cluster (Pango2LineIter *iter,
+ int cluster_start_index)
{
- PangoGlyphItem *glyph_item;
+ Pango2GlyphItem *glyph_item;
char *cluster_text;
int cluster_length;
- PangoRun *run = iter->run_link->data;
+ Pango2Run *run = iter->run_link->data;
- glyph_item = pango_run_get_glyph_item (run);
+ glyph_item = pango2_run_get_glyph_item (run);
iter->character_position = 0;
@@ -165,14 +165,14 @@ update_cluster (PangoLineIter *iter,
* is considered non-empty.
*/
static gboolean
-next_nonempty_line (PangoLineIter *iter,
- gboolean include_terminators)
+next_nonempty_line (Pango2LineIter *iter,
+ gboolean include_terminators)
{
gboolean result;
while (TRUE)
{
- result = pango_line_iter_next_line (iter);
+ result = pango2_line_iter_next_line (iter);
if (!result)
break;
@@ -191,14 +191,14 @@ next_nonempty_line (PangoLineIter *iter,
* paragraph separator is considered non-empty.
*/
static gboolean
-next_nonempty_run (PangoLineIter *iter,
- gboolean include_terminators)
+next_nonempty_run (Pango2LineIter *iter,
+ gboolean include_terminators)
{
gboolean result;
while (TRUE)
{
- result = pango_line_iter_next_run (iter);
+ result = pango2_line_iter_next_run (iter);
if (!result)
break;
@@ -212,22 +212,22 @@ next_nonempty_run (PangoLineIter *iter,
return result;
}
-/* Like pango_layout_next_cluster(), but if @include_terminators
+/* Like pango2_layout_next_cluster(), but if @include_terminators
* is set, includes the fake runs/clusters for empty lines.
* (But not positions introduced by line wrapping).
*/
static gboolean
-next_cluster_internal (PangoLineIter *iter,
- gboolean include_terminators)
+next_cluster_internal (Pango2LineIter *iter,
+ gboolean include_terminators)
{
- PangoGlyphItem *glyph_item;
- PangoRun *run;
+ Pango2GlyphItem *glyph_item;
+ Pango2Run *run;
if (iter->run_link == NULL)
return next_nonempty_line (iter, include_terminators);
run = iter->run_link->data;
- glyph_item = pango_run_get_glyph_item (run);
+ glyph_item = pango2_run_get_glyph_item (run);
if (iter->next_cluster_glyph == glyph_item->glyphs->num_glyphs)
{
@@ -244,19 +244,19 @@ next_cluster_internal (PangoLineIter *iter,
}
static void
-update_run (PangoLineIter *iter,
- int start_index)
+update_run (Pango2LineIter *iter,
+ int start_index)
{
if (iter->run)
{
- PangoGlyphItem *glyph_item = pango_run_get_glyph_item (iter->run);
+ Pango2GlyphItem *glyph_item = pango2_run_get_glyph_item (iter->run);
if (iter->run_link == iter->line->runs)
iter->run_x = 0;
else
iter->run_x += iter->run_width + iter->end_x_offset + glyph_item->start_x_offset;
- iter->run_width = pango_glyph_string_get_width (glyph_item->glyphs);
+ iter->run_width = pango2_glyph_string_get_width (glyph_item->glyphs);
iter->end_x_offset = glyph_item->end_x_offset;
iter->ltr = (glyph_item->item->analysis.level % 2) == 0;
iter->cluster_start = 0;
@@ -281,9 +281,9 @@ update_run (PangoLineIter *iter,
}
static inline void
-offset_line (PangoLineIter *iter,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+offset_line (Pango2LineIter *iter,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
if (ink_rect)
{
@@ -298,9 +298,9 @@ offset_line (PangoLineIter *iter,
}
static inline void
-offset_run (PangoLineIter *iter,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+offset_run (Pango2LineIter *iter,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
if (ink_rect)
ink_rect->x += iter->run_x;
@@ -309,20 +309,20 @@ offset_run (PangoLineIter *iter,
}
/* }}} */
-/* {{{ Private API */
+/* {{{ Private API */
-PangoLineIter *
-pango_line_iter_new (PangoLines *lines)
+Pango2LineIter *
+pango2_line_iter_new (Pango2Lines *lines)
{
- PangoLineIter *iter;
+ Pango2LineIter *iter;
int run_start_index;
- g_return_val_if_fail (PANGO_IS_LINES (lines), NULL);
+ g_return_val_if_fail (PANGO2_IS_LINES (lines), NULL);
- iter = g_new0 (PangoLineIter, 1);
+ iter = g_new0 (Pango2LineIter, 1);
iter->lines = g_object_ref (lines);
- iter->serial = pango_lines_get_serial (lines);
+ iter->serial = pango2_lines_get_serial (lines);
iter->line_no = 0;
iter->line = g_ptr_array_index (lines->lines, 0);
@@ -331,7 +331,7 @@ pango_line_iter_new (PangoLines *lines)
if (iter->run_link)
{
iter->run = iter->run_link->data;
- run_start_index = pango_run_get_glyph_item (iter->run)->item->offset;
+ run_start_index = pango2_run_get_glyph_item (iter->run)->item->offset;
}
else
{
@@ -348,36 +348,36 @@ pango_line_iter_new (PangoLines *lines)
/* {{{ Public API */
/**
- * pango_line_iter_copy:
- * @iter: (nullable): a `PangoLineIter`
+ * pango2_line_iter_copy:
+ * @iter: (nullable): a `Pango2LineIter`
*
- * Copies a `PangoLineIter`.
+ * Copies a `Pango2LineIter`.
*
- * Return value: (nullable): the newly allocated `PangoLineIter`
+ * Return value: (nullable): the newly allocated `Pango2LineIter`
*/
-PangoLineIter *
-pango_line_iter_copy (PangoLineIter *iter)
+Pango2LineIter *
+pango2_line_iter_copy (Pango2LineIter *iter)
{
- PangoLineIter *copy;
+ Pango2LineIter *copy;
if (iter == NULL)
return NULL;
- copy = g_new0 (PangoLineIter, 1);
- memcpy (iter, copy, sizeof (PangoLineIter));
+ copy = g_new0 (Pango2LineIter, 1);
+ memcpy (iter, copy, sizeof (Pango2LineIter));
g_object_ref (copy->lines);
return copy;
}
/**
- * pango_line_iter_free:
- * @iter: (nullable): a `PangoLineIter`
+ * pango2_line_iter_free:
+ * @iter: (nullable): a `Pango2LineIter`
*
* Frees an iterator that's no longer in use.
*/
void
-pango_line_iter_free (PangoLineIter *iter)
+pango2_line_iter_free (Pango2LineIter *iter)
{
if (iter == NULL)
return;
@@ -387,29 +387,29 @@ pango_line_iter_free (PangoLineIter *iter)
}
/**
- * pango_line_iter_get_lines:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_get_lines:
+ * @iter: a `Pango2LineIter`
*
- * Gets the `PangoLines` object associated with a `PangoLineIter`.
+ * Gets the `Pango2Lines` object associated with a `Pango2LineIter`.
*
* Return value: (transfer none): the lines associated with @iter
*/
-PangoLines *
-pango_line_iter_get_lines (PangoLineIter *iter)
+Pango2Lines *
+pango2_line_iter_get_lines (Pango2LineIter *iter)
{
return iter->lines;
}
/**
- * pango_line_iter_get_line:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_get_line:
+ * @iter: a `Pango2LineIter`
*
* Gets the current line.
*
* Return value: (transfer none): the current line
*/
-PangoLine *
-pango_line_iter_get_line (PangoLineIter *iter)
+Pango2Line *
+pango2_line_iter_get_line (Pango2LineIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), NULL);
@@ -417,24 +417,24 @@ pango_line_iter_get_line (PangoLineIter *iter)
}
/**
- * pango_line_iter_at_last_line:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_at_last_line:
+ * @iter: a `Pango2LineIter`
*
* Determines whether @iter is on the last line.
*
* Return value: %TRUE if @iter is on the last line
*/
gboolean
-pango_line_iter_at_last_line (PangoLineIter *iter)
+pango2_line_iter_at_last_line (Pango2LineIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), FALSE);
- return iter->line_no + 1 == pango_lines_get_line_count (iter->lines);
+ return iter->line_no + 1 == pango2_lines_get_line_count (iter->lines);
}
/**
- * pango_line_iter_get_run:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_get_run:
+ * @iter: a `Pango2LineIter`
*
* Gets the current run.
*
@@ -445,8 +445,8 @@ pango_line_iter_at_last_line (PangoLineIter *iter)
*
* Return value: (transfer none) (nullable): the current run
*/
-PangoRun *
-pango_line_iter_get_run (PangoLineIter *iter)
+Pango2Run *
+pango2_line_iter_get_run (Pango2LineIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), NULL);
@@ -454,8 +454,8 @@ pango_line_iter_get_run (PangoLineIter *iter)
}
/**
- * pango_line_iter_get_index:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_get_index:
+ * @iter: a `Pango2LineIter`
*
* Gets the current byte index.
*
@@ -465,12 +465,12 @@ pango_line_iter_get_run (PangoLineIter *iter)
* Note that iterating forward by char moves in visual order,
* not logical order, so indexes may not be sequential. Also,
* the index may be equal to the length of the text in the
- * layout, if on the %NULL run (see [method@Pango.LineIter.get_run]).
+ * layout, if on the %NULL run (see [method@Pango2.LineIter.get_run]).
*
* Return value: current byte index
*/
int
-pango_line_iter_get_index (PangoLineIter *iter)
+pango2_line_iter_get_index (Pango2LineIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), 0);
@@ -478,8 +478,8 @@ pango_line_iter_get_index (PangoLineIter *iter)
}
/**
- * pango_line_iter_next_line:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_next_line:
+ * @iter: a `Pango2LineIter`
*
* Moves @iter forward to the start of the next line.
*
@@ -488,7 +488,7 @@ pango_line_iter_get_index (PangoLineIter *iter)
* Return value: whether motion was possible
*/
gboolean
-pango_line_iter_next_line (PangoLineIter *iter)
+pango2_line_iter_next_line (Pango2LineIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), FALSE);
@@ -511,8 +511,8 @@ pango_line_iter_next_line (PangoLineIter *iter)
}
/**
- * pango_line_iter_next_run:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_next_run:
+ * @iter: a `Pango2LineIter`
*
* Moves @iter forward to the next run in visual order.
*
@@ -521,26 +521,26 @@ pango_line_iter_next_line (PangoLineIter *iter)
* Return value: whether motion was possible
*/
gboolean
-pango_line_iter_next_run (PangoLineIter *iter)
+pango2_line_iter_next_run (Pango2LineIter *iter)
{
int run_start_index;
g_return_val_if_fail (ITER_IS_VALID (iter), FALSE);
if (iter->run == NULL)
- return pango_line_iter_next_line (iter);
+ return pango2_line_iter_next_line (iter);
iter->run_link = iter->run_link->next;
if (iter->run_link == NULL)
{
- PangoItem *item = pango_run_get_glyph_item (iter->run)->item;
+ Pango2Item *item = pango2_run_get_glyph_item (iter->run)->item;
run_start_index = item->offset + item->length;
iter->run = NULL;
}
else
{
iter->run = iter->run_link->data;
- run_start_index = pango_run_get_glyph_item (iter->run)->item->offset;
+ run_start_index = pango2_run_get_glyph_item (iter->run)->item->offset;
}
update_run (iter, run_start_index);
@@ -549,8 +549,8 @@ pango_line_iter_next_run (PangoLineIter *iter)
}
/**
- * pango_line_iter_next_cluster:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_next_cluster:
+ * @iter: a `Pango2LineIter`
*
* Moves @iter forward to the next cluster in visual order.
*
@@ -559,7 +559,7 @@ pango_line_iter_next_run (PangoLineIter *iter)
* Return value: whether motion was possible
*/
gboolean
-pango_line_iter_next_cluster (PangoLineIter *iter)
+pango2_line_iter_next_cluster (Pango2LineIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), FALSE);
@@ -567,8 +567,8 @@ pango_line_iter_next_cluster (PangoLineIter *iter)
}
/**
- * pango_line_iter_next_char:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_next_char:
+ * @iter: a `Pango2LineIter`
*
* Moves @iter forward to the next character in visual order.
*
@@ -577,7 +577,7 @@ pango_line_iter_next_cluster (PangoLineIter *iter)
* Return value: whether motion was possible
*/
gboolean
-pango_line_iter_next_char (PangoLineIter *iter)
+pango2_line_iter_next_char (Pango2LineIter *iter)
{
const char *text;
@@ -613,88 +613,88 @@ pango_line_iter_next_char (PangoLineIter *iter)
}
/**
- * pango_line_iter_get_layout_extents:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_get_layout_extents:
+ * @iter: a `Pango2LineIter`
* @ink_rect: (out) (optional): rectangle to fill with ink extents
* @logical_rect: (out) (optional): rectangle to fill with logical extents
*
- * Obtains the extents of the `PangoLines` being iterated over.
+ * Obtains the extents of the `Pango2Lines` being iterated over.
*/
void
-pango_line_iter_get_layout_extents (PangoLineIter *iter,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_line_iter_get_layout_extents (Pango2LineIter *iter,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
g_return_if_fail (ITER_IS_VALID (iter));
- pango_lines_get_extents (iter->lines, ink_rect, logical_rect);
+ pango2_lines_get_extents (iter->lines, ink_rect, logical_rect);
}
/**
- * pango_line_iter_get_line_extents:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_get_line_extents:
+ * @iter: a `Pango2LineIter`
* @ink_rect: (out) (optional): rectangle to fill with ink extents
* @logical_rect: (out) (optional): rectangle to fill with logical extents
*
* Obtains the extents of the current line.
*
* Extents are in layout coordinates (origin is the top-left corner of the
- * entire `PangoLines`). Thus the extents returned by this function will be
+ * entire `Pango2Lines`). Thus the extents returned by this function will be
* the same width/height but not at the same x/y as the extents returned
- * from [method@Pango.Line.get_extents].
+ * from [method@Pango2.Line.get_extents].
*
* The logical extents returned by this function always have their leading
* trimmed according to paragraph boundaries: if the line starts a paragraph,
* it has its start leading trimmed; if it ends a paragraph, it has its end
* leading trimmed. If you need other trimming, use
- * [method@Pango.Line.get_trimmed_extents].
+ * [method@Pango2.Line.get_trimmed_extents].
*/
void
-pango_line_iter_get_line_extents (PangoLineIter *iter,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_line_iter_get_line_extents (Pango2LineIter *iter,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
g_return_if_fail (ITER_IS_VALID (iter));
- pango_line_get_extents (iter->line, ink_rect, logical_rect);
+ pango2_line_get_extents (iter->line, ink_rect, logical_rect);
offset_line (iter, ink_rect, logical_rect);
}
void
-pango_line_iter_get_trimmed_line_extents (PangoLineIter *iter,
- PangoLeadingTrim trim,
- PangoRectangle *logical_rect)
+pango2_line_iter_get_trimmed_line_extents (Pango2LineIter *iter,
+ Pango2LeadingTrim trim,
+ Pango2Rectangle *logical_rect)
{
g_return_if_fail (ITER_IS_VALID (iter));
- pango_line_get_trimmed_extents (iter->line, trim, logical_rect);
+ pango2_line_get_trimmed_extents (iter->line, trim, logical_rect);
offset_line (iter, NULL, logical_rect);
}
/**
- * pango_line_iter_get_run_extents:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_get_run_extents:
+ * @iter: a `Pango2LineIter`
* @ink_rect: (out) (optional): rectangle to fill with ink extents
* @logical_rect: (out) (optional): rectangle to fill with logical extents
*
* Gets the extents of the current run in layout coordinates.
*
- * Layout coordinates have the origin at the top left of the entire `PangoLines`.
+ * Layout coordinates have the origin at the top left of the entire `Pango2Lines`.
*
* The logical extents returned by this function always have their leading
* trimmed off. If you need extents that include leading, use
- * [method@Pango.Run.get_extents].
+ * [method@Pango2.Run.get_extents].
*/
void
-pango_line_iter_get_run_extents (PangoLineIter *iter,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_line_iter_get_run_extents (Pango2LineIter *iter,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
g_return_if_fail (ITER_IS_VALID (iter));
if (iter->run)
{
- pango_run_get_extents (iter->run, PANGO_LEADING_TRIM_BOTH, ink_rect, logical_rect);
+ pango2_run_get_extents (iter->run, PANGO2_LEADING_TRIM_BOTH, ink_rect, logical_rect);
}
else
{
@@ -702,9 +702,9 @@ pango_line_iter_get_run_extents (PangoLineIter *iter,
if (runs)
{
/* Virtual run at the end of a nonempty line */
- PangoRun *run = g_slist_last (runs)->data;
+ Pango2Run *run = g_slist_last (runs)->data;
- pango_run_get_extents (run, PANGO_LEADING_TRIM_BOTH, ink_rect, logical_rect);
+ pango2_run_get_extents (run, PANGO2_LEADING_TRIM_BOTH, ink_rect, logical_rect);
if (ink_rect)
{
ink_rect->x += ink_rect->width;
@@ -719,9 +719,9 @@ pango_line_iter_get_run_extents (PangoLineIter *iter,
else
{
/* Empty line */
- PangoRectangle r;
+ Pango2Rectangle r;
- pango_line_get_empty_extents (iter->line, PANGO_LEADING_TRIM_BOTH, &r);
+ pango2_line_get_empty_extents (iter->line, PANGO2_LEADING_TRIM_BOTH, &r);
if (ink_rect)
*ink_rect = r;
@@ -736,39 +736,39 @@ pango_line_iter_get_run_extents (PangoLineIter *iter,
}
/**
- * pango_line_iter_get_cluster_extents:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_get_cluster_extents:
+ * @iter: a `Pango2LineIter`
* @ink_rect: (out) (optional): rectangle to fill with ink extents
* @logical_rect: (out) (optional): rectangle to fill with logical extents
*
* Gets the extents of the current cluster, in layout coordinates.
*
- * Layout coordinates have the origin at the top left of the entire `PangoLines`.
+ * Layout coordinates have the origin at the top left of the entire `Pango2Lines`.
*/
void
-pango_line_iter_get_cluster_extents (PangoLineIter *iter,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_line_iter_get_cluster_extents (Pango2LineIter *iter,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
- PangoGlyphItem *glyph_item;
+ Pango2GlyphItem *glyph_item;
g_return_if_fail (ITER_IS_VALID (iter));
if (iter->run == NULL)
{
/* When on the NULL run, all extents are the same */
- pango_line_iter_get_run_extents (iter, ink_rect, logical_rect);
+ pango2_line_iter_get_run_extents (iter, ink_rect, logical_rect);
return;
}
- glyph_item = pango_run_get_glyph_item (iter->run);
+ glyph_item = pango2_run_get_glyph_item (iter->run);
- pango_glyph_string_extents_range (glyph_item->glyphs,
- iter->cluster_start,
- iter->next_cluster_glyph,
- glyph_item->item->analysis.font,
- ink_rect,
- logical_rect);
+ pango2_glyph_string_extents_range (glyph_item->glyphs,
+ iter->cluster_start,
+ iter->next_cluster_glyph,
+ glyph_item->item->analysis.font,
+ ink_rect,
+ logical_rect);
offset_line (iter, ink_rect, logical_rect);
if (ink_rect)
@@ -786,22 +786,22 @@ pango_line_iter_get_cluster_extents (PangoLineIter *iter,
}
/**
- * pango_line_iter_get_char_extents:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_get_char_extents:
+ * @iter: a `Pango2LineIter`
* @logical_rect: (out caller-allocates): rectangle to fill with logical extents
*
* Gets the extents of the current character, in layout coordinates.
*
- * Layout coordinates have the origin at the top left of the entire `PangoLines`.
+ * Layout coordinates have the origin at the top left of the entire `Pango2Lines`.
*
* Only logical extents can sensibly be obtained for characters;
* ink extents make sense only down to the level of clusters.
*/
void
-pango_line_iter_get_char_extents (PangoLineIter *iter,
- PangoRectangle *logical_rect)
+pango2_line_iter_get_char_extents (Pango2LineIter *iter,
+ Pango2Rectangle *logical_rect)
{
- PangoRectangle cluster_rect;
+ Pango2Rectangle cluster_rect;
int x0, x1;
g_return_if_fail (ITER_IS_VALID (iter));
@@ -809,7 +809,7 @@ pango_line_iter_get_char_extents (PangoLineIter *iter,
if (logical_rect == NULL)
return;
- pango_line_iter_get_cluster_extents (iter, NULL, &cluster_rect);
+ pango2_line_iter_get_cluster_extents (iter, NULL, &cluster_rect);
if (iter->run == NULL)
{
@@ -835,18 +835,18 @@ pango_line_iter_get_char_extents (PangoLineIter *iter,
}
/**
- * pango_line_iter_get_line_baseline:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_get_line_baseline:
+ * @iter: a `Pango2LineIter`
*
* Gets the Y position of the current line's baseline, in layout
* coordinates.
*
- * Layout coordinates have the origin at the top left of the entire `PangoLines`.
+ * Layout coordinates have the origin at the top left of the entire `Pango2Lines`.
*
* Return value: baseline of current line
*/
int
-pango_line_iter_get_line_baseline (PangoLineIter *iter)
+pango2_line_iter_get_line_baseline (Pango2LineIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), 0);
@@ -854,28 +854,28 @@ pango_line_iter_get_line_baseline (PangoLineIter *iter)
}
/**
- * pango_line_iter_get_run_baseline:
- * @iter: a `PangoLineIter`
+ * pango2_line_iter_get_run_baseline:
+ * @iter: a `Pango2LineIter`
*
* Gets the Y position of the current run's baseline, in layout
* coordinates.
*
- * Layout coordinates have the origin at the top left of the entire `PangoLines`.
+ * Layout coordinates have the origin at the top left of the entire `Pango2Lines`.
*
* The run baseline can be different from the line baseline, for
* example due to superscript or subscript positioning.
*/
int
-pango_line_iter_get_run_baseline (PangoLineIter *iter)
+pango2_line_iter_get_run_baseline (Pango2LineIter *iter)
{
g_return_val_if_fail (ITER_IS_VALID (iter), 0);
if (iter->run)
- return pango_line_iter_get_line_baseline (iter) - pango_run_get_glyph_item (iter->run)->y_offset;
+ return pango2_line_iter_get_line_baseline (iter) - pango2_run_get_glyph_item (iter->run)->y_offset;
else
- return pango_line_iter_get_line_baseline (iter);
+ return pango2_line_iter_get_line_baseline (iter);
}
-/* }}} */
+/* }}} */
/* vim:set foldmethod=marker expandtab: */
diff --git a/pango/pango-line-iter.h b/pango/pango-line-iter.h
index 244f1e21..8923c134 100644
--- a/pango/pango-line-iter.h
+++ b/pango/pango-line-iter.h
@@ -26,77 +26,77 @@
G_BEGIN_DECLS
-PANGO_AVAILABLE_IN_ALL
-GType pango_line_iter_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_line_iter_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoLineIter * pango_line_iter_copy (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+Pango2LineIter * pango2_line_iter_copy (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_iter_free (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_iter_free (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-PangoLines * pango_line_iter_get_lines (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Lines * pango2_line_iter_get_lines (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-PangoLine * pango_line_iter_get_line (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Line * pango2_line_iter_get_line (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_iter_at_last_line (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_iter_at_last_line (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-PangoRun * pango_line_iter_get_run (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Run * pango2_line_iter_get_run (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-int pango_line_iter_get_index (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_line_iter_get_index (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_iter_next_line (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_iter_next_line (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_iter_next_run (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_iter_next_run (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_iter_next_cluster (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_iter_next_cluster (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_iter_next_char (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_iter_next_char (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_iter_get_layout_extents (PangoLineIter *iter,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_iter_get_layout_extents (Pango2LineIter *iter,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_iter_get_line_extents (PangoLineIter *iter,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_iter_get_line_extents (Pango2LineIter *iter,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_iter_get_trimmed_line_extents (PangoLineIter *iter,
- PangoLeadingTrim trim,
- PangoRectangle *logical_rect);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_iter_get_trimmed_line_extents (Pango2LineIter *iter,
+ Pango2LeadingTrim trim,
+ Pango2Rectangle *logical_rect);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_iter_get_run_extents (PangoLineIter *iter,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_iter_get_run_extents (Pango2LineIter *iter,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_iter_get_cluster_extents (PangoLineIter *iter,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_iter_get_cluster_extents (Pango2LineIter *iter,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_iter_get_char_extents (PangoLineIter *iter,
- PangoRectangle *logical_rect);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_iter_get_char_extents (Pango2LineIter *iter,
+ Pango2Rectangle *logical_rect);
-PANGO_AVAILABLE_IN_ALL
-int pango_line_iter_get_line_baseline (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_line_iter_get_line_baseline (Pango2LineIter *iter);
-PANGO_AVAILABLE_IN_ALL
-int pango_line_iter_get_run_baseline (PangoLineIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_line_iter_get_run_baseline (Pango2LineIter *iter);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoLineIter, pango_line_iter_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2LineIter, pango2_line_iter_free)
G_END_DECLS
diff --git a/pango/pango-line-private.h b/pango/pango-line-private.h
index deb04e8a..963674c2 100644
--- a/pango/pango-line-private.h
+++ b/pango/pango-line-private.h
@@ -30,10 +30,10 @@ struct _LineData {
char *text;
int length;
int n_chars;
- PangoDirection direction;
+ Pango2Direction direction;
- PangoAttrList *attrs;
- PangoLogAttr *log_attrs;
+ Pango2AttrList *attrs;
+ Pango2LogAttr *log_attrs;
};
LineData * line_data_new (void);
@@ -41,9 +41,9 @@ LineData * line_data_ref (LineData *data);
void line_data_unref (LineData *data);
void line_data_clear (LineData *data);
-struct _PangoLine
+struct _Pango2Line
{
- PangoContext *context;
+ Pango2Context *context;
LineData *data;
int start_index;
@@ -51,7 +51,7 @@ struct _PangoLine
int start_offset;
int n_chars;
GSList *runs;
- PangoRun **run_array;
+ Pango2Run **run_array;
int n_runs;
guint wrapped : 1;
@@ -62,26 +62,26 @@ struct _PangoLine
guint ends_paragraph : 1;
guint has_extents : 1;
- PangoDirection direction;
+ Pango2Direction direction;
- PangoRectangle ink_rect;
- PangoRectangle logical_rect;
+ Pango2Rectangle ink_rect;
+ Pango2Rectangle logical_rect;
};
-PangoLine * pango_line_new (PangoContext *context,
- LineData *data);
+Pango2Line * pango2_line_new (Pango2Context *context,
+ LineData *data);
-void pango_line_ellipsize (PangoLine *line,
- PangoContext *context,
- PangoEllipsizeMode ellipsize,
- int goal_width);
+void pango2_line_ellipsize (Pango2Line *line,
+ Pango2Context *context,
+ Pango2EllipsizeMode ellipsize,
+ int goal_width);
-void pango_line_index_to_run (PangoLine *line,
- int idx,
- PangoRun **run);
+void pango2_line_index_to_run (Pango2Line *line,
+ int idx,
+ Pango2Run **run);
-void pango_line_get_empty_extents (PangoLine *line,
- PangoLeadingTrim trim,
- PangoRectangle *logical_rect);
+void pango2_line_get_empty_extents (Pango2Line *line,
+ Pango2LeadingTrim trim,
+ Pango2Rectangle *logical_rect);
-void pango_line_check_invariants (PangoLine *line);
+void pango2_line_check_invariants (Pango2Line *line);
diff --git a/pango/pango-line.c b/pango/pango-line.c
index 0acdd168..992a29fe 100644
--- a/pango/pango-line.c
+++ b/pango/pango-line.c
@@ -17,22 +17,22 @@
#include <hb-ot.h>
/**
- * PangoLine:
+ * Pango2Line:
*
- * A `PangoLine` is an immutable object which represents a line resulting
- * from laying out text via `PangoLayout` or `PangoLineBreaker`.
+ * A `Pango2Line` is an immutable object which represents a line resulting
+ * from laying out text via `Pango2Layout` or `Pango2LineBreaker`.
*
* A line consists of a number of runs (i.e. ranges of text with uniform
* script, font and attributes that are shaped as a unit). Runs are
- * represented as [struct@Pango.Run] objects.
+ * represented as [struct@Pango2.Run] objects.
*
- * A `PangoLine` always has its origin at the leftmost point of its
+ * A `Pango2Line` always has its origin at the leftmost point of its
* baseline. To position lines in an entire paragraph of text (i.e. in layout
- * coordinates), the `PangoLines` object stores X and Y coordinates to
+ * coordinates), the `Pango2Lines` object stores X and Y coordinates to
* offset each line to.
*
* The most convenient way to access the visual extents and components
- * of a `PangoLine` is via a [struct@Pango.LineIter] iterator.
+ * of a `Pango2Line` is via a [struct@Pango2.LineIter] iterator.
*/
/* {{{ LineData */
@@ -41,7 +41,7 @@ void
line_data_clear (LineData *data)
{
g_free (data->text);
- g_clear_pointer (&data->attrs, pango_attr_list_unref);
+ g_clear_pointer (&data->attrs, pango2_attr_list_unref);
g_free (data->log_attrs);
}
@@ -64,10 +64,10 @@ line_data_unref (LineData *data)
}
/* }}} */
-/* {{{ PangoLine implementation */
+/* {{{ Pango2Line implementation */
-G_DEFINE_BOXED_TYPE (PangoLine, pango_line,
- pango_line_copy, pango_line_free);
+G_DEFINE_BOXED_TYPE (Pango2Line, pango2_line,
+ pango2_line_copy, pango2_line_free);
/* }}} */
/* {{{ Justification */
@@ -80,13 +80,13 @@ distribute_letter_spacing (int letter_spacing,
*space_left = letter_spacing / 2;
/* hinting */
- if ((letter_spacing & (PANGO_SCALE - 1)) == 0)
- *space_left = PANGO_UNITS_ROUND (*space_left);
+ if ((letter_spacing & (PANGO2_SCALE - 1)) == 0)
+ *space_left = PANGO2_UNITS_ROUND (*space_left);
*space_right = letter_spacing - *space_left;
}
static int
-pango_line_compute_width (PangoLine *line)
+pango2_line_compute_width (Pango2Line *line)
{
int width = 0;
@@ -95,16 +95,16 @@ pango_line_compute_width (PangoLine *line)
*/
for (GSList *l = line->runs; l; l = l->next)
{
- PangoGlyphItem *run = l->data;
- width += pango_glyph_string_get_width (run->glyphs);
+ Pango2GlyphItem *run = l->data;
+ width += pango2_glyph_string_get_width (run->glyphs);
}
return width;
}
static void
-justify_clusters (PangoLine *line,
- int *remaining_width)
+justify_clusters (Pango2Line *line,
+ int *remaining_width)
{
int total_remaining_width, total_gaps = 0;
int added_so_far, gaps_so_far;
@@ -120,12 +120,12 @@ justify_clusters (PangoLine *line,
return;
/* hint to full pixel if total remaining width was so */
- is_hinted = (total_remaining_width & (PANGO_SCALE - 1)) == 0;
+ is_hinted = (total_remaining_width & (PANGO2_SCALE - 1)) == 0;
for (mode = MEASURE; mode <= ADJUST; mode++)
{
gboolean leftedge = TRUE;
- PangoGlyphString *rightmost_glyphs = NULL;
+ Pango2GlyphString *rightmost_glyphs = NULL;
int rightmost_space = 0;
int residual = 0;
@@ -134,9 +134,9 @@ justify_clusters (PangoLine *line,
for (run_iter = line->runs; run_iter; run_iter = run_iter->next)
{
- PangoGlyphItem *run = run_iter->data;
- PangoGlyphString *glyphs = run->glyphs;
- PangoGlyphItemIter cluster_iter;
+ Pango2GlyphItem *run = run_iter->data;
+ Pango2GlyphString *glyphs = run->glyphs;
+ Pango2GlyphItemIter cluster_iter;
gboolean have_cluster;
int dir;
int offset;
@@ -144,12 +144,12 @@ justify_clusters (PangoLine *line,
dir = run->item->analysis.level % 2 == 0 ? +1 : -1;
offset = run->item->char_offset;
for (have_cluster = dir > 0 ?
- pango_glyph_item_iter_init_start (&cluster_iter, run, line->data->text) :
- pango_glyph_item_iter_init_end (&cluster_iter, run, line->data->text);
+ pango2_glyph_item_iter_init_start (&cluster_iter, run, line->data->text) :
+ pango2_glyph_item_iter_init_end (&cluster_iter, run, line->data->text);
have_cluster;
have_cluster = dir > 0 ?
- pango_glyph_item_iter_next_cluster (&cluster_iter) :
- pango_glyph_item_iter_prev_cluster (&cluster_iter))
+ pango2_glyph_item_iter_next_cluster (&cluster_iter) :
+ pango2_glyph_item_iter_prev_cluster (&cluster_iter))
{
int i;
int width = 0;
@@ -176,7 +176,7 @@ justify_clusters (PangoLine *line,
if (is_hinted)
{
int old_adjustment = adjustment;
- adjustment = PANGO_UNITS_ROUND (adjustment);
+ adjustment = PANGO2_UNITS_ROUND (adjustment);
residual = old_adjustment - adjustment;
}
/* distribute to before/after */
@@ -240,8 +240,8 @@ justify_clusters (PangoLine *line,
}
static void
-justify_words (PangoLine *line,
- int *remaining_width)
+justify_words (Pango2Line *line,
+ int *remaining_width)
{
int total_remaining_width, total_space_width = 0;
int added_so_far, spaces_so_far;
@@ -257,7 +257,7 @@ justify_words (PangoLine *line,
return;
/* hint to full pixel if total remaining width was so */
- is_hinted = (total_remaining_width & (PANGO_SCALE - 1)) == 0;
+ is_hinted = (total_remaining_width & (PANGO2_SCALE - 1)) == 0;
for (mode = MEASURE; mode <= ADJUST; mode++)
{
@@ -266,16 +266,16 @@ justify_words (PangoLine *line,
for (run_iter = line->runs; run_iter; run_iter = run_iter->next)
{
- PangoGlyphItem *run = run_iter->data;
- PangoGlyphString *glyphs = run->glyphs;
- PangoGlyphItemIter cluster_iter;
+ Pango2GlyphItem *run = run_iter->data;
+ Pango2GlyphString *glyphs = run->glyphs;
+ Pango2GlyphItemIter cluster_iter;
gboolean have_cluster;
int offset;
offset = run->item->char_offset;
- for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter, run, line->data->text);
+ for (have_cluster = pango2_glyph_item_iter_init_start (&cluster_iter, run, line->data->text);
have_cluster;
- have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter))
+ have_cluster = pango2_glyph_item_iter_next_cluster (&cluster_iter))
{
int i;
int dir;
@@ -298,7 +298,7 @@ justify_words (PangoLine *line,
adjustment = ((guint64) spaces_so_far * total_remaining_width) / total_space_width - added_so_far;
if (is_hinted)
- adjustment = PANGO_UNITS_ROUND (adjustment);
+ adjustment = PANGO2_UNITS_ROUND (adjustment);
glyphs->glyphs[i].geometry.width += adjustment;
added_so_far += adjustment;
@@ -326,28 +326,28 @@ justify_words (PangoLine *line,
/* {{{ Extents */
static void
-compute_extents (PangoLine *line,
- PangoLeadingTrim trim,
- PangoRectangle *ink,
- PangoRectangle *logical)
+compute_extents (Pango2Line *line,
+ Pango2LeadingTrim trim,
+ Pango2Rectangle *ink,
+ Pango2Rectangle *logical)
{
int x_pos = 0;
if (!line->runs)
{
- memset (ink, 0, sizeof (PangoRectangle));
- pango_line_get_empty_extents (line, trim, logical);
+ memset (ink, 0, sizeof (Pango2Rectangle));
+ pango2_line_get_empty_extents (line, trim, logical);
return;
}
for (GSList *l = line->runs; l; l = l->next)
{
- PangoRun *run = l->data;
- PangoRectangle run_ink;
- PangoRectangle run_logical;
+ Pango2Run *run = l->data;
+ Pango2Rectangle run_ink;
+ Pango2Rectangle run_logical;
int new_pos;
- pango_run_get_extents (run, trim, &run_ink, &run_logical);
+ pango2_run_get_extents (run, trim, &run_ink, &run_logical);
if (ink->width == 0 || ink->height == 0)
{
@@ -358,12 +358,12 @@ compute_extents (PangoLine *line,
{
new_pos = MIN (ink->x, x_pos + run_ink.x);
ink->width = MAX (ink->x + ink->width,
- x_pos + run_ink.x + run_ink.width) - new_pos;
+ x_pos + run_ink.x + run_ink.width) - new_pos;
ink->x = new_pos;
new_pos = MIN (ink->y, run_ink.y);
ink->height = MAX (ink->y + ink->height,
- run_ink.y + run_ink.height) - new_pos;
+ run_ink.y + run_ink.height) - new_pos;
ink->y = new_pos;
}
@@ -376,12 +376,12 @@ compute_extents (PangoLine *line,
{
new_pos = MIN (logical->x, x_pos + run_logical.x);
logical->width = MAX (logical->x + logical->width,
- x_pos + run_logical.x + run_logical.width) - new_pos;
+ x_pos + run_logical.x + run_logical.width) - new_pos;
logical->x = new_pos;
new_pos = MIN (logical->y, run_logical.y);
logical->height = MAX (logical->y + logical->height,
- run_logical.y + run_logical.height) - new_pos;
+ run_logical.y + run_logical.height) - new_pos;
logical->y = new_pos;
}
@@ -393,7 +393,7 @@ compute_extents (PangoLine *line,
/* {{{ Private API */
void
-pango_line_check_invariants (PangoLine *line)
+pango2_line_check_invariants (Pango2Line *line)
{
/* Check that byte and char positions agree */
g_assert (g_utf8_strlen (line->data->text + line->start_index, line->length) == line->n_chars);
@@ -410,7 +410,7 @@ pango_line_check_invariants (PangoLine *line)
n_chars = 0;
for (GSList *l = line->runs; l; l = l->next)
{
- PangoGlyphItem *run = l->data;
+ Pango2GlyphItem *run = l->data;
run_min = MIN (run_min, run->item->offset);
run_max = MAX (run_max, run->item->offset + run->item->length);
@@ -424,71 +424,71 @@ pango_line_check_invariants (PangoLine *line)
}
void
-pango_line_get_empty_extents (PangoLine *line,
- PangoLeadingTrim trim,
- PangoRectangle *logical_rect)
+pango2_line_get_empty_extents (Pango2Line *line,
+ Pango2LeadingTrim trim,
+ Pango2Rectangle *logical_rect)
{
- PangoFontDescription *font_desc = NULL;
+ Pango2FontDescription *font_desc = NULL;
gboolean free_font_desc = FALSE;
double line_height_factor = 0.0;
int absolute_line_height = 0;
- PangoFont *font;
+ Pango2Font *font;
- font_desc = pango_context_get_font_description (line->context);
+ font_desc = pango2_context_get_font_description (line->context);
if (line->data->attrs)
{
- PangoAttrIterator iter;
+ Pango2AttrIterator iter;
int start, end;
- pango_attr_list_init_iterator (line->data->attrs, &iter);
+ pango2_attr_list_init_iterator (line->data->attrs, &iter);
do
{
- pango_attr_iterator_range (&iter, &start, &end);
+ pango2_attr_iterator_range (&iter, &start, &end);
if (start <= line->start_index && line->start_index < end)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
if (!free_font_desc)
{
- font_desc = pango_font_description_copy_static (font_desc);
+ font_desc = pango2_font_description_copy_static (font_desc);
free_font_desc = TRUE;
}
- pango_attr_iterator_get_font (&iter, font_desc, NULL, NULL);
+ pango2_attr_iterator_get_font (&iter, font_desc, NULL, NULL);
- attr = pango_attr_iterator_get (&iter, PANGO_ATTR_LINE_HEIGHT);
+ attr = pango2_attr_iterator_get (&iter, PANGO2_ATTR_LINE_HEIGHT);
if (attr)
line_height_factor = attr->double_value;
- attr = pango_attr_iterator_get (&iter, PANGO_ATTR_ABSOLUTE_LINE_HEIGHT);
+ attr = pango2_attr_iterator_get (&iter, PANGO2_ATTR_ABSOLUTE_LINE_HEIGHT);
if (attr)
absolute_line_height = attr->int_value;
break;
}
}
- while (pango_attr_iterator_next (&iter));
+ while (pango2_attr_iterator_next (&iter));
- pango_attr_iterator_clear (&iter);
+ pango2_attr_iterator_clear (&iter);
}
- memset (logical_rect, 0, sizeof (PangoRectangle));
+ memset (logical_rect, 0, sizeof (Pango2Rectangle));
- font = pango_context_load_font (line->context, font_desc);
+ font = pango2_context_load_font (line->context, font_desc);
if (font)
{
- PangoFontMetrics *metrics;
+ Pango2FontMetrics *metrics;
- metrics = pango_font_get_metrics (font, pango_context_get_language (line->context));
+ metrics = pango2_font_get_metrics (font, pango2_context_get_language (line->context));
if (metrics)
{
- logical_rect->y = - pango_font_metrics_get_ascent (metrics);
- logical_rect->height = - logical_rect->y + pango_font_metrics_get_descent (metrics);
+ logical_rect->y = - pango2_font_metrics_get_ascent (metrics);
+ logical_rect->height = - logical_rect->y + pango2_font_metrics_get_descent (metrics);
- if (trim != PANGO_LEADING_TRIM_BOTH)
+ if (trim != PANGO2_LEADING_TRIM_BOTH)
{
int leading;
@@ -505,44 +505,44 @@ pango_line_get_empty_extents (PangoLine *line,
leading = MAX (metrics->height - (metrics->ascent + metrics->descent), 0);
}
- if ((trim & PANGO_LEADING_TRIM_START) == 0)
+ if ((trim & PANGO2_LEADING_TRIM_START) == 0)
logical_rect->y -= leading / 2;
- if (trim == PANGO_LEADING_TRIM_NONE)
+ if (trim == PANGO2_LEADING_TRIM_NONE)
logical_rect->height += leading;
else
logical_rect->height += (leading - leading / 2);
}
- pango_font_metrics_free (metrics);
+ pango2_font_metrics_free (metrics);
}
g_object_unref (font);
}
if (free_font_desc)
- pango_font_description_free (font_desc);
+ pango2_font_description_free (font_desc);
}
/*< private >
- * pango_line_new:
- * @context: the `PangoContext`
+ * pango2_line_new:
+ * @context: the `Pango2Context`
* @data: the `LineData`
*
- * Creates a new `PangoLine`.
+ * Creates a new `Pango2Line`.
*
* The line shares the immutable `LineData` with other lines.
*
* The @context is needed for shape rendering.
*
- * Returns: new `PangoLine`
+ * Returns: new `Pango2Line`
*/
-PangoLine *
-pango_line_new (PangoContext *context,
- LineData *data)
+Pango2Line *
+pango2_line_new (Pango2Context *context,
+ LineData *data)
{
- PangoLine *line;
+ Pango2Line *line;
- line = g_new0 (PangoLine, 1);
+ line = g_new0 (Pango2Line, 1);
line->context = g_object_ref (context);
line->data = line_data_ref (data);
@@ -550,26 +550,26 @@ pango_line_new (PangoContext *context,
}
/*< private >
- * pango_line_index_to_run:
- * @line: a `PangoLine`
+ * pango2_line_index_to_run:
+ * @line: a `Pango2Line`
* @idx: a byte offset in the line
* @run: (out): return location for the run
*
* Finds the run in @line which contains @idx.
*/
void
-pango_line_index_to_run (PangoLine *line,
- int idx,
- PangoRun **run)
+pango2_line_index_to_run (Pango2Line *line,
+ int idx,
+ Pango2Run **run)
{
*run = NULL;
for (GSList *l = line->runs; l; l = l->next)
{
- PangoRun *r = l->data;
- PangoItem *item;
+ Pango2Run *r = l->data;
+ Pango2Item *item;
- item = pango_run_get_glyph_item (r)->item;
+ item = pango2_run_get_glyph_item (r)->item;
if (item->offset <= idx && idx < item->offset + item->length)
{
*run = r;
@@ -581,15 +581,15 @@ pango_line_index_to_run (PangoLine *line,
/* }}} */
/* {{{ Public API */
-PangoLine *
-pango_line_copy (PangoLine *line)
+Pango2Line *
+pango2_line_copy (Pango2Line *line)
{
- PangoLine *copy;
+ Pango2Line *copy;
if (line == NULL)
return NULL;
- copy = g_new0 (PangoLine, 1);
+ copy = g_new0 (Pango2Line, 1);
copy->context = g_object_ref (line->context);
copy->data = line_data_ref (line->data);
copy->start_index = line->start_index;
@@ -604,18 +604,18 @@ pango_line_copy (PangoLine *line)
copy->ends_paragraph = line->ends_paragraph;
copy->has_extents = FALSE;
copy->direction = line->direction;
- copy->runs = g_slist_copy_deep (line->runs, (GCopyFunc) pango_glyph_item_copy, NULL);
+ copy->runs = g_slist_copy_deep (line->runs, (GCopyFunc) pango2_glyph_item_copy, NULL);
copy->n_runs = line->n_runs;
return copy;
}
void
-pango_line_free (PangoLine *line)
+pango2_line_free (Pango2Line *line)
{
g_object_unref (line->context);
line_data_unref (line->data);
- g_slist_free_full (line->runs, (GDestroyNotify)pango_glyph_item_free);
+ g_slist_free_full (line->runs, (GDestroyNotify)pango2_glyph_item_free);
g_free (line->run_array);
g_free (line);
}
@@ -623,39 +623,39 @@ pango_line_free (PangoLine *line)
/* {{{ Simple getters */
/**
- * pango_line_get_run_count:
- * @line: a `PangoLine`
+ * pango2_line_get_run_count:
+ * @line: a `Pango2Line`
*
* Gets the number of runs in the line.
*
* Returns: the number of runs
*/
int
-pango_line_get_run_count (PangoLine *line)
+pango2_line_get_run_count (Pango2Line *line)
{
g_return_val_if_fail (line != NULL, 0);
- pango_line_get_runs (line);
+ pango2_line_get_runs (line);
return line->n_runs;
}
/**
- * pango_line_get_runs:
- * @line: a `PangoLine`
+ * pango2_line_get_runs:
+ * @line: a `Pango2Line`
*
* Gets the runs of the line.
*
* Note that the returned list and its contents
- * are owned by Pango and must not be modified.
+ * are owned by Pango2 and must not be modified.
*
* The length of the returned array can be obtained
- * with [method@Pango.Line.get_run_count].
+ * with [method@Pango2.Line.get_run_count].
*
- * Returns: (transfer none): an array of `PangoRun`
+ * Returns: (transfer none): an array of `Pango2Run`
*/
-PangoRun **
-pango_line_get_runs (PangoLine *line)
+Pango2Run **
+pango2_line_get_runs (Pango2Line *line)
{
g_return_val_if_fail (line != NULL, NULL);
@@ -666,7 +666,7 @@ pango_line_get_runs (PangoLine *line)
line->n_runs = g_slist_length (line->runs);
- line->run_array = g_new (PangoRun *, line->n_runs);
+ line->run_array = g_new (Pango2Run *, line->n_runs);
for (l = line->runs, i = 0; l; l = l->next, i++)
line->run_array[i] = l->data;
}
@@ -675,14 +675,14 @@ pango_line_get_runs (PangoLine *line)
}
/**
- * pango_line_get_text:
- * @line: a `PangoLine`
+ * pango2_line_get_text:
+ * @line: a `Pango2Line`
* @start_index: the byte index of the first byte of @line
* @length: the number of bytes in @line
*
* Gets the text that @line presents.
*
- * The `PangoLine` represents the slice from @start_index
+ * The `Pango2Line` represents the slice from @start_index
* to @start_index + @length of the returned string.
*
* The returned string is owned by @line and must not
@@ -691,9 +691,9 @@ pango_line_get_runs (PangoLine *line)
* Returns: the text
*/
const char *
-pango_line_get_text (PangoLine *line,
- int *start_index,
- int *length)
+pango2_line_get_text (Pango2Line *line,
+ int *start_index,
+ int *length)
{
g_return_val_if_fail (line != NULL, NULL);
g_return_val_if_fail (start_index != NULL, NULL);
@@ -706,8 +706,8 @@ pango_line_get_text (PangoLine *line,
}
/**
- * pango_line_get_start_index:
- * @line: a `PangoLine`
+ * pango2_line_get_start_index:
+ * @line: a `Pango2Line`
*
* Returns the start index of the line, as byte index
* into the text of the layout.
@@ -715,7 +715,7 @@ pango_line_get_text (PangoLine *line,
* Returns: the start index of the line
*/
int
-pango_line_get_start_index (PangoLine *line)
+pango2_line_get_start_index (Pango2Line *line)
{
g_return_val_if_fail (line != NULL, 0);
@@ -723,15 +723,15 @@ pango_line_get_start_index (PangoLine *line)
}
/**
- * pango_line_get_length:
- * @line: a `PangoLine`
+ * pango2_line_get_length:
+ * @line: a `Pango2Line`
*
* Returns the length of the line, in bytes.
*
* Returns: the length of the line
*/
int
-pango_line_get_length (PangoLine *line)
+pango2_line_get_length (Pango2Line *line)
{
g_return_val_if_fail (line != NULL, 0);
@@ -739,25 +739,25 @@ pango_line_get_length (PangoLine *line)
}
/**
- * pango_line_get_log_attrs:
- * @line: a `PangoLine`
+ * pango2_line_get_log_attrs:
+ * @line: a `Pango2Line`
* @start_offset: the character offset of the first character of @line
* @n_attrs: the number of attributes that apply to @line
*
- * Gets the `PangoLogAttr` array for the line.
+ * Gets the `Pango2LogAttr` array for the line.
*
- * The `PangoLogAttrs` for @line are the slice from @start_offset
+ * The `Pango2LogAttrs` for @line are the slice from @start_offset
* to @start_offset+@n_attrs of the returned array. @n_attrs is
* be the number of characters plus one.
*
* The returned array is owned by @line and must not be modified.
*
- * Returns: the `PangoLogAttr` array
+ * Returns: the `Pango2LogAttr` array
*/
-const PangoLogAttr *
-pango_line_get_log_attrs (PangoLine *line,
- int *start_offset,
- int *n_attrs)
+const Pango2LogAttr *
+pango2_line_get_log_attrs (Pango2Line *line,
+ int *start_offset,
+ int *n_attrs)
{
g_return_val_if_fail (line != NULL, NULL);
g_return_val_if_fail (start_offset != NULL, NULL);
@@ -770,15 +770,15 @@ pango_line_get_log_attrs (PangoLine *line,
}
/**
- * pango_line_is_wrapped:
- * @line: a `PangoLine`
+ * pango2_line_is_wrapped:
+ * @line: a `Pango2Line`
*
* Gets whether the line is wrapped.
*
* Returns: `TRUE` if @line has been wrapped
*/
gboolean
-pango_line_is_wrapped (PangoLine *line)
+pango2_line_is_wrapped (Pango2Line *line)
{
g_return_val_if_fail (line != NULL, FALSE);
@@ -786,15 +786,15 @@ pango_line_is_wrapped (PangoLine *line)
}
/**
- * pango_line_is_ellipsized:
- * @line: a `PangoLine`
+ * pango2_line_is_ellipsized:
+ * @line: a `Pango2Line`
*
* Gets whether the line is ellipsized.
*
* Returns: `TRUE` if @line has been ellipsized
*/
gboolean
-pango_line_is_ellipsized (PangoLine *line)
+pango2_line_is_ellipsized (Pango2Line *line)
{
g_return_val_if_fail (line != NULL, FALSE);
@@ -802,15 +802,15 @@ pango_line_is_ellipsized (PangoLine *line)
}
/**
- * pango_line_is_hyphenated:
- * @line: a `PangoLine`
+ * pango2_line_is_hyphenated:
+ * @line: a `Pango2Line`
*
* Gets whether the line is hyphenated.
*
* Returns: `TRUE` if @line has been hyphenated
*/
gboolean
-pango_line_is_hyphenated (PangoLine *line)
+pango2_line_is_hyphenated (Pango2Line *line)
{
g_return_val_if_fail (line != NULL, FALSE);
@@ -818,17 +818,17 @@ pango_line_is_hyphenated (PangoLine *line)
}
/**
- * pango_line_is_justified:
- * @line: a `PangoLine`
+ * pango2_line_is_justified:
+ * @line: a `Pango2Line`
*
* Gets whether the line is justified.
*
- * See [method@Pango.Line.justify].
+ * See [method@Pango2.Line.justify].
*
* Returns: `TRUE` if @line has been justified
*/
gboolean
-pango_line_is_justified (PangoLine *line)
+pango2_line_is_justified (Pango2Line *line)
{
g_return_val_if_fail (line != NULL, FALSE);
@@ -836,15 +836,15 @@ pango_line_is_justified (PangoLine *line)
}
/**
- * pango_line_is_paragraph_start:
- * @line: a `PangoLine`
+ * pango2_line_is_paragraph_start:
+ * @line: a `Pango2Line`
*
* Gets whether the line is the first of a paragraph.
*
* Returns: `TRUE` if @line starts a paragraph
*/
gboolean
-pango_line_is_paragraph_start (PangoLine *line)
+pango2_line_is_paragraph_start (Pango2Line *line)
{
g_return_val_if_fail (line != NULL, FALSE);
@@ -852,15 +852,15 @@ pango_line_is_paragraph_start (PangoLine *line)
}
/**
- * pango_line_is_paragraph_end:
- * @line: a `PangoLine`
+ * pango2_line_is_paragraph_end:
+ * @line: a `Pango2Line`
*
* Gets whether the line is the last of a paragraph.
*
* Returns: `TRUE` if @line ends a paragraph
*/
gboolean
-pango_line_is_paragraph_end (PangoLine *line)
+pango2_line_is_paragraph_end (Pango2Line *line)
{
g_return_val_if_fail (line != NULL, FALSE);
@@ -868,17 +868,17 @@ pango_line_is_paragraph_end (PangoLine *line)
}
/**
- * pango_line_get_resolved_direction:
- * @line: a `PangoLine`
+ * pango2_line_get_resolved_direction:
+ * @line: a `Pango2Line`
*
* Gets the resolved direction of the line.
*
* Returns: the resolved direction of @line
*/
-PangoDirection
-pango_line_get_resolved_direction (PangoLine *line)
+Pango2Direction
+pango2_line_get_resolved_direction (Pango2Line *line)
{
- g_return_val_if_fail (line != NULL, PANGO_DIRECTION_LTR);
+ g_return_val_if_fail (line != NULL, PANGO2_DIRECTION_LTR);
return line->direction;
}
@@ -887,11 +887,11 @@ pango_line_get_resolved_direction (PangoLine *line)
/* {{{ Justification */
/**
- * pango_line_justify:
- * @line: (transfer full): a `PangoLine`
+ * pango2_line_justify:
+ * @line: (transfer full): a `Pango2Line`
* @width: the width to justify @line to
*
- * Creates a new `PangoLine` that is justified
+ * Creates a new `Pango2Line` that is justified
* copy of @line.
*
* The content of the returned line is justified
@@ -900,22 +900,22 @@ pango_line_get_resolved_direction (PangoLine *line)
*
* Note that this function consumes @line.
*
- * Returns: (transfer full): a new `PangoLine`
+ * Returns: (transfer full): a new `Pango2Line`
*/
-PangoLine *
-pango_line_justify (PangoLine *line,
- int width)
+Pango2Line *
+pango2_line_justify (Pango2Line *line,
+ int width)
{
int remaining_width;
- PangoLine *copy;
+ Pango2Line *copy;
g_return_val_if_fail (line != NULL, NULL);
- remaining_width = width - pango_line_compute_width (line);
+ remaining_width = width - pango2_line_compute_width (line);
if (remaining_width <= 0)
return line;
- copy = pango_line_new (line->context, line->data);
+ copy = pango2_line_new (line->context, line->data);
copy->start_index = line->start_index;
copy->length = line->length;
copy->start_offset = line->start_offset;
@@ -933,7 +933,7 @@ pango_line_justify (PangoLine *line,
justify_words (copy, &remaining_width);
- pango_line_free (line);
+ pango2_line_free (line);
return copy;
}
@@ -942,26 +942,26 @@ pango_line_justify (PangoLine *line,
/* {{{ Extents */
/**
- * pango_line_get_extents:
- * @line: a `PangoLine`
+ * pango2_line_get_extents:
+ * @line: a `Pango2Line`
* @ink_rect: (out) (optional): rectangle that will be filled with ink extents
* @logical_rect: (out) (optional): rectangle that will be filled with the logical extents
*
* Gets the extents of the line.
*
* The logical extents returned by this function always include leading.
- * If you need extents with trimmed leading, use [method@Pango.Line.get_trimmed_extents].
+ * If you need extents with trimmed leading, use [method@Pango2.Line.get_trimmed_extents].
*
* Note that the origin is at the left end of the baseline.
*
- * Pango is following CSS in splitting the external leading, and giving one half of it
+ * Pango2 is following CSS in splitting the external leading, and giving one half of it
* to the line above, and the other half the the line below. Unless the line height is set
* via attributes, the external leading is determined as the difference between the
* height and ascent + descent in font metrics:
*
* <picture>
* <source srcset="line-height1-dark.png" media="(prefers-color-scheme: dark)">
- * <img alt="Pango Font Metrics" src="line-height1-light.png">
+ * <img alt="Pango2 Font Metrics" src="line-height1-light.png">
* </picture>
*
* If spacing is set, it also gets split, for the purpose of determining the
@@ -969,28 +969,28 @@ pango_line_justify (PangoLine *line,
*
* <picture>
* <source srcset="line-height2-dark.png" media="(prefers-color-scheme: dark)">
- * <img alt="Pango Extents and Spacing" src="line-height2-light.png">
+ * <img alt="Pango2 Extents and Spacing" src="line-height2-light.png">
* </picture>
*
* If line height is set, it determines the logical extents.
*
* <picture>
* <source srcset="line-height3-dark.png" media="(prefers-color-scheme: dark)">
- * <img alt="Pango Extents and Line Height" src="line-height3-light.png">
+ * <img alt="Pango2 Extents and Line Height" src="line-height3-light.png">
* </picture>
*/
void
-pango_line_get_extents (PangoLine *line,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_line_get_extents (Pango2Line *line,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
- PangoRectangle ink = { 0, };
- PangoRectangle logical = { 0, };
+ Pango2Rectangle ink = { 0, };
+ Pango2Rectangle logical = { 0, };
if (line->has_extents)
goto cached;
- compute_extents (line, PANGO_LEADING_TRIM_NONE, &ink, &logical);
+ compute_extents (line, PANGO2_LEADING_TRIM_NONE, &ink, &logical);
line->ink_rect = ink;
line->logical_rect = logical;
@@ -1004,9 +1004,9 @@ cached:
}
/**
- * pango_line_get_trimmed_extents:
- * @line: a `PangoLine`
- * @trim: `PangoLeadingTrim` flags
+ * pango2_line_get_trimmed_extents:
+ * @line: a `Pango2Line`
+ * @trim: `Pango2LeadingTrim` flags
* @logical_rect: (out): rectangle that will be filled with the logical extents
*
* Gets trimmed logical extents of the line.
@@ -1019,13 +1019,13 @@ cached:
* Note that the origin is at the left end of the baseline.
*/
void
-pango_line_get_trimmed_extents (PangoLine *line,
- PangoLeadingTrim trim,
- PangoRectangle *logical_rect)
+pango2_line_get_trimmed_extents (Pango2Line *line,
+ Pango2LeadingTrim trim,
+ Pango2Rectangle *logical_rect)
{
- PangoRectangle ink = { 0, };
+ Pango2Rectangle ink = { 0, };
- if (line->has_extents && trim == PANGO_LEADING_TRIM_NONE)
+ if (line->has_extents && trim == PANGO2_LEADING_TRIM_NONE)
{
*logical_rect = line->logical_rect;
return;
@@ -1038,12 +1038,12 @@ pango_line_get_trimmed_extents (PangoLine *line,
/* {{{ Editing API */
/**
- * pango_line_layout_index_to_pos:
- * @line: a `PangoLine`
+ * pango2_line_layout_index_to_pos:
+ * @line: a `Pango2Line`
* @idx: byte index within @line
* @pos: (out): rectangle in which to store the position of the grapheme
*
- * Converts from an index within a `PangoLine` to the
+ * Converts from an index within a `Pango2Line` to the
* position corresponding to the grapheme at that index.
*
* The return value is represented as rectangle. Note that `pos->x` is
@@ -1054,16 +1054,16 @@ pango_line_get_trimmed_extents (PangoLine *line,
* Note that @idx is allowed to be @line->start_index + @line->length.
*/
void
-pango_line_index_to_pos (PangoLine *line,
- int idx,
- PangoRectangle *pos)
+pango2_line_index_to_pos (Pango2Line *line,
+ int idx,
+ Pango2Rectangle *pos)
{
- PangoRectangle run_logical;
- PangoRectangle line_logical;
- PangoRun *run = NULL;
+ Pango2Rectangle run_logical;
+ Pango2Rectangle line_logical;
+ Pango2Run *run = NULL;
int x_pos;
- pango_line_get_extents (line, NULL, &line_logical);
+ pango2_line_get_extents (line, NULL, &line_logical);
if (!line->runs)
{
@@ -1074,21 +1074,21 @@ pango_line_index_to_pos (PangoLine *line,
if (idx == line->start_index + line->length)
run = g_slist_last (line->runs)->data;
else
- pango_line_index_to_run (line, idx, &run);
+ pango2_line_index_to_run (line, idx, &run);
- pango_run_get_extents (run, PANGO_LEADING_TRIM_BOTH, NULL, &run_logical);
+ pango2_run_get_extents (run, PANGO2_LEADING_TRIM_BOTH, NULL, &run_logical);
pos->y = run_logical.y;
pos->height = run_logical.height;
/* FIXME: avoid iterating through the runs multiple times */
- pango_line_index_to_x (line, idx, 0, &x_pos);
+ pango2_line_index_to_x (line, idx, 0, &x_pos);
pos->x = line_logical.x + x_pos;
if (idx < line->start_index + line->length)
{
- pango_line_index_to_x (line, idx, 1, &x_pos);
+ pango2_line_index_to_x (line, idx, 1, &x_pos);
pos->width = (line_logical.x + x_pos) - pos->x;
}
else
@@ -1096,30 +1096,30 @@ pango_line_index_to_pos (PangoLine *line,
}
/**
- * pango_line_index_to_x:
- * @line: a `PangoLine`
+ * pango2_line_index_to_x:
+ * @line: a `Pango2Line`
* @idx: byte index within @line
* @trailing: an integer indicating the edge of the grapheme to retrieve
* the position of. If > 0, the trailing edge of the grapheme,
* if 0, the leading of the grapheme
- * @x_pos: (out): location to store the x_offset (in Pango units)
+ * @x_pos: (out): location to store the x_offset (in Pango2 units)
*
- * Converts an index within a `PangoLine` to a X position.
+ * Converts an index within a `Pango2Line` to a X position.
*
* Note that @idx is allowed to be @line->start_index + @line->length.
*/
void
-pango_line_index_to_x (PangoLine *line,
- int index,
- int trailing,
- int *x_pos)
+pango2_line_index_to_x (Pango2Line *line,
+ int index,
+ int trailing,
+ int *x_pos)
{
GSList *run_list = line->runs;
int width = 0;
while (run_list)
{
- PangoGlyphItem *run = run_list->data;
+ Pango2GlyphItem *run = run_list->data;
if (run->item->offset <= index && run->item->offset + run->item->length > index)
{
@@ -1147,19 +1147,19 @@ pango_line_index_to_x (PangoLine *line,
}
attr_offset = run->item->char_offset;
- pango_glyph_string_index_to_x_full (run->glyphs,
- line->data->text + run->item->offset,
- run->item->length,
- &run->item->analysis,
- line->data->log_attrs + attr_offset,
- index - run->item->offset, trailing, x_pos);
+ pango2_glyph_string_index_to_x_full (run->glyphs,
+ line->data->text + run->item->offset,
+ run->item->length,
+ &run->item->analysis,
+ line->data->log_attrs + attr_offset,
+ index - run->item->offset, trailing, x_pos);
if (x_pos)
*x_pos += width;
return;
}
- width += pango_glyph_string_get_width (run->glyphs);
+ width += pango2_glyph_string_get_width (run->glyphs);
run_list = run_list->next;
}
@@ -1169,9 +1169,9 @@ pango_line_index_to_x (PangoLine *line,
}
/**
- * pango_line_x_to_index:
- * @line: a `PangoLine`
- * @x: the X offset (in Pango units) from the left edge of the line
+ * pango2_line_x_to_index:
+ * @line: a `Pango2Line`
+ * @x: the X offset (in Pango2 units) from the left edge of the line
* @idx: (out): location to store calculated byte index for the grapheme
* in which the user clicked
* @trailing: (out): location to store an integer indicating where in the
@@ -1193,10 +1193,10 @@ pango_line_index_to_x (PangoLine *line,
* Return value: %FALSE if @x_pos was outside the line, %TRUE if inside
*/
gboolean
-pango_line_x_to_index (PangoLine *line,
- int x_pos,
- int *index,
- int *trailing)
+pango2_line_x_to_index (Pango2Line *line,
+ int x_pos,
+ int *index,
+ int *trailing)
{
GSList *tmp_list;
int start_pos = 0;
@@ -1273,10 +1273,10 @@ pango_line_x_to_index (PangoLine *line,
{
/* pick the leftmost char */
if (index)
- *index = (line->direction == PANGO_DIRECTION_LTR) ? first_index : last_index;
+ *index = (line->direction == PANGO2_DIRECTION_LTR) ? first_index : last_index;
/* and its leftmost edge */
if (trailing)
- *trailing = (line->direction == PANGO_DIRECTION_LTR || suppress_last_trailing) ? 0 : last_trailing;
+ *trailing = (line->direction == PANGO2_DIRECTION_LTR || suppress_last_trailing) ? 0 : last_trailing;
return FALSE;
}
@@ -1284,10 +1284,10 @@ pango_line_x_to_index (PangoLine *line,
tmp_list = line->runs;
while (tmp_list)
{
- PangoGlyphItem *run = tmp_list->data;
+ Pango2GlyphItem *run = tmp_list->data;
int logical_width;
- logical_width = pango_glyph_string_get_width (run->glyphs);
+ logical_width = pango2_glyph_string_get_width (run->glyphs);
if (x_pos >= start_pos && x_pos < start_pos + logical_width)
{
@@ -1299,11 +1299,11 @@ pango_line_x_to_index (PangoLine *line,
int pos;
int char_index;
- pango_glyph_string_x_to_index (run->glyphs,
- line->data->text + run->item->offset, run->item->length,
- &run->item->analysis,
- x_pos - start_pos,
- &pos, &char_trailing);
+ pango2_glyph_string_x_to_index (run->glyphs,
+ line->data->text + run->item->offset, run->item->length,
+ &run->item->analysis,
+ x_pos - start_pos,
+ &pos, &char_trailing);
char_index = run->item->offset + pos;
@@ -1349,11 +1349,11 @@ pango_line_x_to_index (PangoLine *line,
/* pick the rightmost char */
if (index)
- *index = (line->direction == PANGO_DIRECTION_LTR) ? last_index : first_index;
+ *index = (line->direction == PANGO2_DIRECTION_LTR) ? last_index : first_index;
/* and its rightmost edge */
if (trailing)
- *trailing = (line->direction == PANGO_DIRECTION_LTR && !suppress_last_trailing) ? last_trailing : 0;
+ *trailing = (line->direction == PANGO2_DIRECTION_LTR && !suppress_last_trailing) ? last_trailing : 0;
return FALSE;
}
@@ -1362,8 +1362,8 @@ pango_line_x_to_index (PangoLine *line,
/* {{{ Cursor positioning */
/**
- * pango_line_get_cursor_pos:
- * @line: a `PangoLine`
+ * pango2_line_get_cursor_pos:
+ * @line: a `Pango2Line`
* @idx: the byte index of the cursor
* @strong_pos: (out) (optional): location to store the strong cursor position
* @weak_pos: (out) (optional): location to store the weak cursor position
@@ -1399,16 +1399,16 @@ pango_line_x_to_index (PangoLine *line,
* will insert it at the end.
*/
void
-pango_line_get_cursor_pos (PangoLine *line,
- int idx,
- PangoRectangle *strong_pos,
- PangoRectangle *weak_pos)
+pango2_line_get_cursor_pos (Pango2Line *line,
+ int idx,
+ Pango2Rectangle *strong_pos,
+ Pango2Rectangle *weak_pos)
{
- PangoRectangle line_rect = { 666, };
- PangoRectangle run_rect = { 666, };
- PangoDirection dir1, dir2;
+ Pango2Rectangle line_rect = { 666, };
+ Pango2Rectangle run_rect = { 666, };
+ Pango2Direction dir1, dir2;
int level1, level2;
- PangoRun *run = NULL;
+ Pango2Run *run = NULL;
int x1_trailing;
int x2;
@@ -1418,11 +1418,11 @@ pango_line_get_cursor_pos (PangoLine *line,
run = g_slist_last (line->runs)->data;
}
else
- pango_line_index_to_run (line, idx, &run);
+ pango2_line_index_to_run (line, idx, &run);
- pango_line_get_extents (line, NULL, &line_rect);
+ pango2_line_get_extents (line, NULL, &line_rect);
if (run)
- pango_run_get_extents (run, PANGO_LEADING_TRIM_BOTH, NULL, &run_rect);
+ pango2_run_get_extents (run, PANGO2_LEADING_TRIM_BOTH, NULL, &run_rect);
else
{
run_rect = line_rect;
@@ -1434,8 +1434,8 @@ pango_line_get_cursor_pos (PangoLine *line,
if (idx == line->start_index)
{
dir1 = line->direction;
- level1 = dir1 == PANGO_DIRECTION_LTR ? 0 : 1;
- if (line->direction == PANGO_DIRECTION_LTR)
+ level1 = dir1 == PANGO2_DIRECTION_LTR ? 0 : 1;
+ if (line->direction == PANGO2_DIRECTION_LTR)
x1_trailing = 0;
else
x1_trailing = line_rect.width;
@@ -1447,17 +1447,17 @@ pango_line_get_cursor_pos (PangoLine *line,
if (prev_index >= line->start_index + line->length)
{
dir1 = line->direction;
- level1 = dir1 == PANGO_DIRECTION_LTR ? 0 : 1;
+ level1 = dir1 == PANGO2_DIRECTION_LTR ? 0 : 1;
x1_trailing = line_rect.width;
}
else
{
- PangoRun *prev_run;
+ Pango2Run *prev_run;
- pango_line_index_to_run (line, prev_index, &prev_run);
- level1 = pango_run_get_glyph_item (prev_run)->item->analysis.level;
- dir1 = level1 % 2 ? PANGO_DIRECTION_RTL : PANGO_DIRECTION_LTR;
- pango_line_index_to_x (line, prev_index, TRUE, &x1_trailing);
+ pango2_line_index_to_run (line, prev_index, &prev_run);
+ level1 = pango2_run_get_glyph_item (prev_run)->item->analysis.level;
+ dir1 = level1 % 2 ? PANGO2_DIRECTION_RTL : PANGO2_DIRECTION_LTR;
+ pango2_line_index_to_x (line, prev_index, TRUE, &x1_trailing);
}
}
@@ -1465,17 +1465,17 @@ pango_line_get_cursor_pos (PangoLine *line,
if (idx >= line->start_index + line->length)
{
dir2 = line->direction;
- level2 = dir2 == PANGO_DIRECTION_LTR ? 0 : 1;
- if (line->direction == PANGO_DIRECTION_LTR)
+ level2 = dir2 == PANGO2_DIRECTION_LTR ? 0 : 1;
+ if (line->direction == PANGO2_DIRECTION_LTR)
x2 = line_rect.width;
else
x2 = 0;
}
else
{
- pango_line_index_to_x (line, idx, FALSE, &x2);
- level2 = pango_run_get_glyph_item (run)->item->analysis.level;
- dir2 = level2 % 2 ? PANGO_DIRECTION_RTL : PANGO_DIRECTION_LTR;
+ pango2_line_index_to_x (line, idx, FALSE, &x2);
+ level2 = pango2_run_get_glyph_item (run)->item->analysis.level;
+ dir2 = level2 % 2 ? PANGO2_DIRECTION_RTL : PANGO2_DIRECTION_LTR;
}
done:
@@ -1511,8 +1511,8 @@ done:
}
/**
- * pango_line_get_caret_pos:
- * @line: a `PangoLine`
+ * pango2_line_get_caret_pos:
+ * @line: a `Pango2Line`
* @idx: the byte index of the cursor
* @strong_pos: (out) (optional): location to store the strong cursor position
* @weak_pos: (out) (optional): location to store the weak cursor position
@@ -1522,7 +1522,7 @@ done:
*
* Note that @idx is allowed to be @line->start_index + @line->length.
*
- * This is a variant of [method@Pango.Line.get_cursor_pos] that applies
+ * This is a variant of [method@Pango2.Line.get_cursor_pos] that applies
* font metric information about caret slope and offset to the positions
* it returns.
*
@@ -1532,17 +1532,17 @@ done:
* </picture>
*/
void
-pango_line_get_caret_pos (PangoLine *line,
- int idx,
- PangoRectangle *strong_pos,
- PangoRectangle *weak_pos)
+pango2_line_get_caret_pos (Pango2Line *line,
+ int idx,
+ Pango2Rectangle *strong_pos,
+ Pango2Rectangle *weak_pos)
{
- PangoRun *run = NULL;
- PangoGlyphItem *glyph_item;
+ Pango2Run *run = NULL;
+ Pango2GlyphItem *glyph_item;
hb_font_t *hb_font;
hb_position_t caret_offset, caret_run, caret_rise, descender;
- pango_line_get_cursor_pos (line, idx, strong_pos, weak_pos);
+ pango2_line_get_cursor_pos (line, idx, strong_pos, weak_pos);
if (idx >= line->start_index + line->length)
{
@@ -1550,13 +1550,13 @@ pango_line_get_caret_pos (PangoLine *line,
run = g_slist_last (line->runs)->data;
}
else
- pango_line_index_to_run (line, idx, &run);
+ pango2_line_index_to_run (line, idx, &run);
if (!run)
return;
- glyph_item = pango_run_get_glyph_item (run);
- hb_font = pango_font_get_hb_font (glyph_item->item->analysis.font);
+ glyph_item = pango2_run_get_glyph_item (run);
+ hb_font = pango2_font_get_hb_font (glyph_item->item->analysis.font);
if (hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_TAG_HORIZONTAL_CARET_RISE, &caret_rise) &&
hb_ot_metrics_get_position (hb_font, HB_OT_METRICS_TAG_HORIZONTAL_CARET_RUN, &caret_run) &&
diff --git a/pango/pango-line.h b/pango/pango-line.h
index 2a0562b9..c2c85195 100644
--- a/pango/pango-line.h
+++ b/pango/pango-line.h
@@ -26,101 +26,101 @@
G_BEGIN_DECLS
-PANGO_AVAILABLE_IN_ALL
-GType pango_line_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_line_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoLine * pango_line_copy (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Line * pango2_line_copy (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_free (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_free (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-PangoLine * pango_line_justify (PangoLine *line,
- int width);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Line * pango2_line_justify (Pango2Line *line,
+ int width);
-PANGO_AVAILABLE_IN_ALL
-int pango_line_get_run_count (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_line_get_run_count (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-PangoRun ** pango_line_get_runs (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Run ** pango2_line_get_runs (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-const char * pango_line_get_text (PangoLine *line,
- int *start_index,
- int *length);
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_line_get_text (Pango2Line *line,
+ int *start_index,
+ int *length);
-PANGO_AVAILABLE_IN_ALL
-int pango_line_get_start_index (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_line_get_start_index (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-int pango_line_get_length (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_line_get_length (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-const PangoLogAttr * pango_line_get_log_attrs (PangoLine *line,
- int *start_offset,
- int *n_attrs);
+PANGO2_AVAILABLE_IN_ALL
+const Pango2LogAttr * pango2_line_get_log_attrs (Pango2Line *line,
+ int *start_offset,
+ int *n_attrs);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_is_wrapped (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_is_wrapped (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_is_ellipsized (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_is_ellipsized (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_is_hyphenated (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_is_hyphenated (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_is_justified (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_is_justified (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_is_paragraph_start (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_is_paragraph_start (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_is_paragraph_end (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_is_paragraph_end (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-PangoDirection pango_line_get_resolved_direction (PangoLine *line);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Direction pango2_line_get_resolved_direction (Pango2Line *line);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_get_extents (PangoLine *line,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_get_extents (Pango2Line *line,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_get_trimmed_extents (PangoLine *line,
- PangoLeadingTrim trim,
- PangoRectangle *logical_rect);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_get_trimmed_extents (Pango2Line *line,
+ Pango2LeadingTrim trim,
+ Pango2Rectangle *logical_rect);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_index_to_pos (PangoLine *line,
- int idx,
- PangoRectangle *pos);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_index_to_pos (Pango2Line *line,
+ int idx,
+ Pango2Rectangle *pos);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_index_to_x (PangoLine *line,
- int idx,
- int trailing,
- int *x_pos);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_index_to_x (Pango2Line *line,
+ int idx,
+ int trailing,
+ int *x_pos);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_line_x_to_index (PangoLine *line,
- int x,
- int *idx,
- int *trailing);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_line_x_to_index (Pango2Line *line,
+ int x,
+ int *idx,
+ int *trailing);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_get_cursor_pos (PangoLine *line,
- int idx,
- PangoRectangle *strong_pos,
- PangoRectangle *weak_pos);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_get_cursor_pos (Pango2Line *line,
+ int idx,
+ Pango2Rectangle *strong_pos,
+ Pango2Rectangle *weak_pos);
-PANGO_AVAILABLE_IN_ALL
-void pango_line_get_caret_pos (PangoLine *line,
- int idx,
- PangoRectangle *strong_pos,
- PangoRectangle *weak_pos);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_line_get_caret_pos (Pango2Line *line,
+ int idx,
+ Pango2Rectangle *strong_pos,
+ Pango2Rectangle *weak_pos);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoLine, pango_line_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2Line, pango2_line_free)
G_END_DECLS
diff --git a/pango/pango-lines-private.h b/pango/pango-lines-private.h
index 447d716c..8832fba0 100644
--- a/pango/pango-lines-private.h
+++ b/pango/pango-lines-private.h
@@ -28,7 +28,7 @@ struct _Position
int x, y;
};
-struct _PangoLines
+struct _Pango2Lines
{
GObject parent_instance;
diff --git a/pango/pango-lines.c b/pango/pango-lines.c
index fe6f9352..e528ec05 100644
--- a/pango/pango-lines.c
+++ b/pango/pango-lines.c
@@ -7,46 +7,46 @@
#include "pango-line-iter-private.h"
/**
- * PangoLines:
+ * Pango2Lines:
*
- * A `PangoLines` object represents the result of formatting an
+ * A `Pango2Lines` object represents the result of formatting an
* entire paragraph (or more) of text.
*
- * A `PangoLines` object contains a list of `PangoLine` objects,
+ * A `Pango2Lines` object contains a list of `Pango2Line` objects,
* together with information about where to position each line
* in layout coordinates.
*
- * `PangoLines` has APIs to query collective information about
+ * `Pango2Lines` has APIs to query collective information about
* its lines (such as ellipsization or unknown glyphs), to translate
* between logical character positions within the text and the physical
* position of the resulting glyphs, and to determine cursor positions
* for editing the text.
*
- * One way to obtain a `PangoLines` object is to use a [class@Pango.Layout].
- * But it is also possible to populate a `PangoLines` manually with lines
- * produced by a [class@Pango.LineBreaker] object.
+ * One way to obtain a `Pango2Lines` object is to use a [class@Pango2.Layout].
+ * But it is also possible to populate a `Pango2Lines` manually with lines
+ * produced by a [class@Pango2.LineBreaker] object.
*
- * Note that the lines that make up a `PangoLines` object don't have to
+ * Note that the lines that make up a `Pango2Lines` object don't have to
* share the same underlying text. Therefore, using byte indexes to refer
- * to positions within the `PangoLines` is, in general, ambiguous. All the
- * `PangoLines` APIs that take a byte index as argument or return one have
- * a `PangoLine*` companion argument to handle this situation. When all
- * the lines in the `PangoLines` share the same text (such as when they
- * originate from the same `PangoLayout`), it is safe to always pass `NULL`
- * for the `PangoLines*`.
+ * to positions within the `Pango2Lines` is, in general, ambiguous. All the
+ * `Pango2Lines` APIs that take a byte index as argument or return one have
+ * a `Pango2Line*` companion argument to handle this situation. When all
+ * the lines in the `Pango2Lines` share the same text (such as when they
+ * originate from the same `Pango2Layout`), it is safe to always pass `NULL`
+ * for the `Pango2Lines*`.
*
* The most convenient way to access the visual extents and components
- * of a `PangoLines` is via a [struct@Pango.LineIter] iterator.
+ * of a `Pango2Lines` is via a [struct@Pango2.LineIter] iterator.
*/
-/* {{{ PangoLines implementation */
+/* {{{ Pango2Lines implementation */
-struct _PangoLinesClass
+struct _Pango2LinesClass
{
GObjectClass parent_class;
};
-G_DEFINE_TYPE (PangoLines, pango_lines, G_TYPE_OBJECT)
+G_DEFINE_TYPE (Pango2Lines, pango2_lines, G_TYPE_OBJECT)
enum {
PROP_UNKNOWN_GLYPHS_COUNT = 1,
@@ -59,48 +59,48 @@ enum {
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
static void
-pango_lines_init (PangoLines *lines)
+pango2_lines_init (Pango2Lines *lines)
{
lines->serial = 1;
- lines->lines = g_ptr_array_new_with_free_func ((GDestroyNotify) pango_line_free);
+ lines->lines = g_ptr_array_new_with_free_func ((GDestroyNotify) pango2_line_free);
lines->positions = g_array_new (FALSE, FALSE, sizeof (Position));
}
static void
-pango_lines_finalize (GObject *object)
+pango2_lines_finalize (GObject *object)
{
- PangoLines *lines = PANGO_LINES (object);
+ Pango2Lines *lines = PANGO2_LINES (object);
g_ptr_array_unref (lines->lines);
g_array_unref (lines->positions);
- G_OBJECT_CLASS (pango_lines_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_lines_parent_class)->finalize (object);
}
static void
-pango_lines_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+pango2_lines_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- PangoLines *self = PANGO_LINES (object);
+ Pango2Lines *self = PANGO2_LINES (object);
switch (prop_id)
{
case PROP_UNKNOWN_GLYPHS_COUNT:
- g_value_set_int (value, pango_lines_get_unknown_glyphs_count (self));
+ g_value_set_int (value, pango2_lines_get_unknown_glyphs_count (self));
break;
case PROP_WRAPPED:
- g_value_set_boolean (value, pango_lines_is_wrapped (self));
+ g_value_set_boolean (value, pango2_lines_is_wrapped (self));
break;
case PROP_ELLIPSIZED:
- g_value_set_boolean (value, pango_lines_is_ellipsized (self));
+ g_value_set_boolean (value, pango2_lines_is_ellipsized (self));
break;
case PROP_HYPHENATED:
- g_value_set_boolean (value, pango_lines_is_hyphenated (self));
+ g_value_set_boolean (value, pango2_lines_is_hyphenated (self));
break;
default:
@@ -110,44 +110,44 @@ pango_lines_get_property (GObject *object,
}
static void
-pango_lines_class_init (PangoLinesClass *class)
+pango2_lines_class_init (Pango2LinesClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- object_class->finalize = pango_lines_finalize;
- object_class->get_property = pango_lines_get_property;
+ object_class->finalize = pango2_lines_finalize;
+ object_class->get_property = pango2_lines_get_property;
/**
- * PangoLines:unknown-glyphs-count: (attributes org.gtk.Property.get=pango_lines_get_unknown_glyphs_count)
+ * Pango2Lines:unknown-glyphs-count: (attributes org.gtk.Property.get=pango2_lines_get_unknown_glyphs_count)
*
- * The number of unknown glyphs in the `PangoLines`.
+ * The number of unknown glyphs in the `Pango2Lines`.
*/
properties[PROP_UNKNOWN_GLYPHS_COUNT] =
g_param_spec_uint ("unknown-glyphs-count", NULL, NULL, 0, G_MAXUINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoLines:wrapped: (attributes org.gtk.Property.get=pango_lines_is_wrapped)
+ * Pango2Lines:wrapped: (attributes org.gtk.Property.get=pango2_lines_is_wrapped)
*
- * `TRUE` if the `PangoLines` contains any wrapped lines.
+ * `TRUE` if the `Pango2Lines` contains any wrapped lines.
*/
properties[PROP_WRAPPED] =
g_param_spec_boolean ("wrapped", NULL, NULL, FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoLines:ellipsized: (attributes org.gtk.Property.get=pango_lines_is_ellipsized)
+ * Pango2Lines:ellipsized: (attributes org.gtk.Property.get=pango2_lines_is_ellipsized)
*
- * `TRUE` if the `PangoLines` contains any ellipsized lines.
+ * `TRUE` if the `Pango2Lines` contains any ellipsized lines.
*/
properties[PROP_ELLIPSIZED] =
g_param_spec_boolean ("ellipsized", NULL, NULL, FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
- * PangoLines:hyphenated: (attributes org.gtk.Property.get=pango_lines_is_hyphenated)
+ * Pango2Lines:hyphenated: (attributes org.gtk.Property.get=pango2_lines_is_hyphenated)
*
- * `TRUE` if the `PangoLines` contains any hyphenated lines.
+ * `TRUE` if the `Pango2Lines` contains any hyphenated lines.
*/
properties[PROP_HYPHENATED] =
g_param_spec_boolean ("hyphenated", NULL, NULL, FALSE,
@@ -157,7 +157,7 @@ pango_lines_class_init (PangoLinesClass *class)
}
/* }}} */
- /* {{{ Utilities*/
+/* {{{ Utilities*/
typedef struct {
int x;
@@ -175,16 +175,16 @@ compare_cursor (gconstpointer v1,
}
static void
-pango_line_get_cursors (PangoLines *lines,
- PangoLine *line,
- gboolean strong,
- GArray *cursors)
+pango2_line_get_cursors (Pango2Lines *lines,
+ Pango2Line *line,
+ gboolean strong,
+ GArray *cursors)
{
const char *start, *end;
int start_offset;
int j;
const char *p;
- PangoRectangle pos;
+ Pango2Rectangle pos;
Position offset;
g_assert (g_array_get_element_size (cursors) == sizeof (CursorPos));
@@ -214,9 +214,9 @@ pango_line_get_cursors (PangoLines *lines,
{
CursorPos cursor;
- pango_line_get_cursor_pos (line, idx,
- strong ? &pos : NULL,
- strong ? NULL : &pos);
+ pango2_line_get_cursor_pos (line, idx,
+ strong ? &pos : NULL,
+ strong ? NULL : &pos);
cursor.x = pos.x + offset.x;
cursor.pos = idx;
@@ -228,24 +228,24 @@ pango_line_get_cursors (PangoLines *lines,
}
/* }}} */
- /* {{{ Public API */
+/* {{{ Public API */
/**
- * pango_lines_new:
+ * pango2_lines_new:
*
- * Creates an empty `PangoLines` object.
+ * Creates an empty `Pango2Lines` object.
*
- * Returns: a newly allocated `PangoLines`
+ * Returns: a newly allocated `Pango2Lines`
*/
-PangoLines *
-pango_lines_new (void)
+Pango2Lines *
+pango2_lines_new (void)
{
- return g_object_new (PANGO_TYPE_LINES, NULL);
+ return g_object_new (PANGO2_TYPE_LINES, NULL);
}
/**
- * pango_lines_get_serial:
- * @lines: a `PangoLines`
+ * pango2_lines_get_serial:
+ * @lines: a `Pango2Lines`
*
* Returns the current serial number of @lines.
*
@@ -256,25 +256,25 @@ pango_lines_new (void)
* The serial may wrap, but will never have the value 0. Since it can
* wrap, never compare it with "less than", always use "not equals".
*
- * This can be used to automatically detect changes to a `PangoLines`,
+ * This can be used to automatically detect changes to a `Pango2Lines`,
* and is useful for example to decide whether a layout needs redrawing.
*
* Return value: The current serial number of @lines
*/
guint
-pango_lines_get_serial (PangoLines *lines)
+pango2_lines_get_serial (Pango2Lines *lines)
{
return lines->serial;
}
/**
- * pango_lines_add_line:
- * @lines: a `PangoLines`
- * @line: (transfer full): the `PangoLine` to add
+ * pango2_lines_add_line:
+ * @lines: a `Pango2Lines`
+ * @line: (transfer full): the `Pango2Line` to add
* @line_x: X coordinate of the position
* @line_y: Y coordinate of the position
*
- * Adds a line to the `PangoLines`.
+ * Adds a line to the `Pango2Lines`.
*
* The coordinates are the position
* at which @line is placed.
@@ -282,10 +282,10 @@ pango_lines_get_serial (PangoLines *lines)
* Note that this function takes ownership of the line.
*/
void
-pango_lines_add_line (PangoLines *lines,
- PangoLine *line,
- int x_line,
- int y_line)
+pango2_lines_add_line (Pango2Lines *lines,
+ Pango2Line *line,
+ int x_line,
+ int y_line)
{
Position pos = { x_line, y_line };
@@ -303,8 +303,8 @@ pango_lines_add_line (PangoLines *lines,
}
/**
- * pango_lines_get_iter:
- * @lines: a `PangoLines`
+ * pango2_lines_get_iter:
+ * @lines: a `Pango2Lines`
*
* Returns an iterator to iterate over the visual extents of the lines.
*
@@ -314,51 +314,50 @@ pango_lines_add_line (PangoLines *lines,
*
* Note that the iter holds a reference to @lines.
*
- * Return value: the new `PangoLineIter`
+ * Return value: the new `Pango2LineIter`
*/
-PangoLineIter *
-pango_lines_get_iter (PangoLines *lines)
+Pango2LineIter *
+pango2_lines_get_iter (Pango2Lines *lines)
{
- return pango_line_iter_new (lines);
+ return pango2_line_iter_new (lines);
}
/**
- * pango_lines_get_line_count:
- * @lines: a `PangoLines`
+ * pango2_lines_get_line_count:
+ * @lines: a `Pango2Lines`
*
* Gets the number of lines in @lines.
*
* Returns: the number of lines'
*/
int
-pango_lines_get_line_count (PangoLines *lines)
+pango2_lines_get_line_count (Pango2Lines *lines)
{
return lines->lines->len;
}
/**
- * pango_lines_get_lines:
- * @lines: a `PangoLines`
+ * pango2_lines_get_lines:
+ * @lines: a `Pango2Lines`
*
* Gets the lines.
*
* The length of the returned array can be obtained with
- * [method@Pango.Lines.get_line_count].
+ * [method@Pango2.Lines.get_line_count].
*
* Returns: (transfer none): the array of lines
*/
-PangoLine **
-pango_lines_get_lines (PangoLines *lines)
+Pango2Line **
+pango2_lines_get_lines (Pango2Lines *lines)
{
- g_return_val_if_fail (PANGO_IS_LINES (lines), NULL);
+ g_return_val_if_fail (PANGO2_IS_LINES (lines), NULL);
- return (PangoLine **)lines->lines->pdata;
+ return (Pango2Line **)lines->lines->pdata;
}
/**
- * pango_lines_get_line_position:
- * pango_lines_get_lines:
- * @lines: a `PangoLines`
+ * pango2_lines_get_line_position:
+ * @lines: a `Pango2Lines`
* @num: the index of the line to get the position for
* @line_x: (out) (optional): return location for the X coordinate
* @line_y: (out) (optional): return location for the Y coordinate
@@ -366,14 +365,14 @@ pango_lines_get_lines (PangoLines *lines)
* Gets the position of a line.
*/
void
-pango_lines_get_line_position (PangoLines *lines,
- int num,
- int *line_x,
- int *line_y)
+pango2_lines_get_line_position (Pango2Lines *lines,
+ int num,
+ int *line_x,
+ int *line_y)
{
Position *pos;
- g_return_if_fail (PANGO_IS_LINES (lines));
+ g_return_if_fail (PANGO2_IS_LINES (lines));
if (num >= lines->lines->len)
return;
@@ -389,34 +388,34 @@ pango_lines_get_line_position (PangoLines *lines,
/* {{{ Miscellaneous */
/**
- * pango_lines_get_unknown_glyphs_count:
- * @lines: a `PangoLines` object
+ * pango2_lines_get_unknown_glyphs_count:
+ * @lines: a `Pango2Lines` object
*
- * Counts the number of unknown glyphs in the `PangoLines`
+ * Counts the number of unknown glyphs in the `Pango2Lines`
*
* This function can be used to determine if there are any fonts
* available to render all characters in a certain string, or when
- * used in combination with `PANGO_ATTR_FALLBACK`, to check if a
+ * used in combination with `PANGO2_ATTR_FALLBACK`, to check if a
* certain font supports all the characters in the string.
*
* Return value: The number of unknown glyphs in @lines
*/
int
-pango_lines_get_unknown_glyphs_count (PangoLines *lines)
+pango2_lines_get_unknown_glyphs_count (Pango2Lines *lines)
{
int count = 0;
for (int i = 0; i < lines->lines->len; i++)
{
- PangoLine *line = g_ptr_array_index (lines->lines, i);
+ Pango2Line *line = g_ptr_array_index (lines->lines, i);
for (GSList *l = line->runs; l; l = l->next)
{
- PangoGlyphItem *run = l->data;
+ Pango2GlyphItem *run = l->data;
for (int j = 0; j < run->glyphs->num_glyphs; j++)
{
- if (run->glyphs->glyphs[j].glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ if (run->glyphs->glyphs[j].glyph & PANGO2_GLYPH_UNKNOWN_FLAG)
count++;
}
}
@@ -426,20 +425,20 @@ pango_lines_get_unknown_glyphs_count (PangoLines *lines)
}
/**
- * pango_lines_is_wrapped:
- * @lines: a `PangoLines` object
+ * pango2_lines_is_wrapped:
+ * @lines: a `Pango2Lines` object
*
* Returns whether any of the lines is wrapped.
*
* Returns: `TRUE` if @lines is wrapped
*/
gboolean
-pango_lines_is_wrapped (PangoLines *lines)
+pango2_lines_is_wrapped (Pango2Lines *lines)
{
for (int i = 0; i < lines->lines->len; i++)
{
- PangoLine *line = g_ptr_array_index (lines->lines, i);
- if (pango_line_is_wrapped (line))
+ Pango2Line *line = g_ptr_array_index (lines->lines, i);
+ if (pango2_line_is_wrapped (line))
return TRUE;
}
@@ -447,20 +446,20 @@ pango_lines_is_wrapped (PangoLines *lines)
}
/**
- * pango_lines_is_ellipsized:
- * @lines: a `PangoLines` object
+ * pango2_lines_is_ellipsized:
+ * @lines: a `Pango2Lines` object
*
* Returns whether any of the lines is ellipsized.
*
* Returns: `TRUE` if @lines is ellipsized
*/
gboolean
-pango_lines_is_ellipsized (PangoLines *lines)
+pango2_lines_is_ellipsized (Pango2Lines *lines)
{
for (int i = 0; i < lines->lines->len; i++)
{
- PangoLine *line = g_ptr_array_index (lines->lines, i);
- if (pango_line_is_ellipsized (line))
+ Pango2Line *line = g_ptr_array_index (lines->lines, i);
+ if (pango2_line_is_ellipsized (line))
return TRUE;
}
@@ -468,20 +467,20 @@ pango_lines_is_ellipsized (PangoLines *lines)
}
/**
- * pango_lines_is_hyphenated:
- * @lines: a `PangoLines` object
+ * pango2_lines_is_hyphenated:
+ * @lines: a `Pango2Lines` object
*
* Returns whether any of the lines is hyphenated.
*
* Returns: `TRUE` if @lines is hyphenated
*/
gboolean
-pango_lines_is_hyphenated (PangoLines *lines)
+pango2_lines_is_hyphenated (Pango2Lines *lines)
{
for (int i = 0; i < lines->lines->len; i++)
{
- PangoLine *line = g_ptr_array_index (lines->lines, i);
- if (pango_line_is_hyphenated (line))
+ Pango2Line *line = g_ptr_array_index (lines->lines, i);
+ if (pango2_line_is_hyphenated (line))
return TRUE;
}
@@ -492,8 +491,8 @@ pango_lines_is_hyphenated (PangoLines *lines)
/* {{{ Extents */
/**
- * pango_lines_get_extents:
- * @lines: a `PangoLines` object
+ * pango2_lines_get_extents:
+ * @lines: a `Pango2Lines` object
* @ink_rect: (out) (optional): return location for the ink extents
* @logical_rect: (out) (optional): return location for the logical extents
*
@@ -505,29 +504,29 @@ pango_lines_is_hyphenated (PangoLines *lines)
* bug that shows up as right-to-left layouts not being correctly positioned
* in a layout with a set width.
*
- * The extents are given in layout coordinates and in Pango units; layout
+ * The extents are given in layout coordinates and in Pango2 units; layout
* coordinates begin at the top left corner.
*/
void
-pango_lines_get_extents (PangoLines *lines,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_lines_get_extents (Pango2Lines *lines,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
for (int i = 0; i < lines->lines->len; i++)
{
- PangoLine *line = g_ptr_array_index (lines->lines, i);
+ Pango2Line *line = g_ptr_array_index (lines->lines, i);
Position *pos = &g_array_index (lines->positions, Position, i);
- PangoRectangle line_ink;
- PangoRectangle line_logical;
- PangoLeadingTrim trim = PANGO_LEADING_TRIM_NONE;
+ Pango2Rectangle line_ink;
+ Pango2Rectangle line_logical;
+ Pango2LeadingTrim trim = PANGO2_LEADING_TRIM_NONE;
if (line->starts_paragraph)
- trim |= PANGO_LEADING_TRIM_START;
+ trim |= PANGO2_LEADING_TRIM_START;
if (line->ends_paragraph)
- trim |= PANGO_LEADING_TRIM_END;
+ trim |= PANGO2_LEADING_TRIM_END;
- pango_line_get_extents (line, &line_ink, NULL);
- pango_line_get_trimmed_extents (line, trim, &line_logical);
+ pango2_line_get_extents (line, &line_ink, NULL);
+ pango2_line_get_trimmed_extents (line, trim, &line_logical);
line_ink.x += pos->x;
line_ink.y += pos->y;
@@ -570,25 +569,25 @@ pango_lines_get_extents (PangoLines *lines,
}
/**
- * pango_lines_get_size:
- * @lines: a `PangoLines`
+ * pango2_lines_get_size:
+ * @lines: a `Pango2Lines`
* @width: (out) (optional): location to store the logical width
* @height: (out) (optional): location to store the logical height
*
- * Determines the logical width and height of a `PangoLines`
- * in Pango units.
+ * Determines the logical width and height of a `Pango2Lines`
+ * in Pango2 units.
*
* This is simply a convenience function around
- * [method@Pango.Lines.get_extents].
+ * [method@Pango2.Lines.get_extents].
*/
void
-pango_lines_get_size (PangoLines *lines,
- int *width,
- int *height)
+pango2_lines_get_size (Pango2Lines *lines,
+ int *width,
+ int *height)
{
- PangoRectangle ext;
+ Pango2Rectangle ext;
- pango_lines_get_extents (lines, NULL, &ext);
+ pango2_lines_get_extents (lines, NULL, &ext);
if (width)
*width = ext.width;
@@ -597,19 +596,19 @@ pango_lines_get_size (PangoLines *lines,
}
/**
- * pango_lines_get_baseline:
- * @lines: a `PangoLines` object
+ * pango2_lines_get_baseline:
+ * @lines: a `Pango2Lines` object
*
* Gets the Y position of baseline of the first line.
*
* Return value: baseline of first line
*/
int
-pango_lines_get_baseline (PangoLines *lines)
+pango2_lines_get_baseline (Pango2Lines *lines)
{
Position *pos;
- g_return_val_if_fail (PANGO_IS_LINES (lines), 0);
+ g_return_val_if_fail (PANGO2_IS_LINES (lines), 0);
if (lines->lines->len == 0)
return 0;
@@ -620,16 +619,16 @@ pango_lines_get_baseline (PangoLines *lines)
}
/**
- * pango_lines_get_x_ranges:
- * @lines: a `PangoLines` object
- * @line: the `PangoLine` in @lines whose x ranges will be reported
- * @start_line: (nullable): `PangoLine` wrt to which @start_index is
+ * pango2_lines_get_x_ranges:
+ * @lines: a `Pango2Lines` object
+ * @line: the `Pango2Line` in @lines whose x ranges will be reported
+ * @start_line: (nullable): `Pango2Line` wrt to which @start_index is
* interpreted or `NULL` for the first matching line
* @start_index: Start byte index of the logical range. If this value
* is less than the start index for the line, then the first range
* will extend all the way to the leading edge of the layout. Otherwise,
* it will start at the leading edge of the first character.
- * @end_line: (nullable): `PangoLine` wrt to which @end_index is
+ * @end_line: (nullable): `Pango2Line` wrt to which @end_index is
* interpreted or `NULL` for the first matching line
* @end_index: Ending byte index of the logical range. If this value is
* greater than the end index for the line, then the last range will
@@ -640,7 +639,7 @@ pango_lines_get_baseline (PangoLines *lines)
* `2*n_ranges`, with each range starting at `(*ranges)[2*n]` and of
* width `(*ranges)[2*n + 1] - (*ranges)[2*n]`. This array must be freed
* with [GLib.free]. The coordinates are relative to the layout and are in
- * Pango units.
+ * Pango2 units.
* @n_ranges: The number of ranges stored in @ranges
*
* Gets a list of visual ranges corresponding to a given logical range.
@@ -651,35 +650,35 @@ pango_lines_get_baseline (PangoLines *lines)
* layout, not with respect to the line.
*/
void
-pango_lines_get_x_ranges (PangoLines *lines,
- PangoLine *line,
- PangoLine *start_line,
- int start_index,
- PangoLine *end_line,
- int end_index,
- int **ranges,
- int *n_ranges)
+pango2_lines_get_x_ranges (Pango2Lines *lines,
+ Pango2Line *line,
+ Pango2Line *start_line,
+ int start_index,
+ Pango2Line *end_line,
+ int end_index,
+ int **ranges,
+ int *n_ranges)
{
int x_offset;
int line_no, start_line_no, end_line_no;
- PangoDirection dir;
+ Pango2Direction dir;
int range_count;
int width;
- PangoRectangle ext;
+ Pango2Rectangle ext;
int accumulated_width;
- g_return_if_fail (PANGO_IS_LINES (lines));
+ g_return_if_fail (PANGO2_IS_LINES (lines));
g_return_if_fail (ranges != NULL);
g_return_if_fail (n_ranges != NULL);
- pango_lines_index_to_line (lines, line->start_index, &line, &line_no, &x_offset, NULL);
+ pango2_lines_index_to_line (lines, line->start_index, &line, &line_no, &x_offset, NULL);
g_return_if_fail (line != NULL);
- pango_lines_index_to_line (lines, start_index, &start_line, &start_line_no, NULL, NULL);
+ pango2_lines_index_to_line (lines, start_index, &start_line, &start_line_no, NULL, NULL);
g_return_if_fail (start_line != NULL);
g_return_if_fail (start_line_no <= line_no);
- pango_lines_index_to_line (lines, end_index, &end_line, &end_line_no, NULL, NULL);
+ pango2_lines_index_to_line (lines, end_index, &end_line, &end_line_no, NULL, NULL);
g_return_if_fail (end_line != NULL);
g_return_if_fail (end_line_no >= line_no);
@@ -697,11 +696,11 @@ pango_lines_get_x_ranges (PangoLines *lines,
*ranges = g_new (int, 2 * (2 + g_slist_length (line->runs)));
range_count = 0;
- dir = pango_line_get_resolved_direction (line);
+ dir = pango2_line_get_resolved_direction (line);
if (x_offset > 0 &&
- ((dir == PANGO_DIRECTION_LTR && start_line_no < line_no) ||
- (dir == PANGO_DIRECTION_RTL && end_line_no > line_no)))
+ ((dir == PANGO2_DIRECTION_LTR && start_line_no < line_no) ||
+ (dir == PANGO2_DIRECTION_RTL && end_line_no > line_no)))
{
/* add range from left edge of layout to line start */
(*ranges)[2*range_count] = 0;
@@ -710,9 +709,9 @@ pango_lines_get_x_ranges (PangoLines *lines,
}
accumulated_width = 0;
- for (int i = 0; i < pango_line_get_run_count (line); i++)
+ for (int i = 0; i < pango2_line_get_run_count (line); i++)
{
- PangoGlyphItem *run = pango_run_get_glyph_item (pango_line_get_runs (line)[i]);
+ Pango2GlyphItem *run = pango2_run_get_glyph_item (pango2_line_get_runs (line)[i]);
if ((start_index < run->item->offset + run->item->length &&
end_index > run->item->offset))
@@ -732,20 +731,20 @@ pango_lines_get_x_ranges (PangoLines *lines,
attr_offset = run->item->char_offset;
- pango_glyph_string_index_to_x_full (run->glyphs,
- line->data->text + run->item->offset,
- run->item->length,
- &run->item->analysis,
- line->data->log_attrs + attr_offset,
- run_start_index - run->item->offset, FALSE,
- &run_start_x);
- pango_glyph_string_index_to_x_full (run->glyphs,
- line->data->text + run->item->offset,
- run->item->length,
- &run->item->analysis,
- line->data->log_attrs + attr_offset,
- run_end_index - run->item->offset, TRUE,
- &run_end_x);
+ pango2_glyph_string_index_to_x_full (run->glyphs,
+ line->data->text + run->item->offset,
+ run->item->length,
+ &run->item->analysis,
+ line->data->log_attrs + attr_offset,
+ run_start_index - run->item->offset, FALSE,
+ &run_start_x);
+ pango2_glyph_string_index_to_x_full (run->glyphs,
+ line->data->text + run->item->offset,
+ run->item->length,
+ &run->item->analysis,
+ line->data->log_attrs + attr_offset,
+ run_end_index - run->item->offset, TRUE,
+ &run_end_x);
(*ranges)[2*range_count] = x_offset + accumulated_width + MIN (run_start_x, run_end_x);
(*ranges)[2*range_count + 1] = x_offset + accumulated_width + MAX (run_start_x, run_end_x);
@@ -753,16 +752,16 @@ pango_lines_get_x_ranges (PangoLines *lines,
range_count++;
- if (i + 1 < pango_line_get_run_count (line))
- accumulated_width += pango_glyph_string_get_width (run->glyphs);
+ if (i + 1 < pango2_line_get_run_count (line))
+ accumulated_width += pango2_glyph_string_get_width (run->glyphs);
}
- pango_line_get_extents (line, NULL, &ext);
- pango_lines_get_size (lines, &width, NULL);
+ pango2_line_get_extents (line, NULL, &ext);
+ pango2_lines_get_size (lines, &width, NULL);
if (x_offset + ext.width < width &&
- ((dir == PANGO_DIRECTION_LTR && start_line_no < line_no) ||
- (dir == PANGO_DIRECTION_RTL && end_line_no > line_no)))
+ ((dir == PANGO2_DIRECTION_LTR && start_line_no < line_no) ||
+ (dir == PANGO2_DIRECTION_RTL && end_line_no > line_no)))
{
/* add range from line end to rigth edge of layout */
(*ranges)[2*range_count] = x_offset + ext.width;
@@ -777,8 +776,8 @@ pango_lines_get_x_ranges (PangoLines *lines,
/* { {{ Editing API */
/**
- * pango_lines_index_to_line:
- * @lines: a `PangoLines`
+ * pango2_lines_index_to_line:
+ * @lines: a `Pango2Lines`
* @idx: index in @lines
* @line: (inout): if *@line is `NULL`, the found line will be returned here
* @line_no: (out) (optional): return location for line number
@@ -799,23 +798,23 @@ pango_lines_get_x_ranges (PangoLines *lines,
* as *@line and use this function to find the line at @idx.
*/
void
-pango_lines_index_to_line (PangoLines *lines,
- int idx,
- PangoLine **line,
- int *line_no,
- int *x_offset,
- int *y_offset)
+pango2_lines_index_to_line (Pango2Lines *lines,
+ int idx,
+ Pango2Line **line,
+ int *line_no,
+ int *x_offset,
+ int *y_offset)
{
- PangoLine *found = NULL;
+ Pango2Line *found = NULL;
int num;
int i;
Position pos;
- g_return_if_fail (PANGO_IS_LINES (lines));
+ g_return_if_fail (PANGO2_IS_LINES (lines));
for (i = 0; i < lines->lines->len; i++)
{
- PangoLine *l = g_ptr_array_index (lines->lines, i);
+ Pango2Line *l = g_ptr_array_index (lines->lines, i);
if (l->start_index > idx && found)
break;
@@ -848,10 +847,10 @@ pango_lines_index_to_line (PangoLines *lines,
}
/**
- * pango_lines_pos_to_line:
- * @lines: a `PangoLines` object
- * @x: the X position (in Pango units)
- * @y: the Y position (in Pango units)
+ * pango2_lines_pos_to_line:
+ * @lines: a `Pango2Lines` object
+ * @x: the X position (in Pango2 units)
+ * @y: the Y position (in Pango2 units)
* @line_x: (out) (optional): return location for the X offset of the line
* @line_y: (out) (optional): return location for the Y offset of the line
*
@@ -862,22 +861,22 @@ pango_lines_index_to_line (PangoLines *lines,
* Returns: (transfer none) (nullable): the line that was found
*/
-PangoLine *
-pango_lines_pos_to_line (PangoLines *lines,
- int x,
- int y,
- int *line_x,
- int *line_y)
+Pango2Line *
+pango2_lines_pos_to_line (Pango2Lines *lines,
+ int x,
+ int y,
+ int *line_x,
+ int *line_y)
{
- g_return_val_if_fail (PANGO_IS_LINES (lines), FALSE);
+ g_return_val_if_fail (PANGO2_IS_LINES (lines), FALSE);
for (int i = 0; i < lines->lines->len; i++)
{
- PangoLine *line = g_ptr_array_index (lines->lines, i);
+ Pango2Line *line = g_ptr_array_index (lines->lines, i);
Position pos = g_array_index (lines->positions, Position, i);
- PangoRectangle ext;
+ Pango2Rectangle ext;
- pango_line_get_extents (line, NULL, &ext);
+ pango2_line_get_extents (line, NULL, &ext);
ext.x += pos.x;
ext.y += pos.y;
@@ -903,14 +902,14 @@ pango_lines_pos_to_line (PangoLines *lines,
}
/**
- * pango_lines_index_to_pos:
- * @lines: a `PangoLines` object
- * @line: (nullable): `PangoLine` wrt to which @idx is interpreted
+ * pango2_lines_index_to_pos:
+ * @lines: a `Pango2Lines` object
+ * @line: (nullable): `Pango2Line` wrt to which @idx is interpreted
* or `NULL` for the first matching line
* @idx: byte index within @line
* @pos: (out): rectangle in which to store the position of the grapheme
*
- * Converts from an index within a `PangoLine` to the
+ * Converts from an index within a `Pango2Line` to the
* position corresponding to the grapheme at that index.
*
* The return value is represented as rectangle. Note that `pos->x`
@@ -922,31 +921,31 @@ pango_lines_pos_to_line (PangoLines *lines,
* for the position off the end of the last line.
*/
void
-pango_lines_index_to_pos (PangoLines *lines,
- PangoLine *line,
- int idx,
- PangoRectangle *pos)
+pango2_lines_index_to_pos (Pango2Lines *lines,
+ Pango2Line *line,
+ int idx,
+ Pango2Rectangle *pos)
{
int x_offset, y_offset;
- g_return_if_fail (PANGO_IS_LINES (lines));
+ g_return_if_fail (PANGO2_IS_LINES (lines));
g_return_if_fail (idx >= 0);
g_return_if_fail (pos != NULL);
- pango_lines_index_to_line (lines, idx, &line, NULL, &x_offset, &y_offset);
+ pango2_lines_index_to_line (lines, idx, &line, NULL, &x_offset, &y_offset);
g_return_if_fail (line != NULL);
- pango_line_index_to_pos (line, idx, pos);
+ pango2_line_index_to_pos (line, idx, pos);
pos->x += x_offset;
pos->y += y_offset;
}
/**
- * pango_lines_pos_to_index:
- * @lines: a `PangoLines` object
- * @x: the X offset (in Pango units) from the left edge of the layout
- * @y: the Y offset (in Pango units) from the top edge of the layout
+ * pango2_lines_pos_to_index:
+ * @lines: a `Pango2Lines` object
+ * @x: the X offset (in Pango2 units) from the left edge of the layout
+ * @y: the Y offset (in Pango2 units) from the top edge of the layout
* @idx: (out): location to store calculated byte index
* @trailing: (out): location to store a integer indicating where
* in the grapheme the user clicked. It will either be zero, or the
@@ -958,23 +957,23 @@ pango_lines_index_to_pos (PangoLines *lines,
*
* Returns: (transfer none) (nullable): the line that was found
*/
-PangoLine *
-pango_lines_pos_to_index (PangoLines *lines,
- int x,
- int y,
- int *idx,
- int *trailing)
+Pango2Line *
+pango2_lines_pos_to_index (Pango2Lines *lines,
+ int x,
+ int y,
+ int *idx,
+ int *trailing)
{
- PangoLine *line;
+ Pango2Line *line;
int x_offset;
- g_return_val_if_fail (PANGO_IS_LINES (lines), FALSE);
+ g_return_val_if_fail (PANGO2_IS_LINES (lines), FALSE);
g_return_val_if_fail (idx != NULL, FALSE);
g_return_val_if_fail (trailing != NULL, FALSE);
- line = pango_lines_pos_to_line (lines, x, y, &x_offset, NULL);
+ line = pango2_lines_pos_to_line (lines, x, y, &x_offset, NULL);
if (line)
- pango_line_x_to_index (line, x - x_offset, idx, trailing);
+ pango2_line_x_to_index (line, x - x_offset, idx, trailing);
return line;
}
@@ -983,9 +982,9 @@ pango_lines_pos_to_index (PangoLines *lines,
/* {{{ Cursor positioning */
/**
- * pango_lines_get_cursor_pos:
- * @lines: a `PangoLines` object
- * @line: (nullable): `PangoLine` wrt to which @idx is interpreted
+ * pango2_lines_get_cursor_pos:
+ * @lines: a `Pango2Lines` object
+ * @line: (nullable): `Pango2Line` wrt to which @idx is interpreted
* or `NULL` for the first matching line
* @idx: the byte index of the cursor
* @strong_pos: (out) (optional): location to store the strong cursor position
@@ -1023,26 +1022,26 @@ pango_lines_pos_to_index (PangoLines *lines,
* will insert it at the end.
*/
void
-pango_lines_get_cursor_pos (PangoLines *lines,
- PangoLine *line,
- int idx,
- PangoRectangle *strong_pos,
- PangoRectangle *weak_pos)
+pango2_lines_get_cursor_pos (Pango2Lines *lines,
+ Pango2Line *line,
+ int idx,
+ Pango2Rectangle *strong_pos,
+ Pango2Rectangle *weak_pos)
{
int x_offset, y_offset;
- PangoLine *l;
+ Pango2Line *l;
- g_return_if_fail (PANGO_IS_LINES (lines));
+ g_return_if_fail (PANGO2_IS_LINES (lines));
l = line;
- pango_lines_index_to_line (lines, idx, &l, NULL, &x_offset, &y_offset);
+ pango2_lines_index_to_line (lines, idx, &l, NULL, &x_offset, &y_offset);
g_return_if_fail (l != NULL);
g_return_if_fail (line == NULL || l == line);
line = l;
- pango_line_get_cursor_pos (line, idx, strong_pos, weak_pos);
+ pango2_line_get_cursor_pos (line, idx, strong_pos, weak_pos);
if (strong_pos)
{
@@ -1057,9 +1056,9 @@ pango_lines_get_cursor_pos (PangoLines *lines,
}
/**
- * pango_lines_get_caret_pos:
- * @lines: a `PangoLines` object
- * @line: (nullable): `PangoLine` wrt to which @idx is interpreted
+ * pango2_lines_get_caret_pos:
+ * @lines: a `Pango2Lines` object
+ * @line: (nullable): `Pango2Line` wrt to which @idx is interpreted
* or `NULL` for the first matching line
* @idx: the byte index of the cursor
* @strong_pos: (out) (optional): location to store the strong cursor position
@@ -1071,7 +1070,7 @@ pango_lines_get_cursor_pos (PangoLines *lines,
* Note that @idx is allowed to be @line->start_index + @line->length
* for the position off the end of the last line.
*
- * This is a variant of [method@Pango.Lines.get_cursor_pos] that applies
+ * This is a variant of [method@Pango2.Lines.get_cursor_pos] that applies
* font metric information about caret slope and offset to the positions
* it returns.
*
@@ -1081,21 +1080,21 @@ pango_lines_get_cursor_pos (PangoLines *lines,
* </picture>
*/
void
-pango_lines_get_caret_pos (PangoLines *lines,
- PangoLine *line,
- int idx,
- PangoRectangle *strong_pos,
- PangoRectangle *weak_pos)
+pango2_lines_get_caret_pos (Pango2Lines *lines,
+ Pango2Line *line,
+ int idx,
+ Pango2Rectangle *strong_pos,
+ Pango2Rectangle *weak_pos)
{
int x_offset, y_offset;
- g_return_if_fail (PANGO_IS_LINES (lines));
+ g_return_if_fail (PANGO2_IS_LINES (lines));
- pango_lines_index_to_line (lines, idx, &line, NULL, &x_offset, &y_offset);
+ pango2_lines_index_to_line (lines, idx, &line, NULL, &x_offset, &y_offset);
g_return_if_fail (line != NULL);
- pango_line_get_caret_pos (line, idx, strong_pos, weak_pos);
+ pango2_line_get_caret_pos (line, idx, strong_pos, weak_pos);
if (strong_pos)
{
@@ -1110,12 +1109,12 @@ pango_lines_get_caret_pos (PangoLines *lines,
}
/**
- * pango_lines_move_cursor:
- * @lines: a `PangoLines` object
+ * pango2_lines_move_cursor:
+ * @lines: a `Pango2Lines` object
* @strong: whether the moving cursor is the strong cursor or the
* weak cursor. The strong cursor is the cursor corresponding
* to text insertion in the base direction for the layout.
- * @line: (nullable): `PangoLine` wrt to which @idx is interpreted
+ * @line: (nullable): `Pango2Line` wrt to which @idx is interpreted
* or `NULL` for the first matching line
* @idx: the byte index of the current cursor position
* @trailing: if 0, the cursor was at the leading edge of the
@@ -1123,7 +1122,7 @@ pango_lines_get_caret_pos (PangoLines *lines,
* was at the trailing edge.
* @direction: direction to move cursor. A negative
* value indicates motion to the left
- * @new_line: (nullable): `PangoLine` wrt to which @new_idx is interpreted
+ * @new_line: (nullable): `Pango2Line` wrt to which @new_idx is interpreted
* @new_idx: (out): location to store the new cursor byte index
* A value of -1 indicates that the cursor has been moved off the
* beginning of the layout. A value of %G_MAXINT indicates that
@@ -1152,15 +1151,15 @@ pango_lines_get_caret_pos (PangoLines *lines,
* when multiple characters combine to form a single grapheme.
*/
void
-pango_lines_move_cursor (PangoLines *lines,
- gboolean strong,
- PangoLine *line,
- int idx,
- int trailing,
- int direction,
- PangoLine **new_line,
- int *new_idx,
- int *new_trailing)
+pango2_lines_move_cursor (Pango2Lines *lines,
+ gboolean strong,
+ Pango2Line *line,
+ int idx,
+ int trailing,
+ int direction,
+ Pango2Line **new_line,
+ int *new_idx,
+ int *new_trailing)
{
int line_no;
GArray *cursors;
@@ -1169,10 +1168,10 @@ pango_lines_move_cursor (PangoLines *lines,
int start_offset;
gboolean off_start = FALSE;
gboolean off_end = FALSE;
- PangoRectangle pos;
+ Pango2Rectangle pos;
int j;
- g_return_if_fail (PANGO_IS_LINES (lines));
+ g_return_if_fail (PANGO2_IS_LINES (lines));
g_return_if_fail (idx >= 0);
g_return_if_fail (trailing >= 0);
g_return_if_fail (new_idx != NULL);
@@ -1180,7 +1179,7 @@ pango_lines_move_cursor (PangoLines *lines,
direction = (direction >= 0 ? 1 : -1);
- pango_lines_index_to_line (lines, idx, &line, &line_no, NULL, NULL);
+ pango2_lines_index_to_line (lines, idx, &line, &line_no, NULL, NULL);
g_return_if_fail (line != NULL);
@@ -1192,9 +1191,9 @@ pango_lines_move_cursor (PangoLines *lines,
idx = line->start_index + line->length;
cursors = g_array_new (FALSE, FALSE, sizeof (CursorPos));
- pango_line_get_cursors (lines, line, strong, cursors);
+ pango2_line_get_cursors (lines, line, strong, cursors);
- pango_lines_get_cursor_pos (lines, line, idx, strong ? &pos : NULL, strong ? NULL : &pos);
+ pango2_lines_get_cursor_pos (lines, line, idx, strong ? &pos : NULL, strong ? NULL : &pos);
vis_pos = -1;
for (j = 0; j < cursors->len; j++)
@@ -1214,14 +1213,14 @@ pango_lines_move_cursor (PangoLines *lines,
if (vis_pos == -1 &&
idx == line->start_index + line->length)
{
- if (line->direction == PANGO_DIRECTION_LTR)
+ if (line->direction == PANGO2_DIRECTION_LTR)
vis_pos = cursors->len;
else
vis_pos = 0;
}
/* Handling movement between lines */
- if (line->direction == PANGO_DIRECTION_LTR)
+ if (line->direction == PANGO2_DIRECTION_LTR)
{
if (idx == line->start_index && direction < 0)
off_start = TRUE;
@@ -1276,7 +1275,7 @@ pango_lines_move_cursor (PangoLines *lines,
}
g_array_set_size (cursors, 0);
- pango_line_get_cursors (lines, line, strong, cursors);
+ pango2_line_get_cursors (lines, line, strong, cursors);
n_vis = cursors->len;
diff --git a/pango/pango-lines.h b/pango/pango-lines.h
index 77871565..83abaa97 100644
--- a/pango/pango-lines.h
+++ b/pango/pango-lines.h
@@ -26,129 +26,129 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_LINES pango_lines_get_type ()
-
-PANGO_AVAILABLE_IN_ALL
-G_DECLARE_FINAL_TYPE (PangoLines, pango_lines, PANGO, LINES, GObject);
-
-PANGO_AVAILABLE_IN_ALL
-PangoLines * pango_lines_new (void);
-
-PANGO_AVAILABLE_IN_ALL
-guint pango_lines_get_serial (PangoLines *lines);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_lines_add_line (PangoLines *lines,
- PangoLine *line,
- int line_x,
- int line_y);
-
-PANGO_AVAILABLE_IN_ALL
-int pango_lines_get_line_count (PangoLines *lines);
-
-PANGO_AVAILABLE_IN_ALL
-PangoLine ** pango_lines_get_lines (PangoLines *lines);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_lines_get_line_position
- (PangoLines *lines,
- int num,
- int *line_x,
- int *line_y);
-
-PANGO_AVAILABLE_IN_ALL
-PangoLineIter * pango_lines_get_iter (PangoLines *lines);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_lines_get_extents (PangoLines *lines,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_lines_get_size (PangoLines *lines,
- int *width,
- int *height);
-
-PANGO_AVAILABLE_IN_ALL
-int pango_lines_get_baseline (PangoLines *lines);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_lines_get_x_ranges (PangoLines *lines,
- PangoLine *line,
- PangoLine *start_line,
- int start_index,
- PangoLine *end_line,
- int end_index,
- int **ranges,
- int *n_ranges);
-
-PANGO_AVAILABLE_IN_ALL
-int pango_lines_get_unknown_glyphs_count
- (PangoLines *lines);
-
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_lines_is_wrapped (PangoLines *lines);
-
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_lines_is_ellipsized (PangoLines *lines);
-
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_lines_is_hyphenated (PangoLines *lines);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_lines_index_to_line (PangoLines *lines,
- int idx,
- PangoLine **line,
- int *line_no,
- int *x_offset,
- int *y_offset);
-
-PANGO_AVAILABLE_IN_ALL
-PangoLine * pango_lines_pos_to_line (PangoLines *lines,
- int x,
- int y,
- int *line_x,
- int *line_y);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_lines_index_to_pos (PangoLines *lines,
- PangoLine *line,
- int idx,
- PangoRectangle *pos);
-
-PANGO_AVAILABLE_IN_ALL
-PangoLine * pango_lines_pos_to_index (PangoLines *lines,
- int x,
- int y,
- int *idx,
- int *trailing);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_lines_get_cursor_pos (PangoLines *lines,
- PangoLine *line,
- int idx,
- PangoRectangle *strong_pos,
- PangoRectangle *weak_pos);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_lines_get_caret_pos (PangoLines *lines,
- PangoLine *line,
- int idx,
- PangoRectangle *strong_pos,
- PangoRectangle *weak_pos);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_lines_move_cursor (PangoLines *lines,
- gboolean strong,
- PangoLine *line,
- int idx,
- int trailing,
- int direction,
- PangoLine **new_line,
- int *new_idx,
- int *new_trailing);
-
-PANGO_AVAILABLE_IN_ALL
-GBytes * pango_lines_serialize (PangoLines *lines);
+#define PANGO2_TYPE_LINES pango2_lines_get_type ()
+
+PANGO2_AVAILABLE_IN_ALL
+G_DECLARE_FINAL_TYPE (Pango2Lines, pango2_lines, PANGO2, LINES, GObject);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Lines * pango2_lines_new (void);
+
+PANGO2_AVAILABLE_IN_ALL
+guint pango2_lines_get_serial (Pango2Lines *lines);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_lines_add_line (Pango2Lines *lines,
+ Pango2Line *line,
+ int line_x,
+ int line_y);
+
+PANGO2_AVAILABLE_IN_ALL
+int pango2_lines_get_line_count (Pango2Lines *lines);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Line ** pango2_lines_get_lines (Pango2Lines *lines);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_lines_get_line_position
+ (Pango2Lines *lines,
+ int num,
+ int *line_x,
+ int *line_y);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2LineIter * pango2_lines_get_iter (Pango2Lines *lines);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_lines_get_extents (Pango2Lines *lines,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_lines_get_size (Pango2Lines *lines,
+ int *width,
+ int *height);
+
+PANGO2_AVAILABLE_IN_ALL
+int pango2_lines_get_baseline (Pango2Lines *lines);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_lines_get_x_ranges (Pango2Lines *lines,
+ Pango2Line *line,
+ Pango2Line *start_line,
+ int start_index,
+ Pango2Line *end_line,
+ int end_index,
+ int **ranges,
+ int *n_ranges);
+
+PANGO2_AVAILABLE_IN_ALL
+int pango2_lines_get_unknown_glyphs_count
+ (Pango2Lines *lines);
+
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_lines_is_wrapped (Pango2Lines *lines);
+
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_lines_is_ellipsized (Pango2Lines *lines);
+
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_lines_is_hyphenated (Pango2Lines *lines);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_lines_index_to_line (Pango2Lines *lines,
+ int idx,
+ Pango2Line **line,
+ int *line_no,
+ int *x_offset,
+ int *y_offset);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Line * pango2_lines_pos_to_line (Pango2Lines *lines,
+ int x,
+ int y,
+ int *line_x,
+ int *line_y);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_lines_index_to_pos (Pango2Lines *lines,
+ Pango2Line *line,
+ int idx,
+ Pango2Rectangle *pos);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Line * pango2_lines_pos_to_index (Pango2Lines *lines,
+ int x,
+ int y,
+ int *idx,
+ int *trailing);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_lines_get_cursor_pos (Pango2Lines *lines,
+ Pango2Line *line,
+ int idx,
+ Pango2Rectangle *strong_pos,
+ Pango2Rectangle *weak_pos);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_lines_get_caret_pos (Pango2Lines *lines,
+ Pango2Line *line,
+ int idx,
+ Pango2Rectangle *strong_pos,
+ Pango2Rectangle *weak_pos);
+
+PANGO2_AVAILABLE_IN_ALL
+void pango2_lines_move_cursor (Pango2Lines *lines,
+ gboolean strong,
+ Pango2Line *line,
+ int idx,
+ int trailing,
+ int direction,
+ Pango2Line **new_line,
+ int *new_idx,
+ int *new_trailing);
+
+PANGO2_AVAILABLE_IN_ALL
+GBytes * pango2_lines_serialize (Pango2Lines *lines);
G_END_DECLS
diff --git a/pango/pango-markup.c b/pango/pango-markup.c
index 6b1a3398..c03196e8 100644
--- a/pango/pango-markup.c
+++ b/pango/pango-markup.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-markup.c: Parse markup into attributed text
*
* Copyright (C) 2000 Red Hat Software
@@ -33,9 +33,6 @@
#include "pango-impl-utils.h"
#include "pango-font-description-private.h"
-/* FIXME */
-#define _(x) x
-
/* CSS size levels */
typedef enum
{
@@ -52,7 +49,7 @@ typedef struct _MarkupData MarkupData;
struct _MarkupData
{
- PangoAttrList *attr_list;
+ Pango2AttrList *attr_list;
GString *text;
GSList *tag_stack;
gsize index;
@@ -160,7 +157,7 @@ static gboolean u_parse_func (MarkupData *md,
GError **error);
static gboolean
-_pango_scan_int (const char **pos, int *out)
+_pango2_scan_int (const char **pos, int *out)
{
char *end;
long temp;
@@ -210,7 +207,7 @@ parse_int (const char *word,
}
static gboolean
-_pango_parse_enum (GType type,
+_pango2_parse_enum (GType type,
const char *str,
int *value,
gboolean warn,
@@ -264,10 +261,10 @@ _pango_parse_enum (GType type,
}
static gboolean
-pango_parse_flags (GType type,
- const char *str,
- int *value,
- char **possible_values)
+pango2_parse_flags (GType type,
+ const char *str,
+ int *value,
+ char **possible_values)
{
GFlagsClass *class = NULL;
gboolean ret = TRUE;
@@ -360,7 +357,7 @@ scale_factor (int scale_level, double base)
static void
open_tag_free (OpenTag *ot)
{
- g_slist_foreach (ot->attrs, (GFunc) pango_attribute_destroy, NULL);
+ g_slist_foreach (ot->attrs, (GFunc) pango2_attribute_destroy, NULL);
g_slist_free (ot->attrs);
g_slice_free (OpenTag, ot);
}
@@ -444,7 +441,7 @@ markup_data_close_tag (MarkupData *md)
tmp_list = ot->attrs;
while (tmp_list != NULL)
{
- PangoAttribute *a = tmp_list->data;
+ Pango2Attribute *a = tmp_list->data;
a->start_index = ot->start_index;
a->end_index = md->index;
@@ -459,7 +456,7 @@ markup_data_close_tag (MarkupData *md)
/* We affected relative font size; create an appropriate
* attribute and reverse our effects on the current level
*/
- PangoAttribute *a;
+ Pango2Attribute *a;
if (ot->has_base_font_size)
{
@@ -472,14 +469,14 @@ markup_data_close_tag (MarkupData *md)
volatile double size;
size = scale_factor (ot->scale_level, 1.0) * ot->base_font_size;
- a = pango_attr_size_new (size);
+ a = pango2_attr_size_new (size);
}
else
{
/* Create a font using the current scale factor
* as the base size to be scaled from
*/
- a = pango_attr_scale_new (scale_factor (ot->scale_level,
+ a = pango2_attr_scale_new (scale_factor (ot->scale_level,
ot->base_scale_factor));
}
@@ -560,7 +557,7 @@ start_element_handler (GMarkupParseContext *context,
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_UNKNOWN_ELEMENT,
- _("Unknown tag '%s' on line %d char %d"),
+ "Unknown tag '%s' on line %d char %d",
element_name,
line_number, char_number);
@@ -665,9 +662,9 @@ text_handler (GMarkupParseContext *context G_GNUC_UNUSED,
if (md->attr_list != NULL)
{
/* Add the underline indicating the accelerator */
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- attr = pango_attr_underline_new (PANGO_LINE_STYLE_SOLID);
+ attr = pango2_attr_underline_new (PANGO2_LINE_STYLE_SOLID);
uline_index = md->index;
uline_len = g_utf8_next_char (p) - p;
@@ -675,14 +672,14 @@ text_handler (GMarkupParseContext *context G_GNUC_UNUSED,
attr->start_index = uline_index;
attr->end_index = uline_index + uline_len;
- pango_attr_list_change (md->attr_list, attr);
+ pango2_attr_list_change (md->attr_list, attr);
- attr = pango_attr_underline_position_new (PANGO_UNDERLINE_POSITION_UNDER);
+ attr = pango2_attr_underline_position_new (PANGO2_UNDERLINE_POSITION_UNDER);
attr->start_index = uline_index;
attr->end_index = uline_index + uline_len;
- pango_attr_list_change (md->attr_list, attr);
+ pango2_attr_list_change (md->attr_list, attr);
}
/* set next range_start to include this char */
@@ -713,7 +710,7 @@ xml_isspace (char c)
return c == ' ' || c == '\t' || c == '\n' || c == '\r';
}
-static const GMarkupParser pango_markup_parser = {
+static const GMarkupParser pango2_markup_parser = {
start_element_handler,
end_element_handler,
text_handler,
@@ -725,20 +722,20 @@ static void
destroy_markup_data (MarkupData *md)
{
g_slist_free_full (md->tag_stack, (GDestroyNotify) open_tag_free);
- g_slist_free_full (md->to_apply, (GDestroyNotify) pango_attribute_destroy);
+ g_slist_free_full (md->to_apply, (GDestroyNotify) pango2_attribute_destroy);
if (md->text)
g_string_free (md->text, TRUE);
if (md->attr_list)
- pango_attr_list_unref (md->attr_list);
+ pango2_attr_list_unref (md->attr_list);
g_slice_free (MarkupData, md);
}
static GMarkupParseContext *
-pango_markup_parser_new_internal (char accel_marker,
- GError **error,
- gboolean want_attr_list)
+pango2_markup_parser_new_internal (char accel_marker,
+ GError **error,
+ gboolean want_attr_list)
{
MarkupData *md;
GMarkupParseContext *context;
@@ -750,7 +747,7 @@ pango_markup_parser_new_internal (char accel_marker,
* some markup.
*/
if (want_attr_list)
- md->attr_list = pango_attr_list_new ();
+ md->attr_list = pango2_attr_list_new ();
else
md->attr_list = NULL;
@@ -763,7 +760,7 @@ pango_markup_parser_new_internal (char accel_marker,
md->tag_stack = NULL;
md->to_apply = NULL;
- context = g_markup_parse_context_new (&pango_markup_parser,
+ context = g_markup_parse_context_new (&pango2_markup_parser,
0, md,
(GDestroyNotify)destroy_markup_data);
@@ -774,24 +771,24 @@ pango_markup_parser_new_internal (char accel_marker,
}
/**
- * pango_parse_markup:
- * @markup_text: markup to parse (see the [Pango Markup](pango_markup.html) docs)
+ * pango2_parse_markup:
+ * @markup_text: markup to parse (see the [Pango2 Markup](pango2_markup.html) docs)
* @length: length of @markup_text, or -1 if nul-terminated
* @accel_marker: character that precedes an accelerator, or 0 for none
- * @attr_list: (out) (optional): address of return location for a `PangoAttrList`
+ * @attr_list: (out) (optional): address of return location for a `Pango2AttrList`
* @text: (out) (optional): address of return location for text with tags stripped
* @accel_char: (out) (optional): address of return location for accelerator char
* @error: address of return location for errors
*
* Parses marked-up text to create a plain-text string and an attribute list.
*
- * See the [Pango Markup](pango_markup.html) docs for details about the
+ * See the [Pango2 Markup](pango2_markup.html) docs for details about the
* supported markup.
*
* If @accel_marker is nonzero, the given character will mark the
* character following it as an accelerator. For example, @accel_marker
* might be an ampersand or underscore. All characters marked
- * as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute,
+ * as an accelerator will receive a %PANGO2_UNDERLINE_LOW attribute,
* and the first character so marked will be returned in @accel_char.
* Two @accel_marker characters following each other produce a single
* literal @accel_marker character.
@@ -804,13 +801,13 @@ pango_markup_parser_new_internal (char accel_marker,
* Return value: %FALSE if @error is set, otherwise %TRUE
**/
gboolean
-pango_parse_markup (const char *markup_text,
- int length,
- gunichar accel_marker,
- PangoAttrList **attr_list,
- char **text,
- gunichar *accel_char,
- GError **error)
+pango2_parse_markup (const char *markup_text,
+ int length,
+ gunichar accel_marker,
+ Pango2AttrList **attr_list,
+ char **text,
+ gunichar *accel_char,
+ GError **error)
{
GMarkupParseContext *context = NULL;
gboolean ret = FALSE;
@@ -827,9 +824,9 @@ pango_parse_markup (const char *markup_text,
while (p != end && xml_isspace (*p))
++p;
- context = pango_markup_parser_new_internal (accel_marker,
- error,
- (attr_list != NULL));
+ context = pango2_markup_parser_new_internal (accel_marker,
+ error,
+ (attr_list != NULL));
if (!g_markup_parse_context_parse (context,
markup_text,
@@ -837,11 +834,11 @@ pango_parse_markup (const char *markup_text,
error))
goto out;
- if (!pango_markup_parser_finish (context,
- attr_list,
- text,
- accel_char,
- error))
+ if (!pango2_markup_parser_finish (context,
+ attr_list,
+ text,
+ accel_char,
+ error))
goto out;
ret = TRUE;
@@ -853,19 +850,19 @@ pango_parse_markup (const char *markup_text,
}
/**
- * pango_markup_parser_new:
+ * pango2_markup_parser_new:
* @accel_marker: character that precedes an accelerator, or 0 for none
*
* Incrementally parses marked-up text to create a plain-text string
* and an attribute list.
*
- * See the [Pango Markup](pango_markup.html) docs for details about the
+ * See the [Pango2 Markup](pango2_markup.html) docs for details about the
* supported markup.
*
* If @accel_marker is nonzero, the given character will mark the
* character following it as an accelerator. For example, @accel_marker
* might be an ampersand or underscore. All characters marked
- * as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute,
+ * as an accelerator will receive a %PANGO2_UNDERLINE_LOW attribute,
* and the first character so marked will be returned in @accel_char,
* when calling [func@markup_parser_finish]. Two @accel_marker characters
* following each other produce a single literal @accel_marker character.
@@ -875,30 +872,30 @@ pango_parse_markup (const char *markup_text,
* to the parser, use [func@markup_parser_finish] to get the data out
* of it, and then use [method@GLib.MarkupParseContext.free] to free it.
*
- * This function is designed for applications that read Pango markup
- * from streams. To simply parse a string containing Pango markup,
- * the [func@Pango.parse_markup] API is recommended instead.
+ * This function is designed for applications that read Pango2 markup
+ * from streams. To simply parse a string containing Pango2 markup,
+ * the [func@Pango2.parse_markup] API is recommended instead.
*
* Return value: (transfer none): a `GMarkupParseContext` that should be
* destroyed with [method@GLib.MarkupParseContext.free].
**/
GMarkupParseContext *
-pango_markup_parser_new (gunichar accel_marker)
+pango2_markup_parser_new (gunichar accel_marker)
{
- return pango_markup_parser_new_internal (accel_marker, NULL, TRUE);
+ return pango2_markup_parser_new_internal (accel_marker, NULL, TRUE);
}
/**
- * pango_markup_parser_finish:
+ * pango2_markup_parser_finish:
* @context: A valid parse context that was returned from [func@markup_parser_new]
- * @attr_list: (out) (optional): address of return location for a `PangoAttrList`
+ * @attr_list: (out) (optional): address of return location for a `Pango2AttrList`
* @text: (out) (optional): address of return location for text with tags stripped
* @accel_char: (out) (optional): address of return location for accelerator char
* @error: address of return location for errors
*
* Finishes parsing markup.
*
- * After feeding a Pango markup parser some data with [method@GLib.MarkupParseContext.parse],
+ * After feeding a Pango2 markup parser some data with [method@GLib.MarkupParseContext.parse],
* use this function to get the list of attributes and text out of the
* markup. This function will not free @context, use [method@GLib.MarkupParseContext.free]
* to do so.
@@ -906,11 +903,11 @@ pango_markup_parser_new (gunichar accel_marker)
* Return value: %FALSE if @error is set, otherwise %TRUE
*/
gboolean
-pango_markup_parser_finish (GMarkupParseContext *context,
- PangoAttrList **attr_list,
- char **text,
- gunichar *accel_char,
- GError **error)
+pango2_markup_parser_finish (GMarkupParseContext *context,
+ Pango2AttrList **attr_list,
+ char **text,
+ gunichar *accel_char,
+ GError **error)
{
gboolean ret = FALSE;
MarkupData *md = g_markup_parse_context_get_user_data (context);
@@ -933,10 +930,10 @@ pango_markup_parser_finish (GMarkupParseContext *context,
tmp_list = md->to_apply;
while (tmp_list != NULL)
{
- PangoAttribute *attr = tmp_list->data;
+ Pango2Attribute *attr = tmp_list->data;
/* Innermost tags before outermost */
- pango_attr_list_insert (md->attr_list, attr);
+ pango2_attr_list_insert (md->attr_list, attr);
tmp_list = g_slist_next (tmp_list);
}
@@ -967,10 +964,10 @@ pango_markup_parser_finish (GMarkupParseContext *context,
}
static void
-set_bad_attribute (GError **error,
- GMarkupParseContext *context,
- const char *element_name,
- const char *attribute_name)
+set_bad_attribute (GError **error,
+ GMarkupParseContext *context,
+ const char *element_name,
+ const char *attribute_name)
{
int line_number, char_number;
@@ -980,18 +977,18 @@ set_bad_attribute (GError **error,
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
- _("Tag '%s' does not support attribute '%s' on line %d char %d"),
+ "Tag '%s' does not support attribute '%s' on line %d char %d",
element_name,
attribute_name,
line_number, char_number);
}
static void
-add_attribute (OpenTag *ot,
- PangoAttribute *attr)
+add_attribute (OpenTag *ot,
+ Pango2Attribute *attr)
{
if (ot == NULL)
- pango_attribute_destroy (attr);
+ pango2_attribute_destroy (attr);
else
ot->attrs = g_slist_prepend (ot->attrs, attr);
}
@@ -1003,25 +1000,25 @@ add_attribute (OpenTag *ot,
} }G_STMT_END
static gboolean
-b_parse_func (MarkupData *md G_GNUC_UNUSED,
- OpenTag *tag,
- const char **names,
- const char **values G_GNUC_UNUSED,
- GMarkupParseContext *context,
- GError **error)
+b_parse_func (MarkupData *md G_GNUC_UNUSED,
+ OpenTag *tag,
+ const char **names,
+ const char **values G_GNUC_UNUSED,
+ GMarkupParseContext *context,
+ GError **error)
{
CHECK_NO_ATTRS("b");
- add_attribute (tag, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
+ add_attribute (tag, pango2_attr_weight_new (PANGO2_WEIGHT_BOLD));
return TRUE;
}
static gboolean
-big_parse_func (MarkupData *md G_GNUC_UNUSED,
- OpenTag *tag,
- const char **names,
- const char **values G_GNUC_UNUSED,
- GMarkupParseContext *context,
- GError **error)
+big_parse_func (MarkupData *md G_GNUC_UNUSED,
+ OpenTag *tag,
+ const char **names,
+ const char **values G_GNUC_UNUSED,
+ GMarkupParseContext *context,
+ GError **error)
{
CHECK_NO_ATTRS("big");
@@ -1053,8 +1050,8 @@ parse_percentage (const char *input,
}
static gboolean
-parse_absolute_size (OpenTag *tag,
- const char *size)
+parse_absolute_size (OpenTag *tag,
+ const char *size)
{
SizeLevel level = Medium;
double val;
@@ -1088,7 +1085,7 @@ parse_absolute_size (OpenTag *tag,
factor = scale_factor (level, 1.0);
done:
- add_attribute (tag, pango_attr_scale_new (factor));
+ add_attribute (tag, pango2_attr_scale_new (factor));
if (tag)
open_tag_set_absolute_font_scale (tag, factor);
@@ -1128,22 +1125,22 @@ attr_strcmp (gconstpointer pa,
}
static gboolean
-span_parse_int (const char *attr_name,
- const char *attr_val,
- int *val,
- int line_number,
- GError **error)
+span_parse_int (const char *attr_name,
+ const char *attr_val,
+ int *val,
+ int line_number,
+ GError **error)
{
const char *end = attr_val;
- if (!_pango_scan_int (&end, val) || *end != '\0')
+ if (!_pango2_scan_int (&end, val) || *end != '\0')
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("Value of '%s' attribute on <span> tag "
- "on line %d could not be parsed; "
- "should be an integer, not '%s'"),
+ "Value of '%s' attribute on <span> tag "
+ "on line %d could not be parsed; "
+ "should be an integer, not '%s'",
attr_name, line_number, attr_val);
return FALSE;
}
@@ -1164,9 +1161,9 @@ span_parse_float (const char *attr_name,
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("Value of '%s' attribute on <span> tag "
- "on line %d could not be parsed; "
- "should be a number, not '%s'"),
+ "Value of '%s' attribute on <span> tag "
+ "on line %d could not be parsed; "
+ "should be a number, not '%s'",
attr_name, line_number, attr_val);
return FALSE;
}
@@ -1175,11 +1172,11 @@ span_parse_float (const char *attr_name,
}
static gboolean
-span_parse_boolean (const char *attr_name,
- const char *attr_val,
- gboolean *val,
- int line_number,
- GError **error)
+span_parse_boolean (const char *attr_name,
+ const char *attr_val,
+ gboolean *val,
+ int line_number,
+ GError **error)
{
if (strcmp (attr_val, "true") == 0 ||
strcmp (attr_val, "yes") == 0 ||
@@ -1196,9 +1193,9 @@ span_parse_boolean (const char *attr_name,
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("Value of '%s' attribute on <span> tag "
- "line %d should have one of "
- "'true/yes/t/y' or 'false/no/f/n': '%s' is not valid"),
+ "Value of '%s' attribute on <span> tag "
+ "line %d should have one of "
+ "'true/yes/t/y' or 'false/no/f/n': '%s' is not valid",
attr_name, line_number, attr_val);
return FALSE;
}
@@ -1207,20 +1204,20 @@ span_parse_boolean (const char *attr_name,
}
static gboolean
-span_parse_color (const char *attr_name,
- const char *attr_val,
- PangoColor *color,
- int line_number,
- GError **error)
+span_parse_color (const char *attr_name,
+ const char *attr_val,
+ Pango2Color *color,
+ int line_number,
+ GError **error)
{
- if (!pango_color_parse (color, attr_val))
+ if (!pango2_color_parse (color, attr_val))
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("Value of '%s' attribute on <span> tag "
- "on line %d could not be parsed; "
- "should be a color specification, not '%s'"),
+ "Value of '%s' attribute on <span> tag "
+ "on line %d could not be parsed; "
+ "should be a color specification, not '%s'",
attr_name, line_number, attr_val);
return FALSE;
}
@@ -1229,23 +1226,23 @@ span_parse_color (const char *attr_name,
}
static gboolean
-span_parse_enum (const char *attr_name,
- const char *attr_val,
- GType type,
- int *val,
- int line_number,
- GError **error)
+span_parse_enum (const char *attr_name,
+ const char *attr_val,
+ GType type,
+ int *val,
+ int line_number,
+ GError **error)
{
char *possible_values = NULL;
- if (!_pango_parse_enum (type, attr_val, val, FALSE, &possible_values))
+ if (!_pango2_parse_enum (type, attr_val, val, FALSE, &possible_values))
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("'%s' is not a valid value for the '%s' "
- "attribute on <span> tag, line %d; valid "
- "values are %s"),
+ "'%s' is not a valid value for the '%s' "
+ "attribute on <span> tag, line %d; valid "
+ "values are %s",
attr_val, attr_name, line_number, possible_values);
g_free (possible_values);
return FALSE;
@@ -1264,14 +1261,14 @@ span_parse_flags (const char *attr_name,
{
char *possible_values = NULL;
- if (!pango_parse_flags (type, attr_val, val, &possible_values))
+ if (!pango2_parse_flags (type, attr_val, val, &possible_values))
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("'%s' is not a valid value for the '%s' "
- "attribute on <span> tag, line %d; valid "
- "values are %s or combinations with |"),
+ "'%s' is not a valid value for the '%s' "
+ "attribute on <span> tag, line %d; valid "
+ "values are %s or combinations with |",
attr_val, attr_name, line_number, possible_values);
g_free (possible_values);
return FALSE;
@@ -1288,7 +1285,7 @@ parse_length (const char *attr_val,
int n;
attr = attr_val;
- if (_pango_scan_int (&attr, &n) && *attr == '\0')
+ if (_pango2_scan_int (&attr, &n) && *attr == '\0')
{
*result = n;
return TRUE;
@@ -1301,7 +1298,7 @@ parse_length (const char *attr_val,
val = g_ascii_strtod (attr_val, &end);
if (errno == 0 && strcmp (end, "pt") == 0)
{
- *result = val * PANGO_SCALE;
+ *result = val * PANGO2_SCALE;
return TRUE;
}
}
@@ -1310,12 +1307,12 @@ parse_length (const char *attr_val,
}
static gboolean
-span_parse_func (MarkupData *md G_GNUC_UNUSED,
- OpenTag *tag,
- const char **names,
- const char **values,
- GMarkupParseContext *context,
- GError **error)
+span_parse_func (MarkupData *md G_GNUC_UNUSED,
+ OpenTag *tag,
+ const char **names,
+ const char **values,
+ GMarkupParseContext *context,
+ GError **error)
{
int line_number, char_number;
int i;
@@ -1359,8 +1356,8 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if ((var) != NULL) { \
g_set_error (error, G_MARKUP_ERROR, \
G_MARKUP_ERROR_INVALID_CONTENT, \
- _("Attribute '%s' occurs twice on <span> tag " \
- "on line %d char %d, may only occur once"), \
+ "Attribute '%s' occurs twice on <span> tag " \
+ "on line %d char %d, may only occur once", \
names[i], line_number, char_number); \
return FALSE; \
}}G_STMT_END
@@ -1384,28 +1381,28 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
break;
case 'b':
CHECK_ATTRIBUTE (background);
- CHECK_ATTRIBUTE2(background, "bgcolor");
- CHECK_ATTRIBUTE(baseline_shift);
+ CHECK_ATTRIBUTE2 (background, "bgcolor");
+ CHECK_ATTRIBUTE (baseline_shift);
break;
case 'c':
- CHECK_ATTRIBUTE2(foreground, "color");
+ CHECK_ATTRIBUTE2 (foreground, "color");
break;
case 'f':
CHECK_ATTRIBUTE (fallback);
- CHECK_ATTRIBUTE2(desc, "font");
- CHECK_ATTRIBUTE2(desc, "font_desc");
- CHECK_ATTRIBUTE2(family, "face");
-
- CHECK_ATTRIBUTE2(family, "font_family");
- CHECK_ATTRIBUTE2(size, "font_size");
- CHECK_ATTRIBUTE2(stretch, "font_stretch");
- CHECK_ATTRIBUTE2(style, "font_style");
- CHECK_ATTRIBUTE2(variant, "font_variant");
- CHECK_ATTRIBUTE2(weight, "font_weight");
- CHECK_ATTRIBUTE(font_scale);
+ CHECK_ATTRIBUTE2 (desc, "font");
+ CHECK_ATTRIBUTE2 (desc, "font_desc");
+ CHECK_ATTRIBUTE2 (family, "face");
+
+ CHECK_ATTRIBUTE2 (family, "font_family");
+ CHECK_ATTRIBUTE2 (size, "font_size");
+ CHECK_ATTRIBUTE2 (stretch, "font_stretch");
+ CHECK_ATTRIBUTE2 (style, "font_style");
+ CHECK_ATTRIBUTE2 (variant, "font_variant");
+ CHECK_ATTRIBUTE2 (weight, "font_weight");
+ CHECK_ATTRIBUTE (font_scale);
CHECK_ATTRIBUTE (foreground);
- CHECK_ATTRIBUTE2(foreground, "fgcolor");
+ CHECK_ATTRIBUTE2 (foreground, "fgcolor");
CHECK_ATTRIBUTE (font_features);
break;
@@ -1458,8 +1455,8 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
{
g_set_error (error, G_MARKUP_ERROR,
G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
- _("Attribute '%s' is not allowed on the <span> tag "
- "on line %d char %d"),
+ "Attribute '%s' is not allowed on the <span> tag "
+ "on line %d char %d",
names[i], line_number, char_number);
return FALSE;
}
@@ -1470,21 +1467,21 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
/* Parse desc first, then modify it with other font-related attributes. */
if (G_UNLIKELY (desc))
{
- PangoFontDescription *parsed;
+ Pango2FontDescription *parsed;
- parsed = pango_font_description_from_string (desc);
+ parsed = pango2_font_description_from_string (desc);
if (parsed)
{
- add_attribute (tag, pango_attr_font_desc_new (parsed));
+ add_attribute (tag, pango2_attr_font_desc_new (parsed));
if (tag)
- open_tag_set_absolute_font_size (tag, pango_font_description_get_size (parsed));
- pango_font_description_free (parsed);
+ open_tag_set_absolute_font_size (tag, pango2_font_description_get_size (parsed));
+ pango2_font_description_free (parsed);
}
}
if (G_UNLIKELY (family))
{
- add_attribute (tag, pango_attr_family_new (family));
+ add_attribute (tag, pango2_attr_family_new (family));
}
if (G_UNLIKELY (size))
@@ -1493,7 +1490,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (parse_length (size, &n) && n > 0)
{
- add_attribute (tag, pango_attr_size_new (n));
+ add_attribute (tag, pango2_attr_size_new (n));
if (tag)
open_tag_set_absolute_font_size (tag, n);
}
@@ -1520,9 +1517,9 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("Value of 'size' attribute on <span> tag on line %d "
- "could not be parsed; should be an integer, or a "
- "string such as 'small', not '%s'"),
+ "Value of 'size' attribute on <span> tag on line %d "
+ "could not be parsed; should be an integer, or a "
+ "string such as 'small', not '%s'",
line_number, size);
goto error;
}
@@ -1530,18 +1527,18 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (G_UNLIKELY (style))
{
- PangoStyle pango_style;
+ Pango2Style pango2_style;
- if (pango_parse_style (style, &pango_style, FALSE))
- add_attribute (tag, pango_attr_style_new (pango_style));
+ if (pango2_parse_style (style, &pango2_style, FALSE))
+ add_attribute (tag, pango2_attr_style_new (pango2_style));
else
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("'%s' is not a valid value for the 'style' attribute "
- "on <span> tag, line %d; valid values are "
- "'normal', 'oblique', 'italic'"),
+ "'%s' is not a valid value for the 'style' attribute "
+ "on <span> tag, line %d; valid values are "
+ "'normal', 'oblique', 'italic'",
style, line_number);
goto error;
}
@@ -1549,19 +1546,19 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (G_UNLIKELY (weight))
{
- PangoWeight pango_weight;
+ Pango2Weight pango2_weight;
- if (pango_parse_weight (weight, &pango_weight, FALSE))
+ if (pango2_parse_weight (weight, &pango2_weight, FALSE))
add_attribute (tag,
- pango_attr_weight_new (pango_weight));
+ pango2_attr_weight_new (pango2_weight));
else
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("'%s' is not a valid value for the 'weight' "
- "attribute on <span> tag, line %d; valid "
- "values are for example 'light', 'ultrabold' or a number"),
+ "'%s' is not a valid value for the 'weight' "
+ "attribute on <span> tag, line %d; valid "
+ "values are for example 'light', 'ultrabold' or a number",
weight, line_number);
goto error;
}
@@ -1569,18 +1566,18 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (G_UNLIKELY (variant))
{
- PangoVariant pango_variant;
+ Pango2Variant pango2_variant;
- if (pango_parse_variant (variant, &pango_variant, FALSE))
- add_attribute (tag, pango_attr_variant_new (pango_variant));
+ if (pango2_parse_variant (variant, &pango2_variant, FALSE))
+ add_attribute (tag, pango2_attr_variant_new (pango2_variant));
else
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("'%s' is not a valid value for the 'variant' "
- "attribute on <span> tag, line %d; valid values are "
- "'normal', 'smallcaps'"),
+ "'%s' is not a valid value for the 'variant' "
+ "attribute on <span> tag, line %d; valid values are "
+ "'normal', 'smallcaps'",
variant, line_number);
goto error;
}
@@ -1588,19 +1585,19 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (G_UNLIKELY (stretch))
{
- PangoStretch pango_stretch;
+ Pango2Stretch pango2_stretch;
- if (pango_parse_stretch (stretch, &pango_stretch, FALSE))
- add_attribute (tag, pango_attr_stretch_new (pango_stretch));
+ if (pango2_parse_stretch (stretch, &pango2_stretch, FALSE))
+ add_attribute (tag, pango2_attr_stretch_new (pango2_stretch));
else
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("'%s' is not a valid value for the 'stretch' "
- "attribute on <span> tag, line %d; valid "
- "values are for example 'condensed', "
- "'ultraexpanded', 'normal'"),
+ "'%s' is not a valid value for the 'stretch' "
+ "attribute on <span> tag, line %d; valid "
+ "values are for example 'condensed', "
+ "'ultraexpanded', 'normal'",
stretch, line_number);
goto error;
}
@@ -1608,125 +1605,125 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (G_UNLIKELY (foreground))
{
- PangoColor color;
+ Pango2Color color;
if (!span_parse_color ("foreground", foreground, &color, line_number, error))
goto error;
- add_attribute (tag, pango_attr_foreground_new (&color));
+ add_attribute (tag, pango2_attr_foreground_new (&color));
}
if (G_UNLIKELY (background))
{
- PangoColor color;
+ Pango2Color color;
if (!span_parse_color ("background", background, &color, line_number, error))
goto error;
- add_attribute (tag, pango_attr_background_new (&color));
+ add_attribute (tag, pango2_attr_background_new (&color));
}
if (G_UNLIKELY (underline))
{
- PangoLineStyle style = PANGO_LINE_STYLE_NONE;
+ Pango2LineStyle style = PANGO2_LINE_STYLE_NONE;
- if (!span_parse_enum ("underline", underline, PANGO_TYPE_LINE_STYLE, (int*)(void*)&style, line_number, error))
+ if (!span_parse_enum ("underline", underline, PANGO2_TYPE_LINE_STYLE, (int*)(void*)&style, line_number, error))
goto error;
- add_attribute (tag, pango_attr_underline_new (style));
+ add_attribute (tag, pango2_attr_underline_new (style));
}
if (G_UNLIKELY (underline_position))
{
- PangoUnderlinePosition pos = PANGO_UNDERLINE_POSITION_NORMAL;
+ Pango2UnderlinePosition pos = PANGO2_UNDERLINE_POSITION_NORMAL;
- if (!span_parse_enum ("underline_position", underline_position, PANGO_TYPE_UNDERLINE_POSITION, (int*)(void*)&pos, line_number, error))
+ if (!span_parse_enum ("underline_position", underline_position, PANGO2_TYPE_UNDERLINE_POSITION, (int*)(void*)&pos, line_number, error))
goto error;
- add_attribute (tag, pango_attr_underline_position_new (pos));
+ add_attribute (tag, pango2_attr_underline_position_new (pos));
}
if (G_UNLIKELY (underline_color))
{
- PangoColor color;
+ Pango2Color color;
if (!span_parse_color ("underline_color", underline_color, &color, line_number, error))
goto error;
- add_attribute (tag, pango_attr_underline_color_new (&color));
+ add_attribute (tag, pango2_attr_underline_color_new (&color));
}
if (G_UNLIKELY (overline))
{
- PangoLineStyle style = PANGO_LINE_STYLE_NONE;
+ Pango2LineStyle style = PANGO2_LINE_STYLE_NONE;
- if (!span_parse_enum ("overline", overline, PANGO_TYPE_LINE_STYLE, (int*)(void*)&style, line_number, error))
+ if (!span_parse_enum ("overline", overline, PANGO2_TYPE_LINE_STYLE, (int*)(void*)&style, line_number, error))
goto error;
- add_attribute (tag, pango_attr_overline_new (style));
+ add_attribute (tag, pango2_attr_overline_new (style));
}
if (G_UNLIKELY (overline_color))
{
- PangoColor color;
+ Pango2Color color;
if (!span_parse_color ("overline_color", overline_color, &color, line_number, error))
goto error;
- add_attribute (tag, pango_attr_overline_color_new (&color));
+ add_attribute (tag, pango2_attr_overline_color_new (&color));
}
if (G_UNLIKELY (gravity))
{
- PangoGravity gr = PANGO_GRAVITY_SOUTH;
+ Pango2Gravity gr = PANGO2_GRAVITY_SOUTH;
- if (!span_parse_enum ("gravity", gravity, PANGO_TYPE_GRAVITY, (int*)(void*)&gr, line_number, error))
+ if (!span_parse_enum ("gravity", gravity, PANGO2_TYPE_GRAVITY, (int*)(void*)&gr, line_number, error))
goto error;
- if (gr == PANGO_GRAVITY_AUTO)
+ if (gr == PANGO2_GRAVITY_AUTO)
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("'%s' is not a valid value for the 'gravity' "
- "attribute on <span> tag, line %d; valid "
- "values are for example 'south', 'east', "
- "'north', 'west'"),
+ "'%s' is not a valid value for the 'gravity' "
+ "attribute on <span> tag, line %d; valid "
+ "values are for example 'south', 'east', "
+ "'north', 'west'",
gravity, line_number);
goto error;
}
- add_attribute (tag, pango_attr_gravity_new (gr));
+ add_attribute (tag, pango2_attr_gravity_new (gr));
}
if (G_UNLIKELY (gravity_hint))
{
- PangoGravityHint hint = PANGO_GRAVITY_HINT_NATURAL;
+ Pango2GravityHint hint = PANGO2_GRAVITY_HINT_NATURAL;
- if (!span_parse_enum ("gravity_hint", gravity_hint, PANGO_TYPE_GRAVITY_HINT, (int*)(void*)&hint, line_number, error))
+ if (!span_parse_enum ("gravity_hint", gravity_hint, PANGO2_TYPE_GRAVITY_HINT, (int*)(void*)&hint, line_number, error))
goto error;
- add_attribute (tag, pango_attr_gravity_hint_new (hint));
+ add_attribute (tag, pango2_attr_gravity_hint_new (hint));
}
if (G_UNLIKELY (strikethrough))
{
- PangoLineStyle style = PANGO_LINE_STYLE_NONE;
+ Pango2LineStyle style = PANGO2_LINE_STYLE_NONE;
- if (!span_parse_enum ("strikethrough", strikethrough, PANGO_TYPE_LINE_STYLE, (int*)(void*)&style, line_number, error))
+ if (!span_parse_enum ("strikethrough", strikethrough, PANGO2_TYPE_LINE_STYLE, (int*)(void*)&style, line_number, error))
goto error;
- add_attribute (tag, pango_attr_strikethrough_new (style));
+ add_attribute (tag, pango2_attr_strikethrough_new (style));
}
if (G_UNLIKELY (strikethrough_color))
{
- PangoColor color;
+ Pango2Color color;
if (!span_parse_color ("strikethrough_color", strikethrough_color, &color, line_number, error))
goto error;
- add_attribute (tag, pango_attr_strikethrough_color_new (&color));
+ add_attribute (tag, pango2_attr_strikethrough_color_new (&color));
}
if (G_UNLIKELY (fallback))
@@ -1736,27 +1733,27 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (!span_parse_boolean ("fallback", fallback, &b, line_number, error))
goto error;
- add_attribute (tag, pango_attr_fallback_new (b));
+ add_attribute (tag, pango2_attr_fallback_new (b));
}
if (G_UNLIKELY (show))
{
- PangoShowFlags flags;
+ Pango2ShowFlags flags;
- if (!span_parse_flags ("show", show, PANGO_TYPE_SHOW_FLAGS, (int*)(void*)&flags, line_number, error))
+ if (!span_parse_flags ("show", show, PANGO2_TYPE_SHOW_FLAGS, (int*)(void*)&flags, line_number, error))
goto error;
- add_attribute (tag, pango_attr_show_new (flags));
+ add_attribute (tag, pango2_attr_show_new (flags));
}
if (G_UNLIKELY (text_transform))
{
- PangoTextTransform tf;
+ Pango2TextTransform tf;
- if (!span_parse_enum ("text_transform", text_transform, PANGO_TYPE_TEXT_TRANSFORM, (int*)(void*)&tf, line_number, error))
+ if (!span_parse_enum ("text_transform", text_transform, PANGO2_TYPE_TEXT_TRANSFORM, (int*)(void*)&tf, line_number, error))
goto error;
- add_attribute (tag, pango_attr_text_transform_new (tf));
+ add_attribute (tag, pango2_attr_text_transform_new (tf));
}
if (G_UNLIKELY (rise))
@@ -1768,32 +1765,32 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("Value of 'rise' attribute on <span> tag on line %d "
- "could not be parsed; should be an integer, or a "
- "string such as '5.5pt', not '%s'"),
+ "Value of 'rise' attribute on <span> tag on line %d "
+ "could not be parsed; should be an integer, or a "
+ "string such as '5.5pt', not '%s'",
line_number, rise);
goto error;
}
- add_attribute (tag, pango_attr_rise_new (n));
+ add_attribute (tag, pango2_attr_rise_new (n));
}
if (G_UNLIKELY (baseline_shift))
{
int shift = 0;
- if (span_parse_enum ("baseline_shift", baseline_shift, PANGO_TYPE_BASELINE_SHIFT, (int*)(void*)&shift, line_number, NULL))
- add_attribute (tag, pango_attr_baseline_shift_new (shift));
+ if (span_parse_enum ("baseline_shift", baseline_shift, PANGO2_TYPE_BASELINE_SHIFT, (int*)(void*)&shift, line_number, NULL))
+ add_attribute (tag, pango2_attr_baseline_shift_new (shift));
else if (parse_length (baseline_shift, &shift) && (shift > 1024 || shift < -1024))
- add_attribute (tag, pango_attr_baseline_shift_new (shift));
+ add_attribute (tag, pango2_attr_baseline_shift_new (shift));
else
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("Value of 'baseline_shift' attribute on <span> tag on line %d "
- "could not be parsed; should be 'superscript' or 'subscript' or "
- "an integer, or a string such as '5.5pt', not '%s'"),
+ "Value of 'baseline_shift' attribute on <span> tag on line %d "
+ "could not be parsed; should be 'superscript' or 'subscript' or "
+ "an integer, or a string such as '5.5pt', not '%s'",
line_number, baseline_shift);
goto error;
}
@@ -1802,12 +1799,12 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (G_UNLIKELY (font_scale))
{
- PangoFontScale scale;
+ Pango2FontScale scale;
- if (!span_parse_enum ("font_scale", font_scale, PANGO_TYPE_FONT_SCALE, (int*)(void*)&scale, line_number, error))
+ if (!span_parse_enum ("font_scale", font_scale, PANGO2_TYPE_FONT_SCALE, (int*)(void*)&scale, line_number, error))
goto error;
- add_attribute (tag, pango_attr_font_scale_new (scale));
+ add_attribute (tag, pango2_attr_font_scale_new (scale));
}
if (G_UNLIKELY (letter_spacing))
@@ -1817,7 +1814,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (!span_parse_int ("letter_spacing", letter_spacing, &n, line_number, error))
goto error;
- add_attribute (tag, pango_attr_letter_spacing_new (n));
+ add_attribute (tag, pango2_attr_letter_spacing_new (n));
}
if (G_UNLIKELY (line_height))
@@ -1828,20 +1825,20 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
goto error;
if (f > 1024.0 && strchr (line_height, '.') == 0)
- add_attribute (tag, pango_attr_line_height_new_absolute ((int)f));
+ add_attribute (tag, pango2_attr_line_height_new_absolute ((int)f));
else
- add_attribute (tag, pango_attr_line_height_new (f));
+ add_attribute (tag, pango2_attr_line_height_new (f));
}
if (G_UNLIKELY (lang))
{
add_attribute (tag,
- pango_attr_language_new (pango_language_from_string (lang)));
+ pango2_attr_language_new (pango2_language_from_string (lang)));
}
if (G_UNLIKELY (font_features))
{
- add_attribute (tag, pango_attr_font_features_new (font_features));
+ add_attribute (tag, pango2_attr_font_features_new (font_features));
}
if (G_UNLIKELY (allow_breaks))
@@ -1851,7 +1848,7 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (!span_parse_boolean ("allow_breaks", allow_breaks, &b, line_number, error))
goto error;
- add_attribute (tag, pango_attr_allow_breaks_new (b));
+ add_attribute (tag, pango2_attr_allow_breaks_new (b));
}
if (G_UNLIKELY (insert_hyphens))
@@ -1861,25 +1858,25 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
if (!span_parse_boolean ("insert_hyphens", insert_hyphens, &b, line_number, error))
goto error;
- add_attribute (tag, pango_attr_insert_hyphens_new (b));
+ add_attribute (tag, pango2_attr_insert_hyphens_new (b));
}
if (G_UNLIKELY (segment))
{
if (strcmp (segment, "word") == 0)
- add_attribute (tag, pango_attr_word_new ());
+ add_attribute (tag, pango2_attr_word_new ());
else if (strcmp (segment, "sentence") == 0)
- add_attribute (tag, pango_attr_sentence_new ());
+ add_attribute (tag, pango2_attr_sentence_new ());
else if (strcmp (segment, "paragraph") == 0)
- add_attribute (tag, pango_attr_paragraph_new ());
+ add_attribute (tag, pango2_attr_paragraph_new ());
else
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- _("Value of 'segment' attribute on <span> tag on line %d "
- "could not be parsed; should be one of 'word' or "
- "'sentence', not '%s'"),
+ "Value of 'segment' attribute on <span> tag on line %d "
+ "could not be parsed; should be one of 'word', 'sentence' "
+ "or 'paragraph', not '%s'",
line_number, segment);
goto error;
}
@@ -1893,15 +1890,16 @@ span_parse_func (MarkupData *md G_GNUC_UNUSED,
}
static gboolean
-i_parse_func (MarkupData *md G_GNUC_UNUSED,
- OpenTag *tag,
- const char **names,
- const char **values G_GNUC_UNUSED,
- GMarkupParseContext *context,
- GError **error)
+i_parse_func (MarkupData *md G_GNUC_UNUSED,
+ OpenTag *tag,
+ const char **names,
+ const char **values G_GNUC_UNUSED,
+ GMarkupParseContext *context,
+ GError **error)
{
- CHECK_NO_ATTRS("i");
- add_attribute (tag, pango_attr_style_new (PANGO_STYLE_ITALIC));
+ CHECK_NO_ATTRS ("i");
+
+ add_attribute (tag, pango2_attr_style_new (PANGO2_STYLE_ITALIC));
return TRUE;
}
@@ -1915,66 +1913,67 @@ markup_parse_func (MarkupData *md G_GNUC_UNUSED,
GError **error G_GNUC_UNUSED)
{
/* We don't do anything with this tag at the moment. */
- CHECK_NO_ATTRS("markup");
+ CHECK_NO_ATTRS ("markup");
return TRUE;
}
static gboolean
-s_parse_func (MarkupData *md G_GNUC_UNUSED,
- OpenTag *tag,
- const char **names,
- const char **values G_GNUC_UNUSED,
- GMarkupParseContext *context,
- GError **error)
+s_parse_func (MarkupData *md G_GNUC_UNUSED,
+ OpenTag *tag,
+ const char **names,
+ const char **values G_GNUC_UNUSED,
+ GMarkupParseContext *context,
+ GError **error)
{
- CHECK_NO_ATTRS("s");
- add_attribute (tag, pango_attr_strikethrough_new (TRUE));
+ CHECK_NO_ATTRS ("s");
+
+ add_attribute (tag, pango2_attr_strikethrough_new (TRUE));
return TRUE;
}
static gboolean
-sub_parse_func (MarkupData *md G_GNUC_UNUSED,
- OpenTag *tag,
- const char **names,
- const char **values G_GNUC_UNUSED,
- GMarkupParseContext *context,
- GError **error)
+sub_parse_func (MarkupData *md G_GNUC_UNUSED,
+ OpenTag *tag,
+ const char **names,
+ const char **values G_GNUC_UNUSED,
+ GMarkupParseContext *context,
+ GError **error)
{
- CHECK_NO_ATTRS("sub");
+ CHECK_NO_ATTRS ("sub");
- add_attribute (tag, pango_attr_font_scale_new (PANGO_FONT_SCALE_SUBSCRIPT));
- add_attribute (tag, pango_attr_baseline_shift_new (PANGO_BASELINE_SHIFT_SUBSCRIPT));
+ add_attribute (tag, pango2_attr_font_scale_new (PANGO2_FONT_SCALE_SUBSCRIPT));
+ add_attribute (tag, pango2_attr_baseline_shift_new (PANGO2_BASELINE_SHIFT_SUBSCRIPT));
return TRUE;
}
static gboolean
-sup_parse_func (MarkupData *md G_GNUC_UNUSED,
- OpenTag *tag,
- const char **names,
- const char **values G_GNUC_UNUSED,
- GMarkupParseContext *context,
- GError **error)
+sup_parse_func (MarkupData *md G_GNUC_UNUSED,
+ OpenTag *tag,
+ const char **names,
+ const char **values G_GNUC_UNUSED,
+ GMarkupParseContext *context,
+ GError **error)
{
- CHECK_NO_ATTRS("sup");
+ CHECK_NO_ATTRS ("sup");
- add_attribute (tag, pango_attr_font_scale_new (PANGO_FONT_SCALE_SUPERSCRIPT));
- add_attribute (tag, pango_attr_baseline_shift_new (PANGO_BASELINE_SHIFT_SUPERSCRIPT));
+ add_attribute (tag, pango2_attr_font_scale_new (PANGO2_FONT_SCALE_SUPERSCRIPT));
+ add_attribute (tag, pango2_attr_baseline_shift_new (PANGO2_BASELINE_SHIFT_SUPERSCRIPT));
return TRUE;
}
static gboolean
-small_parse_func (MarkupData *md G_GNUC_UNUSED,
- OpenTag *tag,
- const char **names,
- const char **values G_GNUC_UNUSED,
- GMarkupParseContext *context,
- GError **error)
+small_parse_func (MarkupData *md G_GNUC_UNUSED,
+ OpenTag *tag,
+ const char **names,
+ const char **values G_GNUC_UNUSED,
+ GMarkupParseContext *context,
+ GError **error)
{
- CHECK_NO_ATTRS("small");
+ CHECK_NO_ATTRS ("small");
/* Shrink text one level */
if (tag)
@@ -1987,30 +1986,31 @@ small_parse_func (MarkupData *md G_GNUC_UNUSED,
}
static gboolean
-tt_parse_func (MarkupData *md G_GNUC_UNUSED,
- OpenTag *tag,
- const char **names,
- const char **values G_GNUC_UNUSED,
- GMarkupParseContext *context,
- GError **error)
+tt_parse_func (MarkupData *md G_GNUC_UNUSED,
+ OpenTag *tag,
+ const char **names,
+ const char **values G_GNUC_UNUSED,
+ GMarkupParseContext *context,
+ GError **error)
{
- CHECK_NO_ATTRS("tt");
+ CHECK_NO_ATTRS ("tt");
- add_attribute (tag, pango_attr_family_new ("Monospace"));
+ add_attribute (tag, pango2_attr_family_new ("Monospace"));
return TRUE;
}
static gboolean
-u_parse_func (MarkupData *md G_GNUC_UNUSED,
- OpenTag *tag,
- const char **names,
- const char **values G_GNUC_UNUSED,
- GMarkupParseContext *context,
- GError **error)
+u_parse_func (MarkupData *md G_GNUC_UNUSED,
+ OpenTag *tag,
+ const char **names,
+ const char **values G_GNUC_UNUSED,
+ GMarkupParseContext *context,
+ GError **error)
{
- CHECK_NO_ATTRS("u");
- add_attribute (tag, pango_attr_underline_new (PANGO_LINE_STYLE_SOLID));
+ CHECK_NO_ATTRS ("u");
+
+ add_attribute (tag, pango2_attr_underline_new (PANGO2_LINE_STYLE_SOLID));
return TRUE;
}
diff --git a/pango/pango-markup.h b/pango/pango-markup.h
index 0a09e8e9..28ba98c0 100644
--- a/pango/pango-markup.h
+++ b/pango/pango-markup.h
@@ -24,24 +24,24 @@
G_BEGIN_DECLS
-PANGO_AVAILABLE_IN_ALL
-GMarkupParseContext * pango_markup_parser_new (gunichar accel_marker);
-
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_markup_parser_finish (GMarkupParseContext *context,
- PangoAttrList **attr_list,
- char **text,
- gunichar *accel_char,
- GError **error);
-
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_parse_markup (const char *markup_text,
- int length,
- gunichar accel_marker,
- PangoAttrList **attr_list,
- char **text,
- gunichar *accel_char,
- GError **error);
+PANGO2_AVAILABLE_IN_ALL
+GMarkupParseContext * pango2_markup_parser_new (gunichar accel_marker);
+
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_markup_parser_finish (GMarkupParseContext *context,
+ Pango2AttrList **attr_list,
+ char **text,
+ gunichar *accel_char,
+ GError **error);
+
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_parse_markup (const char *markup_text,
+ int length,
+ gunichar accel_marker,
+ Pango2AttrList **attr_list,
+ char **text,
+ gunichar *accel_char,
+ GError **error);
G_END_DECLS
diff --git a/pango/pango-matrix.c b/pango/pango-matrix.c
index 3f263101..9381ffcd 100644
--- a/pango/pango-matrix.c
+++ b/pango/pango-matrix.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-matrix.c: Matrix manipulation routines
*
* Copyright (C) 2000, 2006 Red Hat Software
@@ -10,7 +10,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -26,27 +26,27 @@
#include "pango-matrix.h"
#include "pango-impl-utils.h"
-G_DEFINE_BOXED_TYPE (PangoMatrix, pango_matrix,
- pango_matrix_copy,
- pango_matrix_free);
+G_DEFINE_BOXED_TYPE (Pango2Matrix, pango2_matrix,
+ pango2_matrix_copy,
+ pango2_matrix_free);
/**
- * pango_matrix_copy:
- * @matrix: (nullable): a `PangoMatrix`
+ * pango2_matrix_copy:
+ * @matrix: (nullable): a `Pango2Matrix`
*
- * Copies a `PangoMatrix`.
+ * Copies a `Pango2Matrix`.
*
- * Return value: (nullable): the newly allocated `PangoMatrix`
+ * Return value: (nullable): the newly allocated `Pango2Matrix`
*/
-PangoMatrix *
-pango_matrix_copy (const PangoMatrix *matrix)
+Pango2Matrix *
+pango2_matrix_copy (const Pango2Matrix *matrix)
{
- PangoMatrix *new_matrix;
+ Pango2Matrix *new_matrix;
if (matrix == NULL)
return NULL;
- new_matrix = g_slice_new (PangoMatrix);
+ new_matrix = g_slice_new (Pango2Matrix);
*new_matrix = *matrix;
@@ -54,23 +54,23 @@ pango_matrix_copy (const PangoMatrix *matrix)
}
/**
- * pango_matrix_free:
- * @matrix: (nullable): a `PangoMatrix`, may be %NULL
+ * pango2_matrix_free:
+ * @matrix: (nullable): a `Pango2Matrix`, may be %NULL
*
- * Free a `PangoMatrix`.
+ * Free a `Pango2Matrix`.
*/
void
-pango_matrix_free (PangoMatrix *matrix)
+pango2_matrix_free (Pango2Matrix *matrix)
{
if (matrix == NULL)
return;
- g_slice_free (PangoMatrix, matrix);
+ g_slice_free (Pango2Matrix, matrix);
}
/**
- * pango_matrix_translate:
- * @matrix: a `PangoMatrix`
+ * pango2_matrix_translate:
+ * @matrix: a `Pango2Matrix`
* @tx: amount to translate in the X direction
* @ty: amount to translate in the Y direction
*
@@ -79,9 +79,9 @@ pango_matrix_free (PangoMatrix *matrix)
* then applying the original transformation.
*/
void
-pango_matrix_translate (PangoMatrix *matrix,
- double tx,
- double ty)
+pango2_matrix_translate (Pango2Matrix *matrix,
+ double tx,
+ double ty)
{
g_return_if_fail (matrix != NULL);
@@ -90,8 +90,8 @@ pango_matrix_translate (PangoMatrix *matrix,
}
/**
- * pango_matrix_scale:
- * @matrix: a `PangoMatrix`
+ * pango2_matrix_scale:
+ * @matrix: a `Pango2Matrix`
* @scale_x: amount to scale by in X direction
* @scale_y: amount to scale by in Y direction
*
@@ -101,9 +101,9 @@ pango_matrix_translate (PangoMatrix *matrix,
* transformation.
*/
void
-pango_matrix_scale (PangoMatrix *matrix,
- double scale_x,
- double scale_y)
+pango2_matrix_scale (Pango2Matrix *matrix,
+ double scale_x,
+ double scale_y)
{
g_return_if_fail (matrix != NULL);
@@ -114,8 +114,8 @@ pango_matrix_scale (PangoMatrix *matrix,
}
/**
- * pango_matrix_rotate:
- * @matrix: a `PangoMatrix`
+ * pango2_matrix_rotate:
+ * @matrix: a `Pango2Matrix`
* @degrees: degrees to rotate counter-clockwise
*
* Changes the transformation represented by @matrix to be the
@@ -123,10 +123,10 @@ pango_matrix_scale (PangoMatrix *matrix,
* counter-clockwise then applying the original transformation.
*/
void
-pango_matrix_rotate (PangoMatrix *matrix,
- double degrees)
+pango2_matrix_rotate (Pango2Matrix *matrix,
+ double degrees)
{
- PangoMatrix tmp;
+ Pango2Matrix tmp;
double r, s, c;
g_return_if_fail (matrix != NULL);
@@ -142,23 +142,23 @@ pango_matrix_rotate (PangoMatrix *matrix,
tmp.x0 = 0;
tmp.y0 = 0;
- pango_matrix_concat (matrix, &tmp);
+ pango2_matrix_concat (matrix, &tmp);
}
/**
- * pango_matrix_concat:
- * @matrix: a `PangoMatrix`
- * @new_matrix: a `PangoMatrix`
+ * pango2_matrix_concat:
+ * @matrix: a `Pango2Matrix`
+ * @new_matrix: a `Pango2Matrix`
*
* Changes the transformation represented by @matrix to be the
* transformation given by first applying transformation
* given by @new_matrix then applying the original transformation.
*/
void
-pango_matrix_concat (PangoMatrix *matrix,
- const PangoMatrix *new_matrix)
+pango2_matrix_concat (Pango2Matrix *matrix,
+ const Pango2Matrix *new_matrix)
{
- PangoMatrix tmp;
+ Pango2Matrix tmp;
g_return_if_fail (matrix != NULL);
@@ -173,29 +173,29 @@ pango_matrix_concat (PangoMatrix *matrix,
}
/**
- * pango_matrix_get_font_scale_factor:
- * @matrix: (nullable): a `PangoMatrix`, may be %NULL
+ * pango2_matrix_get_font_scale_factor:
+ * @matrix: (nullable): a `Pango2Matrix`, may be %NULL
*
* Returns the scale factor of a matrix on the height of the font.
*
* That is, the scale factor in the direction perpendicular to the
* vector that the X coordinate is mapped to. If the scale in the X
- * coordinate is needed as well, use [method@Pango.Matrix.get_font_scale_factors].
+ * coordinate is needed as well, use [method@Pango2.Matrix.get_font_scale_factors].
*
* Return value: the scale factor of @matrix on the height of the font,
* or 1.0 if @matrix is %NULL.
*/
double
-pango_matrix_get_font_scale_factor (const PangoMatrix *matrix)
+pango2_matrix_get_font_scale_factor (const Pango2Matrix *matrix)
{
double yscale;
- pango_matrix_get_font_scale_factors (matrix, NULL, &yscale);
+ pango2_matrix_get_font_scale_factors (matrix, NULL, &yscale);
return yscale;
}
/**
- * pango_matrix_get_font_scale_factors:
- * @matrix: (nullable): a `PangoMatrix`
+ * pango2_matrix_get_font_scale_factors:
+ * @matrix: (nullable): a `Pango2Matrix`
* @xscale: (out) (optional): output scale factor in the x direction
* @yscale: (out) (optional): output scale factor perpendicular to the x direction
*
@@ -208,8 +208,9 @@ pango_matrix_get_font_scale_factor (const PangoMatrix *matrix)
* Note that output numbers will always be non-negative.
**/
void
-pango_matrix_get_font_scale_factors (const PangoMatrix *matrix,
- double *xscale, double *yscale)
+pango2_matrix_get_font_scale_factors (const Pango2Matrix *matrix,
+ double *xscale,
+ double *yscale)
{
/*
* Based on cairo-matrix.c:_cairo_matrix_compute_scale_factors()
@@ -225,17 +226,17 @@ pango_matrix_get_font_scale_factors (const PangoMatrix *matrix,
major = sqrt (x*x + y*y);
if (major)
- {
- double det = matrix->xx * matrix->yy - matrix->yx * matrix->xy;
+ {
+ double det = matrix->xx * matrix->yy - matrix->yx * matrix->xy;
- /*
- * ignore mirroring
- */
- if (det < 0)
- det = - det;
+ /*
+ * ignore mirroring
+ */
+ if (det < 0)
+ det = - det;
- minor = det / major;
- }
+ minor = det / major;
+ }
else
minor = 0.;
}
@@ -249,8 +250,8 @@ pango_matrix_get_font_scale_factors (const PangoMatrix *matrix,
#define RAD_TO_DEG(x) ((x)/G_PI * 180)
/**
- * pango_matrix_get_rotation:
- * @matrix: a `PangoMatrix`
+ * pango2_matrix_get_rotation:
+ * @matrix: a `Pango2Matrix`
*
* Returns the angle (in degrees) that this
* matrix rotates the X axis by.
@@ -260,21 +261,21 @@ pango_matrix_get_font_scale_factors (const PangoMatrix *matrix,
* Returns: the rotation of @matrix
*/
double
-pango_matrix_get_rotation (const PangoMatrix *matrix)
+pango2_matrix_get_rotation (const Pango2Matrix *matrix)
{
double x, y;
x = 1;
y = 0;
- pango_matrix_transform_distance (matrix, &x, &y);
+ pango2_matrix_transform_distance (matrix, &x, &y);
return RAD_TO_DEG (acos (CLAMP (x / sqrtf (x*x + y*y), -1., 1.)));
}
/**
- * pango_matrix_get_slant_ratio:
- * @matrix: a `PangoMatrix`
+ * pango2_matrix_get_slant_ratio:
+ * @matrix: a `Pango2Matrix`
*
* Gets the slant ratio of a matrix.
*
@@ -288,7 +289,7 @@ pango_matrix_get_rotation (const PangoMatrix *matrix)
* Returns: the slant ratio of @matrix
*/
double
-pango_matrix_get_slant_ratio (const PangoMatrix *matrix)
+pango2_matrix_get_slant_ratio (const Pango2Matrix *matrix)
{
if (matrix)
{
@@ -308,14 +309,14 @@ pango_matrix_get_slant_ratio (const PangoMatrix *matrix)
}
/**
- * pango_matrix_transform_distance:
- * @matrix: (nullable): a `PangoMatrix`
+ * pango2_matrix_transform_distance:
+ * @matrix: (nullable): a `Pango2Matrix`
* @dx: (inout): in/out X component of a distance vector
* @dy: (inout): in/out Y component of a distance vector
*
* Transforms the distance vector (@dx,@dy) by @matrix.
*
- * This is similar to [method@Pango.Matrix.transform_point],
+ * This is similar to [method@Pango2.Matrix.transform_point],
* except that the translation components of the transformation
* are ignored. The calculation of the returned vector is as follows:
*
@@ -330,9 +331,9 @@ pango_matrix_get_slant_ratio (const PangoMatrix *matrix)
* (@x1+@dx2,@y1+@dy2) for all values of @x1 and @x2.
*/
void
-pango_matrix_transform_distance (const PangoMatrix *matrix,
- double *dx,
- double *dy)
+pango2_matrix_transform_distance (const Pango2Matrix *matrix,
+ double *dx,
+ double *dy)
{
if (matrix)
{
@@ -347,21 +348,21 @@ pango_matrix_transform_distance (const PangoMatrix *matrix,
}
/**
- * pango_matrix_transform_point:
- * @matrix: (nullable): a `PangoMatrix`
+ * pango2_matrix_transform_point:
+ * @matrix: (nullable): a `Pango2Matrix`
* @x: (inout): in/out X position
* @y: (inout): in/out Y position
*
* Transforms the point (@x, @y) by @matrix.
*/
void
-pango_matrix_transform_point (const PangoMatrix *matrix,
- double *x,
- double *y)
+pango2_matrix_transform_point (const Pango2Matrix *matrix,
+ double *x,
+ double *y)
{
if (matrix)
{
- pango_matrix_transform_distance (matrix, x, y);
+ pango2_matrix_transform_distance (matrix, x, y);
*x += matrix->x0;
*y += matrix->y0;
@@ -369,32 +370,32 @@ pango_matrix_transform_point (const PangoMatrix *matrix,
}
/**
- * pango_matrix_transform_rectangle:
- * @matrix: (nullable): a `PangoMatrix`
- * @rect: (inout) (optional): in/out bounding box in Pango units
+ * pango2_matrix_transform_rectangle:
+ * @matrix: (nullable): a `Pango2Matrix`
+ * @rect: (inout) (optional): in/out bounding box in Pango2 units
*
* First transforms @rect using @matrix, then calculates the bounding box
* of the transformed rectangle.
*
* This function is useful for example when you want to draw a rotated
- * @PangoLayout to an image buffer, and want to know how large the image
+ * @Pango2Layout to an image buffer, and want to know how large the image
* should be and how much you should shift the layout when rendering.
*
* If you have a rectangle in device units (pixels), use
- * [method@Pango.Matrix.transform_pixel_rectangle].
+ * [method@Pango2.Matrix.transform_pixel_rectangle].
*
- * If you have the rectangle in Pango units and want to convert to
+ * If you have the rectangle in Pango2 units and want to convert to
* transformed pixel bounding box, it is more accurate to transform it first
- * (using this function) and pass the result to pango_extents_to_pixels(),
+ * (using this function) and pass the result to pango2_extents_to_pixels(),
* first argument, for an inclusive rounded rectangle.
* However, there are valid reasons that you may want to convert
* to pixels first and then transform, for example when the transformed
- * coordinates may overflow in Pango units (large matrix translation for
+ * coordinates may overflow in Pango2 units (large matrix translation for
* example).
*/
void
-pango_matrix_transform_rectangle (const PangoMatrix *matrix,
- PangoRectangle *rect)
+pango2_matrix_transform_rectangle (const Pango2Matrix *matrix,
+ Pango2Rectangle *rect)
{
int i;
double quad_x[4], quad_y[4];
@@ -406,19 +407,19 @@ pango_matrix_transform_rectangle (const PangoMatrix *matrix,
if (!rect || !matrix)
return;
- quad_x[0] = pango_units_to_double (rect->x);
- quad_y[0] = pango_units_to_double (rect->y);
- pango_matrix_transform_point (matrix, &quad_x[0], &quad_y[0]);
+ quad_x[0] = pango2_units_to_double (rect->x);
+ quad_y[0] = pango2_units_to_double (rect->y);
+ pango2_matrix_transform_point (matrix, &quad_x[0], &quad_y[0]);
- dx1 = pango_units_to_double (rect->width);
+ dx1 = pango2_units_to_double (rect->width);
dy1 = 0;
- pango_matrix_transform_distance (matrix, &dx1, &dy1);
+ pango2_matrix_transform_distance (matrix, &dx1, &dy1);
quad_x[1] = quad_x[0] + dx1;
quad_y[1] = quad_y[0] + dy1;
dx2 = 0;
- dy2 = pango_units_to_double (rect->height);
- pango_matrix_transform_distance (matrix, &dx2, &dy2);
+ dy2 = pango2_units_to_double (rect->height);
+ pango2_matrix_transform_distance (matrix, &dx2, &dy2);
quad_x[2] = quad_x[0] + dx2;
quad_y[2] = quad_y[0] + dy2;
@@ -430,41 +431,41 @@ pango_matrix_transform_rectangle (const PangoMatrix *matrix,
for (i=1; i < 4; i++) {
if (quad_x[i] < min_x)
- min_x = quad_x[i];
+ min_x = quad_x[i];
else if (quad_x[i] > max_x)
- max_x = quad_x[i];
+ max_x = quad_x[i];
if (quad_y[i] < min_y)
- min_y = quad_y[i];
+ min_y = quad_y[i];
else if (quad_y[i] > max_y)
- max_y = quad_y[i];
+ max_y = quad_y[i];
}
- rect->x = pango_units_from_double (min_x);
- rect->y = pango_units_from_double (min_y);
- rect->width = pango_units_from_double (max_x) - rect->x;
- rect->height = pango_units_from_double (max_y) - rect->y;
+ rect->x = pango2_units_from_double (min_x);
+ rect->y = pango2_units_from_double (min_y);
+ rect->width = pango2_units_from_double (max_x) - rect->x;
+ rect->height = pango2_units_from_double (max_y) - rect->y;
}
/**
- * pango_matrix_transform_pixel_rectangle:
- * @matrix: (nullable): a `PangoMatrix`
+ * pango2_matrix_transform_pixel_rectangle:
+ * @matrix: (nullable): a `Pango2Matrix`
* @rect: (inout) (optional): in/out bounding box in device units
*
* First transforms the @rect using @matrix, then calculates the bounding box
* of the transformed rectangle.
*
* This function is useful for example when you want to draw a rotated
- * @PangoLayout to an image buffer, and want to know how large the image
+ * @Pango2Layout to an image buffer, and want to know how large the image
* should be and how much you should shift the layout when rendering.
*
- * For better accuracy, you should use [method@Pango.Matrix.transform_rectangle]
- * on original rectangle in Pango units and convert to pixels afterward
+ * For better accuracy, you should use [method@Pango2.Matrix.transform_rectangle]
+ * on original rectangle in Pango2 units and convert to pixels afterward
* using [func@extents_to_pixels]'s first argument.
*/
void
-pango_matrix_transform_pixel_rectangle (const PangoMatrix *matrix,
- PangoRectangle *rect)
+pango2_matrix_transform_pixel_rectangle (const Pango2Matrix *matrix,
+ Pango2Rectangle *rect)
{
int i;
double quad_x[4], quad_y[4];
@@ -478,17 +479,17 @@ pango_matrix_transform_pixel_rectangle (const PangoMatrix *matrix,
quad_x[0] = rect->x;
quad_y[0] = rect->y;
- pango_matrix_transform_point (matrix, &quad_x[0], &quad_y[0]);
+ pango2_matrix_transform_point (matrix, &quad_x[0], &quad_y[0]);
dx1 = rect->width;
dy1 = 0;
- pango_matrix_transform_distance (matrix, &dx1, &dy1);
+ pango2_matrix_transform_distance (matrix, &dx1, &dy1);
quad_x[1] = quad_x[0] + dx1;
quad_y[1] = quad_y[0] + dy1;
dx2 = 0;
dy2 = rect->height;
- pango_matrix_transform_distance (matrix, &dx2, &dy2);
+ pango2_matrix_transform_distance (matrix, &dx2, &dy2);
quad_x[2] = quad_x[0] + dx2;
quad_y[2] = quad_y[0] + dy2;
@@ -518,8 +519,8 @@ pango_matrix_transform_pixel_rectangle (const PangoMatrix *matrix,
}
gboolean
-pango_matrix_equal (const PangoMatrix *m1,
- const PangoMatrix *m2)
+pango2_matrix_equal (const Pango2Matrix *m1,
+ const Pango2Matrix *m2)
{
return m1->xx == m2->xx && m1->xy == m2->xy &&
m1->yx == m2->yx && m1->yy == m2->yy &&
diff --git a/pango/pango-matrix.h b/pango/pango-matrix.h
index ccacb2ab..800d5299 100644
--- a/pango/pango-matrix.h
+++ b/pango/pango-matrix.h
@@ -24,10 +24,10 @@
G_BEGIN_DECLS
-typedef struct _PangoMatrix PangoMatrix;
+typedef struct _Pango2Matrix Pango2Matrix;
/**
- * PangoMatrix:
+ * Pango2Matrix:
* @xx: 1st component of the transformation matrix
* @xy: 2nd component of the transformation matrix
* @yx: 3rd component of the transformation matrix
@@ -35,7 +35,7 @@ typedef struct _PangoMatrix PangoMatrix;
* @x0: x translation
* @y0: y translation
*
- * A `PangoMatrix` specifies a transformation between user-space
+ * A `Pango2Matrix` specifies a transformation between user-space
* and device coordinates.
*
* The transformation is given by
@@ -45,7 +45,7 @@ typedef struct _PangoMatrix PangoMatrix;
* y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0;
* ```
*/
-struct _PangoMatrix
+struct _Pango2Matrix
{
double xx;
double xy;
@@ -55,75 +55,76 @@ struct _PangoMatrix
double y0;
};
-#define PANGO_TYPE_MATRIX (pango_matrix_get_type ())
+#define PANGO2_TYPE_MATRIX (pango2_matrix_get_type ())
/**
- * PANGO_MATRIX_INIT:
+ * PANGO2_MATRIX_INIT:
*
- * Constant that can be used to initialize a `PangoMatrix` to
+ * Constant that can be used to initialize a `Pango2Matrix` to
* the identity transform.
*
* ```
- * PangoMatrix matrix = PANGO_MATRIX_INIT;
- * pango_matrix_rotate (&matrix, 45.);
+ * Pango2Matrix matrix = PANGO2_MATRIX_INIT;
+ * pango2_matrix_rotate (&matrix, 45.);
* ```
*/
-#define PANGO_MATRIX_INIT { 1., 0., 0., 1., 0., 0. }
+#define PANGO2_MATRIX_INIT { 1., 0., 0., 1., 0., 0. }
-/* for PangoRectangle */
+/* for Pango2Rectangle */
#include <pango/pango-types.h>
-PANGO_AVAILABLE_IN_ALL
-GType pango_matrix_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_matrix_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoMatrix *pango_matrix_copy (const PangoMatrix *matrix);
-PANGO_AVAILABLE_IN_ALL
-void pango_matrix_free (PangoMatrix *matrix);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Matrix * pango2_matrix_copy (const Pango2Matrix *matrix);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_matrix_free (Pango2Matrix *matrix);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_matrix_equal (const PangoMatrix *m1,
- const PangoMatrix *m2);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_matrix_equal (const Pango2Matrix *m1,
+ const Pango2Matrix *m2);
-PANGO_AVAILABLE_IN_ALL
-void pango_matrix_translate (PangoMatrix *matrix,
- double tx,
- double ty);
-PANGO_AVAILABLE_IN_ALL
-void pango_matrix_scale (PangoMatrix *matrix,
- double scale_x,
- double scale_y);
-PANGO_AVAILABLE_IN_ALL
-void pango_matrix_rotate (PangoMatrix *matrix,
- double degrees);
-PANGO_AVAILABLE_IN_ALL
-void pango_matrix_concat (PangoMatrix *matrix,
- const PangoMatrix *new_matrix);
-PANGO_AVAILABLE_IN_ALL
-void pango_matrix_transform_point (const PangoMatrix *matrix,
- double *x,
- double *y);
-PANGO_AVAILABLE_IN_ALL
-void pango_matrix_transform_distance (const PangoMatrix *matrix,
- double *dx,
- double *dy);
-PANGO_AVAILABLE_IN_ALL
-void pango_matrix_transform_rectangle (const PangoMatrix *matrix,
- PangoRectangle *rect);
-PANGO_AVAILABLE_IN_ALL
-void pango_matrix_transform_pixel_rectangle (const PangoMatrix *matrix,
- PangoRectangle *rect);
-PANGO_AVAILABLE_IN_ALL
-double pango_matrix_get_font_scale_factor (const PangoMatrix *matrix) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-void pango_matrix_get_font_scale_factors (const PangoMatrix *matrix,
- double *xscale, double *yscale);
-PANGO_AVAILABLE_IN_ALL
-double pango_matrix_get_rotation (const PangoMatrix *matrix) G_GNUC_PURE;
-PANGO_AVAILABLE_IN_ALL
-double pango_matrix_get_slant_ratio (const PangoMatrix *matrix) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_matrix_translate (Pango2Matrix *matrix,
+ double tx,
+ double ty);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_matrix_scale (Pango2Matrix *matrix,
+ double scale_x,
+ double scale_y);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_matrix_rotate (Pango2Matrix *matrix,
+ double degrees);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_matrix_concat (Pango2Matrix *matrix,
+ const Pango2Matrix *new_matrix);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_matrix_transform_point (const Pango2Matrix *matrix,
+ double *x,
+ double *y);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_matrix_transform_distance (const Pango2Matrix *matrix,
+ double *dx,
+ double *dy);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_matrix_transform_rectangle (const Pango2Matrix *matrix,
+ Pango2Rectangle *rect);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_matrix_transform_pixel_rectangle (const Pango2Matrix *matrix,
+ Pango2Rectangle *rect);
+PANGO2_AVAILABLE_IN_ALL
+double pango2_matrix_get_font_scale_factor (const Pango2Matrix *matrix) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+void pango2_matrix_get_font_scale_factors (const Pango2Matrix *matrix,
+ double *xscale,
+ double *yscale);
+PANGO2_AVAILABLE_IN_ALL
+double pango2_matrix_get_rotation (const Pango2Matrix *matrix) G_GNUC_PURE;
+PANGO2_AVAILABLE_IN_ALL
+double pango2_matrix_get_slant_ratio (const Pango2Matrix *matrix) G_GNUC_PURE;
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoMatrix, pango_matrix_free)
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2Matrix, pango2_matrix_free)
G_END_DECLS
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 3bd2b7ea..5f1d3de6 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-renderer.h: Base class for rendering
*
* Copyright (C) 2004 Red Hat, Inc.
@@ -37,7 +37,7 @@
typedef struct _LineState LineState;
typedef struct _Point Point;
-typedef struct _PangoRendererPrivate PangoRendererPrivate;
+typedef struct _Pango2RendererPrivate Pango2RendererPrivate;
struct _Point
{
@@ -46,187 +46,186 @@ struct _Point
struct _LineState
{
- PangoLineStyle underline;
- PangoUnderlinePosition underline_position;
- PangoRectangle underline_rect;
+ Pango2LineStyle underline;
+ Pango2UnderlinePosition underline_position;
+ Pango2Rectangle underline_rect;
- PangoLineStyle strikethrough;
- PangoRectangle strikethrough_rect;
+ Pango2LineStyle strikethrough;
+ Pango2Rectangle strikethrough_rect;
int strikethrough_glyphs;
- PangoLineStyle overline;
- PangoRectangle overline_rect;
+ Pango2LineStyle overline;
+ Pango2Rectangle overline_rect;
int logical_rect_end;
};
-struct _PangoRendererPrivate
+struct _Pango2RendererPrivate
{
- PangoLineStyle underline;
- PangoUnderlinePosition underline_position;
- PangoLineStyle strikethrough;
- PangoLineStyle overline;
+ Pango2LineStyle underline;
+ Pango2UnderlinePosition underline_position;
+ Pango2LineStyle strikethrough;
+ Pango2LineStyle overline;
int active_count;
- PangoMatrix *matrix;
- PangoContext *context;
+ Pango2Matrix *matrix;
+ Pango2Context *context;
- PangoColor color[N_RENDER_PARTS];
+ Pango2Color color[N_RENDER_PARTS];
gboolean color_set[N_RENDER_PARTS];
- PangoLines *lines;
- PangoLine *line;
+ Pango2Lines *lines;
+ Pango2Line *line;
LineState *line_state;
};
-static void pango_renderer_finalize (GObject *gobject);
-static void pango_renderer_default_draw_glyphs (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y);
-static void pango_renderer_default_draw_run (PangoRenderer *renderer,
+static void pango2_renderer_finalize (GObject *gobject);
+static void pango2_renderer_default_draw_glyphs (Pango2Renderer *renderer,
+ Pango2Font *font,
+ Pango2GlyphString *glyphs,
+ int x,
+ int y);
+static void pango2_renderer_default_draw_run (Pango2Renderer *renderer,
const char *text,
- PangoRun *run,
- int x,
- int y);
-static void pango_renderer_default_draw_rectangle (PangoRenderer *renderer,
- PangoRenderPart part,
- int x,
- int y,
- int width,
- int height);
-static void pango_renderer_default_draw_styled_line (PangoRenderer *renderer,
- PangoRenderPart part,
- PangoLineStyle style,
- int x,
- int y,
- int width,
- int height);
-static void pango_renderer_default_prepare_run (PangoRenderer *renderer,
- PangoRun *run);
-
-static void pango_renderer_prepare_run (PangoRenderer *renderer,
- PangoRun *run);
+ Pango2Run *run,
+ int x,
+ int y);
+static void pango2_renderer_default_draw_rectangle (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ int x,
+ int y,
+ int width,
+ int height);
+static void pango2_renderer_default_draw_styled_line (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ Pango2LineStyle style,
+ int x,
+ int y,
+ int width,
+ int height);
+static void pango2_renderer_default_prepare_run (Pango2Renderer *renderer,
+ Pango2Run *run);
+static void pango2_renderer_prepare_run (Pango2Renderer *renderer,
+ Pango2Run *run);
static void
-to_device (PangoMatrix *matrix,
- double x,
- double y,
- Point *result)
+to_device (Pango2Matrix *matrix,
+ double x,
+ double y,
+ Point *result)
{
if (matrix)
{
- result->x = (x * matrix->xx + y * matrix->xy) / PANGO_SCALE + matrix->x0;
- result->y = (x * matrix->yx + y * matrix->yy) / PANGO_SCALE + matrix->y0;
+ result->x = (x * matrix->xx + y * matrix->xy) / PANGO2_SCALE + matrix->x0;
+ result->y = (x * matrix->yx + y * matrix->yy) / PANGO2_SCALE + matrix->y0;
}
else
{
- result->x = x / PANGO_SCALE;
- result->y = y / PANGO_SCALE;
+ result->x = x / PANGO2_SCALE;
+ result->y = y / PANGO2_SCALE;
}
}
-G_DEFINE_ABSTRACT_TYPE_WITH_CODE (PangoRenderer, pango_renderer, G_TYPE_OBJECT,
- G_ADD_PRIVATE (PangoRenderer))
+G_DEFINE_ABSTRACT_TYPE_WITH_CODE (Pango2Renderer, pango2_renderer, G_TYPE_OBJECT,
+ G_ADD_PRIVATE (Pango2Renderer))
static void
-pango_renderer_class_init (PangoRendererClass *klass)
+pango2_renderer_class_init (Pango2RendererClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- klass->draw_glyphs = pango_renderer_default_draw_glyphs;
- klass->draw_run = pango_renderer_default_draw_run;
- klass->draw_rectangle = pango_renderer_default_draw_rectangle;
- klass->draw_styled_line = pango_renderer_default_draw_styled_line;
- klass->prepare_run = pango_renderer_default_prepare_run;
+ klass->draw_glyphs = pango2_renderer_default_draw_glyphs;
+ klass->draw_run = pango2_renderer_default_draw_run;
+ klass->draw_rectangle = pango2_renderer_default_draw_rectangle;
+ klass->draw_styled_line = pango2_renderer_default_draw_styled_line;
+ klass->prepare_run = pango2_renderer_default_prepare_run;
- gobject_class->finalize = pango_renderer_finalize;
+ gobject_class->finalize = pango2_renderer_finalize;
}
static void
-pango_renderer_init (PangoRenderer *renderer)
+pango2_renderer_init (Pango2Renderer *renderer)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
priv->matrix = NULL;
}
static void
-pango_renderer_finalize (GObject *gobject)
+pango2_renderer_finalize (GObject *gobject)
{
- PangoRenderer *renderer = PANGO_RENDERER (gobject);
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2Renderer *renderer = PANGO2_RENDERER (gobject);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
if (priv->matrix)
- pango_matrix_free (priv->matrix);
+ pango2_matrix_free (priv->matrix);
- G_OBJECT_CLASS (pango_renderer_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (pango2_renderer_parent_class)->finalize (gobject);
}
static void
-pango_renderer_activate_with_context (PangoRenderer *renderer,
- PangoContext *context)
+pango2_renderer_activate_with_context (Pango2Renderer *renderer,
+ Pango2Context *context)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
/* We only change the matrix if the renderer isn't already active. */
if (!priv->active_count)
{
- pango_renderer_set_matrix (renderer, context ? pango_context_get_matrix (context) : NULL);
+ pango2_renderer_set_matrix (renderer, context ? pango2_context_get_matrix (context) : NULL);
priv->context = context;
}
- pango_renderer_activate (renderer);
+ pango2_renderer_activate (renderer);
}
static void
-draw_underline (PangoRenderer *renderer,
- LineState *state)
+draw_underline (Pango2Renderer *renderer,
+ LineState *state)
{
- PangoRectangle *rect = &state->underline_rect;
- PangoLineStyle underline = state->underline;
+ Pango2Rectangle *rect = &state->underline_rect;
+ Pango2LineStyle underline = state->underline;
- state->underline = PANGO_LINE_STYLE_NONE;
- state->underline_position = PANGO_UNDERLINE_POSITION_NORMAL;
+ state->underline = PANGO2_LINE_STYLE_NONE;
+ state->underline_position = PANGO2_UNDERLINE_POSITION_NORMAL;
switch (underline)
{
- case PANGO_LINE_STYLE_NONE:
+ case PANGO2_LINE_STYLE_NONE:
break;
- case PANGO_LINE_STYLE_DOUBLE:
- pango_renderer_draw_rectangle (renderer,
- PANGO_RENDER_PART_UNDERLINE,
- rect->x,
- rect->y + 2 * rect->height,
- rect->width,
- rect->height);
+ case PANGO2_LINE_STYLE_DOUBLE:
+ pango2_renderer_draw_rectangle (renderer,
+ PANGO2_RENDER_PART_UNDERLINE,
+ rect->x,
+ rect->y + 2 * rect->height,
+ rect->width,
+ rect->height);
G_GNUC_FALLTHROUGH;
- case PANGO_LINE_STYLE_SOLID:
- pango_renderer_draw_rectangle (renderer,
- PANGO_RENDER_PART_UNDERLINE,
- rect->x,
- rect->y,
- rect->width,
- rect->height);
+ case PANGO2_LINE_STYLE_SOLID:
+ pango2_renderer_draw_rectangle (renderer,
+ PANGO2_RENDER_PART_UNDERLINE,
+ rect->x,
+ rect->y,
+ rect->width,
+ rect->height);
break;
- case PANGO_LINE_STYLE_DOTTED:
- case PANGO_LINE_STYLE_DASHED:
- pango_renderer_draw_styled_line (renderer,
- PANGO_RENDER_PART_UNDERLINE,
- underline,
- rect->x,
- rect->y,
- rect->width,
- rect->height);
+ case PANGO2_LINE_STYLE_DOTTED:
+ case PANGO2_LINE_STYLE_DASHED:
+ pango2_renderer_draw_styled_line (renderer,
+ PANGO2_RENDER_PART_UNDERLINE,
+ underline,
+ rect->x,
+ rect->y,
+ rect->width,
+ rect->height);
break;
- case PANGO_LINE_STYLE_WAVY:
- pango_renderer_draw_styled_line (renderer,
- PANGO_RENDER_PART_UNDERLINE,
- underline,
- rect->x,
- rect->y,
- rect->width,
- 3 * rect->height);
+ case PANGO2_LINE_STYLE_WAVY:
+ pango2_renderer_draw_styled_line (renderer,
+ PANGO2_RENDER_PART_UNDERLINE,
+ underline,
+ rect->x,
+ rect->y,
+ rect->width,
+ 3 * rect->height);
break;
default:
break;
@@ -234,52 +233,52 @@ draw_underline (PangoRenderer *renderer,
}
static void
-draw_overline (PangoRenderer *renderer,
- LineState *state)
+draw_overline (Pango2Renderer *renderer,
+ LineState *state)
{
- PangoRectangle *rect = &state->overline_rect;
- PangoLineStyle overline = state->overline;
+ Pango2Rectangle *rect = &state->overline_rect;
+ Pango2LineStyle overline = state->overline;
- state->overline = PANGO_LINE_STYLE_NONE;
+ state->overline = PANGO2_LINE_STYLE_NONE;
switch (overline)
{
- case PANGO_LINE_STYLE_NONE:
+ case PANGO2_LINE_STYLE_NONE:
break;
- case PANGO_LINE_STYLE_DOUBLE:
- pango_renderer_draw_rectangle (renderer,
- PANGO_RENDER_PART_OVERLINE,
- rect->x,
- rect->y - 2 * rect->height,
- rect->width,
- rect->height);
+ case PANGO2_LINE_STYLE_DOUBLE:
+ pango2_renderer_draw_rectangle (renderer,
+ PANGO2_RENDER_PART_OVERLINE,
+ rect->x,
+ rect->y - 2 * rect->height,
+ rect->width,
+ rect->height);
G_GNUC_FALLTHROUGH;
- case PANGO_LINE_STYLE_SOLID:
- pango_renderer_draw_rectangle (renderer,
- PANGO_RENDER_PART_OVERLINE,
- rect->x,
- rect->y,
- rect->width,
- rect->height);
+ case PANGO2_LINE_STYLE_SOLID:
+ pango2_renderer_draw_rectangle (renderer,
+ PANGO2_RENDER_PART_OVERLINE,
+ rect->x,
+ rect->y,
+ rect->width,
+ rect->height);
break;
- case PANGO_LINE_STYLE_DOTTED:
- case PANGO_LINE_STYLE_DASHED:
- pango_renderer_draw_styled_line (renderer,
- PANGO_RENDER_PART_OVERLINE,
- overline,
- rect->x,
- rect->y,
- rect->width,
- rect->height);
+ case PANGO2_LINE_STYLE_DOTTED:
+ case PANGO2_LINE_STYLE_DASHED:
+ pango2_renderer_draw_styled_line (renderer,
+ PANGO2_RENDER_PART_OVERLINE,
+ overline,
+ rect->x,
+ rect->y,
+ rect->width,
+ rect->height);
break;
- case PANGO_LINE_STYLE_WAVY:
- pango_renderer_draw_styled_line (renderer,
- PANGO_RENDER_PART_OVERLINE,
- overline,
- rect->x,
- rect->y,
- rect->width,
- 3 * rect->height);
+ case PANGO2_LINE_STYLE_WAVY:
+ pango2_renderer_draw_styled_line (renderer,
+ PANGO2_RENDER_PART_OVERLINE,
+ overline,
+ rect->x,
+ rect->y,
+ rect->width,
+ 3 * rect->height);
break;
default:
break;
@@ -287,10 +286,10 @@ draw_overline (PangoRenderer *renderer,
}
static void
-draw_strikethrough (PangoRenderer *renderer,
- LineState *state)
+draw_strikethrough (Pango2Renderer *renderer,
+ LineState *state)
{
- PangoRectangle *rect = &state->strikethrough_rect;
+ Pango2Rectangle *rect = &state->strikethrough_rect;
if (state->strikethrough_glyphs > 0)
{
@@ -299,50 +298,50 @@ draw_strikethrough (PangoRenderer *renderer,
switch (state->strikethrough)
{
- case PANGO_LINE_STYLE_NONE:
+ case PANGO2_LINE_STYLE_NONE:
break;
- case PANGO_LINE_STYLE_DOUBLE:
- pango_renderer_draw_rectangle (renderer,
- PANGO_RENDER_PART_STRIKETHROUGH,
- rect->x,
- rect->y - rect->height,
- rect->width,
- rect->height);
+ case PANGO2_LINE_STYLE_DOUBLE:
+ pango2_renderer_draw_rectangle (renderer,
+ PANGO2_RENDER_PART_STRIKETHROUGH,
+ rect->x,
+ rect->y - rect->height,
+ rect->width,
+ rect->height);
rect->y += rect->height;
G_GNUC_FALLTHROUGH;
- case PANGO_LINE_STYLE_SOLID:
- pango_renderer_draw_rectangle (renderer,
- PANGO_RENDER_PART_STRIKETHROUGH,
- rect->x,
- rect->y,
- rect->width,
- rect->height);
+ case PANGO2_LINE_STYLE_SOLID:
+ pango2_renderer_draw_rectangle (renderer,
+ PANGO2_RENDER_PART_STRIKETHROUGH,
+ rect->x,
+ rect->y,
+ rect->width,
+ rect->height);
break;
- case PANGO_LINE_STYLE_DOTTED:
- case PANGO_LINE_STYLE_DASHED:
- pango_renderer_draw_styled_line (renderer,
- PANGO_RENDER_PART_STRIKETHROUGH,
- state->strikethrough,
- rect->x,
- rect->y,
- rect->width,
- rect->height);
+ case PANGO2_LINE_STYLE_DOTTED:
+ case PANGO2_LINE_STYLE_DASHED:
+ pango2_renderer_draw_styled_line (renderer,
+ PANGO2_RENDER_PART_STRIKETHROUGH,
+ state->strikethrough,
+ rect->x,
+ rect->y,
+ rect->width,
+ rect->height);
break;
- case PANGO_LINE_STYLE_WAVY:
- pango_renderer_draw_styled_line (renderer,
- PANGO_RENDER_PART_STRIKETHROUGH,
- state->strikethrough,
- rect->x,
- rect->y,
- rect->width,
- 3 * rect->height);
+ case PANGO2_LINE_STYLE_WAVY:
+ pango2_renderer_draw_styled_line (renderer,
+ PANGO2_RENDER_PART_STRIKETHROUGH,
+ state->strikethrough,
+ rect->x,
+ rect->y,
+ rect->width,
+ 3 * rect->height);
break;
default:
break;
}
}
- state->strikethrough = PANGO_LINE_STYLE_NONE;
+ state->strikethrough = PANGO2_LINE_STYLE_NONE;
state->strikethrough_glyphs = 0;
rect->x += rect->width;
rect->width = 0;
@@ -351,18 +350,18 @@ draw_strikethrough (PangoRenderer *renderer,
}
static void
-handle_line_state_change (PangoRenderer *renderer,
- PangoRenderPart part)
+handle_line_state_change (Pango2Renderer *renderer,
+ Pango2RenderPart part)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
LineState *state = priv->line_state;
if (!state)
return;
- if (part == PANGO_RENDER_PART_UNDERLINE &&
- state->underline != PANGO_LINE_STYLE_NONE)
+ if (part == PANGO2_RENDER_PART_UNDERLINE &&
+ state->underline != PANGO2_LINE_STYLE_NONE)
{
- PangoRectangle *rect = &state->underline_rect;
+ Pango2Rectangle *rect = &state->underline_rect;
rect->width = state->logical_rect_end - rect->x;
draw_underline (renderer, state);
@@ -372,10 +371,10 @@ handle_line_state_change (PangoRenderer *renderer,
rect->width = 0;
}
- if (part == PANGO_RENDER_PART_OVERLINE &&
- state->overline != PANGO_LINE_STYLE_NONE)
+ if (part == PANGO2_RENDER_PART_OVERLINE &&
+ state->overline != PANGO2_LINE_STYLE_NONE)
{
- PangoRectangle *rect = &state->overline_rect;
+ Pango2Rectangle *rect = &state->overline_rect;
rect->width = state->logical_rect_end - rect->x;
draw_overline (renderer, state);
@@ -384,10 +383,10 @@ handle_line_state_change (PangoRenderer *renderer,
rect->width = 0;
}
- if (part == PANGO_RENDER_PART_STRIKETHROUGH &&
- state->strikethrough != PANGO_LINE_STYLE_NONE)
+ if (part == PANGO2_RENDER_PART_STRIKETHROUGH &&
+ state->strikethrough != PANGO2_LINE_STYLE_NONE)
{
- PangoRectangle *rect = &state->strikethrough_rect;
+ Pango2Rectangle *rect = &state->strikethrough_rect;
rect->width = state->logical_rect_end - rect->x;
draw_strikethrough (renderer, state);
@@ -396,20 +395,20 @@ handle_line_state_change (PangoRenderer *renderer,
}
static void
-add_underline (PangoRenderer *renderer,
- LineState *state,
- PangoFontMetrics *metrics,
- int base_x,
- int base_y,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+add_underline (Pango2Renderer *renderer,
+ LineState *state,
+ Pango2FontMetrics *metrics,
+ int base_x,
+ int base_y,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
- PangoRectangle *current_rect = &state->underline_rect;
- PangoRectangle new_rect;
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
+ Pango2Rectangle *current_rect = &state->underline_rect;
+ Pango2Rectangle new_rect;
- int underline_thickness = pango_font_metrics_get_underline_thickness (metrics);
- int underline_position = pango_font_metrics_get_underline_position (metrics);
+ int underline_thickness = pango2_font_metrics_get_underline_thickness (metrics);
+ int underline_position = pango2_font_metrics_get_underline_position (metrics);
new_rect.x = base_x + MIN (ink_rect->x, logical_rect->x);
new_rect.width = MAX (ink_rect->width, logical_rect->width);
@@ -418,20 +417,20 @@ add_underline (PangoRenderer *renderer,
switch (priv->underline)
{
- case PANGO_LINE_STYLE_NONE:
+ case PANGO2_LINE_STYLE_NONE:
g_assert_not_reached ();
break;
- case PANGO_LINE_STYLE_SOLID:
- case PANGO_LINE_STYLE_DASHED:
- case PANGO_LINE_STYLE_DOTTED:
- if (priv->underline_position == PANGO_UNDERLINE_POSITION_UNDER)
+ case PANGO2_LINE_STYLE_SOLID:
+ case PANGO2_LINE_STYLE_DASHED:
+ case PANGO2_LINE_STYLE_DOTTED:
+ if (priv->underline_position == PANGO2_UNDERLINE_POSITION_UNDER)
{
new_rect.y += ink_rect->y + ink_rect->height + underline_thickness;
break;
}
G_GNUC_FALLTHROUGH;
- case PANGO_LINE_STYLE_DOUBLE:
- case PANGO_LINE_STYLE_WAVY:
+ case PANGO2_LINE_STYLE_DOUBLE:
+ case PANGO2_LINE_STYLE_WAVY:
new_rect.y -= underline_position;
if (state->underline == priv->underline)
{
@@ -463,19 +462,19 @@ add_underline (PangoRenderer *renderer,
}
static void
-add_overline (PangoRenderer *renderer,
- LineState *state,
- PangoFontMetrics *metrics,
- int base_x,
- int base_y,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+add_overline (Pango2Renderer *renderer,
+ LineState *state,
+ Pango2FontMetrics *metrics,
+ int base_x,
+ int base_y,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
- PangoRectangle *current_rect = &state->overline_rect;
- PangoRectangle new_rect;
- int underline_thickness = pango_font_metrics_get_underline_thickness (metrics);
- int ascent = pango_font_metrics_get_ascent (metrics);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
+ Pango2Rectangle *current_rect = &state->overline_rect;
+ Pango2Rectangle new_rect;
+ int underline_thickness = pango2_font_metrics_get_underline_thickness (metrics);
+ int ascent = pango2_font_metrics_get_ascent (metrics);
new_rect.x = base_x + ink_rect->x;
new_rect.width = ink_rect->width;
@@ -484,14 +483,14 @@ add_overline (PangoRenderer *renderer,
switch (priv->overline)
{
- case PANGO_LINE_STYLE_NONE:
+ case PANGO2_LINE_STYLE_NONE:
g_assert_not_reached ();
break;
- case PANGO_LINE_STYLE_SOLID:
- case PANGO_LINE_STYLE_DOUBLE:
- case PANGO_LINE_STYLE_DASHED:
- case PANGO_LINE_STYLE_DOTTED:
- case PANGO_LINE_STYLE_WAVY:
+ case PANGO2_LINE_STYLE_SOLID:
+ case PANGO2_LINE_STYLE_DOUBLE:
+ case PANGO2_LINE_STYLE_DASHED:
+ case PANGO2_LINE_STYLE_DOTTED:
+ case PANGO2_LINE_STYLE_WAVY:
new_rect.y -= ascent;
if (state->overline == priv->overline)
{
@@ -521,21 +520,21 @@ add_overline (PangoRenderer *renderer,
}
static void
-add_strikethrough (PangoRenderer *renderer,
- LineState *state,
- PangoFontMetrics *metrics,
- int base_x,
- int base_y,
- PangoRectangle *ink_rect G_GNUC_UNUSED,
- PangoRectangle *logical_rect,
- int num_glyphs)
+add_strikethrough (Pango2Renderer *renderer,
+ LineState *state,
+ Pango2FontMetrics *metrics,
+ int base_x,
+ int base_y,
+ Pango2Rectangle *ink_rect G_GNUC_UNUSED,
+ Pango2Rectangle *logical_rect,
+ int num_glyphs)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
- PangoRectangle *current_rect = &state->strikethrough_rect;
- PangoRectangle new_rect;
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
+ Pango2Rectangle *current_rect = &state->strikethrough_rect;
+ Pango2Rectangle new_rect;
- int strikethrough_thickness = pango_font_metrics_get_strikethrough_thickness (metrics);
- int strikethrough_position = pango_font_metrics_get_strikethrough_position (metrics);
+ int strikethrough_thickness = pango2_font_metrics_get_strikethrough_thickness (metrics);
+ int strikethrough_position = pango2_font_metrics_get_strikethrough_position (metrics);
new_rect.x = base_x + ink_rect->x;
new_rect.width = ink_rect->width;
@@ -559,21 +558,21 @@ add_strikethrough (PangoRenderer *renderer,
}
}
-static void pango_renderer_draw_runs (PangoRenderer *renderer,
- PangoLine *line,
- GSList *runs,
- const char *text,
- int x,
- int y);
+static void pango2_renderer_draw_runs (Pango2Renderer *renderer,
+ Pango2Line *line,
+ GSList *runs,
+ const char *text,
+ int x,
+ int y);
static void
-draw_shaped_glyphs (PangoRenderer *renderer,
- PangoGlyphString *glyphs,
- PangoAttribute *attr,
- int x,
- int y)
+draw_shaped_glyphs (Pango2Renderer *renderer,
+ Pango2GlyphString *glyphs,
+ Pango2Attribute *attr,
+ int x,
+ int y)
{
- PangoRendererClass *class = PANGO_RENDERER_GET_CLASS (renderer);
+ Pango2RendererClass *class = PANGO2_RENDERER_GET_CLASS (renderer);
int i;
if (!class->draw_shape)
@@ -581,7 +580,7 @@ draw_shaped_glyphs (PangoRenderer *renderer,
for (i = 0; i < glyphs->num_glyphs; i++)
{
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
+ Pango2GlyphInfo *gi = &glyphs->glyphs[i];
ShapeData *data = (ShapeData *)attr->pointer_value;
class->draw_shape (renderer,
@@ -595,42 +594,42 @@ draw_shaped_glyphs (PangoRenderer *renderer,
}
/**
- * pango_renderer_draw_line:
- * @renderer: a `PangoRenderer`
- * @line: a `PangoLine`
+ * pango2_renderer_draw_line:
+ * @renderer: a `Pango2Renderer`
+ * @line: a `Pango2Line`
* @x: X position of left edge of baseline, in user space coordinates
- * in Pango units.
+ * in Pango2 units.
* @y: Y position of left edge of baseline, in user space coordinates
- * in Pango units.
+ * in Pango2 units.
*
- * Draws @line with the specified `PangoRenderer`.
+ * Draws @line with the specified `Pango2Renderer`.
*
* This draws the glyph items that make up the line, as well as
* shapes, backgrounds and lines that are specified by the attributes
* of those items.
*/
void
-pango_renderer_draw_line (PangoRenderer *renderer,
- PangoLine *line,
- int x,
- int y)
+pango2_renderer_draw_line (Pango2Renderer *renderer,
+ Pango2Line *line,
+ int x,
+ int y)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
LineState state = { 0, };
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
- pango_renderer_activate_with_context (renderer, line->context);
+ pango2_renderer_activate_with_context (renderer, line->context);
priv->line = line;
priv->line_state = &state;
- state.underline = PANGO_LINE_STYLE_NONE;
- state.underline_position = PANGO_UNDERLINE_POSITION_NORMAL;
- state.overline = PANGO_LINE_STYLE_NONE;
- state.strikethrough = PANGO_LINE_STYLE_NONE;
+ state.underline = PANGO2_LINE_STYLE_NONE;
+ state.underline_position = PANGO2_UNDERLINE_POSITION_NORMAL;
+ state.overline = PANGO2_LINE_STYLE_NONE;
+ state.strikethrough = PANGO2_LINE_STYLE_NONE;
- pango_renderer_draw_runs (renderer, line, line->runs, line->data->text, x, y);
+ pango2_renderer_draw_runs (renderer, line, line->runs, line->data->text, x, y);
/* Finish off any remaining underlines */
draw_underline (renderer, &state);
@@ -641,60 +640,60 @@ pango_renderer_draw_line (PangoRenderer *renderer,
priv->line_state = NULL;
priv->line = NULL;
- pango_renderer_deactivate (renderer);
+ pango2_renderer_deactivate (renderer);
}
/**
- * pango_renderer_draw_lines:
- * @renderer: a `PangoRenderer`
- * @lines: a `PangoLines` object
+ * pango2_renderer_draw_lines:
+ * @renderer: a `Pango2Renderer`
+ * @lines: a `Pango2Lines` object
* @x: X position of left edge of baseline, in user space coordinates
- * in Pango units.
+ * in Pango2 units.
* @y: Y position of left edge of baseline, in user space coordinates
- * in Pango units.
+ * in Pango2 units.
*
- * Draws @lines with the specified `PangoRenderer`.
+ * Draws @lines with the specified `Pango2Renderer`.
*/
void
-pango_renderer_draw_lines (PangoRenderer *renderer,
- PangoLines *lines,
- int x,
- int y)
+pango2_renderer_draw_lines (Pango2Renderer *renderer,
+ Pango2Lines *lines,
+ int x,
+ int y)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
int n;
- PangoLine *line;
+ Pango2Line *line;
int line_x, line_y;
- PangoLine **l;
+ Pango2Line **l;
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
priv->lines = lines;
- l = pango_lines_get_lines (lines);
- for (n = 0; n < pango_lines_get_line_count (lines); n++)
+ l = pango2_lines_get_lines (lines);
+ for (n = 0; n < pango2_lines_get_line_count (lines); n++)
{
line = l[n];
- pango_lines_get_line_position (lines, n, &line_x, &line_y);
+ pango2_lines_get_line_position (lines, n, &line_x, &line_y);
if (n == 0)
- pango_renderer_activate_with_context (renderer, line->context);
+ pango2_renderer_activate_with_context (renderer, line->context);
- pango_renderer_draw_line (renderer, line, x + line_x, y + line_y);
+ pango2_renderer_draw_line (renderer, line, x + line_x, y + line_y);
}
if (n > 0)
- pango_renderer_deactivate (renderer);
+ pango2_renderer_deactivate (renderer);
priv->lines = NULL;
}
static void
-pango_shape_get_extents (int n_chars,
- PangoRectangle *shape_ink,
- PangoRectangle *shape_logical,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_shape_get_extents (int n_chars,
+ Pango2Rectangle *shape_ink,
+ Pango2Rectangle *shape_logical,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
if (n_chars > 0)
{
@@ -725,38 +724,38 @@ pango_shape_get_extents (int n_chars,
static void
-pango_renderer_draw_runs (PangoRenderer *renderer,
- PangoLine *line,
- GSList *runs,
- const char *text,
- int x,
- int y)
+pango2_renderer_draw_runs (Pango2Renderer *renderer,
+ Pango2Line *line,
+ GSList *runs,
+ const char *text,
+ int x,
+ int y)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
GSList *l;
int x_off = 0;
int glyph_string_width;
gboolean got_overall = FALSE;
- PangoRectangle overall_rect;
+ Pango2Rectangle overall_rect;
for (l = runs; l; l = l->next)
{
- PangoFontMetrics *metrics;
- PangoRun *run = l->data;
- PangoGlyphItem *glyph_item = pango_run_get_glyph_item (run);
- PangoItem *item = pango_run_get_item (run);
- PangoGlyphString *glyphs = pango_run_get_glyphs (run);
- PangoRectangle ink_rect, *ink = NULL;
- PangoRectangle logical_rect, *logical = NULL;
+ Pango2FontMetrics *metrics;
+ Pango2Run *run = l->data;
+ Pango2GlyphItem *glyph_item = pango2_run_get_glyph_item (run);
+ Pango2Item *item = pango2_run_get_item (run);
+ Pango2GlyphString *glyphs = pango2_run_get_glyphs (run);
+ Pango2Rectangle ink_rect, *ink = NULL;
+ Pango2Rectangle logical_rect, *logical = NULL;
ItemProperties properties;
int y_off;
- if (item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
+ if (item->analysis.flags & PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE)
logical = &logical_rect;
- pango_renderer_prepare_run (renderer, run);
+ pango2_renderer_prepare_run (renderer, run);
- pango_item_get_properties (item, &properties);
+ pango2_item_get_properties (item, &properties);
if (properties.shape)
{
@@ -764,29 +763,29 @@ pango_renderer_draw_runs (PangoRenderer *renderer,
ink = &ink_rect;
logical = &logical_rect;
- pango_shape_get_extents (glyphs->num_glyphs,
- &data->ink_rect,
- &data->logical_rect,
- ink,
- logical);
+ pango2_shape_get_extents (glyphs->num_glyphs,
+ &data->ink_rect,
+ &data->logical_rect,
+ ink,
+ logical);
glyph_string_width = logical->width;
}
else
{
- if (priv->underline != PANGO_LINE_STYLE_NONE ||
- priv->overline != PANGO_LINE_STYLE_NONE ||
- priv->strikethrough != PANGO_LINE_STYLE_NONE)
+ if (priv->underline != PANGO2_LINE_STYLE_NONE ||
+ priv->overline != PANGO2_LINE_STYLE_NONE ||
+ priv->strikethrough != PANGO2_LINE_STYLE_NONE)
{
ink = &ink_rect;
logical = &logical_rect;
}
if (G_UNLIKELY (ink || logical))
- pango_glyph_string_extents (glyphs, item->analysis.font, ink, logical);
+ pango2_glyph_string_extents (glyphs, item->analysis.font, ink, logical);
if (logical)
glyph_string_width = logical_rect.width;
else
- glyph_string_width = pango_glyph_string_get_width (glyphs);
+ glyph_string_width = pango2_glyph_string_get_width (glyphs);
}
priv->line_state->logical_rect_end = x + x_off + glyph_string_width;
@@ -794,73 +793,73 @@ pango_renderer_draw_runs (PangoRenderer *renderer,
x_off += glyph_item->start_x_offset;
y_off = glyph_item->y_offset;
- if (item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
+ if (item->analysis.flags & PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE)
{
- gboolean is_hinted = ((logical_rect.y | logical_rect.height) & (PANGO_SCALE - 1)) == 0;
+ gboolean is_hinted = ((logical_rect.y | logical_rect.height) & (PANGO2_SCALE - 1)) == 0;
int adjustment = logical_rect.y + logical_rect.height / 2;
if (is_hinted)
- adjustment = PANGO_UNITS_ROUND (adjustment);
+ adjustment = PANGO2_UNITS_ROUND (adjustment);
y_off += adjustment;
}
- if (priv->color_set[PANGO_RENDER_PART_BACKGROUND])
+ if (priv->color_set[PANGO2_RENDER_PART_BACKGROUND])
{
if (!got_overall)
{
- pango_line_get_extents (line, NULL, &overall_rect);
+ pango2_line_get_extents (line, NULL, &overall_rect);
got_overall = TRUE;
}
- pango_renderer_draw_rectangle (renderer,
- PANGO_RENDER_PART_BACKGROUND,
- x + x_off,
- y + overall_rect.y,
- glyph_string_width,
- overall_rect.height);
+ pango2_renderer_draw_rectangle (renderer,
+ PANGO2_RENDER_PART_BACKGROUND,
+ x + x_off,
+ y + overall_rect.y,
+ glyph_string_width,
+ overall_rect.height);
}
if (properties.shape)
draw_shaped_glyphs (renderer, glyphs, properties.shape, x + x_off, y - y_off);
else
- pango_renderer_draw_run (renderer, text, run, x + x_off, y - y_off);
+ pango2_renderer_draw_run (renderer, text, run, x + x_off, y - y_off);
- if (priv->underline != PANGO_LINE_STYLE_NONE ||
- priv->overline != PANGO_LINE_STYLE_NONE ||
- priv->strikethrough != PANGO_LINE_STYLE_NONE)
+ if (priv->underline != PANGO2_LINE_STYLE_NONE ||
+ priv->overline != PANGO2_LINE_STYLE_NONE ||
+ priv->strikethrough != PANGO2_LINE_STYLE_NONE)
{
- metrics = pango_font_get_metrics (item->analysis.font,
+ metrics = pango2_font_get_metrics (item->analysis.font,
item->analysis.language);
- if (priv->underline != PANGO_LINE_STYLE_NONE)
+ if (priv->underline != PANGO2_LINE_STYLE_NONE)
add_underline (renderer, priv->line_state, metrics,
x + x_off, y - y_off,
ink, logical);
- if (priv->overline != PANGO_LINE_STYLE_NONE)
+ if (priv->overline != PANGO2_LINE_STYLE_NONE)
add_overline (renderer, priv->line_state, metrics,
x + x_off, y - y_off,
ink, logical);
- if (priv->strikethrough != PANGO_LINE_STYLE_NONE)
+ if (priv->strikethrough != PANGO2_LINE_STYLE_NONE)
add_strikethrough (renderer, priv->line_state, metrics,
x + x_off, y - y_off,
ink, logical, glyphs->num_glyphs);
- pango_font_metrics_free (metrics);
+ pango2_font_metrics_free (metrics);
}
- if (priv->underline == PANGO_LINE_STYLE_NONE &&
- priv->line_state->underline != PANGO_LINE_STYLE_NONE)
+ if (priv->underline == PANGO2_LINE_STYLE_NONE &&
+ priv->line_state->underline != PANGO2_LINE_STYLE_NONE)
draw_underline (renderer, priv->line_state);
- if (priv->overline == PANGO_LINE_STYLE_NONE &&
- priv->line_state->overline != PANGO_LINE_STYLE_NONE)
+ if (priv->overline == PANGO2_LINE_STYLE_NONE &&
+ priv->line_state->overline != PANGO2_LINE_STYLE_NONE)
draw_overline (renderer, priv->line_state);
- if (priv->strikethrough == PANGO_LINE_STYLE_NONE &&
- priv->line_state->strikethrough != PANGO_LINE_STYLE_NONE)
+ if (priv->strikethrough == PANGO2_LINE_STYLE_NONE &&
+ priv->line_state->strikethrough != PANGO2_LINE_STYLE_NONE)
draw_strikethrough (renderer, priv->line_state);
x_off += glyph_string_width;
@@ -869,47 +868,47 @@ pango_renderer_draw_runs (PangoRenderer *renderer,
}
/**
- * pango_renderer_draw_glyphs:
- * @renderer: a `PangoRenderer`
- * @font: a `PangoFont`
- * @glyphs: a `PangoGlyphString`
+ * pango2_renderer_draw_glyphs:
+ * @renderer: a `Pango2Renderer`
+ * @font: a `Pango2Font`
+ * @glyphs: a `Pango2GlyphString`
* @x: X position of left edge of baseline, in user space coordinates
- * in Pango units.
+ * in Pango2 units.
* @y: Y position of left edge of baseline, in user space coordinates
- * in Pango units.
+ * in Pango2 units.
*
- * Draws the glyphs in @glyphs with the specified `PangoRenderer`.
+ * Draws the glyphs in @glyphs with the specified `Pango2Renderer`.
*/
void
-pango_renderer_draw_glyphs (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y)
+pango2_renderer_draw_glyphs (Pango2Renderer *renderer,
+ Pango2Font *font,
+ Pango2GlyphString *glyphs,
+ int x,
+ int y)
{
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
- pango_renderer_activate (renderer);
+ pango2_renderer_activate (renderer);
- PANGO_RENDERER_GET_CLASS (renderer)->draw_glyphs (renderer, font, glyphs, x, y);
+ PANGO2_RENDERER_GET_CLASS (renderer)->draw_glyphs (renderer, font, glyphs, x, y);
- pango_renderer_deactivate (renderer);
+ pango2_renderer_deactivate (renderer);
}
static void
-pango_renderer_default_draw_glyphs (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y)
+pango2_renderer_default_draw_glyphs (Pango2Renderer *renderer,
+ Pango2Font *font,
+ Pango2GlyphString *glyphs,
+ int x,
+ int y)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
int i;
int x_position = 0;
for (i = 0; i < glyphs->num_glyphs; i++)
{
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
+ Pango2GlyphInfo *gi = &glyphs->glyphs[i];
Point p;
to_device (priv->matrix,
@@ -917,23 +916,23 @@ pango_renderer_default_draw_glyphs (PangoRenderer *renderer,
y + gi->geometry.y_offset,
&p);
- pango_renderer_draw_glyph (renderer, font, gi->glyph, p.x, p.y);
+ pango2_renderer_draw_glyph (renderer, font, gi->glyph, p.x, p.y);
x_position += gi->geometry.width;
}
}
/**
- * pango_renderer_draw_run:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_draw_run:
+ * @renderer: a `Pango2Renderer`
* @text: (nullable): the UTF-8 text that @glyph_item refers to
- * @run: a `PangoRun`
+ * @run: a `Pango2Run`
* @x: X position of left edge of baseline, in user space coordinates
- * in Pango units
+ * in Pango2 units
* @y: Y position of left edge of baseline, in user space coordinates
- * in Pango units
+ * in Pango2 units
*
- * Draws the glyphs in @run with the specified `PangoRenderer`,
+ * Draws the glyphs in @run with the specified `Pango2Renderer`,
* embedding the text associated with the glyphs in the output if the
* output format supports it.
*
@@ -941,87 +940,87 @@ pango_renderer_default_draw_glyphs (PangoRenderer *renderer,
*
* Note that this method does not handle attributes in @run.
* If you want colors, shapes and lines handled automatically according
- * to those attributes, you need to use [method@Pango.Renderer.draw_line]
- * or [method@Pango.Renderer.draw_lines].
+ * to those attributes, you need to use [method@Pango2.Renderer.draw_line]
+ * or [method@Pango2.Renderer.draw_lines].
*
* Note that @text is the start of the text for layout, which is then
* indexed by `run->item->offset`.
*
- * If @text is %NULL, this simply calls [method@Pango.Renderer.draw_glyphs].
+ * If @text is %NULL, this simply calls [method@Pango2.Renderer.draw_glyphs].
*
* The default implementation of this method simply falls back to
- * [method@Pango.Renderer.draw_glyphs].
+ * [method@Pango2.Renderer.draw_glyphs].
*/
void
-pango_renderer_draw_run (PangoRenderer *renderer,
- const char *text,
- PangoRun *run,
- int x,
- int y)
+pango2_renderer_draw_run (Pango2Renderer *renderer,
+ const char *text,
+ Pango2Run *run,
+ int x,
+ int y)
{
if (!text)
{
- PangoItem *item = pango_run_get_item (run);
- PangoGlyphString *glyphs = pango_run_get_glyphs (run);
+ Pango2Item *item = pango2_run_get_item (run);
+ Pango2GlyphString *glyphs = pango2_run_get_glyphs (run);
- pango_renderer_draw_glyphs (renderer, item->analysis.font, glyphs, x, y);
+ pango2_renderer_draw_glyphs (renderer, item->analysis.font, glyphs, x, y);
return;
}
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
- pango_renderer_activate (renderer);
+ pango2_renderer_activate (renderer);
- PANGO_RENDERER_GET_CLASS (renderer)->draw_run (renderer, text, run, x, y);
+ PANGO2_RENDERER_GET_CLASS (renderer)->draw_run (renderer, text, run, x, y);
- pango_renderer_deactivate (renderer);
+ pango2_renderer_deactivate (renderer);
}
static void
-pango_renderer_default_draw_run (PangoRenderer *renderer,
- const char *text G_GNUC_UNUSED,
- PangoRun *run,
- int x,
- int y)
+pango2_renderer_default_draw_run (Pango2Renderer *renderer,
+ const char *text G_GNUC_UNUSED,
+ Pango2Run *run,
+ int x,
+ int y)
{
- PangoItem *item = pango_run_get_item (run);
- PangoGlyphString *glyphs = pango_run_get_glyphs (run);
+ Pango2Item *item = pango2_run_get_item (run);
+ Pango2GlyphString *glyphs = pango2_run_get_glyphs (run);
- pango_renderer_draw_glyphs (renderer, item->analysis.font, glyphs, x, y);
+ pango2_renderer_draw_glyphs (renderer, item->analysis.font, glyphs, x, y);
}
/**
- * pango_renderer_draw_rectangle:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_draw_rectangle:
+ * @renderer: a `Pango2Renderer`
* @part: type of object this rectangle is part of
* @x: X position at which to draw rectangle, in user space coordinates
- * in Pango units
+ * in Pango2 units
* @y: Y position at which to draw rectangle, in user space coordinates
- * in Pango units
- * @width: width of rectangle in Pango units
- * @height: height of rectangle in Pango units
+ * in Pango2 units
+ * @width: width of rectangle in Pango2 units
+ * @height: height of rectangle in Pango2 units
*
* Draws an axis-aligned rectangle in user space coordinates with the
- * specified `PangoRenderer`.
+ * specified `Pango2Renderer`.
*
* This should be called while @renderer is already active.
- * Use [method@Pango.Renderer.activate] to activate a renderer.
+ * Use [method@Pango2.Renderer.activate] to activate a renderer.
*/
void
-pango_renderer_draw_rectangle (PangoRenderer *renderer,
- PangoRenderPart part,
- int x,
- int y,
- int width,
- int height)
+pango2_renderer_draw_rectangle (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ int x,
+ int y,
+ int width,
+ int height)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
g_return_if_fail (IS_VALID_PART (part));
g_return_if_fail (priv->active_count > 0);
- PANGO_RENDERER_GET_CLASS (renderer)->draw_rectangle (renderer, part, x, y, width, height);
+ PANGO2_RENDERER_GET_CLASS (renderer)->draw_rectangle (renderer, part, x, y, width, height);
}
static int
@@ -1044,13 +1043,13 @@ compare_points (const void *a,
}
static void
-draw_rectangle (PangoRenderer *renderer,
- PangoMatrix *matrix,
- PangoRenderPart part,
- int x,
- int y,
- int width,
- int height)
+draw_rectangle (Pango2Renderer *renderer,
+ Pango2Matrix *matrix,
+ Pango2RenderPart part,
+ int x,
+ int y,
+ int width,
+ int height)
{
Point points[4];
@@ -1082,9 +1081,9 @@ draw_rectangle (PangoRenderer *renderer,
if (points[0].y == points[1].y)
{
/* Case 1 (pure shear) */
- pango_renderer_draw_trapezoid (renderer, part, /* B */
- points[0].y, points[0].x, points[1].x,
- points[2].y, points[2].x, points[3].x);
+ pango2_renderer_draw_trapezoid (renderer, part, /* B */
+ points[0].y, points[0].x, points[1].x,
+ points[2].y, points[2].x, points[3].x);
}
else if (points[1].x < points[2].x)
{
@@ -1092,15 +1091,15 @@ draw_rectangle (PangoRenderer *renderer,
double tmp_width = ((points[2].x - points[0].x) * (points[1].y - points[0].y)) / (points[2].y - points[0].y);
double base_width = tmp_width + points[0].x - points[1].x;
- pango_renderer_draw_trapezoid (renderer, part, /* A */
- points[0].y, points[0].x, points[0].x,
- points[1].y, points[1].x, points[1].x + base_width);
- pango_renderer_draw_trapezoid (renderer, part, /* B */
- points[1].y, points[1].x, points[1].x + base_width,
- points[2].y, points[2].x - base_width, points[2].x);
- pango_renderer_draw_trapezoid (renderer, part, /* C */
- points[2].y, points[2].x - base_width, points[2].x,
- points[3].y, points[3].x, points[3].x);
+ pango2_renderer_draw_trapezoid (renderer, part, /* A */
+ points[0].y, points[0].x, points[0].x,
+ points[1].y, points[1].x, points[1].x + base_width);
+ pango2_renderer_draw_trapezoid (renderer, part, /* B */
+ points[1].y, points[1].x, points[1].x + base_width,
+ points[2].y, points[2].x - base_width, points[2].x);
+ pango2_renderer_draw_trapezoid (renderer, part, /* C */
+ points[2].y, points[2].x - base_width, points[2].x,
+ points[3].y, points[3].x, points[3].x);
}
else
{
@@ -1108,44 +1107,44 @@ draw_rectangle (PangoRenderer *renderer,
double tmp_width = ((points[0].x - points[2].x) * (points[1].y - points[0].y)) / (points[2].y - points[0].y);
double base_width = tmp_width + points[1].x - points[0].x;
- pango_renderer_draw_trapezoid (renderer, part, /* A */
- points[0].y, points[0].x, points[0].x,
- points[1].y, points[1].x - base_width, points[1].x);
- pango_renderer_draw_trapezoid (renderer, part, /* B */
- points[1].y, points[1].x - base_width, points[1].x,
- points[2].y, points[2].x, points[2].x + base_width);
- pango_renderer_draw_trapezoid (renderer, part, /* C */
- points[2].y, points[2].x, points[2].x + base_width,
- points[3].y, points[3].x, points[3].x);
+ pango2_renderer_draw_trapezoid (renderer, part, /* A */
+ points[0].y, points[0].x, points[0].x,
+ points[1].y, points[1].x - base_width, points[1].x);
+ pango2_renderer_draw_trapezoid (renderer, part, /* B */
+ points[1].y, points[1].x - base_width, points[1].x,
+ points[2].y, points[2].x, points[2].x + base_width);
+ pango2_renderer_draw_trapezoid (renderer, part, /* C */
+ points[2].y, points[2].x, points[2].x + base_width,
+ points[3].y, points[3].x, points[3].x);
}
}
static void
-pango_renderer_default_draw_rectangle (PangoRenderer *renderer,
- PangoRenderPart part,
- int x,
- int y,
- int width,
- int height)
+pango2_renderer_default_draw_rectangle (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ int x,
+ int y,
+ int width,
+ int height)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
draw_rectangle (renderer, priv->matrix, part, x, y, width, height);
}
/**
- * pango_renderer_draw_styled_line:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_draw_styled_line:
+ * @renderer: a `Pango2Renderer`
* @part: type of object this rectangle is part of
* @style: the line style
- * @x: X coordinate of line, in Pango units in user coordinate system
- * @y: Y coordinate of line, in Pango units in user coordinate system
- * @width: width of line, in Pango units in user coordinate system
- * @height: height of line, in Pango units in user coordinate system
+ * @x: X coordinate of line, in Pango2 units in user coordinate system
+ * @y: Y coordinate of line, in Pango2 units in user coordinate system
+ * @width: width of line, in Pango2 units in user coordinate system
+ * @height: height of line, in Pango2 units in user coordinate system
*
* Draw a line in the given style.
*
- * For `PANGO_LINE_STYLE_WAVY`, this should draw a squiggly line that
+ * For `PANGO2_LINE_STYLE_WAVY`, this should draw a squiggly line that
* approximately covers the given rectangle in the style of an underline
* used to indicate a spelling error.
*
@@ -1154,24 +1153,24 @@ pango_renderer_default_draw_rectangle (PangoRenderer *renderer,
* in the original rectangle.
*
* This should be called while @renderer is already active.
- * Use [method@Pango.Renderer.activate] to activate a renderer.
+ * Use [method@Pango2.Renderer.activate] to activate a renderer.
*/
void
-pango_renderer_draw_styled_line (PangoRenderer *renderer,
- PangoRenderPart part,
- PangoLineStyle style,
- int x,
- int y,
- int width,
- int height)
+pango2_renderer_draw_styled_line (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ Pango2LineStyle style,
+ int x,
+ int y,
+ int width,
+ int height)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
g_return_if_fail (IS_VALID_PART (part));
g_return_if_fail (priv->active_count > 0);
- PANGO_RENDERER_GET_CLASS (renderer)->draw_styled_line (renderer, part, style, x, y, width, height);
+ PANGO2_RENDERER_GET_CLASS (renderer)->draw_styled_line (renderer, part, style, x, y, width, height);
}
/* We are drawing an error underline that looks like one of:
@@ -1214,13 +1213,13 @@ pango_renderer_draw_styled_line (PangoRenderer *renderer,
#define HEIGHT_SQUARES 2.5
static void
-get_total_matrix (PangoMatrix *total,
- const PangoMatrix *global,
- int x,
- int y,
- int square)
+get_total_matrix (Pango2Matrix *total,
+ const Pango2Matrix *global,
+ int x,
+ int y,
+ int square)
{
- PangoMatrix local;
+ Pango2Matrix local;
double scale = 0.5 * square;
/* The local matrix translates from the axis aligned coordinate system
@@ -1234,38 +1233,38 @@ get_total_matrix (PangoMatrix *total,
local.y0 = 0;
*total = *global;
- pango_matrix_concat (total, &local);
+ pango2_matrix_concat (total, &local);
- total->x0 = (global->xx * x + global->xy * y) / PANGO_SCALE + global->x0;
- total->y0 = (global->yx * x + global->yy * y) / PANGO_SCALE + global->y0;
+ total->x0 = (global->xx * x + global->xy * y) / PANGO2_SCALE + global->x0;
+ total->y0 = (global->yx * x + global->yy * y) / PANGO2_SCALE + global->y0;
}
static void
-pango_renderer_default_draw_styled_line (PangoRenderer *renderer,
- PangoRenderPart part,
- PangoLineStyle style,
- int x,
- int y,
- int width,
- int height)
+pango2_renderer_default_draw_styled_line (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ Pango2LineStyle style,
+ int x,
+ int y,
+ int width,
+ int height)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
int square;
int unit_width;
int width_units;
- const PangoMatrix identity = PANGO_MATRIX_INIT;
- const PangoMatrix *matrix;
+ const Pango2Matrix identity = PANGO2_MATRIX_INIT;
+ const Pango2Matrix *matrix;
double dx, dx0, dy0;
- PangoMatrix total;
+ Pango2Matrix total;
int i;
if (width <= 0 || height <= 0)
return;
- if (style != PANGO_LINE_STYLE_WAVY)
+ if (style != PANGO2_LINE_STYLE_WAVY)
{
/* subclasses can do better */
- pango_renderer_draw_rectangle (renderer, part, x, y, width, height);
+ pango2_renderer_draw_rectangle (renderer, part, x, y, width, height);
return;
}
@@ -1282,13 +1281,13 @@ pango_renderer_default_draw_styled_line (PangoRenderer *renderer,
get_total_matrix (&total, matrix, x, y, square);
dx = unit_width * 2;
- dx0 = (matrix->xx * dx) / PANGO_SCALE;
- dy0 = (matrix->yx * dx) / PANGO_SCALE;
+ dx0 = (matrix->xx * dx) / PANGO2_SCALE;
+ dy0 = (matrix->yx * dx) / PANGO2_SCALE;
i = (width_units - 1) / 2;
while (TRUE)
{
- draw_rectangle (renderer, &total, PANGO_RENDER_PART_UNDERLINE, /* A */
+ draw_rectangle (renderer, &total, PANGO2_RENDER_PART_UNDERLINE, /* A */
0, 0,
HEIGHT_SQUARES * 2 - 1, 1);
@@ -1296,7 +1295,7 @@ pango_renderer_default_draw_styled_line (PangoRenderer *renderer,
break;
i--;
- draw_rectangle (renderer, &total, PANGO_RENDER_PART_UNDERLINE, /* B */
+ draw_rectangle (renderer, &total, PANGO2_RENDER_PART_UNDERLINE, /* B */
HEIGHT_SQUARES * 2 - 2, - (HEIGHT_SQUARES * 2 - 3),
1, HEIGHT_SQUARES * 2 - 3);
@@ -1305,15 +1304,15 @@ pango_renderer_default_draw_styled_line (PangoRenderer *renderer,
}
if (width_units % 2 == 0)
{
- draw_rectangle (renderer, &total, PANGO_RENDER_PART_UNDERLINE, /* C */
+ draw_rectangle (renderer, &total, PANGO2_RENDER_PART_UNDERLINE, /* C */
HEIGHT_SQUARES * 2 - 2, - (HEIGHT_SQUARES * 2 - 2),
1, HEIGHT_SQUARES * 2 - 2);
}
}
/**
- * pango_renderer_draw_trapezoid:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_draw_trapezoid:
+ * @renderer: a `Pango2Renderer`
* @part: type of object this trapezoid is part of
* @y1_: Y coordinate of top of trapezoid
* @x11: X coordinate of left end of top of trapezoid
@@ -1323,33 +1322,33 @@ pango_renderer_default_draw_styled_line (PangoRenderer *renderer,
* @x22: X coordinate of right end of bottom of trapezoid
*
* Draws a trapezoid with the parallel sides aligned with the X axis
- * using the given `PangoRenderer`; coordinates are in device space.
+ * using the given `Pango2Renderer`; coordinates are in device space.
*/
void
-pango_renderer_draw_trapezoid (PangoRenderer *renderer,
- PangoRenderPart part,
- double y1_,
- double x11,
- double x21,
- double y2,
- double x12,
- double x22)
+pango2_renderer_draw_trapezoid (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ double y1_,
+ double x11,
+ double x21,
+ double y2,
+ double x12,
+ double x22)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
g_return_if_fail (priv->active_count > 0);
- if (PANGO_RENDERER_GET_CLASS (renderer)->draw_trapezoid)
- PANGO_RENDERER_GET_CLASS (renderer)->draw_trapezoid (renderer, part,
- y1_, x11, x21,
- y2, x12, x22);
+ if (PANGO2_RENDERER_GET_CLASS (renderer)->draw_trapezoid)
+ PANGO2_RENDERER_GET_CLASS (renderer)->draw_trapezoid (renderer, part,
+ y1_, x11, x21,
+ y2, x12, x22);
}
/**
- * pango_renderer_draw_glyph:
- * @renderer: a `PangoRenderer`
- * @font: a `PangoFont`
+ * pango2_renderer_draw_glyph:
+ * @renderer: a `Pango2Renderer`
+ * @font: a `Pango2Font`
* @glyph: the glyph index of a single glyph
* @x: X coordinate of left edge of baseline of glyph
* @y: Y coordinate of left edge of baseline of glyph
@@ -1357,101 +1356,101 @@ pango_renderer_draw_trapezoid (PangoRenderer *renderer,
* Draws a single glyph with coordinates in device space.
*/
void
-pango_renderer_draw_glyph (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyph glyph,
- double x,
- double y)
+pango2_renderer_draw_glyph (Pango2Renderer *renderer,
+ Pango2Font *font,
+ Pango2Glyph glyph,
+ double x,
+ double y)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
g_return_if_fail (priv->active_count > 0);
- if (glyph == PANGO_GLYPH_EMPTY) /* glyph PANGO_GLYPH_EMPTY never renders */
+ if (glyph == PANGO2_GLYPH_EMPTY) /* glyph PANGO2_GLYPH_EMPTY never renders */
return;
- if (PANGO_RENDERER_GET_CLASS (renderer)->draw_glyph)
- PANGO_RENDERER_GET_CLASS (renderer)->draw_glyph (renderer, font, glyph, x, y);
+ if (PANGO2_RENDERER_GET_CLASS (renderer)->draw_glyph)
+ PANGO2_RENDERER_GET_CLASS (renderer)->draw_glyph (renderer, font, glyph, x, y);
}
/**
- * pango_renderer_activate:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_activate:
+ * @renderer: a `Pango2Renderer`
*
* Does initial setup before rendering operations on @renderer.
*
- * [method@Pango.Renderer.deactivate] should be called when done drawing.
- * Calls such as [method@Pango.Renderer.draw_lines] automatically
+ * [method@Pango2.Renderer.deactivate] should be called when done drawing.
+ * Calls such as [method@Pango2.Renderer.draw_lines] automatically
* activate the layout before drawing on it.
*
- * Calls to [method@Pango.Renderer.activate] and
- * [method@Pango.Renderer.deactivate] can be nested and the
+ * Calls to [method@Pango2.Renderer.activate] and
+ * [method@Pango2.Renderer.deactivate] can be nested and the
* renderer will only be initialized and deinitialized once.
*/
void
-pango_renderer_activate (PangoRenderer *renderer)
+pango2_renderer_activate (Pango2Renderer *renderer)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
priv->active_count++;
if (priv->active_count == 1)
{
- if (PANGO_RENDERER_GET_CLASS (renderer)->begin)
- PANGO_RENDERER_GET_CLASS (renderer)->begin (renderer);
+ if (PANGO2_RENDERER_GET_CLASS (renderer)->begin)
+ PANGO2_RENDERER_GET_CLASS (renderer)->begin (renderer);
}
}
/**
- * pango_renderer_deactivate:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_deactivate:
+ * @renderer: a `Pango2Renderer`
*
* Cleans up after rendering operations on @renderer.
*
- * See docs for [method@Pango.Renderer.activate].
+ * See docs for [method@Pango2.Renderer.activate].
*/
void
-pango_renderer_deactivate (PangoRenderer *renderer)
+pango2_renderer_deactivate (Pango2Renderer *renderer)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
g_return_if_fail (priv->active_count > 0);
if (priv->active_count == 1)
{
- if (PANGO_RENDERER_GET_CLASS (renderer)->end)
- PANGO_RENDERER_GET_CLASS (renderer)->end (renderer);
+ if (PANGO2_RENDERER_GET_CLASS (renderer)->end)
+ PANGO2_RENDERER_GET_CLASS (renderer)->end (renderer);
}
priv->active_count--;
}
/**
- * pango_renderer_set_color:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_set_color:
+ * @renderer: a `Pango2Renderer`
* @part: the part to change the color of
* @color: (nullable): the new color or %NULL to unset the current color
*
* Sets the color for part of the rendering.
*/
void
-pango_renderer_set_color (PangoRenderer *renderer,
- PangoRenderPart part,
- const PangoColor *color)
+pango2_renderer_set_color (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ const Pango2Color *color)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
g_return_if_fail (IS_VALID_PART (part));
if ((!color && !priv->color_set[part]) ||
(color && priv->color_set[part] &&
- pango_color_equal (color, &priv->color[part])))
+ pango2_color_equal (color, &priv->color[part])))
return;
- pango_renderer_part_changed (renderer, part);
+ pango2_renderer_part_changed (renderer, part);
if (color)
{
@@ -1465,8 +1464,8 @@ pango_renderer_set_color (PangoRenderer *renderer,
}
/**
- * pango_renderer_get_color:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_get_color:
+ * @renderer: a `Pango2Renderer`
* @part: the part to get the color for
*
* Gets the current rendering color for the specified part.
@@ -1475,13 +1474,13 @@ pango_renderer_set_color (PangoRenderer *renderer,
* specified part, or %NULL if it hasn't been set and should be
* inherited from the environment.
*/
-PangoColor *
-pango_renderer_get_color (PangoRenderer *renderer,
- PangoRenderPart part)
+Pango2Color *
+pango2_renderer_get_color (Pango2Renderer *renderer,
+ Pango2RenderPart part)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
- g_return_val_if_fail (PANGO_IS_RENDERER (renderer), NULL);
+ g_return_val_if_fail (PANGO2_IS_RENDERER (renderer), NULL);
g_return_val_if_fail (IS_VALID_PART (part), NULL);
if (priv->color_set[part])
@@ -1491,117 +1490,117 @@ pango_renderer_get_color (PangoRenderer *renderer,
}
/**
- * pango_renderer_part_changed:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_part_changed:
+ * @renderer: a `Pango2Renderer`
* @part: the part for which rendering has changed.
*
- * Informs Pango that the way that the rendering is done
+ * Informs Pango2 that the way that the rendering is done
* for @part has changed.
*
* This should be called if the rendering changes in a way that would
* prevent multiple pieces being joined together into one drawing call.
- * For instance, if a subclass of `PangoRenderer` was to add a stipple
+ * For instance, if a subclass of `Pango2Renderer` was to add a stipple
* option for drawing underlines, it needs to call
*
* ```
- * pango_renderer_part_changed (render, PANGO_RENDER_PART_UNDERLINE);
+ * pango2_renderer_part_changed (render, PANGO2_RENDER_PART_UNDERLINE);
* ```
*
* When the stipple changes or underlines with different stipples
- * might be joined together. Pango automatically calls this for
- * changes to colors. (See [method@Pango.Renderer.set_color])
+ * might be joined together. Pango2 automatically calls this for
+ * changes to colors. (See [method@Pango2.Renderer.set_color])
*/
void
-pango_renderer_part_changed (PangoRenderer *renderer,
- PangoRenderPart part)
+pango2_renderer_part_changed (Pango2Renderer *renderer,
+ Pango2RenderPart part)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
g_return_if_fail (IS_VALID_PART (part));
g_return_if_fail (priv->active_count > 0);
handle_line_state_change (renderer, part);
- if (PANGO_RENDERER_GET_CLASS (renderer)->part_changed)
- PANGO_RENDERER_GET_CLASS (renderer)->part_changed (renderer, part);
+ if (PANGO2_RENDERER_GET_CLASS (renderer)->part_changed)
+ PANGO2_RENDERER_GET_CLASS (renderer)->part_changed (renderer, part);
}
/**
- * pango_renderer_prepare_run:
- * @renderer: a `PangoRenderer`
- * @run: a `PangoRun`
+ * pango2_renderer_prepare_run:
+ * @renderer: a `Pango2Renderer`
+ * @run: a `Pango2Run`
*
- * Set up the state of the `PangoRenderer` for rendering @run.
+ * Set up the state of the `Pango2Renderer` for rendering @run.
*/
static void
-pango_renderer_prepare_run (PangoRenderer *renderer,
- PangoRun *run)
+pango2_renderer_prepare_run (Pango2Renderer *renderer,
+ Pango2Run *run)
{
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
- PANGO_RENDERER_GET_CLASS (renderer)->prepare_run (renderer, run);
+ PANGO2_RENDERER_GET_CLASS (renderer)->prepare_run (renderer, run);
}
static void
-pango_renderer_default_prepare_run (PangoRenderer *renderer,
- PangoRun *run)
+pango2_renderer_default_prepare_run (Pango2Renderer *renderer,
+ Pango2Run *run)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
- PangoColor *fg_color = NULL;
- PangoColor *bg_color = NULL;
- PangoColor *underline_color = NULL;
- PangoColor *overline_color = NULL;
- PangoColor *strikethrough_color = NULL;
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
+ Pango2Color *fg_color = NULL;
+ Pango2Color *bg_color = NULL;
+ Pango2Color *underline_color = NULL;
+ Pango2Color *overline_color = NULL;
+ Pango2Color *strikethrough_color = NULL;
GSList *l;
- PangoGlyphItem *glyph_item;
+ Pango2GlyphItem *glyph_item;
- glyph_item = pango_run_get_glyph_item (run);
+ glyph_item = pango2_run_get_glyph_item (run);
- priv->underline = PANGO_LINE_STYLE_NONE;
- priv->underline_position = PANGO_UNDERLINE_POSITION_NORMAL;
- priv->overline = PANGO_LINE_STYLE_NONE;
- priv->strikethrough = PANGO_LINE_STYLE_NONE;
+ priv->underline = PANGO2_LINE_STYLE_NONE;
+ priv->underline_position = PANGO2_UNDERLINE_POSITION_NORMAL;
+ priv->overline = PANGO2_LINE_STYLE_NONE;
+ priv->strikethrough = PANGO2_LINE_STYLE_NONE;
for (l = glyph_item->item->analysis.extra_attrs; l; l = l->next)
{
- PangoAttribute *attr = l->data;
+ Pango2Attribute *attr = l->data;
switch ((int) attr->type)
{
- case PANGO_ATTR_UNDERLINE:
+ case PANGO2_ATTR_UNDERLINE:
priv->underline = attr->int_value;
break;
- case PANGO_ATTR_UNDERLINE_POSITION:
+ case PANGO2_ATTR_UNDERLINE_POSITION:
priv->underline_position = attr->int_value;
break;
- case PANGO_ATTR_OVERLINE:
+ case PANGO2_ATTR_OVERLINE:
priv->overline = attr->int_value;
break;
- case PANGO_ATTR_STRIKETHROUGH:
+ case PANGO2_ATTR_STRIKETHROUGH:
priv->strikethrough = attr->int_value;
break;
- case PANGO_ATTR_FOREGROUND:
+ case PANGO2_ATTR_FOREGROUND:
fg_color = &attr->color_value;
break;
- case PANGO_ATTR_BACKGROUND:
+ case PANGO2_ATTR_BACKGROUND:
bg_color = &attr->color_value;
break;
- case PANGO_ATTR_UNDERLINE_COLOR:
+ case PANGO2_ATTR_UNDERLINE_COLOR:
underline_color = &attr->color_value;
break;
- case PANGO_ATTR_OVERLINE_COLOR:
+ case PANGO2_ATTR_OVERLINE_COLOR:
overline_color = &attr->color_value;
break;
- case PANGO_ATTR_STRIKETHROUGH_COLOR:
+ case PANGO2_ATTR_STRIKETHROUGH_COLOR:
strikethrough_color = &attr->color_value;
break;
@@ -1619,61 +1618,61 @@ pango_renderer_default_prepare_run (PangoRenderer *renderer,
if (!strikethrough_color)
strikethrough_color = fg_color;
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_FOREGROUND, fg_color);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_BACKGROUND, bg_color);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_UNDERLINE, underline_color);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_STRIKETHROUGH, strikethrough_color);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_OVERLINE, overline_color);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_FOREGROUND, fg_color);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_BACKGROUND, bg_color);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_UNDERLINE, underline_color);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_STRIKETHROUGH, strikethrough_color);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_OVERLINE, overline_color);
}
/**
- * pango_renderer_set_matrix:
- * @renderer: a `PangoRenderer`
- * @matrix: (nullable): a `PangoMatrix`, or %NULL to unset any existing matrix
+ * pango2_renderer_set_matrix:
+ * @renderer: a `Pango2Renderer`
+ * @matrix: (nullable): a `Pango2Matrix`, or %NULL to unset any existing matrix
* (No matrix set is the same as setting the identity matrix.)
*
* Sets the transformation matrix that will be applied when rendering.
*/
void
-pango_renderer_set_matrix (PangoRenderer *renderer,
- const PangoMatrix *matrix)
+pango2_renderer_set_matrix (Pango2Renderer *renderer,
+ const Pango2Matrix *matrix)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
- g_return_if_fail (PANGO_IS_RENDERER (renderer));
+ g_return_if_fail (PANGO2_IS_RENDERER (renderer));
- pango_matrix_free (priv->matrix);
- priv->matrix = pango_matrix_copy (matrix);
+ pango2_matrix_free (priv->matrix);
+ priv->matrix = pango2_matrix_copy (matrix);
}
/**
- * pango_renderer_get_matrix:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_get_matrix:
+ * @renderer: a `Pango2Renderer`
*
* Gets the transformation matrix that will be applied when
* rendering.
*
- * See [method@Pango.Renderer.set_matrix].
+ * See [method@Pango2.Renderer.set_matrix].
*
* Return value: (nullable): the matrix, or %NULL if no matrix has
* been set (which is the same as the identity matrix). The returned
- * matrix is owned by Pango and must not be modified or freed.
+ * matrix is owned by Pango2 and must not be modified or freed.
*/
-const PangoMatrix *
-pango_renderer_get_matrix (PangoRenderer *renderer)
+const Pango2Matrix *
+pango2_renderer_get_matrix (Pango2Renderer *renderer)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
- g_return_val_if_fail (PANGO_IS_RENDERER (renderer), NULL);
+ g_return_val_if_fail (PANGO2_IS_RENDERER (renderer), NULL);
return priv->matrix;
}
/**
- * pango_renderer_get_lines:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_get_lines:
+ * @renderer: a `Pango2Renderer`
*
- * Gets the `PangoLines` currently being rendered using @renderer.
+ * Gets the `Pango2Lines` currently being rendered using @renderer.
*
* Calling this function only makes sense from inside a subclass's
* methods, like in its draw_shape vfunc, for example.
@@ -1681,20 +1680,20 @@ pango_renderer_get_matrix (PangoRenderer *renderer)
* The returned layout should not be modified while still being
* rendered.
*
- * Return value: (transfer none) (nullable): the `PangoLines`, or
+ * Return value: (transfer none) (nullable): the `Pango2Lines`, or
* %NULL if no layout is being rendered using @renderer at this time.
*/
-PangoLines *
-pango_renderer_get_lines (PangoRenderer *renderer)
+Pango2Lines *
+pango2_renderer_get_lines (Pango2Renderer *renderer)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
return priv->lines;
}
/**
- * pango_renderer_get_layout_line:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_get_layout_line:
+ * @renderer: a `Pango2Renderer`
*
* Gets the line currently being rendered using @renderer.
*
@@ -1707,26 +1706,26 @@ pango_renderer_get_lines (PangoRenderer *renderer)
* Return value: (transfer none) (nullable): the line, or %NULL
* if no layout line is being rendered using @renderer at this time.
*/
-PangoLine *
-pango_renderer_get_layout_line (PangoRenderer *renderer)
+Pango2Line *
+pango2_renderer_get_layout_line (Pango2Renderer *renderer)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
return priv->line;
}
/**
- * pango_renderer_get_context:
- * @renderer: a `PangoRenderer`
+ * pango2_renderer_get_context:
+ * @renderer: a `Pango2Renderer`
*
* Gets the current context in which @renderer operates.
*
- * Returns: (nullable) (transfer none): the `PangoContext`
+ * Returns: (nullable) (transfer none): the `Pango2Context`
*/
-PangoContext *
-pango_renderer_get_context (PangoRenderer *renderer)
+Pango2Context *
+pango2_renderer_get_context (Pango2Renderer *renderer)
{
- PangoRendererPrivate *priv = pango_renderer_get_instance_private (renderer);
+ Pango2RendererPrivate *priv = pango2_renderer_get_instance_private (renderer);
return priv->context;
}
diff --git a/pango/pango-renderer.h b/pango/pango-renderer.h
index d75c6db1..b9d361d6 100644
--- a/pango/pango-renderer.h
+++ b/pango/pango-renderer.h
@@ -25,55 +25,55 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_RENDERER (pango_renderer_get_type())
-#define PANGO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_RENDERER, PangoRenderer))
-#define PANGO_IS_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_RENDERER))
-#define PANGO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_RENDERER, PangoRendererClass))
-#define PANGO_IS_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_RENDERER))
-#define PANGO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_RENDERER, PangoRendererClass))
+#define PANGO2_TYPE_RENDERER (pango2_renderer_get_type())
+#define PANGO2_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO2_TYPE_RENDERER, Pango2Renderer))
+#define PANGO2_IS_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO2_TYPE_RENDERER))
+#define PANGO2_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO2_TYPE_RENDERER, Pango2RendererClass))
+#define PANGO2_IS_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO2_TYPE_RENDERER))
+#define PANGO2_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO2_TYPE_RENDERER, Pango2RendererClass))
-typedef struct _PangoRenderer PangoRenderer;
-typedef struct _PangoRendererClass PangoRendererClass;
+typedef struct _Pango2Renderer Pango2Renderer;
+typedef struct _Pango2RendererClass Pango2RendererClass;
/**
- * PangoRenderPart:
- * @PANGO_RENDER_PART_FOREGROUND: the text itself
- * @PANGO_RENDER_PART_BACKGROUND: the area behind the text
- * @PANGO_RENDER_PART_UNDERLINE: underlines
- * @PANGO_RENDER_PART_STRIKETHROUGH: strikethrough lines
- * @PANGO_RENDER_PART_OVERLINE: overlines
+ * Pango2RenderPart:
+ * @PANGO2_RENDER_PART_FOREGROUND: the text itself
+ * @PANGO2_RENDER_PART_BACKGROUND: the area behind the text
+ * @PANGO2_RENDER_PART_UNDERLINE: underlines
+ * @PANGO2_RENDER_PART_STRIKETHROUGH: strikethrough lines
+ * @PANGO2_RENDER_PART_OVERLINE: overlines
*
- * `PangoRenderPart` defines different items to render for such
+ * `Pango2RenderPart` defines different items to render for such
* purposes as setting colors.
*/
/* When extending, note N_RENDER_PARTS #define in pango-renderer.c */
typedef enum
{
- PANGO_RENDER_PART_FOREGROUND,
- PANGO_RENDER_PART_BACKGROUND,
- PANGO_RENDER_PART_UNDERLINE,
- PANGO_RENDER_PART_STRIKETHROUGH,
- PANGO_RENDER_PART_OVERLINE
-} PangoRenderPart;
+ PANGO2_RENDER_PART_FOREGROUND,
+ PANGO2_RENDER_PART_BACKGROUND,
+ PANGO2_RENDER_PART_UNDERLINE,
+ PANGO2_RENDER_PART_STRIKETHROUGH,
+ PANGO2_RENDER_PART_OVERLINE
+} Pango2RenderPart;
/**
- * PangoRenderer:
+ * Pango2Renderer:
*
- * `PangoRenderer` is a base class for objects that can render text
- * provided as `PangoGlyphString` or `PangoLayout`.
+ * `Pango2Renderer` is a base class for objects that can render text
+ * provided as `Pango2GlyphString` or `Pango2Layout`.
*
- * By subclassing `PangoRenderer` and overriding operations such as
+ * By subclassing `Pango2Renderer` and overriding operations such as
* @draw_glyphs and @draw_rectangle, renderers for particular font
* backends and destinations can be created.
*/
-struct _PangoRenderer
+struct _Pango2Renderer
{
GObject parent_instance;
};
/**
- * PangoRendererClass:
- * @draw_glyphs: draws a `PangoGlyphString`
+ * Pango2RendererClass:
+ * @draw_glyphs: draws a `Pango2GlyphString`
* @draw_rectangle: draws a rectangle
* @draw_line: draws a line in the given style that approximately
* covers the given rectangle
@@ -84,11 +84,11 @@ struct _PangoRenderer
* @begin: Do renderer-specific initialization before drawing
* @end: Do renderer-specific cleanup after drawing
* @prepare_run: updates the renderer for a new run
- * @draw_glyph_item: draws a `PangoGlyphItem`
+ * @draw_glyph_item: draws a `Pango2GlyphItem`
*
- * Class structure for `PangoRenderer`.
+ * Class structure for `Pango2Renderer`.
*
- * The following vfuncs take user space coordinates in Pango units
+ * The following vfuncs take user space coordinates in Pango2 units
* and have default implementations:
* - draw_glyphs
* - draw_rectangle
@@ -103,171 +103,171 @@ struct _PangoRenderer
* - draw_trapezoid
* - draw_glyph
*/
-struct _PangoRendererClass
+struct _Pango2RendererClass
{
/*< private >*/
GObjectClass parent_class;
/*< public >*/
- void (*draw_glyphs) (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y);
- void (*draw_rectangle) (PangoRenderer *renderer,
- PangoRenderPart part,
- int x,
- int y,
- int width,
- int height);
- void (*draw_styled_line) (PangoRenderer *renderer,
- PangoRenderPart part,
- PangoLineStyle style,
- int x,
- int y,
- int width,
- int height);
- void (*draw_line) (PangoRenderer *renderer,
- PangoLineStyle style,
- int x,
- int y,
- int width,
- int height);
- void (*draw_shape) (PangoRenderer *renderer,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect,
- gpointer data,
- int x,
- int y);
- void (*draw_trapezoid) (PangoRenderer *renderer,
- PangoRenderPart part,
- double y1_,
- double x11,
- double x21,
- double y2,
- double x12,
- double x22);
- void (*draw_glyph) (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyph glyph,
- double x,
- double y);
+ void (* draw_glyphs) (Pango2Renderer *renderer,
+ Pango2Font *font,
+ Pango2GlyphString *glyphs,
+ int x,
+ int y);
+ void (* draw_rectangle) (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ int x,
+ int y,
+ int width,
+ int height);
+ void (* draw_styled_line) (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ Pango2LineStyle style,
+ int x,
+ int y,
+ int width,
+ int height);
+ void (* draw_line) (Pango2Renderer *renderer,
+ Pango2LineStyle style,
+ int x,
+ int y,
+ int width,
+ int height);
+ void (* draw_shape) (Pango2Renderer *renderer,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect,
+ gpointer data,
+ int x,
+ int y);
+ void (* draw_trapezoid) (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ double y1_,
+ double x11,
+ double x21,
+ double y2,
+ double x12,
+ double x22);
+ void (* draw_glyph) (Pango2Renderer *renderer,
+ Pango2Font *font,
+ Pango2Glyph glyph,
+ double x,
+ double y);
- void (*part_changed) (PangoRenderer *renderer,
- PangoRenderPart part);
+ void (* part_changed) (Pango2Renderer *renderer,
+ Pango2RenderPart part);
- void (*begin) (PangoRenderer *renderer);
- void (*end) (PangoRenderer *renderer);
+ void (* begin) (Pango2Renderer *renderer);
+ void (* end) (Pango2Renderer *renderer);
- void (*prepare_run) (PangoRenderer *renderer,
- PangoRun *run);
+ void (* prepare_run) (Pango2Renderer *renderer,
+ Pango2Run *run);
- void (*draw_run) (PangoRenderer *renderer,
- const char *text,
- PangoRun *run,
- int x,
- int y);
+ void (* draw_run) (Pango2Renderer *renderer,
+ const char *text,
+ Pango2Run *run,
+ int x,
+ int y);
/*< private >*/
/* Padding for future expansion */
- gpointer _pango_reserved[8];
+ gpointer _pango2_reserved[8];
};
-PANGO_AVAILABLE_IN_ALL
-GType pango_renderer_get_type (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_renderer_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_draw_lines (PangoRenderer *renderer,
- PangoLines *lines,
- int x,
- int y);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_draw_lines (Pango2Renderer *renderer,
+ Pango2Lines *lines,
+ int x,
+ int y);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_draw_line (PangoRenderer *renderer,
- PangoLine *line,
- int x,
- int y);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_draw_glyphs (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_draw_run (PangoRenderer *renderer,
- const char *text,
- PangoRun *run,
- int x,
- int y);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_draw_rectangle (PangoRenderer *renderer,
- PangoRenderPart part,
- int x,
- int y,
- int width,
- int height);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_draw_styled_line (PangoRenderer *renderer,
- PangoRenderPart part,
- PangoLineStyle style,
- int x,
- int y,
- int width,
- int height);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_draw_error_underline (PangoRenderer *renderer,
- int x,
- int y,
- int width,
- int height);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_draw_trapezoid (PangoRenderer *renderer,
- PangoRenderPart part,
- double y1_,
- double x11,
- double x21,
- double y2,
- double x12,
- double x22);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_draw_glyph (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyph glyph,
- double x,
- double y);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_draw_line (Pango2Renderer *renderer,
+ Pango2Line *line,
+ int x,
+ int y);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_draw_glyphs (Pango2Renderer *renderer,
+ Pango2Font *font,
+ Pango2GlyphString *glyphs,
+ int x,
+ int y);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_draw_run (Pango2Renderer *renderer,
+ const char *text,
+ Pango2Run *run,
+ int x,
+ int y);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_draw_rectangle (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ int x,
+ int y,
+ int width,
+ int height);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_draw_styled_line (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ Pango2LineStyle style,
+ int x,
+ int y,
+ int width,
+ int height);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_draw_error_underline (Pango2Renderer *renderer,
+ int x,
+ int y,
+ int width,
+ int height);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_draw_trapezoid (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ double y1_,
+ double x11,
+ double x21,
+ double y2,
+ double x12,
+ double x22);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_draw_glyph (Pango2Renderer *renderer,
+ Pango2Font *font,
+ Pango2Glyph glyph,
+ double x,
+ double y);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_activate (PangoRenderer *renderer);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_deactivate (PangoRenderer *renderer);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_activate (Pango2Renderer *renderer);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_deactivate (Pango2Renderer *renderer);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_part_changed (PangoRenderer *renderer,
- PangoRenderPart part);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_part_changed (Pango2Renderer *renderer,
+ Pango2RenderPart part);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_set_color (PangoRenderer *renderer,
- PangoRenderPart part,
- const PangoColor *color);
-PANGO_AVAILABLE_IN_ALL
-PangoColor *pango_renderer_get_color (PangoRenderer *renderer,
- PangoRenderPart part);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_set_color (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ const Pango2Color *color);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Color * pango2_renderer_get_color (Pango2Renderer *renderer,
+ Pango2RenderPart part);
-PANGO_AVAILABLE_IN_ALL
-void pango_renderer_set_matrix (PangoRenderer *renderer,
- const PangoMatrix *matrix);
-PANGO_AVAILABLE_IN_ALL
-const PangoMatrix *pango_renderer_get_matrix (PangoRenderer *renderer);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_renderer_set_matrix (Pango2Renderer *renderer,
+ const Pango2Matrix *matrix);
+PANGO2_AVAILABLE_IN_ALL
+const Pango2Matrix * pango2_renderer_get_matrix (Pango2Renderer *renderer);
-PANGO_AVAILABLE_IN_ALL
-PangoLines * pango_renderer_get_lines (PangoRenderer *renderer);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Lines * pango2_renderer_get_lines (Pango2Renderer *renderer);
-PANGO_AVAILABLE_IN_ALL
-PangoLine * pango_renderer_get_layout_line (PangoRenderer *renderer);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Line * pango2_renderer_get_layout_line (Pango2Renderer *renderer);
-PANGO_AVAILABLE_IN_ALL
-PangoContext * pango_renderer_get_context (PangoRenderer *renderer);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Context * pango2_renderer_get_context (Pango2Renderer *renderer);
G_END_DECLS
diff --git a/pango/pango-run-private.h b/pango/pango-run-private.h
index 6fa31db7..2e84bdfe 100644
--- a/pango/pango-run-private.h
+++ b/pango/pango-run-private.h
@@ -26,13 +26,13 @@
#include "pango-item-private.h"
-struct _PangoRun
+struct _Pango2Run
{
- PangoGlyphItem glyph_item;
+ Pango2GlyphItem glyph_item;
};
-static inline PangoGlyphItem *
-pango_run_get_glyph_item (PangoRun *run)
+static inline Pango2GlyphItem *
+pango2_run_get_glyph_item (Pango2Run *run)
{
return &run->glyph_item;
}
diff --git a/pango/pango-run.c b/pango/pango-run.c
index eb8dafe5..8c36f138 100644
--- a/pango/pango-run.c
+++ b/pango/pango-run.c
@@ -10,57 +10,57 @@
#include <math.h>
/**
- * PangoRun:
+ * Pango2Run:
*
- * A `PangoRun` represents a single run within a `PangoLine`.
+ * A `Pango2Run` represents a single run within a `Pango2Line`.
*
* A run is a range of text with uniform script, font and attributes that
* is shaped as a unit.
*
* Script, font and attributes of a run can be accessed via
- * [method@Pango.Run.get_item]. The glyphs that result from shaping
- * the text of the run can be obtained via [method@Pango.Run.get_glyphs].
+ * [method@Pango2.Run.get_item]. The glyphs that result from shaping
+ * the text of the run can be obtained via [method@Pango2.Run.get_glyphs].
*/
/**
- * pango_run_get_item:
- * @run: a `PangoRun`
+ * pango2_run_get_item:
+ * @run: a `Pango2Run`
*
- * Gets the `PangoItem` for the run.
+ * Gets the `Pango2Item` for the run.
*
- * Returns: (transfer none): the `PangoItem` of @run
+ * Returns: (transfer none): the `Pango2Item` of @run
*/
-PangoItem *
-pango_run_get_item (PangoRun *run)
+Pango2Item *
+pango2_run_get_item (Pango2Run *run)
{
return run->glyph_item.item;
}
/**
- * pango_run_get_glyphs:
- * @run: a `PangoRun`
+ * pango2_run_get_glyphs:
+ * @run: a `Pango2Run`
*
- * Gets the `PangoGlyphString` for the run.
+ * Gets the `Pango2GlyphString` for the run.
*
- * Returns: (transfer none): the `PangoGlyphString` of @run
+ * Returns: (transfer none): the `Pango2GlyphString` of @run
*/
-PangoGlyphString *
-pango_run_get_glyphs (PangoRun *run)
+Pango2GlyphString *
+pango2_run_get_glyphs (Pango2Run *run)
{
return run->glyph_item.glyphs;
}
static void
-pango_shape_get_extents (int n_chars,
- PangoAttribute *attr,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_shape_get_extents (int n_chars,
+ Pango2Attribute *attr,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
if (n_chars > 0)
{
ShapeData *data = (ShapeData *)attr->pointer_value;
- PangoRectangle *shape_ink = &data->ink_rect;
- PangoRectangle *shape_logical = &data->logical_rect;
+ Pango2Rectangle *shape_ink = &data->ink_rect;
+ Pango2Rectangle *shape_logical = &data->logical_rect;
if (ink_rect)
{
@@ -99,15 +99,15 @@ pango_shape_get_extents (int n_chars,
}
/**
- * pango_run_get_extents:
- * @run: a `PangoRun`
- * @trim: `PangoLeadingTrim` flags
+ * pango2_run_get_extents:
+ * @run: a `Pango2Run`
+ * @trim: `Pango2LeadingTrim` flags
* @ink_rect: (out caller-allocates) (optional): return location
* for the ink extents
* @logical_rect: (out caller-allocates) (optional): return location
* for the logical extents
*
- * Gets the extents of a `PangoRun`.
+ * Gets the extents of a `Pango2Run`.
*
* The @trim flags specify if line-height attributes are taken
* into consideration for determining the logical height. See the
@@ -115,38 +115,38 @@ pango_shape_get_extents (int n_chars,
* specification for details.
*/
void
-pango_run_get_extents (PangoRun *run,
- PangoLeadingTrim trim,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_run_get_extents (Pango2Run *run,
+ Pango2LeadingTrim trim,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
- PangoGlyphItem *glyph_item = &run->glyph_item;
+ Pango2GlyphItem *glyph_item = &run->glyph_item;
ItemProperties properties;
gboolean has_underline;
gboolean has_overline;
gboolean has_strikethrough;
- PangoRectangle logical;
- PangoFontMetrics *metrics = NULL;
+ Pango2Rectangle logical;
+ Pango2FontMetrics *metrics = NULL;
int y_offset;
- pango_item_get_properties (glyph_item->item, &properties);
+ pango2_item_get_properties (glyph_item->item, &properties);
- has_underline = properties.uline_style != PANGO_LINE_STYLE_NONE;
- has_overline = properties.oline_style != PANGO_LINE_STYLE_NONE;
- has_strikethrough = properties.strikethrough_style != PANGO_LINE_STYLE_NONE;
+ has_underline = properties.uline_style != PANGO2_LINE_STYLE_NONE;
+ has_overline = properties.oline_style != PANGO2_LINE_STYLE_NONE;
+ has_strikethrough = properties.strikethrough_style != PANGO2_LINE_STYLE_NONE;
- if (!logical_rect && (glyph_item->item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE))
+ if (!logical_rect && (glyph_item->item->analysis.flags & PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE))
logical_rect = &logical;
if (!logical_rect && (has_underline || has_overline || has_strikethrough))
logical_rect = &logical;
if (properties.shape)
- pango_shape_get_extents (glyph_item->item->num_chars, properties.shape,
- ink_rect, logical_rect);
+ pango2_shape_get_extents (glyph_item->item->num_chars, properties.shape,
+ ink_rect, logical_rect);
else
- pango_glyph_string_extents (glyph_item->glyphs, glyph_item->item->analysis.font,
- ink_rect, logical_rect);
+ pango2_glyph_string_extents (glyph_item->glyphs, glyph_item->item->analysis.font,
+ ink_rect, logical_rect);
if (ink_rect && (has_underline || has_overline || has_strikethrough))
{
@@ -157,13 +157,13 @@ pango_run_get_extents (PangoRun *run,
int new_pos;
if (!metrics)
- metrics = pango_font_get_metrics (glyph_item->item->analysis.font,
- glyph_item->item->analysis.language);
+ metrics = pango2_font_get_metrics (glyph_item->item->analysis.font,
+ glyph_item->item->analysis.language);
- underline_thickness = pango_font_metrics_get_underline_thickness (metrics);
- underline_position = pango_font_metrics_get_underline_position (metrics);
- strikethrough_thickness = pango_font_metrics_get_strikethrough_thickness (metrics);
- strikethrough_position = pango_font_metrics_get_strikethrough_position (metrics);
+ underline_thickness = pango2_font_metrics_get_underline_thickness (metrics);
+ underline_position = pango2_font_metrics_get_underline_position (metrics);
+ strikethrough_thickness = pango2_font_metrics_get_strikethrough_thickness (metrics);
+ strikethrough_position = pango2_font_metrics_get_strikethrough_position (metrics);
/* the underline/strikethrough takes x, width of logical_rect.
* Reflect that into ink_rect.
@@ -185,50 +185,50 @@ pango_run_get_extents (PangoRun *run,
}
}
- if (properties.oline_style == PANGO_LINE_STYLE_SOLID ||
- properties.oline_style == PANGO_LINE_STYLE_DASHED ||
- properties.oline_style == PANGO_LINE_STYLE_DOTTED)
+ if (properties.oline_style == PANGO2_LINE_STYLE_SOLID ||
+ properties.oline_style == PANGO2_LINE_STYLE_DASHED ||
+ properties.oline_style == PANGO2_LINE_STYLE_DOTTED)
{
ink_rect->y -= underline_thickness;
ink_rect->height += underline_thickness;
}
- else if (properties.oline_style == PANGO_LINE_STYLE_DOUBLE ||
- properties.oline_style == PANGO_LINE_STYLE_WAVY)
+ else if (properties.oline_style == PANGO2_LINE_STYLE_DOUBLE ||
+ properties.oline_style == PANGO2_LINE_STYLE_WAVY)
{
ink_rect->y -= 3 * underline_thickness;
ink_rect->height += 3 * underline_thickness;
}
- if (properties.uline_style == PANGO_LINE_STYLE_SOLID ||
- properties.uline_style == PANGO_LINE_STYLE_DASHED ||
- properties.uline_style == PANGO_LINE_STYLE_DOTTED)
+ if (properties.uline_style == PANGO2_LINE_STYLE_SOLID ||
+ properties.uline_style == PANGO2_LINE_STYLE_DASHED ||
+ properties.uline_style == PANGO2_LINE_STYLE_DOTTED)
{
- if (properties.uline_position == PANGO_UNDERLINE_POSITION_UNDER)
+ if (properties.uline_position == PANGO2_UNDERLINE_POSITION_UNDER)
ink_rect->height += 2 * underline_thickness;
else
ink_rect->height = MAX (ink_rect->height,
underline_thickness - underline_position - ink_rect->y);
}
- else if (properties.uline_style == PANGO_LINE_STYLE_DOUBLE ||
- properties.uline_style == PANGO_LINE_STYLE_WAVY)
+ else if (properties.uline_style == PANGO2_LINE_STYLE_DOUBLE ||
+ properties.uline_style == PANGO2_LINE_STYLE_WAVY)
{
- if (properties.uline_position == PANGO_UNDERLINE_POSITION_UNDER)
+ if (properties.uline_position == PANGO2_UNDERLINE_POSITION_UNDER)
ink_rect->height += 4 * underline_thickness;
else
ink_rect->height = MAX (ink_rect->height,
- 3 * underline_thickness - underline_position - ink_rect->y);
+ 3 * underline_thickness - underline_position - ink_rect->y);
}
}
y_offset = glyph_item->y_offset;
- if (glyph_item->item->analysis.flags & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
+ if (glyph_item->item->analysis.flags & PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE)
{
- gboolean is_hinted = (logical_rect->y & logical_rect->height & (PANGO_SCALE - 1)) == 0;
+ gboolean is_hinted = (logical_rect->y & logical_rect->height & (PANGO2_SCALE - 1)) == 0;
int adjustment = logical_rect->y + logical_rect->height / 2;
if (is_hinted)
- adjustment = PANGO_UNITS_ROUND (adjustment);
+ adjustment = PANGO2_UNITS_ROUND (adjustment);
y_offset += adjustment;
}
@@ -239,7 +239,7 @@ pango_run_get_extents (PangoRun *run,
if (logical_rect)
logical_rect->y -= y_offset;
- if (logical_rect && trim != PANGO_LEADING_TRIM_BOTH)
+ if (logical_rect && trim != PANGO2_LEADING_TRIM_BOTH)
{
int leading;
@@ -254,18 +254,18 @@ pango_run_get_extents (PangoRun *run,
{
/* line-height 'normal' in the CSS inline layout spec */
if (!metrics)
- metrics = pango_font_get_metrics (glyph_item->item->analysis.font,
- glyph_item->item->analysis.language);
+ metrics = pango2_font_get_metrics (glyph_item->item->analysis.font,
+ glyph_item->item->analysis.language);
leading = MAX (metrics->height - (metrics->ascent + metrics->descent) + properties.line_spacing, 0);
}
- if ((trim & PANGO_LEADING_TRIM_START) == 0)
+ if ((trim & PANGO2_LEADING_TRIM_START) == 0)
logical_rect->y -= leading / 2;
- if (trim == PANGO_LEADING_TRIM_NONE)
+ if (trim == PANGO2_LEADING_TRIM_NONE)
logical_rect->height += leading;
else
logical_rect->height += (leading - leading / 2);
}
if (metrics)
- pango_font_metrics_free (metrics);
+ pango2_font_metrics_free (metrics);
}
diff --git a/pango/pango-run.h b/pango/pango-run.h
index 1264ecb5..fd090ae4 100644
--- a/pango/pango-run.h
+++ b/pango/pango-run.h
@@ -24,14 +24,14 @@
#include <pango/pango-item.h>
#include <pango/pango-glyph.h>
-PANGO_AVAILABLE_IN_ALL
-PangoItem * pango_run_get_item (PangoRun *run);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Item * pango2_run_get_item (Pango2Run *run);
-PANGO_AVAILABLE_IN_ALL
-PangoGlyphString * pango_run_get_glyphs (PangoRun *run);
+PANGO2_AVAILABLE_IN_ALL
+Pango2GlyphString * pango2_run_get_glyphs (Pango2Run *run);
-PANGO_AVAILABLE_IN_ALL
-void pango_run_get_extents (PangoRun *run,
- PangoLeadingTrim trim,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_run_get_extents (Pango2Run *run,
+ Pango2LeadingTrim trim,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect);
diff --git a/pango/pango-script-lang-table.h b/pango/pango-script-lang-table.h
index 9f6e0b42..1332b2d6 100644
--- a/pango/pango-script-lang-table.h
+++ b/pango/pango-script-lang-table.h
@@ -6,12 +6,12 @@
*
* Do not edit.
*/
-typedef struct _PangoScriptForLang {
+typedef struct _Pango2ScriptForLang {
const char lang[9];
GUnicodeScript scripts[3];
-} PangoScriptForLang;
+} Pango2ScriptForLang;
-static const PangoScriptForLang pango_script_for_lang[] = {
+static const Pango2ScriptForLang pango2_script_for_lang[] = {
{ "aa", { G_UNICODE_SCRIPT_LATIN/*62*/ } },
{ "ab", { G_UNICODE_SCRIPT_CYRILLIC/*90*/ } },
{ "af", { G_UNICODE_SCRIPT_LATIN/*69*/ } },
diff --git a/pango/pango-script-private.h b/pango/pango-script-private.h
index c300be43..06c84b65 100644
--- a/pango/pango-script-private.h
+++ b/pango/pango-script-private.h
@@ -30,7 +30,7 @@ struct _ParenStackEntry
GUnicodeScript script_code;
};
-struct _PangoScriptIter
+struct _Pango2ScriptIter
{
const char *text_start;
const char *text_end;
@@ -43,10 +43,10 @@ struct _PangoScriptIter
int paren_sp;
};
-PangoScriptIter *
-_pango_script_iter_init (PangoScriptIter *iter,
- const char *text,
- int length);
+Pango2ScriptIter *
+_pango2_script_iter_init (Pango2ScriptIter *iter,
+ const char *text,
+ int length);
void
-_pango_script_iter_fini (PangoScriptIter *iter);
+_pango2_script_iter_fini (Pango2ScriptIter *iter);
diff --git a/pango/pango-script.c b/pango/pango-script.c
index 0a394151..e65c6265 100644
--- a/pango/pango-script.c
+++ b/pango/pango-script.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-script.c: Script tag handling
*
* Copyright (C) 2002 Red Hat Software
@@ -18,7 +18,7 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * Implementation of pango_script_iter is derived from ICU:
+ * Implementation of pango2_script_iter is derived from ICU:
*
* icu/sources/common/usc_impl.c
*
@@ -63,17 +63,17 @@
/**********************************************************************/
-static PangoScriptIter *pango_script_iter_copy (PangoScriptIter *iter);
+static Pango2ScriptIter *pango2_script_iter_copy (Pango2ScriptIter *iter);
-G_DEFINE_BOXED_TYPE (PangoScriptIter,
- pango_script_iter,
- pango_script_iter_copy,
- pango_script_iter_free)
+G_DEFINE_BOXED_TYPE (Pango2ScriptIter,
+ pango2_script_iter,
+ pango2_script_iter_copy,
+ pango2_script_iter_free)
-PangoScriptIter *
-_pango_script_iter_init (PangoScriptIter *iter,
- const char *text,
- int length)
+Pango2ScriptIter *
+_pango2_script_iter_init (Pango2ScriptIter *iter,
+ const char *text,
+ int length)
{
iter->text_start = text;
if (length >= 0)
@@ -87,62 +87,62 @@ _pango_script_iter_init (PangoScriptIter *iter,
iter->paren_sp = -1;
- pango_script_iter_next (iter);
+ pango2_script_iter_next (iter);
return iter;
}
/**
- * pango_script_iter_new:
+ * pango2_script_iter_new:
* @text: a UTF-8 string
* @length: length of @text, or -1 if @text is nul-terminated
*
- * Create a new `PangoScriptIter`, used to break a string of
+ * Create a new `Pango2ScriptIter`, used to break a string of
* Unicode text into runs by Unicode script.
*
* No copy is made of @text, so the caller needs to make
* sure it remains valid until the iterator is freed with
- * [method@Pango.ScriptIter.free].
+ * [method@Pango2.ScriptIter.free].
*
* Return value: the new script iterator, initialized
* to point at the first range in the text, which should be
- * freed with [method@Pango.ScriptIter.free]. If the string is
+ * freed with [method@Pango2.ScriptIter.free]. If the string is
* empty, it will point at an empty range.
*/
-PangoScriptIter *
-pango_script_iter_new (const char *text,
- int length)
+Pango2ScriptIter *
+pango2_script_iter_new (const char *text,
+ int length)
{
- return _pango_script_iter_init (g_slice_new (PangoScriptIter), text, length);
+ return _pango2_script_iter_init (g_slice_new (Pango2ScriptIter), text, length);
}
-static PangoScriptIter *
-pango_script_iter_copy (PangoScriptIter *iter)
+static Pango2ScriptIter *
+pango2_script_iter_copy (Pango2ScriptIter *iter)
{
- return g_slice_dup (PangoScriptIter, iter);
+ return g_slice_dup (Pango2ScriptIter, iter);
}
void
-_pango_script_iter_fini (PangoScriptIter *iter)
+_pango2_script_iter_fini (Pango2ScriptIter *iter)
{
}
/**
- * pango_script_iter_free:
- * @iter: a `PangoScriptIter`
+ * pango2_script_iter_free:
+ * @iter: a `Pango2ScriptIter`
*
- * Frees a `PangoScriptIter`.
+ * Frees a `Pango2ScriptIter`.
*/
void
-pango_script_iter_free (PangoScriptIter *iter)
+pango2_script_iter_free (Pango2ScriptIter *iter)
{
- _pango_script_iter_fini (iter);
- g_slice_free (PangoScriptIter, iter);
+ _pango2_script_iter_fini (iter);
+ g_slice_free (Pango2ScriptIter, iter);
}
/**
- * pango_script_iter_get_range:
- * @iter: a `PangoScriptIter`
+ * pango2_script_iter_get_range:
+ * @iter: a `Pango2ScriptIter`
* @start: (out) (optional): location to store start position of the range
* @end: (out) (optional): location to store end position of the range
* @script: (out) (optional): location to store script for range
@@ -153,10 +153,10 @@ pango_script_iter_free (PangoScriptIter *iter)
* (That is, it doesn't include the character stored at *end)
*/
void
-pango_script_iter_get_range (PangoScriptIter *iter,
- const char **start,
- const char **end,
- GUnicodeScript *script)
+pango2_script_iter_get_range (Pango2ScriptIter *iter,
+ const char **start,
+ const char **end,
+ GUnicodeScript *script)
{
if (start)
*start = iter->script_start;
@@ -258,10 +258,10 @@ get_pair_index (gunichar ch)
#define IS_OPEN(pair_index) (((pair_index) & 1) == 0)
/**
- * pango_script_iter_next:
- * @iter: a `PangoScriptIter`
+ * pango2_script_iter_next:
+ * @iter: a `Pango2ScriptIter`
*
- * Advances a `PangoScriptIter` to the next range.
+ * Advances a `Pango2ScriptIter` to the next range.
*
* If @iter is already at the end, it is left unchanged
* and %FALSE is returned.
@@ -269,7 +269,7 @@ get_pair_index (gunichar ch)
* Return value: %TRUE if @iter was successfully advanced
*/
gboolean
-pango_script_iter_next (PangoScriptIter *iter)
+pango2_script_iter_next (Pango2ScriptIter *iter)
{
int start_sp;
diff --git a/pango/pango-script.h b/pango/pango-script.h
index 0ceeda22..ad4e5cbf 100644
--- a/pango/pango-script.h
+++ b/pango/pango-script.h
@@ -27,33 +27,32 @@
G_BEGIN_DECLS
/**
- * PangoScriptIter:
+ * Pango2ScriptIter:
*
- * A `PangoScriptIter` is used to iterate through a string
+ * A `Pango2ScriptIter` is used to iterate through a string
* and identify ranges in different scripts.
**/
-typedef struct _PangoScriptIter PangoScriptIter;
-
-PANGO_AVAILABLE_IN_ALL
-GType pango_script_iter_get_type (void) G_GNUC_CONST;
-
-PANGO_AVAILABLE_IN_ALL
-PangoScriptIter *pango_script_iter_new (const char *text,
- int length);
-PANGO_AVAILABLE_IN_ALL
-void pango_script_iter_get_range (PangoScriptIter *iter,
- const char **start,
- const char **end,
- GUnicodeScript *script);
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_script_iter_next (PangoScriptIter *iter);
-PANGO_AVAILABLE_IN_ALL
-void pango_script_iter_free (PangoScriptIter *iter);
-
-PANGO_AVAILABLE_IN_ALL
-PangoLanguage *pango_script_get_sample_language
- (GUnicodeScript script) G_GNUC_PURE;
-
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoScriptIter, pango_script_iter_free)
+typedef struct _Pango2ScriptIter Pango2ScriptIter;
+
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_script_iter_get_type (void) G_GNUC_CONST;
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2ScriptIter * pango2_script_iter_new (const char *text,
+ int length);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_script_iter_get_range (Pango2ScriptIter *iter,
+ const char **start,
+ const char **end,
+ GUnicodeScript *script);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_script_iter_next (Pango2ScriptIter *iter);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_script_iter_free (Pango2ScriptIter *iter);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2Language * pango2_script_get_sample_language (GUnicodeScript script) G_GNUC_PURE;
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2ScriptIter, pango2_script_iter_free)
G_END_DECLS
diff --git a/pango/pango-tabs.c b/pango/pango-tabs.c
index 1ad732f5..71fdfe2f 100644
--- a/pango/pango-tabs.c
+++ b/pango/pango-tabs.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-tabs.c: Tab-related stuff
*
* Copyright (C) 2000 Red Hat Software
@@ -25,62 +25,62 @@
#include <stdlib.h>
#include <string.h>
-typedef struct _PangoTab PangoTab;
+typedef struct _Pango2Tab Pango2Tab;
-struct _PangoTab
+struct _Pango2Tab
{
int location;
- PangoTabAlign alignment;
+ Pango2TabAlign alignment;
gunichar decimal_point;
};
/**
- * PangoTabArray:
+ * Pango2TabArray:
*
- * A `PangoTabArray` contains an array of tab stops.
+ * A `Pango2TabArray` contains an array of tab stops.
*
- * `PangoTabArray` can be used to set tab stops in a `PangoLayout`.
+ * `Pango2TabArray` can be used to set tab stops in a `Pango2Layout`.
* Each tab stop has an alignment, a position, and optionally
* a character to use as decimal point.
*/
-struct _PangoTabArray
+struct _Pango2TabArray
{
int size;
int allocated;
gboolean positions_in_pixels;
- PangoTab *tabs;
+ Pango2Tab *tabs;
};
static void
-init_tabs (PangoTabArray *array, int start, int end)
+init_tabs (Pango2TabArray *array, int start, int end)
{
while (start < end)
{
array->tabs[start].location = 0;
- array->tabs[start].alignment = PANGO_TAB_LEFT;
+ array->tabs[start].alignment = PANGO2_TAB_LEFT;
array->tabs[start].decimal_point = 0;
++start;
}
}
/**
- * pango_tab_array_new:
+ * pango2_tab_array_new:
* @initial_size: Initial number of tab stops to allocate, can be 0
* @positions_in_pixels: whether positions are in pixel units
*
* Creates an array of @initial_size tab stops.
*
* Tab stops are specified in pixel units if @positions_in_pixels is %TRUE,
- * otherwise in Pango units. All stops are initially at position 0.
+ * otherwise in Pango2 units. All stops are initially at position 0.
*
- * Return value: the newly allocated `PangoTabArray`, which should
- * be freed with [method@Pango.TabArray.free].
+ * Return value: the newly allocated `Pango2TabArray`, which should
+ * be freed with [method@Pango2.TabArray.free].
*/
-PangoTabArray*
-pango_tab_array_new (int initial_size,
- gboolean positions_in_pixels)
+Pango2TabArray*
+pango2_tab_array_new (int initial_size,
+ gboolean positions_in_pixels)
{
- PangoTabArray *array;
+ Pango2TabArray *array;
g_return_val_if_fail (initial_size >= 0, NULL);
@@ -89,12 +89,12 @@ pango_tab_array_new (int initial_size,
* If we allowed tab array resizing we'd need to drop this
* optimization.
*/
- array = g_slice_new (PangoTabArray);
+ array = g_slice_new (Pango2TabArray);
array->size = initial_size; array->allocated = initial_size;
if (array->allocated > 0)
{
- array->tabs = g_new (PangoTab, array->allocated);
+ array->tabs = g_new (Pango2Tab, array->allocated);
init_tabs (array, 0, array->allocated);
}
else
@@ -106,35 +106,35 @@ pango_tab_array_new (int initial_size,
}
/**
- * pango_tab_array_new_with_positions:
+ * pango2_tab_array_new_with_positions:
* @size: number of tab stops in the array
* @positions_in_pixels: whether positions are in pixel units
* @first_alignment: alignment of first tab stop
* @first_position: position of first tab stop
* @...: additional alignment/position pairs
*
- * Creates a `PangoTabArray` and allows you to specify the alignment
+ * Creates a `Pango2TabArray` and allows you to specify the alignment
* and position of each tab stop.
*
* You **must** provide an alignment and position for @size tab stops.
*
- * Return value: the newly allocated `PangoTabArray`, which should
- * be freed with [method@Pango.TabArray.free].
+ * Return value: the newly allocated `Pango2TabArray`, which should
+ * be freed with [method@Pango2.TabArray.free].
*/
-PangoTabArray *
-pango_tab_array_new_with_positions (int size,
- gboolean positions_in_pixels,
- PangoTabAlign first_alignment,
- int first_position,
- ...)
+Pango2TabArray *
+pango2_tab_array_new_with_positions (int size,
+ gboolean positions_in_pixels,
+ Pango2TabAlign first_alignment,
+ int first_position,
+ ...)
{
- PangoTabArray *array;
+ Pango2TabArray *array;
va_list args;
int i;
g_return_val_if_fail (size >= 0, NULL);
- array = pango_tab_array_new (size, positions_in_pixels);
+ array = pango2_tab_array_new (size, positions_in_pixels);
if (size == 0)
return array;
@@ -151,7 +151,7 @@ pango_tab_array_new_with_positions (int size,
i = 1;
while (i < size)
{
- PangoTabAlign align = va_arg (args, PangoTabAlign);
+ Pango2TabAlign align = va_arg (args, Pango2TabAlign);
int pos = va_arg (args, int);
array->tabs[i].alignment = align;
@@ -166,60 +166,60 @@ pango_tab_array_new_with_positions (int size,
return array;
}
-G_DEFINE_BOXED_TYPE (PangoTabArray, pango_tab_array,
- pango_tab_array_copy,
- pango_tab_array_free);
+G_DEFINE_BOXED_TYPE (Pango2TabArray, pango2_tab_array,
+ pango2_tab_array_copy,
+ pango2_tab_array_free);
/**
- * pango_tab_array_copy:
- * @src: `PangoTabArray` to copy
+ * pango2_tab_array_copy:
+ * @src: `Pango2TabArray` to copy
*
- * Copies a `PangoTabArray`.
+ * Copies a `Pango2TabArray`.
*
- * Return value: the newly allocated `PangoTabArray`, which should
- * be freed with [method@Pango.TabArray.free].
+ * Return value: the newly allocated `Pango2TabArray`, which should
+ * be freed with [method@Pango2.TabArray.free].
*/
-PangoTabArray*
-pango_tab_array_copy (PangoTabArray *src)
+Pango2TabArray*
+pango2_tab_array_copy (Pango2TabArray *src)
{
- PangoTabArray *copy;
+ Pango2TabArray *copy;
g_return_val_if_fail (src != NULL, NULL);
- copy = pango_tab_array_new (src->size, src->positions_in_pixels);
+ copy = pango2_tab_array_new (src->size, src->positions_in_pixels);
if (copy->tabs)
- memcpy (copy->tabs, src->tabs, sizeof(PangoTab) * src->size);
+ memcpy (copy->tabs, src->tabs, sizeof(Pango2Tab) * src->size);
return copy;
}
/**
- * pango_tab_array_free:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_free:
+ * @tab_array: a `Pango2TabArray`
*
* Frees a tab array and associated resources.
*/
void
-pango_tab_array_free (PangoTabArray *tab_array)
+pango2_tab_array_free (Pango2TabArray *tab_array)
{
g_return_if_fail (tab_array != NULL);
g_free (tab_array->tabs);
- g_slice_free (PangoTabArray, tab_array);
+ g_slice_free (Pango2TabArray, tab_array);
}
/**
- * pango_tab_array_get_size:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_get_size:
+ * @tab_array: a `Pango2TabArray`
*
* Gets the number of tab stops in @tab_array.
*
* Return value: the number of tab stops in the array.
*/
int
-pango_tab_array_get_size (PangoTabArray *tab_array)
+pango2_tab_array_get_size (Pango2TabArray *tab_array)
{
g_return_val_if_fail (tab_array != NULL, 0);
@@ -227,8 +227,8 @@ pango_tab_array_get_size (PangoTabArray *tab_array)
}
/**
- * pango_tab_array_resize:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_resize:
+ * @tab_array: a `Pango2TabArray`
* @new_size: new size of the array
*
* Resizes a tab array.
@@ -237,8 +237,8 @@ pango_tab_array_get_size (PangoTabArray *tab_array)
* that were added as a result of growing the array.
*/
void
-pango_tab_array_resize (PangoTabArray *tab_array,
- int new_size)
+pango2_tab_array_resize (Pango2TabArray *tab_array,
+ int new_size)
{
if (new_size > tab_array->allocated)
{
@@ -251,7 +251,7 @@ pango_tab_array_resize (PangoTabArray *tab_array,
while (new_size > tab_array->allocated)
tab_array->allocated = tab_array->allocated * 2;
- tab_array->tabs = g_renew (PangoTab, tab_array->tabs,
+ tab_array->tabs = g_renew (Pango2Tab, tab_array->tabs,
tab_array->allocated);
init_tabs (tab_array, current_end, tab_array->allocated);
@@ -261,34 +261,34 @@ pango_tab_array_resize (PangoTabArray *tab_array,
}
/**
- * pango_tab_array_set_tab:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_set_tab:
+ * @tab_array: a `Pango2TabArray`
* @tab_index: the index of a tab stop
* @alignment: tab alignment
- * @location: tab location in Pango units
+ * @location: tab location in Pango2 units
*
* Sets the alignment and location of a tab stop.
*/
void
-pango_tab_array_set_tab (PangoTabArray *tab_array,
- int tab_index,
- PangoTabAlign alignment,
- int location)
+pango2_tab_array_set_tab (Pango2TabArray *tab_array,
+ int tab_index,
+ Pango2TabAlign alignment,
+ int location)
{
g_return_if_fail (tab_array != NULL);
g_return_if_fail (tab_index >= 0);
g_return_if_fail (location >= 0);
if (tab_index >= tab_array->size)
- pango_tab_array_resize (tab_array, tab_index + 1);
+ pango2_tab_array_resize (tab_array, tab_index + 1);
tab_array->tabs[tab_index].alignment = alignment;
tab_array->tabs[tab_index].location = location;
}
/**
- * pango_tab_array_get_tab:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_get_tab:
+ * @tab_array: a `Pango2TabArray`
* @tab_index: tab stop index
* @alignment: (out) (optional): location to store alignment
* @location: (out) (optional): location to store tab position
@@ -296,10 +296,10 @@ pango_tab_array_set_tab (PangoTabArray *tab_array,
* Gets the alignment and position of a tab stop.
*/
void
-pango_tab_array_get_tab (PangoTabArray *tab_array,
- int tab_index,
- PangoTabAlign *alignment,
- int *location)
+pango2_tab_array_get_tab (Pango2TabArray *tab_array,
+ int tab_index,
+ Pango2TabAlign *alignment,
+ int *location)
{
g_return_if_fail (tab_array != NULL);
g_return_if_fail (tab_index < tab_array->size);
@@ -313,8 +313,8 @@ pango_tab_array_get_tab (PangoTabArray *tab_array,
}
/**
- * pango_tab_array_get_tabs:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_get_tabs:
+ * @tab_array: a `Pango2TabArray`
* @alignments: (out) (optional): location to store an array of tab
* stop alignments
* @locations: (out) (optional) (array): location to store an array
@@ -323,20 +323,20 @@ pango_tab_array_get_tab (PangoTabArray *tab_array,
* If non-%NULL, @alignments and @locations are filled with allocated
* arrays.
*
- * The arrays are of length [method@Pango.TabArray.get_size].
+ * The arrays are of length [method@Pango2.TabArray.get_size].
* You must free the returned array.
*/
void
-pango_tab_array_get_tabs (PangoTabArray *tab_array,
- PangoTabAlign **alignments,
- int **locations)
+pango2_tab_array_get_tabs (Pango2TabArray *tab_array,
+ Pango2TabAlign **alignments,
+ int **locations)
{
int i;
g_return_if_fail (tab_array != NULL);
if (alignments)
- *alignments = g_new (PangoTabAlign, tab_array->size);
+ *alignments = g_new (Pango2TabAlign, tab_array->size);
if (locations)
*locations = g_new (int, tab_array->size);
@@ -354,16 +354,16 @@ pango_tab_array_get_tabs (PangoTabArray *tab_array,
}
/**
- * pango_tab_array_get_positions_in_pixels:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_get_positions_in_pixels:
+ * @tab_array: a `Pango2TabArray`
*
* Returns %TRUE if the tab positions are in pixels,
- * %FALSE if they are in Pango units.
+ * %FALSE if they are in Pango2 units.
*
* Return value: whether positions are in pixels.
*/
gboolean
-pango_tab_array_get_positions_in_pixels (PangoTabArray *tab_array)
+pango2_tab_array_get_positions_in_pixels (Pango2TabArray *tab_array)
{
g_return_val_if_fail (tab_array != NULL, FALSE);
@@ -371,16 +371,16 @@ pango_tab_array_get_positions_in_pixels (PangoTabArray *tab_array)
}
/**
- * pango_tab_array_set_positions_in_pixels:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_set_positions_in_pixels:
+ * @tab_array: a `Pango2TabArray`
* @positions_in_pixels: whether positions are in pixels
*
* Sets whether positions in this array are specified in
* pixels.
*/
void
-pango_tab_array_set_positions_in_pixels (PangoTabArray *tab_array,
- gboolean positions_in_pixels)
+pango2_tab_array_set_positions_in_pixels (Pango2TabArray *tab_array,
+ gboolean positions_in_pixels)
{
g_return_if_fail (tab_array != NULL);
@@ -388,13 +388,13 @@ pango_tab_array_set_positions_in_pixels (PangoTabArray *tab_array,
}
/**
- * pango_tab_array_to_string:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_to_string:
+ * @tab_array: a `Pango2TabArray`
*
- * Serializes a `PangoTabArray` to a string.
+ * Serializes a `Pango2TabArray` to a string.
*
* No guarantees are made about the format of the string,
- * it may change between Pango versions.
+ * it may change between Pango2 versions.
*
* The intended use of this function is testing and
* debugging. The format is not meant as a permanent
@@ -403,7 +403,7 @@ pango_tab_array_set_positions_in_pixels (PangoTabArray *tab_array,
* Returns: (transfer full): a newly allocated string
*/
char *
-pango_tab_array_to_string (PangoTabArray *tab_array)
+pango2_tab_array_to_string (Pango2TabArray *tab_array)
{
GString *s;
@@ -414,11 +414,11 @@ pango_tab_array_to_string (PangoTabArray *tab_array)
if (i > 0)
g_string_append_c (s, '\n');
- if (tab_array->tabs[i].alignment == PANGO_TAB_RIGHT)
+ if (tab_array->tabs[i].alignment == PANGO2_TAB_RIGHT)
g_string_append (s, "right:");
- else if (tab_array->tabs[i].alignment == PANGO_TAB_CENTER)
+ else if (tab_array->tabs[i].alignment == PANGO2_TAB_CENTER)
g_string_append (s, "center:");
- else if (tab_array->tabs[i].alignment == PANGO_TAB_DECIMAL)
+ else if (tab_array->tabs[i].alignment == PANGO2_TAB_DECIMAL)
g_string_append (s, "decimal:");
g_string_append_printf (s, "%d", tab_array->tabs[i].location);
@@ -441,27 +441,27 @@ skip_whitespace (const char *p)
}
/**
- * pango_tab_array_from_string:
+ * pango2_tab_array_from_string:
* @text: a string
*
- * Deserializes a `PangoTabArray` from a string.
+ * Deserializes a `Pango2TabArray` from a string.
*
- * This is the counterpart to [method@Pango.TabArray.to_string].
+ * This is the counterpart to [method@Pango2.TabArray.to_string].
* See that functions for details about the format.
*
- * Returns: (transfer full) (nullable): a new `PangoTabArray`
+ * Returns: (transfer full) (nullable): a new `Pango2TabArray`
*/
-PangoTabArray *
-pango_tab_array_from_string (const char *text)
+Pango2TabArray *
+pango2_tab_array_from_string (const char *text)
{
- PangoTabArray *array;
+ Pango2TabArray *array;
gboolean pixels;
const char *p;
int i;
pixels = strstr (text, "px") != NULL;
- array = pango_tab_array_new (0, pixels);
+ array = pango2_tab_array_new (0, pixels);
p = skip_whitespace (text);
@@ -470,31 +470,31 @@ pango_tab_array_from_string (const char *text)
{
char *endp;
gint64 pos;
- PangoTabAlign align;
+ Pango2TabAlign align;
if (g_str_has_prefix (p, "left:"))
{
- align = PANGO_TAB_LEFT;
+ align = PANGO2_TAB_LEFT;
p += strlen ("left:");
}
else if (g_str_has_prefix (p, "right:"))
{
- align = PANGO_TAB_RIGHT;
+ align = PANGO2_TAB_RIGHT;
p += strlen ("right:");
}
else if (g_str_has_prefix (p, "center:"))
{
- align = PANGO_TAB_CENTER;
+ align = PANGO2_TAB_CENTER;
p += strlen ("center:");
}
else if (g_str_has_prefix (p, "decimal:"))
{
- align = PANGO_TAB_DECIMAL;
+ align = PANGO2_TAB_DECIMAL;
p += strlen ("decimal:");
}
else
{
- align = PANGO_TAB_LEFT;
+ align = PANGO2_TAB_LEFT;
}
pos = g_ascii_strtoll (p, &endp, 10);
@@ -502,7 +502,7 @@ pango_tab_array_from_string (const char *text)
(pixels && *endp != 'p') ||
(!pixels && !g_ascii_isspace (*endp) && *endp != ':' && *endp != '\0')) goto fail;
- pango_tab_array_set_tab (array, i, align, pos);
+ pango2_tab_array_set_tab (array, i, align, pos);
p = (const char *)endp;
if (pixels)
@@ -519,7 +519,7 @@ pango_tab_array_from_string (const char *text)
ch = g_ascii_strtoll (p, &endp, 10);
if (!g_ascii_isspace (*endp) && *endp != '\0') goto fail;
- pango_tab_array_set_decimal_point (array, i, ch);
+ pango2_tab_array_set_decimal_point (array, i, ch);
p = (const char *)endp;
}
@@ -532,7 +532,7 @@ pango_tab_array_from_string (const char *text)
goto success;
fail:
- pango_tab_array_free (array);
+ pango2_tab_array_free (array);
array = NULL;
success:
@@ -540,51 +540,51 @@ success:
}
/**
- * pango_tab_array_set_decimal_point:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_set_decimal_point:
+ * @tab_array: a `Pango2TabArray`
* @tab_index: the index of a tab stop
* @decimal_point: the decimal point to use
*
* Sets the Unicode character to use as decimal point.
*
- * This is only relevant for tabs with %PANGO_TAB_DECIMAL alignment,
+ * This is only relevant for tabs with %PANGO2_TAB_DECIMAL alignment,
* which align content at the first occurrence of the decimal point
* character.
*
- * By default, Pango uses the decimal point according
+ * By default, Pango2 uses the decimal point according
* to the current locale.
*/
void
-pango_tab_array_set_decimal_point (PangoTabArray *tab_array,
- int tab_index,
- gunichar decimal_point)
+pango2_tab_array_set_decimal_point (Pango2TabArray *tab_array,
+ int tab_index,
+ gunichar decimal_point)
{
g_return_if_fail (tab_array != NULL);
g_return_if_fail (tab_index >= 0);
if (tab_index >= tab_array->size)
- pango_tab_array_resize (tab_array, tab_index + 1);
+ pango2_tab_array_resize (tab_array, tab_index + 1);
tab_array->tabs[tab_index].decimal_point = decimal_point;
}
/**
- * pango_tab_array_get_decimal_point:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_get_decimal_point:
+ * @tab_array: a `Pango2TabArray`
* @tab_index: the index of a tab stop
*
* Gets the Unicode character to use as decimal point.
*
- * This is only relevant for tabs with %PANGO_TAB_DECIMAL alignment,
+ * This is only relevant for tabs with %PANGO2_TAB_DECIMAL alignment,
* which align content at the first occurrence of the decimal point
* character.
*
- * The default value of 0 means that Pango will use the
+ * The default value of 0 means that Pango2 will use the
* decimal point according to the current locale.
*/
gunichar
-pango_tab_array_get_decimal_point (PangoTabArray *tab_array,
- int tab_index)
+pango2_tab_array_get_decimal_point (Pango2TabArray *tab_array,
+ int tab_index)
{
g_return_val_if_fail (tab_array != NULL, 0);
g_return_val_if_fail (tab_index < tab_array->size, 0);
@@ -596,22 +596,22 @@ pango_tab_array_get_decimal_point (PangoTabArray *tab_array,
static int
compare_tabs (const void *p1, const void *p2)
{
- const PangoTab *t1 = p1;
- const PangoTab *t2 = p2;
+ const Pango2Tab *t1 = p1;
+ const Pango2Tab *t2 = p2;
return t1->location - t2->location;
}
/**
- * pango_tab_array_sort:
- * @tab_array: a `PangoTabArray`
+ * pango2_tab_array_sort:
+ * @tab_array: a `Pango2TabArray`
*
* Utility function to ensure that the tab stops are in increasing order.
*/
void
-pango_tab_array_sort (PangoTabArray *tab_array)
+pango2_tab_array_sort (Pango2TabArray *tab_array)
{
g_return_if_fail (tab_array != NULL);
- qsort (tab_array->tabs, tab_array->size, sizeof (PangoTab), compare_tabs);
+ qsort (tab_array->tabs, tab_array->size, sizeof (Pango2Tab), compare_tabs);
}
diff --git a/pango/pango-tabs.h b/pango/pango-tabs.h
index 828a153b..e98fdef1 100644
--- a/pango/pango-tabs.h
+++ b/pango/pango-tabs.h
@@ -23,90 +23,91 @@
G_BEGIN_DECLS
-typedef struct _PangoTabArray PangoTabArray;
+typedef struct _Pango2TabArray Pango2TabArray;
/**
- * PangoTabAlign:
- * @PANGO_TAB_LEFT: the text appears to the right of the tab stop position
- * @PANGO_TAB_RIGHT: the text appears to the left of the tab stop position
+ * Pango2TabAlign:
+ * @PANGO2_TAB_LEFT: the text appears to the right of the tab stop position
+ * @PANGO2_TAB_RIGHT: the text appears to the left of the tab stop position
* until the available space is filled.
- * @PANGO_TAB_CENTER: the text is centered at the tab stop position
+ * @PANGO2_TAB_CENTER: the text is centered at the tab stop position
* until the available space is filled.
- * @PANGO_TAB_DECIMAL: text before the first occurrence of the decimal point
+ * @PANGO2_TAB_DECIMAL: text before the first occurrence of the decimal point
* character appears to the left of the tab stop position (until the available
* space is filled), the rest to the right.
*
- * `PangoTabAlign` specifies where the text appears relative to the tab stop
+ * `Pango2TabAlign` specifies where the text appears relative to the tab stop
* position.
*/
typedef enum
{
- PANGO_TAB_LEFT,
- PANGO_TAB_RIGHT,
- PANGO_TAB_CENTER,
- PANGO_TAB_DECIMAL
-} PangoTabAlign;
+ PANGO2_TAB_LEFT,
+ PANGO2_TAB_RIGHT,
+ PANGO2_TAB_CENTER,
+ PANGO2_TAB_DECIMAL
+} Pango2TabAlign;
-#define PANGO_TYPE_TAB_ARRAY (pango_tab_array_get_type ())
+#define PANGO2_TYPE_TAB_ARRAY (pango2_tab_array_get_type ())
-PANGO_AVAILABLE_IN_ALL
-PangoTabArray *pango_tab_array_new (int initial_size,
- gboolean positions_in_pixels);
-PANGO_AVAILABLE_IN_ALL
-PangoTabArray *pango_tab_array_new_with_positions (int size,
- gboolean positions_in_pixels,
- PangoTabAlign first_alignment,
- int first_position,
- ...);
-PANGO_AVAILABLE_IN_ALL
-GType pango_tab_array_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-PangoTabArray *pango_tab_array_copy (PangoTabArray *src);
-PANGO_AVAILABLE_IN_ALL
-void pango_tab_array_free (PangoTabArray *tab_array);
-PANGO_AVAILABLE_IN_ALL
-int pango_tab_array_get_size (PangoTabArray *tab_array);
-PANGO_AVAILABLE_IN_ALL
-void pango_tab_array_resize (PangoTabArray *tab_array,
- int new_size);
-PANGO_AVAILABLE_IN_ALL
-void pango_tab_array_set_tab (PangoTabArray *tab_array,
- int tab_index,
- PangoTabAlign alignment,
- int location);
-PANGO_AVAILABLE_IN_ALL
-void pango_tab_array_get_tab (PangoTabArray *tab_array,
- int tab_index,
- PangoTabAlign *alignment,
- int *location);
-PANGO_AVAILABLE_IN_ALL
-void pango_tab_array_get_tabs (PangoTabArray *tab_array,
- PangoTabAlign **alignments,
- int **locations);
+PANGO2_AVAILABLE_IN_ALL
+GType pango2_tab_array_get_type (void) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_tab_array_get_positions_in_pixels (PangoTabArray *tab_array);
+PANGO2_AVAILABLE_IN_ALL
+Pango2TabArray * pango2_tab_array_new (int initial_size,
+ gboolean positions_in_pixels);
+PANGO2_AVAILABLE_IN_ALL
+Pango2TabArray * pango2_tab_array_new_with_positions (int size,
+ gboolean positions_in_pixels,
+ Pango2TabAlign first_alignment,
+ int first_position,
+ ...);
+PANGO2_AVAILABLE_IN_ALL
+Pango2TabArray * pango2_tab_array_copy (Pango2TabArray *src);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_tab_array_free (Pango2TabArray *tab_array);
+PANGO2_AVAILABLE_IN_ALL
+int pango2_tab_array_get_size (Pango2TabArray *tab_array);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_tab_array_resize (Pango2TabArray *tab_array,
+ int new_size);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_tab_array_set_tab (Pango2TabArray *tab_array,
+ int tab_index,
+ Pango2TabAlign alignment,
+ int location);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_tab_array_get_tab (Pango2TabArray *tab_array,
+ int tab_index,
+ Pango2TabAlign *alignment,
+ int *location);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_tab_array_get_tabs (Pango2TabArray *tab_array,
+ Pango2TabAlign **alignments,
+ int **locations);
-PANGO_AVAILABLE_IN_ALL
-void pango_tab_array_set_positions_in_pixels (PangoTabArray *tab_array,
- gboolean positions_in_pixels);
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_tab_array_get_positions_in_pixels (Pango2TabArray *tab_array);
-PANGO_AVAILABLE_IN_ALL
-char * pango_tab_array_to_string (PangoTabArray *tab_array);
-PANGO_AVAILABLE_IN_ALL
-PangoTabArray * pango_tab_array_from_string (const char *text);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_tab_array_set_positions_in_pixels (Pango2TabArray *tab_array,
+ gboolean positions_in_pixels);
-PANGO_AVAILABLE_IN_ALL
-void pango_tab_array_set_decimal_point (PangoTabArray *tab_array,
- int tab_index,
- gunichar decimal_point);
-PANGO_AVAILABLE_IN_ALL
-gunichar pango_tab_array_get_decimal_point (PangoTabArray *tab_array,
- int tab_index);
+PANGO2_AVAILABLE_IN_ALL
+char * pango2_tab_array_to_string (Pango2TabArray *tab_array);
+PANGO2_AVAILABLE_IN_ALL
+Pango2TabArray * pango2_tab_array_from_string (const char *text);
-PANGO_AVAILABLE_IN_ALL
-void pango_tab_array_sort (PangoTabArray *tab_array);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_tab_array_set_decimal_point (Pango2TabArray *tab_array,
+ int tab_index,
+ gunichar decimal_point);
+PANGO2_AVAILABLE_IN_ALL
+gunichar pango2_tab_array_get_decimal_point (Pango2TabArray *tab_array,
+ int tab_index);
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoTabArray, pango_tab_array_free)
+PANGO2_AVAILABLE_IN_ALL
+void pango2_tab_array_sort (Pango2TabArray *tab_array);
+
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(Pango2TabArray, pango2_tab_array_free)
G_END_DECLS
diff --git a/pango/pango-trace-private.h b/pango/pango-trace-private.h
index 96cc44d6..5ef2a5ff 100644
--- a/pango/pango-trace-private.h
+++ b/pango/pango-trace-private.h
@@ -27,22 +27,22 @@
#ifdef HAVE_SYSPROF
-#define PANGO_TRACE_CURRENT_TIME SYSPROF_CAPTURE_CURRENT_TIME
+#define PANGO2_TRACE_CURRENT_TIME SYSPROF_CAPTURE_CURRENT_TIME
#else
-#define PANGO_TRACE_CURRENT_TIME 0
+#define PANGO2_TRACE_CURRENT_TIME 0
#endif
-void pango_trace_mark (gint64 begin_time,
- const char *name,
- const char *message_format,
- ...) G_GNUC_PRINTF (3, 4);
+void pango2_trace_mark (gint64 begin_time,
+ const char *name,
+ const char *message_format,
+ ...) G_GNUC_PRINTF (3, 4);
#ifndef HAVE_SYSPROF
/* Optimise the whole call out */
#if defined(G_HAVE_ISO_VARARGS)
-#define pango_trace_mark(b, n, m, ...) G_STMT_START { } G_STMT_END
+#define pango2_trace_mark(b, n, m, ...) G_STMT_START { } G_STMT_END
#elif defined(G_HAVE_GNUC_VARARGS)
-#define pango_trace_mark(b, n, m...) G_STMT_START { } G_STMT_END
+#define pango2_trace_mark(b, n, m...) G_STMT_START { } G_STMT_END
#else
/* no varargs macro support; the call will have to be optimised out by the compiler */
#endif
diff --git a/pango/pango-trace.c b/pango/pango-trace.c
index 4338928f..99417c45 100644
--- a/pango/pango-trace.c
+++ b/pango/pango-trace.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-trace.c:
*
* Copyright (C) 2020 Red Hat, Inc
@@ -24,17 +24,17 @@
#include <stdarg.h>
void
-(pango_trace_mark) (gint64 begin_time,
- const char *name,
- const char *message_format,
- ...)
+(pango2_trace_mark) (gint64 begin_time,
+ const char *name,
+ const char *message_format,
+ ...)
{
#ifdef HAVE_SYSPROF
- gint64 end_time = PANGO_TRACE_CURRENT_TIME;
+ gint64 end_time = PANGO2_TRACE_CURRENT_TIME;
va_list args;
va_start (args, message_format);
- sysprof_collector_mark_vprintf (begin_time, end_time - begin_time, "Pango", name, message_format, args);
+ sysprof_collector_mark_vprintf (begin_time, end_time - begin_time, "Pango2", name, message_format, args);
va_end (args);
#endif /* HAVE_SYSPROF */
}
diff --git a/pango/pango-types.h b/pango/pango-types.h
index f39f35b2..373ace78 100644
--- a/pango/pango-types.h
+++ b/pango/pango-types.h
@@ -26,142 +26,142 @@
G_BEGIN_DECLS
-typedef struct _PangoLogAttr PangoLogAttr;
+typedef struct _Pango2LogAttr Pango2LogAttr;
-typedef struct _PangoFontDescription PangoFontDescription;
+typedef struct _Pango2FontDescription Pango2FontDescription;
-typedef struct _PangoFont PangoFont;
-typedef struct _PangoFontFace PangoFontFace;
-typedef struct _PangoFontFamily PangoFontFamily;
+typedef struct _Pango2Font Pango2Font;
+typedef struct _Pango2FontFace Pango2FontFace;
+typedef struct _Pango2FontFamily Pango2FontFamily;
-typedef struct _PangoFontMap PangoFontMap;
+typedef struct _Pango2FontMap Pango2FontMap;
-typedef struct _PangoRectangle PangoRectangle;
+typedef struct _Pango2Rectangle Pango2Rectangle;
-typedef struct _PangoContext PangoContext;
+typedef struct _Pango2Context Pango2Context;
-typedef struct _PangoLanguage PangoLanguage;
+typedef struct _Pango2Language Pango2Language;
/* A index of a glyph into a font. Rendering system dependent */
/**
- * PangoGlyph:
+ * Pango2Glyph:
*
- * A `PangoGlyph` represents a single glyph in the output form of a string.
+ * A `Pango2Glyph` represents a single glyph in the output form of a string.
*/
-typedef guint32 PangoGlyph;
+typedef guint32 Pango2Glyph;
-typedef struct _PangoLines PangoLines;
-typedef struct _PangoRun PangoRun;
-typedef struct _PangoLine PangoLine;
-typedef struct _PangoLineIter PangoLineIter;
+typedef struct _Pango2Lines Pango2Lines;
+typedef struct _Pango2Run Pango2Run;
+typedef struct _Pango2Line Pango2Line;
+typedef struct _Pango2LineIter Pango2LineIter;
/**
- * PANGO_SCALE:
+ * PANGO2_SCALE:
*
- * The scale between dimensions used for Pango distances and device units.
+ * The scale between dimensions used for Pango2 distances and device units.
*
* The definition of device units is dependent on the output device; it will
- * typically be pixels for a screen, and points for a printer. %PANGO_SCALE is
+ * typically be pixels for a screen, and points for a printer. %PANGO2_SCALE is
* currently 1024, but this may be changed in the future.
*
* When setting font sizes, device units are always considered to be
* points (as in "12 point font"), rather than pixels.
*/
/**
- * PANGO_PIXELS:
- * @d: a dimension in Pango units.
+ * PANGO2_PIXELS:
+ * @d: a dimension in Pango2 units.
*
* Converts a dimension to device units by rounding.
*
* Return value: rounded dimension in device units.
*/
/**
- * PANGO_PIXELS_FLOOR:
- * @d: a dimension in Pango units.
+ * PANGO2_PIXELS_FLOOR:
+ * @d: a dimension in Pango2 units.
*
* Converts a dimension to device units by flooring.
*
* Return value: floored dimension in device units.
*/
/**
- * PANGO_PIXELS_CEIL:
- * @d: a dimension in Pango units.
+ * PANGO2_PIXELS_CEIL:
+ * @d: a dimension in Pango2 units.
*
* Converts a dimension to device units by ceiling.
*
* Return value: ceiled dimension in device units.
*/
-#define PANGO_SCALE 1024
-#define PANGO_PIXELS(d) (((int)(d) + 512) >> 10)
-#define PANGO_PIXELS_FLOOR(d) (((int)(d)) >> 10)
-#define PANGO_PIXELS_CEIL(d) (((int)(d) + 1023) >> 10)
+#define PANGO2_SCALE 1024
+#define PANGO2_PIXELS(d) (((int)(d) + 512) >> 10)
+#define PANGO2_PIXELS_FLOOR(d) (((int)(d)) >> 10)
+#define PANGO2_PIXELS_CEIL(d) (((int)(d) + 1023) >> 10)
/* The above expressions are just slightly wrong for floating point d;
- * For example we'd expect PANGO_PIXELS(-512.5) => -1 but instead we get 0.
+ * For example we'd expect PANGO2_PIXELS(-512.5) => -1 but instead we get 0.
* That's unlikely to matter for practical use and the expression is much
* more compact and faster than alternatives that work exactly for both
* integers and floating point.
*
- * PANGO_PIXELS also behaves differently for +512 and -512.
+ * PANGO2_PIXELS also behaves differently for +512 and -512.
*/
/**
- * PANGO_UNITS_FLOOR:
- * @d: a dimension in Pango units.
+ * PANGO2_UNITS_FLOOR:
+ * @d: a dimension in Pango2 units.
*
* Rounds a dimension down to whole device units, but does not
* convert it to device units.
*
- * Return value: rounded down dimension in Pango units.
+ * Return value: rounded down dimension in Pango2 units.
*/
-#define PANGO_UNITS_FLOOR(d) \
- ((d) & ~(PANGO_SCALE - 1))
+#define PANGO2_UNITS_FLOOR(d) \
+ ((d) & ~(PANGO2_SCALE - 1))
/**
- * PANGO_UNITS_CEIL:
- * @d: a dimension in Pango units.
+ * PANGO2_UNITS_CEIL:
+ * @d: a dimension in Pango2 units.
*
* Rounds a dimension up to whole device units, but does not
* convert it to device units.
*
- * Return value: rounded up dimension in Pango units.
+ * Return value: rounded up dimension in Pango2 units.
*/
-#define PANGO_UNITS_CEIL(d) \
- (((d) + (PANGO_SCALE - 1)) & ~(PANGO_SCALE - 1))
+#define PANGO2_UNITS_CEIL(d) \
+ (((d) + (PANGO2_SCALE - 1)) & ~(PANGO2_SCALE - 1))
/**
- * PANGO_UNITS_ROUND:
- * @d: a dimension in Pango units.
+ * PANGO2_UNITS_ROUND:
+ * @d: a dimension in Pango2 units.
*
* Rounds a dimension to whole device units, but does not
* convert it to device units.
*
- * Return value: rounded dimension in Pango units.
+ * Return value: rounded dimension in Pango2 units.
*/
-#define PANGO_UNITS_ROUND(d) \
- (((d) + (PANGO_SCALE >> 1)) & ~(PANGO_SCALE - 1))
+#define PANGO2_UNITS_ROUND(d) \
+ (((d) + (PANGO2_SCALE >> 1)) & ~(PANGO2_SCALE - 1))
-PANGO_AVAILABLE_IN_ALL
-int pango_units_from_double (double d) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-double pango_units_to_double (int i) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+int pango2_units_from_double (double d) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+double pango2_units_to_double (int i) G_GNUC_CONST;
/**
- * PangoRectangle:
+ * Pango2Rectangle:
* @x: X coordinate of the left side of the rectangle.
* @y: Y coordinate of the the top side of the rectangle.
* @width: width of the rectangle.
* @height: height of the rectangle.
*
- * The `PangoRectangle` structure represents a rectangle.
+ * The `Pango2Rectangle` structure represents a rectangle.
*
- * `PangoRectangle` is frequently used to represent the logical or ink
+ * `Pango2Rectangle` is frequently used to represent the logical or ink
* extents of a single glyph or section of text. (See, for instance,
- * [method@Pango.Font.get_glyph_extents].)
+ * [method@Pango2.Font.get_glyph_extents].)
*/
-struct _PangoRectangle
+struct _Pango2Rectangle
{
int x;
int y;
@@ -172,10 +172,10 @@ struct _PangoRectangle
/* Macros to translate from extents rectangles to ascent/descent/lbearing/rbearing
*/
/**
- * PANGO_ASCENT:
- * @rect: a `PangoRectangle`
+ * PANGO2_ASCENT:
+ * @rect: a `Pango2Rectangle`
*
- * Extracts the *ascent* from a `PangoRectangle`
+ * Extracts the *ascent* from a `Pango2Rectangle`
* representing glyph extents.
*
* The ascent is the distance from the baseline to the
@@ -183,10 +183,10 @@ struct _PangoRectangle
* glyph ascends above the baseline.
*/
/**
- * PANGO_DESCENT:
- * @rect: a `PangoRectangle`
+ * PANGO2_DESCENT:
+ * @rect: a `Pango2Rectangle`
*
- * Extracts the *descent* from a `PangoRectangle`
+ * Extracts the *descent* from a `Pango2Rectangle`
* representing glyph extents.
*
* The descent is the distance from the baseline to the
@@ -194,10 +194,10 @@ struct _PangoRectangle
* glyph descends below the baseline.
*/
/**
- * PANGO_LBEARING:
- * @rect: a `PangoRectangle`
+ * PANGO2_LBEARING:
+ * @rect: a `Pango2Rectangle`
*
- * Extracts the *left bearing* from a `PangoRectangle`
+ * Extracts the *left bearing* from a `Pango2Rectangle`
* representing glyph extents.
*
* The left bearing is the distance from the horizontal
@@ -206,10 +206,10 @@ struct _PangoRectangle
* the right of the glyph origin.
*/
/**
- * PANGO_RBEARING:
- * @rect: a `PangoRectangle`
+ * PANGO2_RBEARING:
+ * @rect: a `Pango2Rectangle`
*
- * Extracts the *right bearing* from a `PangoRectangle`
+ * Extracts the *right bearing* from a `Pango2Rectangle`
* representing glyph extents.
*
* The right bearing is the distance from the horizontal
@@ -217,14 +217,14 @@ struct _PangoRectangle
* This is positive except for characters drawn completely
* to the left of the horizontal origin.
*/
-#define PANGO_ASCENT(rect) (-(rect).y)
-#define PANGO_DESCENT(rect) ((rect).y + (rect).height)
-#define PANGO_LBEARING(rect) ((rect).x)
-#define PANGO_RBEARING(rect) ((rect).x + (rect).width)
+#define PANGO2_ASCENT(rect) (-(rect).y)
+#define PANGO2_DESCENT(rect) ((rect).y + (rect).height)
+#define PANGO2_LBEARING(rect) ((rect).x)
+#define PANGO2_RBEARING(rect) ((rect).x + (rect).width)
-PANGO_AVAILABLE_IN_ALL
-void pango_extents_to_pixels (PangoRectangle *inclusive,
- PangoRectangle *nearest);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_extents_to_pixels (Pango2Rectangle *inclusive,
+ Pango2Rectangle *nearest);
#include <pango/pango-direction.h>
@@ -234,55 +234,55 @@ void pango_extents_to_pixels (PangoRectangle *inclusive,
#include <pango/pango-script.h>
/**
- * PangoAlignment:
- * @PANGO_ALIGN_LEFT: Put all available space on the right
- * @PANGO_ALIGN_CENTER: Center the line within the available space
- * @PANGO_ALIGN_RIGHT: Put all available space on the left
- * @PANGO_ALIGN_NATURAL: Use left or right alignment, depending
+ * Pango2Alignment:
+ * @PANGO2_ALIGN_LEFT: Put all available space on the right
+ * @PANGO2_ALIGN_CENTER: Center the line within the available space
+ * @PANGO2_ALIGN_RIGHT: Put all available space on the left
+ * @PANGO2_ALIGN_NATURAL: Use left or right alignment, depending
* on the text direction of the paragraph
- * @PANGO_ALIGN_JUSTIFY: Justify the content to fill the available space
+ * @PANGO2_ALIGN_JUSTIFY: Justify the content to fill the available space
*
- * `PangoAlignment` describes how to align the lines of a `PangoLayout`
+ * `Pango2Alignment` describes how to align the lines of a `Pango2Layout`
* within the available space.
*/
typedef enum
{
- PANGO_ALIGN_LEFT,
- PANGO_ALIGN_CENTER,
- PANGO_ALIGN_RIGHT,
- PANGO_ALIGN_NATURAL,
- PANGO_ALIGN_JUSTIFY
-} PangoAlignment;
+ PANGO2_ALIGN_LEFT,
+ PANGO2_ALIGN_CENTER,
+ PANGO2_ALIGN_RIGHT,
+ PANGO2_ALIGN_NATURAL,
+ PANGO2_ALIGN_JUSTIFY
+} Pango2Alignment;
/**
- * PangoWrapMode:
- * @PANGO_WRAP_WORD: wrap lines at word boundaries.
- * @PANGO_WRAP_CHAR: wrap lines at character boundaries.
- * @PANGO_WRAP_WORD_CHAR: wrap lines at word boundaries, but fall back to
+ * Pango2WrapMode:
+ * @PANGO2_WRAP_WORD: wrap lines at word boundaries.
+ * @PANGO2_WRAP_CHAR: wrap lines at character boundaries.
+ * @PANGO2_WRAP_WORD_CHAR: wrap lines at word boundaries, but fall back to
* character boundaries if there is not enough space for a full word.
*
- * `PangoWrapMode` describes how to wrap the lines of a `PangoLayout`
+ * `Pango2WrapMode` describes how to wrap the lines of a `Pango2Layout`
* to the desired width.
*
- * For @PANGO_WRAP_WORD, Pango uses break opportunities that are determined
- * by the Unicode line breaking algorithm. For @PANGO_WRAP_CHAR, Pango allows
+ * For @PANGO2_WRAP_WORD, Pango2 uses break opportunities that are determined
+ * by the Unicode line breaking algorithm. For @PANGO2_WRAP_CHAR, Pango2 allows
* breaking at grapheme boundaries that are determined by the Unicode text
* segmentation algorithm.
*/
typedef enum {
- PANGO_WRAP_WORD,
- PANGO_WRAP_CHAR,
- PANGO_WRAP_WORD_CHAR
-} PangoWrapMode;
+ PANGO2_WRAP_WORD,
+ PANGO2_WRAP_CHAR,
+ PANGO2_WRAP_WORD_CHAR
+} Pango2WrapMode;
/**
- * PangoEllipsizeMode:
- * @PANGO_ELLIPSIZE_NONE: No ellipsization
- * @PANGO_ELLIPSIZE_START: Omit characters at the start of the text
- * @PANGO_ELLIPSIZE_MIDDLE: Omit characters in the middle of the text
- * @PANGO_ELLIPSIZE_END: Omit characters at the end of the text
+ * Pango2EllipsizeMode:
+ * @PANGO2_ELLIPSIZE_NONE: No ellipsization
+ * @PANGO2_ELLIPSIZE_START: Omit characters at the start of the text
+ * @PANGO2_ELLIPSIZE_MIDDLE: Omit characters in the middle of the text
+ * @PANGO2_ELLIPSIZE_END: Omit characters at the end of the text
*
- * `PangoEllipsizeMode` describes what sort of ellipsization
+ * `Pango2EllipsizeMode` describes what sort of ellipsization
* should be applied to text.
*
* In the ellipsization process characters are removed from the
@@ -290,37 +290,37 @@ typedef enum {
* with an ellipsis.
*/
typedef enum {
- PANGO_ELLIPSIZE_NONE,
- PANGO_ELLIPSIZE_START,
- PANGO_ELLIPSIZE_MIDDLE,
- PANGO_ELLIPSIZE_END
-} PangoEllipsizeMode;
+ PANGO2_ELLIPSIZE_NONE,
+ PANGO2_ELLIPSIZE_START,
+ PANGO2_ELLIPSIZE_MIDDLE,
+ PANGO2_ELLIPSIZE_END
+} Pango2EllipsizeMode;
/**
-* PangoLeadingTrim:
- * @PANGO_LEADING_TRIM_NONE: No trimming
- * @PANGO_LEADING_TRIM_START: Trim leading at the top
- * @PANGO_LEADING_TRIM_END: Trim leading at the bottom
+* Pango2LeadingTrim:
+ * @PANGO2_LEADING_TRIM_NONE: No trimming
+ * @PANGO2_LEADING_TRIM_START: Trim leading at the top
+ * @PANGO2_LEADING_TRIM_END: Trim leading at the bottom
*
- * The `PangoLeadingTrim` flags control how the line height affects
+ * The `Pango2LeadingTrim` flags control how the line height affects
* the extents of runs and lines.
*/
typedef enum
{
- PANGO_LEADING_TRIM_NONE = 0,
- PANGO_LEADING_TRIM_START = 1 << 0,
- PANGO_LEADING_TRIM_END = 1 << 1,
-} PangoLeadingTrim;
+ PANGO2_LEADING_TRIM_NONE = 0,
+ PANGO2_LEADING_TRIM_START = 1 << 0,
+ PANGO2_LEADING_TRIM_END = 1 << 1,
+} Pango2LeadingTrim;
/**
- * PANGO_LEADING_TRIM_BOTH:
+ * PANGO2_LEADING_TRIM_BOTH:
*
- * Shorthand for `PANGO_LEADING_TRIM_START|PANGO_LEADING_TRIM_END`.
+ * Shorthand for `PANGO2_LEADING_TRIM_START|PANGO2_LEADING_TRIM_END`.
*/
-#define PANGO_LEADING_TRIM_BOTH (PANGO_LEADING_TRIM_START|PANGO_LEADING_TRIM_END)
+#define PANGO2_LEADING_TRIM_BOTH (PANGO2_LEADING_TRIM_START|PANGO2_LEADING_TRIM_END)
/*
- * PANGO_DECLARE_INTERNAL_TYPE:
+ * PANGO2_DECLARE_INTERNAL_TYPE:
* @ModuleObjName: The name of the new type, in camel case (like GtkWidget)
* @module_obj_name: The name of the new type in lowercase, with words
* separated by '_' (like 'gtk_widget')
@@ -337,7 +337,7 @@ typedef enum
* derive this type, assuming they have access to the instance and class
* structures; external users will not be able to subclass this type.
*/
-#define PANGO_DECLARE_INTERNAL_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
+#define PANGO2_DECLARE_INTERNAL_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
GType module_obj_name##_get_type (void); \
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
typedef struct _##ModuleObjName ModuleObjName; \
diff --git a/pango/pango-userface-private.h b/pango/pango-userface-private.h
index 7ea0bf88..a8a564fc 100644
--- a/pango/pango-userface-private.h
+++ b/pango/pango-userface-private.h
@@ -24,17 +24,17 @@
#include "pango-font-face-private.h"
-struct _PangoUserFace
+struct _Pango2UserFace
{
- PangoFontFace parent_instance;
+ Pango2FontFace parent_instance;
char *faceid;
- PangoUserFaceGetFontInfoFunc font_info_func;
- PangoUserFaceUnicodeToGlyphFunc glyph_func;
- PangoUserFaceGetGlyphInfoFunc glyph_info_func;
- PangoUserFaceTextToGlyphFunc shape_func;
- PangoUserFaceRenderGlyphFunc render_func;
+ Pango2UserFaceGetFontInfoFunc font_info_func;
+ Pango2UserFaceUnicodeToGlyphFunc glyph_func;
+ Pango2UserFaceGetGlyphInfoFunc glyph_info_func;
+ Pango2UserFaceTextToGlyphFunc shape_func;
+ Pango2UserFaceRenderGlyphFunc render_func;
gpointer user_data;
GDestroyNotify destroy;
};
diff --git a/pango/pango-userface.c b/pango/pango-userface.c
index 597674b6..d4cb60f5 100644
--- a/pango/pango-userface.c
+++ b/pango/pango-userface.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2022 Matthias Clasen
*
@@ -31,31 +31,31 @@
#include <hb-ot.h>
/**
- * PangoUserFace:
+ * Pango2UserFace:
*
- * `PangoUserFace` is a `PangoFontFace` implementation that uses callbacks.
+ * `Pango2UserFace` is a `Pango2FontFace` implementation that uses callbacks.
*
* It allows to draw the glyphs in a font using custom code. This can
* be used to implement fonts in non-standard formats, but can also be
* used by games and other application to draw "funky" fonts.
*
- * To get a font instance at a specific size from a `PangoUserFace`,
- * use [ctor@Pango.UserFont.new].
+ * To get a font instance at a specific size from a `Pango2UserFace`,
+ * use [ctor@Pango2.UserFont.new].
*/
- /* {{{ Utilities */
+/* {{{ Utilities */
static void
-ensure_faceid (PangoUserFace *self)
+ensure_faceid (Pango2UserFace *self)
{
- PangoFontFace *face = PANGO_FONT_FACE (self);
+ Pango2FontFace *face = PANGO2_FONT_FACE (self);
char *psname;
char *p;
if (self->faceid)
return;
- psname = g_strconcat (pango_font_description_get_family (face->description), "_", face->name, NULL);
+ psname = g_strconcat (pango2_font_description_get_family (face->description), "_", face->name, NULL);
/* PostScript name should not contain problematic chars, but just in case,
* make sure we don't have any ' ', '=' or ',' that would give us parsing
@@ -71,27 +71,27 @@ ensure_faceid (PangoUserFace *self)
}
static const char *
-style_from_font_description (const PangoFontDescription *desc)
+style_from_font_description (const Pango2FontDescription *desc)
{
- PangoStyle style = pango_font_description_get_style (desc);
- PangoWeight weight = pango_font_description_get_weight (desc);
+ Pango2Style style = pango2_font_description_get_style (desc);
+ Pango2Weight weight = pango2_font_description_get_weight (desc);
switch (style)
{
- case PANGO_STYLE_ITALIC:
- if (weight == PANGO_WEIGHT_BOLD)
+ case PANGO2_STYLE_ITALIC:
+ if (weight == PANGO2_WEIGHT_BOLD)
return "Bold Italic";
else
return "Italic";
break;
- case PANGO_STYLE_OBLIQUE:
- if (weight == PANGO_WEIGHT_BOLD)
+ case PANGO2_STYLE_OBLIQUE:
+ if (weight == PANGO2_WEIGHT_BOLD)
return "Bold Oblique";
else
return "Oblique";
break;
- case PANGO_STYLE_NORMAL:
- if (weight == PANGO_WEIGHT_BOLD)
+ case PANGO2_STYLE_NORMAL:
+ if (weight == PANGO2_WEIGHT_BOLD)
return "Bold";
else
return "Regular";
@@ -103,14 +103,14 @@ style_from_font_description (const PangoFontDescription *desc)
}
static gboolean
-default_shape_func (PangoUserFace *face,
- int size,
- const char *text,
- int length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags,
- gpointer user_data)
+default_shape_func (Pango2UserFace *face,
+ int size,
+ const char *text,
+ int length,
+ const Pango2Analysis *analysis,
+ Pango2GlyphString *glyphs,
+ Pango2ShapeFlags flags,
+ gpointer user_data)
{
int n_chars;
const char *p;
@@ -125,58 +125,58 @@ default_shape_func (PangoUserFace *face,
n_chars = g_utf8_strlen (text, length);
- pango_glyph_string_set_size (glyphs, n_chars);
+ pango2_glyph_string_set_size (glyphs, n_chars);
last_cluster = -1;
- hb_font = pango_font_get_hb_font (analysis->font);
+ hb_font = pango2_font_get_hb_font (analysis->font);
hb_font_get_h_extents (hb_font, &font_extents);
p = text;
for (i = 0; i < n_chars; i++)
{
gunichar wc;
- PangoGlyph glyph;
- PangoRectangle ink_rect;
- PangoRectangle logical_rect;
+ Pango2Glyph glyph;
+ Pango2Rectangle ink_rect;
+ Pango2Rectangle logical_rect;
wc = g_utf8_get_char (p);
if (g_unichar_type (wc) != G_UNICODE_NON_SPACING_MARK)
cluster = p - text;
- if (pango_is_zero_width (wc))
- glyph = PANGO_GLYPH_EMPTY;
+ if (pango2_is_zero_width (wc))
+ glyph = PANGO2_GLYPH_EMPTY;
else if (!face->glyph_func (face, wc, &glyph, face->user_data))
- glyph = PANGO_GET_UNKNOWN_GLYPH (wc);
+ glyph = PANGO2_GET_UNKNOWN_GLYPH (wc);
face->glyph_info_func (face, size, glyph, &ext, &dummy, &dummy, &is_color, face->user_data);
- pango_font_get_glyph_extents (analysis->font, glyph, &ink_rect, &logical_rect);
+ pango2_font_get_glyph_extents (analysis->font, glyph, &ink_rect, &logical_rect);
glyphs->glyphs[i].glyph = glyph;
glyphs->glyphs[i].attr.is_cluster_start = cluster != last_cluster;
glyphs->glyphs[i].attr.is_color = is_color;
- if (analysis->gravity == PANGO_GRAVITY_EAST)
+ if (analysis->gravity == PANGO2_GRAVITY_EAST)
{
glyphs->glyphs[i].geometry.x_offset = font_extents.ascender;
glyphs->glyphs[i].geometry.y_offset = - logical_rect.y - (logical_rect.height - ink_rect.height) / 2;
glyphs->glyphs[i].geometry.width = logical_rect.width;
}
- else if (analysis->gravity == PANGO_GRAVITY_WEST)
+ else if (analysis->gravity == PANGO2_GRAVITY_WEST)
{
glyphs->glyphs[i].geometry.x_offset = font_extents.descender;
glyphs->glyphs[i].geometry.y_offset = logical_rect.y + (logical_rect.height - ink_rect.height) / 2;
glyphs->glyphs[i].geometry.width = logical_rect.width;
}
- else if (analysis->gravity == PANGO_GRAVITY_SOUTH)
+ else if (analysis->gravity == PANGO2_GRAVITY_SOUTH)
{
glyphs->glyphs[i].geometry.x_offset = 0;
glyphs->glyphs[i].geometry.y_offset = 0;
glyphs->glyphs[i].geometry.width = logical_rect.width;
}
- else if (analysis->gravity == PANGO_GRAVITY_NORTH)
+ else if (analysis->gravity == PANGO2_GRAVITY_NORTH)
{
glyphs->glyphs[i].geometry.x_offset = 0;
glyphs->glyphs[i].geometry.y_offset = 0;
@@ -190,17 +190,17 @@ default_shape_func (PangoUserFace *face,
}
if (analysis->level & 1)
- pango_glyph_string_reverse_range (glyphs, 0, glyphs->num_glyphs);
+ pango2_glyph_string_reverse_range (glyphs, 0, glyphs->num_glyphs);
return TRUE;
}
static gboolean
-default_render_func (PangoUserFace *face,
- int size,
+default_render_func (Pango2UserFace *face,
+ int size,
hb_codepoint_t glyph,
gpointer user_data,
- const char *backend_id,
+ const char *backend_id,
gpointer backend_data)
{
/* Draw nothing... not very exciting */
@@ -208,106 +208,106 @@ default_render_func (PangoUserFace *face,
}
/* }}} */
-/* {{{ PangoFontFace implementation */
+/* {{{ Pango2FontFace implementation */
-struct _PangoUserFaceClass
+struct _Pango2UserFaceClass
{
- PangoFontFaceClass parent_class;
+ Pango2FontFaceClass parent_class;
};
-G_DEFINE_FINAL_TYPE (PangoUserFace, pango_user_face, PANGO_TYPE_FONT_FACE)
+G_DEFINE_FINAL_TYPE (Pango2UserFace, pango2_user_face, PANGO2_TYPE_FONT_FACE)
static void
-pango_user_face_init (PangoUserFace *self)
+pango2_user_face_init (Pango2UserFace *self)
{
}
static void
-pango_user_face_finalize (GObject *object)
+pango2_user_face_finalize (GObject *object)
{
- PangoUserFace *self = PANGO_USER_FACE (object);
+ Pango2UserFace *self = PANGO2_USER_FACE (object);
g_free (self->faceid);
if (self->destroy)
self->destroy (self->user_data);
- G_OBJECT_CLASS (pango_user_face_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_user_face_parent_class)->finalize (object);
}
static gboolean
-pango_user_face_is_synthesized (PangoFontFace *face)
+pango2_user_face_is_synthesized (Pango2FontFace *face)
{
return TRUE;
}
static gboolean
-pango_user_face_is_monospace (PangoFontFace *face)
+pango2_user_face_is_monospace (Pango2FontFace *face)
{
return FALSE;
}
static gboolean
-pango_user_face_is_variable (PangoFontFace *face)
+pango2_user_face_is_variable (Pango2FontFace *face)
{
return FALSE;
}
static gboolean
-pango_user_face_has_char (PangoFontFace *face,
- gunichar wc)
+pango2_user_face_has_char (Pango2FontFace *face,
+ gunichar wc)
{
- PangoUserFace *self = PANGO_USER_FACE (face);
+ Pango2UserFace *self = PANGO2_USER_FACE (face);
hb_codepoint_t glyph;
return self->glyph_func (self, wc, &glyph, self->user_data);
}
static const char *
-pango_user_face_get_faceid (PangoFontFace *face)
+pango2_user_face_get_faceid (Pango2FontFace *face)
{
- PangoUserFace *self = PANGO_USER_FACE (face);
+ Pango2UserFace *self = PANGO2_USER_FACE (face);
ensure_faceid (self);
return self->faceid;
}
-static PangoFont *
-pango_user_face_create_font (PangoFontFace *face,
- const PangoFontDescription *desc,
- float dpi,
- const PangoMatrix *ctm)
+static Pango2Font *
+pango2_user_face_create_font (Pango2FontFace *face,
+ const Pango2FontDescription *desc,
+ float dpi,
+ const Pango2Matrix *ctm)
{
- PangoUserFace *self = PANGO_USER_FACE (face);
+ Pango2UserFace *self = PANGO2_USER_FACE (face);
- return PANGO_FONT (pango_user_font_new_for_description (self, desc, dpi, ctm));
+ return PANGO2_FONT (pango2_user_font_new_for_description (self, desc, dpi, ctm));
}
static void
-pango_user_face_class_init (PangoUserFaceClass *class)
+pango2_user_face_class_init (Pango2UserFaceClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontFaceClass *face_class = PANGO_FONT_FACE_CLASS (class);
+ Pango2FontFaceClass *face_class = PANGO2_FONT_FACE_CLASS (class);
- object_class->finalize = pango_user_face_finalize;
+ object_class->finalize = pango2_user_face_finalize;
- face_class->is_synthesized = pango_user_face_is_synthesized;
- face_class->is_monospace = pango_user_face_is_monospace;
- face_class->is_variable = pango_user_face_is_variable;
- face_class->has_char = pango_user_face_has_char;
- face_class->get_faceid = pango_user_face_get_faceid;
- face_class->create_font = pango_user_face_create_font;
+ face_class->is_synthesized = pango2_user_face_is_synthesized;
+ face_class->is_monospace = pango2_user_face_is_monospace;
+ face_class->is_variable = pango2_user_face_is_variable;
+ face_class->has_char = pango2_user_face_has_char;
+ face_class->get_faceid = pango2_user_face_get_faceid;
+ face_class->create_font = pango2_user_face_create_font;
}
/* }}} */
/* {{{ Public API */
/**
- * PangoUserFaceGetFontInfoFunc:
- * @face: the `PangoUserFace`
+ * Pango2UserFaceGetFontInfoFunc:
+ * @face: the `Pango2UserFace`
* @size: the size of the font that is being created
* @extents: (out caller-allocates): return location for font extents
- * user_data: user data that was passed to [ctor@Pango.UserFace.new]
+ * user_data: user data that was passed to [ctor@Pango2.UserFace.new]
*
* Callback to obtain font extents for user fonts.
*
@@ -319,11 +319,11 @@ pango_user_face_class_init (PangoUserFaceClass *class)
*/
/**
- * PangoUserFaceUnicodeToGlyphFunc:
- * @face: the `PangoUserFace`
+ * Pango2UserFaceUnicodeToGlyphFunc:
+ * @face: the `Pango2UserFace`
* @unicode: the Unicode character
* @glyph: (out caller-allocates): return location for the glyph that
- * @user_data: user data that was passed to [ctor@Pango.UserFace.new]
+ * @user_data: user data that was passed to [ctor@Pango2.UserFace.new]
*
* Callback to determine if a user font can render a character,
* and what glyph it will use.
@@ -332,8 +332,8 @@ pango_user_face_class_init (PangoUserFaceClass *class)
*/
/**
- * PangoUserFaceGetGlyphInfoFunc:
- * @face: the `PangoUserFace`
+ * Pango2UserFaceGetGlyphInfoFunc:
+ * @face: the `Pango2UserFace`
* @size: the size of the font that is queried
* @glyph: the glyph that is being queried
* @extents: (out caller-allocates): return location for the glyphs ink rectangle
@@ -341,7 +341,7 @@ pango_user_face_class_init (PangoUserFaceClass *class)
* @v_advance: (out caller-allocates): return location for the v advance
* @is_color_glyph: (out caller-allocates): return location for information about
* whether @glyph has color
- * @user_data: user data that was passed to [ctor@Pango.UserFace.new]
+ * @user_data: user data that was passed to [ctor@Pango2.UserFace.new]
*
* Callback to obtain information about a glyph in a user font.
*
@@ -353,41 +353,41 @@ pango_user_face_class_init (PangoUserFaceClass *class)
*/
/**
- * PangoUserFaceTextToGlyphFunc:
- * @face: the `PangoUserFace`
+ * Pango2UserFaceTextToGlyphFunc:
+ * @face: the `Pango2UserFace`
* @size: the size of the font that is used
* @text: the text to shape
* @length: the length of @text
- * @analysis: `PangoAnalysis` for @text
- * @glyphs: (out caller-allocates): the `PangoGlyphString` to populate
- * @flags: `PangoShapeFlags` to use
- * @user_data: user data that was pased to [ctor@Pango.UserFace.new]
+ * @analysis: `Pango2Analysis` for @text
+ * @glyphs: (out caller-allocates): the `Pango2GlyphString` to populate
+ * @flags: `Pango2ShapeFlags` to use
+ * @user_data: user data that was pased to [ctor@Pango2.UserFace.new]
*
* Callback to shape a segment of text with a user font.
*
* This callback is optional when creating a user font. If it isn't
- * provided, Pango will rely on the `PangoUserFaceUnicodeToGlyphFunc`
- * and the `PangoUserFaceGetGlyphInfo` callback to translate Unicode
+ * provided, Pango2 will rely on the `Pango2UserFaceUnicodeToGlyphFunc`
+ * and the `Pango2UserFaceGetGlyphInfo` callback to translate Unicode
* characters to glyphs 1-1, and position the glyphs according to their
* advance widths.
*
- * If this callback is provided, it replaces all of Pango's own shaping.
+ * If this callback is provided, it replaces all of Pango2's own shaping.
* The function can implement ligatures, reordering, and other features
* that turn the text-to-glyph mapping into an m-n relationship. The
* function is responsible for filling not just the glyphs and their
* positions, but also cluster information and glyph attributes in
- * [struct@Pango.GlyphVisAttr].
+ * [struct@Pango2.GlyphVisAttr].
*
* Returns: `TRUE` on success
*/
/**
- * PangoUserFaceRenderGlyphFunc:
- * @face: the `PangoUserFace`
+ * Pango2UserFaceRenderGlyphFunc:
+ * @face: the `Pango2UserFace`
* @size: the size of the font that is used
* @glyph: the glyph that is being queried
- * @user_data: user data that was pased to [ctor@Pango.UserFace.new]
- * @backend_id: a string identifying the [class@Pango.Renderer] in use
+ * @user_data: user data that was pased to [ctor@Pango2.UserFace.new]
+ * @backend_id: a string identifying the [class@Pango2.Renderer] in use
* @backend_data: backend-specific data
*
* Callback to render a glyph with a user font.
@@ -395,13 +395,13 @@ pango_user_face_class_init (PangoUserFaceClass *class)
* This callback is optional when creating a user font. If it isn't
* provided, the font will not produce any visible output.
*
- * The @backend_id identifies the [class@Pango.Renderer] in use.
+ * The @backend_id identifies the [class@Pango2.Renderer] in use.
* Implementations should return `FALSE` for unsupported backends.
*
* The cairo backend uses the string "cairo" as @backend_id, and
* provides a `cairo_t` as @backend_data. The context is set up
* to render in `font space`, i.e. The transformation is set up
- * to map the unit square to @size x @size. If supported, Pango
+ * to map the unit square to @size x @size. If supported, Pango2
* uses `cairo_user_font_face_set_render_color_glyph_func` to
* allow glyphs to be rendered with colors. For more information,
* see the cairo documentation about user fonts.
@@ -410,16 +410,16 @@ pango_user_face_class_init (PangoUserFaceClass *class)
*/
/**
- * pango_user_face_new:
- * @font_info_func: (scope notified): a `PangoUserFaceGetFontInfoFunc`
- * @glyph_func: (scope notified): a `PangoUserFaceUnicodeToGlyphFunc`
- * @glyph_info_func: (scope notified): a `PangoUserFaceGetGlyphInfoFunc`
- * @shape_func: (scope notified) (nullable): a `PangoUserFaceTextToGlyphFunc`
- * @render_func: (scope notified) (nullable): a `PangoUserFaceRenderGlyphFunc`
+ * pango2_user_face_new:
+ * @font_info_func: (scope notified): a `Pango2UserFaceGetFontInfoFunc`
+ * @glyph_func: (scope notified): a `Pango2UserFaceUnicodeToGlyphFunc`
+ * @glyph_info_func: (scope notified): a `Pango2UserFaceGetGlyphInfoFunc`
+ * @shape_func: (scope notified) (nullable): a `Pango2UserFaceTextToGlyphFunc`
+ * @render_func: (scope notified) (nullable): a `Pango2UserFaceRenderGlyphFunc`
* @user_data: user data that will be assed to the callbacks
* @destroy: destroy notify for @user_data
* @name: name for the face
- * @description: `PangoFontDescription` for the font
+ * @description: `Pango2FontDescription` for the font
*
* Creates a new user font face.
*
@@ -427,27 +427,27 @@ pango_user_face_class_init (PangoUserFaceClass *class)
* but instead uses callbacks to determine glyph extents, positions
* and rendering.
*
- * If @shape_func is `NULL`, Pango will rely on @glyph_func and
+ * If @shape_func is `NULL`, Pango2 will rely on @glyph_func and
* @glyph_info_func to find and position a glyph for each character.
*
* If @render_func is `NULL`, the font will not produce any visible
* glyphs.
*
- * Returns: (transfer full): a newly created `PangoUserFace`
+ * Returns: (transfer full): a newly created `Pango2UserFace`
*/
-PangoUserFace *
-pango_user_face_new (PangoUserFaceGetFontInfoFunc font_info_func,
- PangoUserFaceUnicodeToGlyphFunc glyph_func,
- PangoUserFaceGetGlyphInfoFunc glyph_info_func,
- PangoUserFaceTextToGlyphFunc shape_func,
- PangoUserFaceRenderGlyphFunc render_func,
- gpointer user_data,
- GDestroyNotify destroy,
- const char *name,
- const PangoFontDescription *description)
+Pango2UserFace *
+pango2_user_face_new (Pango2UserFaceGetFontInfoFunc font_info_func,
+ Pango2UserFaceUnicodeToGlyphFunc glyph_func,
+ Pango2UserFaceGetGlyphInfoFunc glyph_info_func,
+ Pango2UserFaceTextToGlyphFunc shape_func,
+ Pango2UserFaceRenderGlyphFunc render_func,
+ gpointer user_data,
+ GDestroyNotify destroy,
+ const char *name,
+ const Pango2FontDescription *description)
{
- PangoUserFace *self;
- PangoFontFace *face;
+ Pango2UserFace *self;
+ Pango2FontFace *face;
g_return_val_if_fail (font_info_func != NULL, NULL);
g_return_val_if_fail (glyph_func != NULL, NULL);
@@ -455,7 +455,7 @@ pango_user_face_new (PangoUserFaceGetFontInfoFunc font_info_func,
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (description != NULL, NULL);
- self = g_object_new (PANGO_TYPE_USER_FACE, NULL);
+ self = g_object_new (PANGO2_TYPE_USER_FACE, NULL);
self->font_info_func = font_info_func;
self->glyph_func = glyph_func;
@@ -468,10 +468,10 @@ pango_user_face_new (PangoUserFaceGetFontInfoFunc font_info_func,
if (!name)
name = style_from_font_description (description);
- face = PANGO_FONT_FACE (self);
+ face = PANGO2_FONT_FACE (self);
face->name = g_strdup (name);
- face->description = pango_font_description_copy (description);
+ face->description = pango2_font_description_copy (description);
return self;
}
diff --git a/pango/pango-userface.h b/pango/pango-userface.h
index 6d6def4b..68c7079c 100644
--- a/pango/pango-userface.h
+++ b/pango/pango-userface.h
@@ -25,57 +25,57 @@
G_BEGIN_DECLS
-typedef struct _PangoUserFont PangoUserFont;
+typedef struct _Pango2UserFont Pango2UserFont;
-#define PANGO_TYPE_USER_FACE (pango_user_face_get_type ())
+#define PANGO2_TYPE_USER_FACE (pango2_user_face_get_type ())
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoUserFace, pango_user_face, PANGO, USER_FACE, PangoFontFace)
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2UserFace, pango2_user_face, PANGO2, USER_FACE, Pango2FontFace)
-typedef gboolean (* PangoUserFaceGetFontInfoFunc) (PangoUserFace *face,
- int size,
- hb_font_extents_t *extents,
- gpointer user_data);
+typedef gboolean (* Pango2UserFaceGetFontInfoFunc) (Pango2UserFace *face,
+ int size,
+ hb_font_extents_t *extents,
+ gpointer user_data);
-typedef gboolean (* PangoUserFaceUnicodeToGlyphFunc) (PangoUserFace *face,
- hb_codepoint_t unicode,
- hb_codepoint_t *glyph,
- gpointer user_data);
+typedef gboolean (* Pango2UserFaceUnicodeToGlyphFunc) (Pango2UserFace *face,
+ hb_codepoint_t unicode,
+ hb_codepoint_t *glyph,
+ gpointer user_data);
-typedef gboolean (* PangoUserFaceGetGlyphInfoFunc) (PangoUserFace *face,
- int size,
- hb_codepoint_t glyph,
- hb_glyph_extents_t *extents,
- hb_position_t *h_advance,
- hb_position_t *v_advance,
- gboolean *is_color_glyph,
- gpointer user_data);
+typedef gboolean (* Pango2UserFaceGetGlyphInfoFunc) (Pango2UserFace *face,
+ int size,
+ hb_codepoint_t glyph,
+ hb_glyph_extents_t *extents,
+ hb_position_t *h_advance,
+ hb_position_t *v_advance,
+ gboolean *is_color_glyph,
+ gpointer user_data);
-typedef gboolean (* PangoUserFaceTextToGlyphFunc) (PangoUserFace *face,
- int size,
- const char *text,
- int length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags,
- gpointer user_data);
+typedef gboolean (* Pango2UserFaceTextToGlyphFunc) (Pango2UserFace *face,
+ int size,
+ const char *text,
+ int length,
+ const Pango2Analysis *analysis,
+ Pango2GlyphString *glyphs,
+ Pango2ShapeFlags flags,
+ gpointer user_data);
-typedef gboolean (* PangoUserFaceRenderGlyphFunc) (PangoUserFace *face,
- int size,
- hb_codepoint_t glyph,
- gpointer user_data,
- const char *backend_id,
- gpointer backend_data);
+typedef gboolean (* Pango2UserFaceRenderGlyphFunc) (Pango2UserFace *face,
+ int size,
+ hb_codepoint_t glyph,
+ gpointer user_data,
+ const char *backend_id,
+ gpointer backend_data);
-PANGO_AVAILABLE_IN_ALL
-PangoUserFace * pango_user_face_new (PangoUserFaceGetFontInfoFunc font_info_func,
- PangoUserFaceUnicodeToGlyphFunc glyph_func,
- PangoUserFaceGetGlyphInfoFunc glyph_info_func,
- PangoUserFaceTextToGlyphFunc shape_func,
- PangoUserFaceRenderGlyphFunc render_func,
- gpointer user_data,
- GDestroyNotify destroy,
- const char *name,
- const PangoFontDescription *description);
+PANGO2_AVAILABLE_IN_ALL
+Pango2UserFace * pango2_user_face_new (Pango2UserFaceGetFontInfoFunc font_info_func,
+ Pango2UserFaceUnicodeToGlyphFunc glyph_func,
+ Pango2UserFaceGetGlyphInfoFunc glyph_info_func,
+ Pango2UserFaceTextToGlyphFunc shape_func,
+ Pango2UserFaceRenderGlyphFunc render_func,
+ gpointer user_data,
+ GDestroyNotify destroy,
+ const char *name,
+ const Pango2FontDescription *description);
G_END_DECLS
diff --git a/pango/pango-userfont-private.h b/pango/pango-userfont-private.h
index a4e688b1..94be5a18 100644
--- a/pango/pango-userfont-private.h
+++ b/pango/pango-userfont-private.h
@@ -24,7 +24,7 @@
#include "pango-font-private.h"
-struct _PangoUserFont
+struct _Pango2UserFont
{
- PangoFont parent_instance;
+ Pango2Font parent_instance;
};
diff --git a/pango/pango-userfont.c b/pango/pango-userfont.c
index d88babee..6bd4b20c 100644
--- a/pango/pango-userfont.c
+++ b/pango/pango-userfont.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -32,61 +32,61 @@
#include <hb-ot.h>
/**
- * PangoUserFont:
+ * Pango2UserFont:
*
- * `PangoUserFont` is a `PangoFont` implementation that uses callbacks.
+ * `Pango2UserFont` is a `Pango2Font` implementation that uses callbacks.
*/
-/* {{{ PangoFont implementation */
+/* {{{ Pango2Font implementation */
-struct _PangoUserFontClass
+struct _Pango2UserFontClass
{
- PangoFontClass parent_class;
+ Pango2FontClass parent_class;
};
-G_DEFINE_FINAL_TYPE (PangoUserFont, pango_user_font, PANGO_TYPE_FONT)
+G_DEFINE_FINAL_TYPE (Pango2UserFont, pango2_user_font, PANGO2_TYPE_FONT)
static void
-pango_user_font_init (PangoUserFont *self G_GNUC_UNUSED)
+pango2_user_font_init (Pango2UserFont *self G_GNUC_UNUSED)
{
}
static void
-pango_user_font_finalize (GObject *object)
+pango2_user_font_finalize (GObject *object)
{
- G_OBJECT_CLASS (pango_user_font_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_user_font_parent_class)->finalize (object);
}
-static PangoFontDescription *
-pango_user_font_describe (PangoFont *font)
+static Pango2FontDescription *
+pango2_user_font_describe (Pango2Font *font)
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
- desc = pango_font_face_describe (PANGO_FONT_FACE (font->face));
- pango_font_description_set_gravity (desc, font->gravity);
- pango_font_description_set_size (desc, font->size);
+ desc = pango2_font_face_describe (PANGO2_FONT_FACE (font->face));
+ pango2_font_description_set_gravity (desc, font->gravity);
+ pango2_font_description_set_size (desc, font->size);
return desc;
}
static void
-pango_user_font_get_glyph_extents (PangoFont *font,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
+pango2_user_font_get_glyph_extents (Pango2Font *font,
+ Pango2Glyph glyph,
+ Pango2Rectangle *ink_rect,
+ Pango2Rectangle *logical_rect)
{
- hb_font_t *hb_font = pango_font_get_hb_font (font);
+ hb_font_t *hb_font = pango2_font_get_hb_font (font);
hb_glyph_extents_t extents;
hb_direction_t direction;
hb_font_extents_t font_extents;
- direction = PANGO_GRAVITY_IS_VERTICAL (font->gravity)
+ direction = PANGO2_GRAVITY_IS_VERTICAL (font->gravity)
? HB_DIRECTION_TTB
: HB_DIRECTION_LTR;
hb_font_get_extents_for_direction (hb_font, direction, &font_extents);
- if (glyph == PANGO_GLYPH_EMPTY || (glyph & PANGO_GLYPH_UNKNOWN_FLAG))
+ if (glyph == PANGO2_GLYPH_EMPTY || (glyph & PANGO2_GLYPH_UNKNOWN_FLAG))
{
if (ink_rect)
ink_rect->x = ink_rect->y = ink_rect->width = ink_rect->height = 0;
@@ -105,7 +105,7 @@ pango_user_font_get_glyph_extents (PangoFont *font,
if (ink_rect)
{
- PangoRectangle r;
+ Pango2Rectangle r;
r.x = extents.x_bearing;
r.y = - extents.y_bearing;
@@ -114,26 +114,26 @@ pango_user_font_get_glyph_extents (PangoFont *font,
switch (font->gravity)
{
- case PANGO_GRAVITY_AUTO:
- case PANGO_GRAVITY_SOUTH:
+ case PANGO2_GRAVITY_AUTO:
+ case PANGO2_GRAVITY_SOUTH:
ink_rect->x = r.x;
ink_rect->y = r.y;
ink_rect->width = r.width;
ink_rect->height = r.height;
break;
- case PANGO_GRAVITY_NORTH:
+ case PANGO2_GRAVITY_NORTH:
ink_rect->x = - r.x;
ink_rect->y = - r.y;
ink_rect->width = - r.width;
ink_rect->height = - r.height;
break;
- case PANGO_GRAVITY_EAST:
+ case PANGO2_GRAVITY_EAST:
ink_rect->x = r.y;
ink_rect->y = - r.x - r.width;
ink_rect->width = r.height;
ink_rect->height = r.width;
break;
- case PANGO_GRAVITY_WEST:
+ case PANGO2_GRAVITY_WEST:
ink_rect->x = - r.y - r.height;
ink_rect->y = r.x;
ink_rect->width = r.height;
@@ -143,11 +143,11 @@ pango_user_font_get_glyph_extents (PangoFont *font,
g_assert_not_reached ();
}
- if (PANGO_GRAVITY_IS_IMPROPER (font->gravity))
+ if (PANGO2_GRAVITY_IS_IMPROPER (font->gravity))
{
- PangoMatrix matrix = (PangoMatrix) PANGO_MATRIX_INIT;
- pango_matrix_scale (&matrix, -1, -1);
- pango_matrix_transform_rectangle (&matrix, ink_rect);
+ Pango2Matrix matrix = (Pango2Matrix) PANGO2_MATRIX_INIT;
+ pango2_matrix_scale (&matrix, -1, -1);
+ pango2_matrix_transform_rectangle (&matrix, ink_rect);
}
}
@@ -164,20 +164,20 @@ pango_user_font_get_glyph_extents (PangoFont *font,
switch (font->gravity)
{
- case PANGO_GRAVITY_AUTO:
- case PANGO_GRAVITY_SOUTH:
+ case PANGO2_GRAVITY_AUTO:
+ case PANGO2_GRAVITY_SOUTH:
logical_rect->y = - extents.ascender;
logical_rect->width = h_advance;
break;
- case PANGO_GRAVITY_NORTH:
+ case PANGO2_GRAVITY_NORTH:
logical_rect->y = extents.descender;
logical_rect->width = h_advance;
break;
- case PANGO_GRAVITY_EAST:
+ case PANGO2_GRAVITY_EAST:
logical_rect->y = - logical_rect->height / 2;
logical_rect->width = logical_rect->height;
break;
- case PANGO_GRAVITY_WEST:
+ case PANGO2_GRAVITY_WEST:
logical_rect->y = - logical_rect->height / 2;
logical_rect->width = - logical_rect->height;
break;
@@ -185,7 +185,7 @@ pango_user_font_get_glyph_extents (PangoFont *font,
g_assert_not_reached ();
}
- if (PANGO_GRAVITY_IS_IMPROPER (font->gravity))
+ if (PANGO2_GRAVITY_IS_IMPROPER (font->gravity))
{
logical_rect->height = - logical_rect->height;
logical_rect->y = - logical_rect->y;
@@ -193,15 +193,15 @@ pango_user_font_get_glyph_extents (PangoFont *font,
}
}
-static PangoFontMetrics *
-pango_user_font_get_metrics (PangoFont *font,
- PangoLanguage *language)
+static Pango2FontMetrics *
+pango2_user_font_get_metrics (Pango2Font *font,
+ Pango2Language *language)
{
- hb_font_t *hb_font = pango_font_get_hb_font (font);
- PangoFontMetrics *metrics;
+ hb_font_t *hb_font = pango2_font_get_hb_font (font);
+ Pango2FontMetrics *metrics;
hb_font_extents_t extents;
- metrics = pango_font_metrics_new ();
+ metrics = pango2_font_metrics_new ();
hb_font_get_extents_for_direction (hb_font, HB_DIRECTION_LTR, &extents);
@@ -209,9 +209,9 @@ pango_user_font_get_metrics (PangoFont *font,
metrics->ascent = extents.ascender;
metrics->height = extents.ascender - extents.descender + extents.line_gap;
- metrics->underline_thickness = PANGO_SCALE;
- metrics->underline_position = - PANGO_SCALE;
- metrics->strikethrough_thickness = PANGO_SCALE;
+ metrics->underline_thickness = PANGO2_SCALE;
+ metrics->underline_position = - PANGO2_SCALE;
+ metrics->strikethrough_thickness = PANGO2_SCALE;
metrics->strikethrough_position = metrics->ascent / 2;
metrics->approximate_char_width = 0; /* FIXME */
metrics->approximate_digit_width = 0;
@@ -220,24 +220,26 @@ pango_user_font_get_metrics (PangoFont *font,
}
static hb_bool_t
-nominal_glyph_func (hb_font_t *hb_font, void *font_data,
- hb_codepoint_t unicode,
+nominal_glyph_func (hb_font_t *hb_font,
+ void *font_data,
+ hb_codepoint_t unicode,
hb_codepoint_t *glyph,
- void *user_data)
+ void *user_data)
{
- PangoFont *font = font_data;
- PangoUserFace *face = PANGO_USER_FACE (font->face);
+ Pango2Font *font = font_data;
+ Pango2UserFace *face = PANGO2_USER_FACE (font->face);
return face->glyph_func (face, unicode, glyph, face->user_data);
}
static hb_position_t
-glyph_h_advance_func (hb_font_t *hb_font, void *font_data,
- hb_codepoint_t glyph,
- void *user_data)
+glyph_h_advance_func (hb_font_t *hb_font,
+ void *font_data,
+ hb_codepoint_t glyph,
+ void *user_data)
{
- PangoFont *font = font_data;
- PangoUserFace *face = PANGO_USER_FACE (font->face);
+ Pango2Font *font = font_data;
+ Pango2UserFace *face = PANGO2_USER_FACE (font->face);
int size = font->size * font->dpi / 72.;
hb_position_t h_advance, v_advance;
hb_glyph_extents_t glyph_extents;
@@ -253,13 +255,14 @@ glyph_h_advance_func (hb_font_t *hb_font, void *font_data,
}
static hb_bool_t
-glyph_extents_func (hb_font_t *hb_font, void *font_data,
- hb_codepoint_t glyph,
+glyph_extents_func (hb_font_t *hb_font,
+ void *font_data,
+ hb_codepoint_t glyph,
hb_glyph_extents_t *extents,
- void *user_data)
+ void *user_data)
{
- PangoFont *font = font_data;
- PangoUserFace *face = PANGO_USER_FACE (font->face);
+ Pango2Font *font = font_data;
+ Pango2UserFace *face = PANGO2_USER_FACE (font->face);
int size = font->size * font->dpi / 72.;
hb_position_t h_advance, v_advance;
gboolean is_color;
@@ -270,7 +273,7 @@ glyph_extents_func (hb_font_t *hb_font, void *font_data,
&is_color,
face->user_data);
- if (PANGO_GRAVITY_IS_IMPROPER (font->gravity))
+ if (PANGO2_GRAVITY_IS_IMPROPER (font->gravity))
{
extents->x_bearing = - extents->x_bearing;
extents->y_bearing = - extents->y_bearing;
@@ -282,18 +285,19 @@ glyph_extents_func (hb_font_t *hb_font, void *font_data,
}
static hb_bool_t
-font_extents_func (hb_font_t *hb_font, void *font_data,
+font_extents_func (hb_font_t *hb_font,
+ void *font_data,
hb_font_extents_t *extents,
- void *user_data)
+ void *user_data)
{
- PangoFont *font = font_data;
- PangoUserFace *face = PANGO_USER_FACE (font->face);
+ Pango2Font *font = font_data;
+ Pango2UserFace *face = PANGO2_USER_FACE (font->face);
int size = font->size * font->dpi / 72.;
gboolean ret;
ret = face->font_info_func (face, size, extents, face->user_data);
- if (PANGO_GRAVITY_IS_IMPROPER (font->gravity))
+ if (PANGO2_GRAVITY_IS_IMPROPER (font->gravity))
{
extents->ascender = - extents->ascender;
extents->descender = - extents->descender;
@@ -303,7 +307,7 @@ font_extents_func (hb_font_t *hb_font, void *font_data,
}
static hb_font_t *
-pango_user_font_create_hb_font (PangoFont *font)
+pango2_user_font_create_hb_font (Pango2Font *font)
{
double x_scale, y_scale;
int size;
@@ -333,104 +337,104 @@ pango_user_font_create_hb_font (PangoFont *font)
size = font->size * font->dpi / 72.f;
x_scale = y_scale = 1;
- if (PANGO_GRAVITY_IS_IMPROPER (font->gravity))
+ if (PANGO2_GRAVITY_IS_IMPROPER (font->gravity))
{
x_scale = - x_scale;
y_scale = - y_scale;
}
hb_font_set_scale (hb_font, size * x_scale, size * y_scale);
- hb_font_set_ptem (hb_font, font->size / PANGO_SCALE);
+ hb_font_set_ptem (hb_font, font->size / PANGO2_SCALE);
return hb_font;
}
static void
-pango_user_font_class_init (PangoUserFontClass *class)
+pango2_user_font_class_init (Pango2UserFontClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontClass *font_class = PANGO_FONT_CLASS (class);
+ Pango2FontClass *font_class = PANGO2_FONT_CLASS (class);
- object_class->finalize = pango_user_font_finalize;
+ object_class->finalize = pango2_user_font_finalize;
- font_class->describe = pango_user_font_describe;
- font_class->get_glyph_extents = pango_user_font_get_glyph_extents;
- font_class->get_metrics = pango_user_font_get_metrics;
- font_class->create_hb_font = pango_user_font_create_hb_font;
+ font_class->describe = pango2_user_font_describe;
+ font_class->get_glyph_extents = pango2_user_font_get_glyph_extents;
+ font_class->get_metrics = pango2_user_font_get_metrics;
+ font_class->create_hb_font = pango2_user_font_create_hb_font;
}
/* }}} */
/* {{{ Public API */
/**
- * pango_user_font_new:
- * @face: the `PangoUserFace` to use
- * @size: the desired size in points, scaled by `PANGO_SCALE`
+ * pango2_user_font_new:
+ * @face: the `Pango2UserFace` to use
+ * @size: the desired size in points, scaled by `PANGO2_SCALE`
* @gravity: the gravity to use when rendering
* @dpi: the dpi used when rendering
* @ctm: (nullable): transformation matrix to use when rendering
*
- * Creates a new `PangoUserFont`.
+ * Creates a new `Pango2UserFont`.
*
- * Returns: a newly created `PangoUserFont`
+ * Returns: a newly created `Pango2UserFont`
*/
-PangoUserFont *
-pango_user_font_new (PangoUserFace *face,
- int size,
- PangoGravity gravity,
- float dpi,
- const PangoMatrix *ctm)
+Pango2UserFont *
+pango2_user_font_new (Pango2UserFace *face,
+ int size,
+ Pango2Gravity gravity,
+ float dpi,
+ const Pango2Matrix *ctm)
{
- PangoUserFont *self;
- PangoFont *font;
+ Pango2UserFont *self;
+ Pango2Font *font;
- self = g_object_new (PANGO_TYPE_USER_FONT, NULL);
+ self = g_object_new (PANGO2_TYPE_USER_FONT, NULL);
- font = PANGO_FONT (self);
+ font = PANGO2_FONT (self);
- pango_font_set_face (font, PANGO_FONT_FACE (face));
- pango_font_set_size (font, size);
- pango_font_set_dpi (font, dpi);
- pango_font_set_gravity (font, gravity);
- pango_font_set_ctm (font, ctm);
+ pango2_font_set_face (font, PANGO2_FONT_FACE (face));
+ pango2_font_set_size (font, size);
+ pango2_font_set_dpi (font, dpi);
+ pango2_font_set_gravity (font, gravity);
+ pango2_font_set_ctm (font, ctm);
return self;
}
/**
- * pango_user_font_new_for_description:
- * @face: the `PangoUserFace` to use
- * @description: a `PangoFontDescription`
+ * pango2_user_font_new_for_description:
+ * @face: the `Pango2UserFace` to use
+ * @description: a `Pango2FontDescription`
* @dpi: the dpi used when rendering
* @ctm: (nullable): transformation matrix to use when rendering
*
- * Creates a new `PangoUserFont` with size and gravity taken
+ * Creates a new `Pango2UserFont` with size and gravity taken
* from a font description.
*
- * Returns: a newly created `PangoHbFont`
+ * Returns: a newly created `Pango2HbFont`
*/
-PangoUserFont *
-pango_user_font_new_for_description (PangoUserFace *face,
- const PangoFontDescription *description,
- float dpi,
- const PangoMatrix *ctm)
+Pango2UserFont *
+pango2_user_font_new_for_description (Pango2UserFace *face,
+ const Pango2FontDescription *description,
+ float dpi,
+ const Pango2Matrix *ctm)
{
int size;
- PangoGravity gravity;
+ Pango2Gravity gravity;
- if (pango_font_description_get_size_is_absolute (description))
- size = pango_font_description_get_size (description) * 72. / dpi;
+ if (pango2_font_description_get_size_is_absolute (description))
+ size = pango2_font_description_get_size (description) * 72. / dpi;
else
- size = pango_font_description_get_size (description);
+ size = pango2_font_description_get_size (description);
- if ((pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_GRAVITY) != 0 &&
- pango_font_description_get_gravity (description) != PANGO_GRAVITY_SOUTH)
- gravity = pango_font_description_get_gravity (description);
+ if ((pango2_font_description_get_set_fields (description) & PANGO2_FONT_MASK_GRAVITY) != 0 &&
+ pango2_font_description_get_gravity (description) != PANGO2_GRAVITY_SOUTH)
+ gravity = pango2_font_description_get_gravity (description);
else
- gravity = PANGO_GRAVITY_AUTO;
+ gravity = PANGO2_GRAVITY_AUTO;
- return pango_user_font_new (face, size, gravity, dpi, ctm);
+ return pango2_user_font_new (face, size, gravity, dpi, ctm);
}
/* }}} */
diff --git a/pango/pango-userfont.h b/pango/pango-userfont.h
index 85f8723c..c3c3f9aa 100644
--- a/pango/pango-userfont.h
+++ b/pango/pango-userfont.h
@@ -25,22 +25,22 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_USER_FONT (pango_user_font_get_type ())
-
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoUserFont, pango_user_font, PANGO, USER_FONT, PangoFont)
-
-PANGO_AVAILABLE_IN_ALL
-PangoUserFont * pango_user_font_new (PangoUserFace *face,
- int size,
- PangoGravity gravity,
- float dpi,
- const PangoMatrix *ctm);
-
-PANGO_AVAILABLE_IN_ALL
-PangoUserFont * pango_user_font_new_for_description (PangoUserFace *face,
- const PangoFontDescription *description,
- float dpi,
- const PangoMatrix *ctm);
+#define PANGO2_TYPE_USER_FONT (pango2_user_font_get_type ())
+
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2UserFont, pango2_user_font, PANGO2, USER_FONT, Pango2Font)
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2UserFont * pango2_user_font_new (Pango2UserFace *face,
+ int size,
+ Pango2Gravity gravity,
+ float dpi,
+ const Pango2Matrix *ctm);
+
+PANGO2_AVAILABLE_IN_ALL
+Pango2UserFont * pango2_user_font_new_for_description (Pango2UserFace *face,
+ const Pango2FontDescription *description,
+ float dpi,
+ const Pango2Matrix *ctm);
G_END_DECLS
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index e993976e..89e20dac 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pango-utils.c: Utilities for internal functions and modules
*
* Copyright (C) 2000 Red Hat Software
@@ -10,7 +10,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -48,53 +48,53 @@
#endif
/**
- * pango_version:
+ * pango2_version:
*
- * Returns the encoded version of Pango available at run-time.
+ * Returns the encoded version of Pango2 available at run-time.
*
- * This is similar to the macro %PANGO_VERSION except that the macro
+ * This is similar to the macro %PANGO2_VERSION except that the macro
* returns the encoded version available at compile-time. A version
- * number can be encoded into an integer using PANGO_VERSION_ENCODE().
+ * number can be encoded into an integer using PANGO2_VERSION_ENCODE().
*
- * Returns: The encoded version of Pango library available at run time.
+ * Returns: The encoded version of Pango2 library available at run time.
*/
int
-pango_version (void)
+pango2_version (void)
{
- return PANGO_VERSION;
+ return PANGO2_VERSION;
}
/**
- * pango_version_string:
+ * pango2_version_string:
*
- * Returns the version of Pango available at run-time.
+ * Returns the version of Pango2 available at run-time.
*
- * This is similar to the macro %PANGO_VERSION_STRING except that the
+ * This is similar to the macro %PANGO2_VERSION_STRING except that the
* macro returns the version available at compile-time.
*
- * Returns: A string containing the version of Pango library available
- * at run time. The returned string is owned by Pango and should not
+ * Returns: A string containing the version of Pango2 library available
+ * at run time. The returned string is owned by Pango2 and should not
* be modified or freed.
*/
const char *
-pango_version_string (void)
+pango2_version_string (void)
{
- return PANGO_VERSION_STRING;
+ return PANGO2_VERSION_STRING;
}
/**
- * pango_version_check:
+ * pango2_version_check:
* @required_major: the required major version
* @required_minor: the required minor version
* @required_micro: the required major version
*
- * Checks that the Pango library in use is compatible with the
+ * Checks that the Pango2 library in use is compatible with the
* given version.
*
- * Generally you would pass in the constants %PANGO_VERSION_MAJOR,
- * %PANGO_VERSION_MINOR, %PANGO_VERSION_MICRO as the three arguments
+ * Generally you would pass in the constants %PANGO2_VERSION_MAJOR,
+ * %PANGO2_VERSION_MINOR, %PANGO2_VERSION_MICRO as the three arguments
* to this function; that produces a check that the library in use at
- * run-time is compatible with the version of Pango the application or
+ * run-time is compatible with the version of Pango2 the application or
* module was compiled against.
*
* Compatibility is defined by two things: first the version
@@ -104,34 +104,34 @@ pango_version_string (void)
* version @required_major.required_minor.@required_micro
* (same major version.)
*
- * For compile-time version checking use PANGO_VERSION_CHECK().
+ * For compile-time version checking use PANGO2_VERSION_CHECK().
*
- * Return value: (nullable): %NULL if the Pango library is compatible
+ * Return value: (nullable): %NULL if the Pango2 library is compatible
* with the given version, or a string describing the version
- * mismatch. The returned string is owned by Pango and should not
+ * mismatch. The returned string is owned by Pango2 and should not
* be modified or freed.
*/
const char *
-pango_version_check (int required_major,
- int required_minor,
- int required_micro)
+pango2_version_check (int required_major,
+ int required_minor,
+ int required_micro)
{
- int pango_effective_micro = 100 * PANGO_VERSION_MINOR + PANGO_VERSION_MICRO;
+ int pango2_effective_micro = 100 * PANGO2_VERSION_MINOR + PANGO2_VERSION_MICRO;
int required_effective_micro = 100 * required_minor + required_micro;
- if (required_major > PANGO_VERSION_MAJOR)
- return "Pango version too old (major mismatch)";
- if (required_major < PANGO_VERSION_MAJOR)
- return "Pango version too new (major mismatch)";
- if (required_effective_micro < pango_effective_micro - PANGO_BINARY_AGE)
- return "Pango version too new (micro mismatch)";
- if (required_effective_micro > pango_effective_micro)
- return "Pango version too old (micro mismatch)";
+ if (required_major > PANGO2_VERSION_MAJOR)
+ return "Pango2 version too old (major mismatch)";
+ if (required_major < PANGO2_VERSION_MAJOR)
+ return "Pango2 version too new (major mismatch)";
+ if (required_effective_micro < pango2_effective_micro - PANGO2_BINARY_AGE)
+ return "Pango2 version too new (micro mismatch)";
+ if (required_effective_micro > pango2_effective_micro)
+ return "Pango2 version too old (micro mismatch)";
return NULL;
}
/**
- * pango_is_zero_width:
+ * pango2_is_zero_width:
* @ch: a Unicode character
*
* Checks if a character that should not be normally rendered.
@@ -144,7 +144,7 @@ pango_version_check (int required_major,
* Return value: %TRUE if @ch is a zero-width character, %FALSE otherwise
*/
gboolean
-pango_is_zero_width (gunichar ch)
+pango2_is_zero_width (gunichar ch)
{
/* Zero Width characters:
*
@@ -178,57 +178,57 @@ pango_is_zero_width (gunichar ch)
* FEFF ZERO WIDTH NO-BREAK SPACE
*/
return ((ch & ~(gunichar)0x007F) == 0x2000 && (
- (ch >= 0x200B && ch <= 0x200F) ||
- (ch >= 0x202A && ch <= 0x202E) ||
- (ch >= 0x2060 && ch <= 0x2063) ||
+ (ch >= 0x200B && ch <= 0x200F) ||
+ (ch >= 0x202A && ch <= 0x202E) ||
+ (ch >= 0x2060 && ch <= 0x2063) ||
(ch >= 0x2066 && ch <= 0x2069) ||
- (ch == 0x2028)
- )) || G_UNLIKELY (ch == 0x00AD
- || ch == 0x034F
- || ch == 0xFEFF);
+ (ch == 0x2028)
+ )) || G_UNLIKELY (ch == 0x00AD
+ || ch == 0x034F
+ || ch == 0xFEFF);
}
/**
- * pango_units_from_double:
+ * pango2_units_from_double:
* @d: double floating-point value
*
- * Converts a floating-point number to Pango units.
+ * Converts a floating-point number to Pango2 units.
*
- * The conversion is done by multiplying @d by %PANGO_SCALE and
+ * The conversion is done by multiplying @d by %PANGO2_SCALE and
* rounding the result to nearest integer.
*
- * Return value: the value in Pango units.
+ * Return value: the value in Pango2 units.
*/
int
-pango_units_from_double (double d)
+pango2_units_from_double (double d)
{
- return (int)floor (d * PANGO_SCALE + 0.5);
+ return (int)floor (d * PANGO2_SCALE + 0.5);
}
/**
- * pango_units_to_double:
- * @i: value in Pango units
+ * pango2_units_to_double:
+ * @i: value in Pango2 units
*
- * Converts a number in Pango units to floating-point.
+ * Converts a number in Pango2 units to floating-point.
*
- * The conversion is done by dividing @i by %PANGO_SCALE.
+ * The conversion is done by dividing @i by %PANGO2_SCALE.
*
* Return value: the double value.
*/
double
-pango_units_to_double (int i)
+pango2_units_to_double (int i)
{
- return (double)i / PANGO_SCALE;
+ return (double)i / PANGO2_SCALE;
}
/**
- * pango_extents_to_pixels:
+ * pango2_extents_to_pixels:
* @inclusive: (nullable): rectangle to round to pixels inclusively
* @nearest: (nullable): rectangle to round to nearest pixels
*
- * Converts extents from Pango units to device units.
+ * Converts extents from Pango2 units to device units.
*
- * The conversion is done by dividing by the %PANGO_SCALE factor and
+ * The conversion is done by dividing by the %PANGO2_SCALE factor and
* performing rounding.
*
* The @inclusive rectangle is converted by flooring the x/y coordinates
@@ -245,19 +245,19 @@ pango_units_to_double (int i)
* as @nearest.
*/
void
-pango_extents_to_pixels (PangoRectangle *inclusive,
- PangoRectangle *nearest)
+pango2_extents_to_pixels (Pango2Rectangle *inclusive,
+ Pango2Rectangle *nearest)
{
if (inclusive)
{
int orig_x = inclusive->x;
int orig_y = inclusive->y;
- inclusive->x = PANGO_PIXELS_FLOOR (inclusive->x);
- inclusive->y = PANGO_PIXELS_FLOOR (inclusive->y);
+ inclusive->x = PANGO2_PIXELS_FLOOR (inclusive->x);
+ inclusive->y = PANGO2_PIXELS_FLOOR (inclusive->y);
- inclusive->width = PANGO_PIXELS_CEIL (orig_x + inclusive->width ) - inclusive->x;
- inclusive->height = PANGO_PIXELS_CEIL (orig_y + inclusive->height) - inclusive->y;
+ inclusive->width = PANGO2_PIXELS_CEIL (orig_x + inclusive->width ) - inclusive->x;
+ inclusive->height = PANGO2_PIXELS_CEIL (orig_y + inclusive->height) - inclusive->y;
}
if (nearest)
@@ -265,16 +265,16 @@ pango_extents_to_pixels (PangoRectangle *inclusive,
int orig_x = nearest->x;
int orig_y = nearest->y;
- nearest->x = PANGO_PIXELS (nearest->x);
- nearest->y = PANGO_PIXELS (nearest->y);
+ nearest->x = PANGO2_PIXELS (nearest->x);
+ nearest->y = PANGO2_PIXELS (nearest->y);
- nearest->width = PANGO_PIXELS (orig_x + nearest->width ) - nearest->x;
- nearest->height = PANGO_PIXELS (orig_y + nearest->height) - nearest->y;
+ nearest->width = PANGO2_PIXELS (orig_x + nearest->width ) - nearest->x;
+ nearest->height = PANGO2_PIXELS (orig_y + nearest->height) - nearest->y;
}
}
/**
- * pango_find_paragraph_boundary:
+ * pango2_find_paragraph_boundary:
* @text: UTF-8 text
* @length: length of @text in bytes, or -1 if nul-terminated
* @paragraph_delimiter_index: (out): return location for index of
@@ -298,10 +298,10 @@ pango_extents_to_pixels (PangoRectangle *inclusive,
* (an index one off the end).
*/
void
-pango_find_paragraph_boundary (const char *text,
- int length,
- int *paragraph_delimiter_index,
- int *next_paragraph_start)
+pango2_find_paragraph_boundary (const char *text,
+ int length,
+ int *paragraph_delimiter_index,
+ int *next_paragraph_start)
{
const char *p = text;
const char *end;
diff --git a/pango/pango-utils.h b/pango/pango-utils.h
index 0fd5507f..069978c8 100644
--- a/pango/pango-utils.h
+++ b/pango/pango-utils.h
@@ -25,99 +25,92 @@
G_BEGIN_DECLS
-/* Unicode characters that are zero-width and should not be rendered
- * normally.
- */
-PANGO_AVAILABLE_IN_ALL
-gboolean pango_is_zero_width (gunichar ch) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+gboolean pango2_is_zero_width (gunichar ch) G_GNUC_CONST;
-PANGO_AVAILABLE_IN_ALL
-void pango_find_paragraph_boundary (const char *text,
- int length,
- int *paragraph_delimiter_index,
- int *next_paragraph_start);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_find_paragraph_boundary (const char *text,
+ int length,
+ int *paragraph_delimiter_index,
+ int *next_paragraph_start);
/**
- * PANGO_RENDERING_CAIRO:
+ * PANGO2_RENDERING_CAIRO:
*
- * Defined to 1 at compile time if Pango was built with cairo support.
+ * Defined to 1 at compile time if Pango2 was built with cairo support.
*/
-/* Encode a Pango version as an integer */
-/* Pango version checking */
+/* Encode a Pango2 version as an integer */
+/* Pango2 version checking */
/**
- * PANGO_VERSION_ENCODE:
+ * PANGO2_VERSION_ENCODE:
* @major: the major component of the version number
* @minor: the minor component of the version number
* @micro: the micro component of the version number
*
- * This macro encodes the given Pango version into an integer. The numbers
- * returned by %PANGO_VERSION and pango_version() are encoded using this macro.
+ * This macro encodes the given Pango2 version into an integer. The numbers
+ * returned by %PANGO2_VERSION and pango2_version() are encoded using this macro.
* Two encoded version numbers can be compared as integers.
*/
-#define PANGO_VERSION_ENCODE(major, minor, micro) ( \
+#define PANGO2_VERSION_ENCODE(major, minor, micro) ( \
((major) * 10000) \
+ ((minor) * 100) \
+ ((micro) * 1))
-/* Encoded version of Pango at compile-time */
+/* Encoded version of Pango2 at compile-time */
/**
- * PANGO_VERSION:
+ * PANGO2_VERSION:
*
- * The version of Pango available at compile-time, encoded using PANGO_VERSION_ENCODE().
+ * The version of Pango2 available at compile-time, encoded using PANGO2_VERSION_ENCODE().
*/
/**
- * PANGO_VERSION_STRING:
+ * PANGO2_VERSION_STRING:
*
- * A string literal containing the version of Pango available at compile-time.
+ * A string literal containing the version of Pango2 available at compile-time.
*/
/**
- * PANGO_VERSION_MAJOR:
+ * PANGO2_VERSION_MAJOR:
*
- * The major component of the version of Pango available at compile-time.
+ * The major component of the version of Pango2 available at compile-time.
*/
/**
- * PANGO_VERSION_MINOR:
+ * PANGO2_VERSION_MINOR:
*
- * The minor component of the version of Pango available at compile-time.
+ * The minor component of the version of Pango2 available at compile-time.
*/
/**
- * PANGO_VERSION_MICRO:
+ * PANGO2_VERSION_MICRO:
*
- * The micro component of the version of Pango available at compile-time.
+ * The micro component of the version of Pango2 available at compile-time.
*/
-#define PANGO_VERSION PANGO_VERSION_ENCODE( \
- PANGO_VERSION_MAJOR, \
- PANGO_VERSION_MINOR, \
- PANGO_VERSION_MICRO)
+#define PANGO2_VERSION PANGO2_VERSION_ENCODE( \
+ PANGO2_VERSION_MAJOR, \
+ PANGO2_VERSION_MINOR, \
+ PANGO2_VERSION_MICRO)
-/* Check that compile-time Pango is as new as required */
+/* Check that compile-time Pango2 is as new as required */
/**
- * PANGO_VERSION_CHECK:
+ * PANGO2_VERSION_CHECK:
* @major: the major component of the version number
* @minor: the minor component of the version number
* @micro: the micro component of the version number
*
- * Checks that the version of Pango available at compile-time is not older than
+ * Checks that the version of Pango2 available at compile-time is not older than
* the provided version number.
*/
-#define PANGO_VERSION_CHECK(major,minor,micro) \
- (PANGO_VERSION >= PANGO_VERSION_ENCODE(major,minor,micro))
-
+#define PANGO2_VERSION_CHECK(major,minor,micro) \
+ (PANGO2_VERSION >= PANGO2_VERSION_ENCODE(major,minor,micro))
-/* Return encoded version of Pango at run-time */
-PANGO_AVAILABLE_IN_ALL
-int pango_version (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+int pango2_version (void) G_GNUC_CONST;
-/* Return run-time Pango version as an string */
-PANGO_AVAILABLE_IN_ALL
-const char * pango_version_string (void) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_version_string (void) G_GNUC_CONST;
-/* Check that run-time Pango is as new as required */
-PANGO_AVAILABLE_IN_ALL
-const char * pango_version_check (int required_major,
- int required_minor,
- int required_micro) G_GNUC_CONST;
+PANGO2_AVAILABLE_IN_ALL
+const char * pango2_version_check (int required_major,
+ int required_minor,
+ int required_micro) G_GNUC_CONST;
G_END_DECLS
diff --git a/pango/pango-version-macros.h b/pango/pango-version-macros.h
index 1dcbb1e7..ddf93837 100644
--- a/pango/pango-version-macros.h
+++ b/pango/pango-version-macros.h
@@ -25,133 +25,133 @@
#include <glib.h>
-#ifndef _PANGO_EXTERN
-#define _PANGO_EXTERN extern
+#ifndef _PANGO2_EXTERN
+#define _PANGO2_EXTERN extern
#endif
-#define PANGO_AVAILABLE_IN_ALL _PANGO_EXTERN
+#define PANGO2_AVAILABLE_IN_ALL _PANGO2_EXTERN
/* XXX: Every new stable minor release bump should add a macro here */
/**
- * PANGO_VERSION_1_90
+ * PANGO2_VERSION_1_90
*
- * A macro that evaluates to the 1.90 version of Pango, in a format
+ * A macro that evaluates to the 1.90 version of Pango2, in a format
* that can be used by the C pre-processor.
*/
-#define PANGO_VERSION_1_90 (G_ENCODE_VERSION (1, 90))
+#define PANGO2_VERSION_1_90 (G_ENCODE_VERSION (1, 90))
/**
- * PANGO_VERSION_2_0
+ * PANGO2_VERSION_2_0
*
- * A macro that evaluates to the 2.0 version of Pango, in a format
+ * A macro that evaluates to the 2.0 version of Pango2, in a format
* that can be used by the C pre-processor.
*/
-#define PANGO_VERSION_2_0 (G_ENCODE_VERSION (2, 0))
+#define PANGO2_VERSION_2_0 (G_ENCODE_VERSION (2, 0))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target
*/
-#if (PANGO_VERSION_MINOR % 2)
-#define PANGO_VERSION_CUR_STABLE (G_ENCODE_VERSION (PANGO_VERSION_MAJOR, PANGO_VERSION_MINOR + 1))
+#if (PANGO2_VERSION_MINOR % 2)
+#define PANGO2_VERSION_CUR_STABLE (G_ENCODE_VERSION (PANGO2_VERSION_MAJOR, PANGO2_VERSION_MINOR + 1))
#else
-#define PANGO_VERSION_CUR_STABLE (G_ENCODE_VERSION (PANGO_VERSION_MAJOR, PANGO_VERSION_MINOR))
+#define PANGO2_VERSION_CUR_STABLE (G_ENCODE_VERSION (PANGO2_VERSION_MAJOR, PANGO2_VERSION_MINOR))
#endif
/* evaluates to the previous stable version */
-#if (PANGO_VERSION_MINOR % 2)
-#define PANGO_VERSION_PREV_STABLE (G_ENCODE_VERSION (PANGO_VERSION_MAJOR, PANGO_VERSION_MINOR - 1))
+#if (PANGO2_VERSION_MINOR % 2)
+#define PANGO2_VERSION_PREV_STABLE (G_ENCODE_VERSION (PANGO2_VERSION_MAJOR, PANGO2_VERSION_MINOR - 1))
#else
-#define PANGO_VERSION_PREV_STABLE (G_ENCODE_VERSION (PANGO_VERSION_MAJOR, PANGO_VERSION_MINOR - 2))
+#define PANGO2_VERSION_PREV_STABLE (G_ENCODE_VERSION (PANGO2_VERSION_MAJOR, PANGO2_VERSION_MINOR - 2))
#endif
/**
- * PANGO_VERSION_MIN_REQUIRED:
+ * PANGO2_VERSION_MIN_REQUIRED:
*
* A macro that should be defined by the user prior to including
* the pango.h header.
- * The definition should be one of the predefined Pango version
- * macros: %PANGO_VERSION_2_0,…
+ * The definition should be one of the predefined Pango2 version
+ * macros: %PANGO2_VERSION_2_0,…
*
- * This macro defines the earliest version of Pango that the package is
+ * This macro defines the earliest version of Pango2 that the package is
* required to be able to compile against.
*
* If the compiler is configured to warn about the use of deprecated
* functions, then using functions that were deprecated in version
- * %PANGO_VERSION_MIN_REQUIRED or earlier will cause warnings (but
+ * %PANGO2_VERSION_MIN_REQUIRED or earlier will cause warnings (but
* using functions deprecated in later releases will not).
*/
-/* If the package sets PANGO_VERSION_MIN_REQUIRED to some future
- * PANGO_VERSION_X_Y value that we don't know about, it will compare as
+/* If the package sets PANGO2_VERSION_MIN_REQUIRED to some future
+ * PANGO2_VERSION_X_Y value that we don't know about, it will compare as
* 0 in preprocessor tests.
*/
-#ifndef PANGO_VERSION_MIN_REQUIRED
-# define PANGO_VERSION_MIN_REQUIRED (PANGO_VERSION_CUR_STABLE)
-#elif PANGO_VERSION_MIN_REQUIRED == 0
-# undef PANGO_VERSION_MIN_REQUIRED
-# define PANGO_VERSION_MIN_REQUIRED (PANGO_VERSION_CUR_STABLE + 2)
+#ifndef PANGO2_VERSION_MIN_REQUIRED
+# define PANGO2_VERSION_MIN_REQUIRED (PANGO2_VERSION_CUR_STABLE)
+#elif PANGO2_VERSION_MIN_REQUIRED == 0
+# undef PANGO2_VERSION_MIN_REQUIRED
+# define PANGO2_VERSION_MIN_REQUIRED (PANGO2_VERSION_CUR_STABLE + 2)
#endif
/**
- * PANGO_VERSION_MAX_ALLOWED:
+ * PANGO2_VERSION_MAX_ALLOWED:
*
* A macro that should be defined by the user prior to including
* the glib.h header.
- * The definition should be one of the predefined Pango version
- * macros: %PANGO_VERSION_2_0,…
+ * The definition should be one of the predefined Pango2 version
+ * macros: %PANGO2_VERSION_2_0,…
*
- * This macro defines the latest version of the Pango API that the
+ * This macro defines the latest version of the Pango2 API that the
* package is allowed to make use of.
*
* If the compiler is configured to warn about the use of deprecated
* functions, then using functions added after version
- * %PANGO_VERSION_MAX_ALLOWED will cause warnings.
+ * %PANGO2_VERSION_MAX_ALLOWED will cause warnings.
*
- * Unless you are using PANGO_VERSION_CHECK() or the like to compile
- * different code depending on the Pango version, then this should be
- * set to the same value as %PANGO_VERSION_MIN_REQUIRED.
+ * Unless you are using PANGO2_VERSION_CHECK() or the like to compile
+ * different code depending on the Pango2 version, then this should be
+ * set to the same value as %PANGO2_VERSION_MIN_REQUIRED.
*/
-#if !defined (PANGO_VERSION_MAX_ALLOWED) || (PANGO_VERSION_MAX_ALLOWED == 0)
-# undef PANGO_VERSION_MAX_ALLOWED
-# define PANGO_VERSION_MAX_ALLOWED (PANGO_VERSION_CUR_STABLE)
+#if !defined (PANGO2_VERSION_MAX_ALLOWED) || (PANGO2_VERSION_MAX_ALLOWED == 0)
+# undef PANGO2_VERSION_MAX_ALLOWED
+# define PANGO2_VERSION_MAX_ALLOWED (PANGO2_VERSION_CUR_STABLE)
#endif
/* sanity checks */
-#if PANGO_VERSION_MIN_REQUIRED > PANGO_VERSION_CUR_STABLE
-#error "PANGO_VERSION_MIN_REQUIRED must be <= PANGO_VERSION_CUR_STABLE"
+#if PANGO2_VERSION_MIN_REQUIRED > PANGO2_VERSION_CUR_STABLE
+#error "PANGO2_VERSION_MIN_REQUIRED must be <= PANGO2_VERSION_CUR_STABLE"
#endif
-#if PANGO_VERSION_MAX_ALLOWED < PANGO_VERSION_MIN_REQUIRED
-#error "PANGO_VERSION_MAX_ALLOWED must be >= PANGO_VERSION_MIN_REQUIRED"
+#if PANGO2_VERSION_MAX_ALLOWED < PANGO2_VERSION_MIN_REQUIRED
+#error "PANGO2_VERSION_MAX_ALLOWED must be >= PANGO2_VERSION_MIN_REQUIRED"
#endif
-#if PANGO_VERSION_MIN_REQUIRED < PANGO_VERSION_1_90
-#error "PANGO_VERSION_MIN_REQUIRED must be >= PANGO_VERSION_1_90"
+#if PANGO2_VERSION_MIN_REQUIRED < PANGO2_VERSION_1_90
+#error "PANGO2_VERSION_MIN_REQUIRED must be >= PANGO2_VERSION_1_90"
#endif
-/* These macros are used to mark deprecated functions in Pango headers,
+/* These macros are used to mark deprecated functions in Pango2 headers,
* and thus have to be exposed in installed headers.
*/
-#ifdef PANGO_DISABLE_DEPRECATION_WARNINGS
-# define PANGO_DEPRECATED _PANGO_EXTERN
-# define PANGO_DEPRECATED_FOR(f) _PANGO_EXTERN
-# define PANGO_UNAVAILABLE(maj,min) _PANGO_EXTERN
+#ifdef PANGO2_DISABLE_DEPRECATION_WARNINGS
+# define PANGO2_DEPRECATED _PANGO2_EXTERN
+# define PANGO2_DEPRECATED_FOR(f) _PANGO2_EXTERN
+# define PANGO2_UNAVAILABLE(maj,min) _PANGO2_EXTERN
#else
-# define PANGO_DEPRECATED G_DEPRECATED _PANGO_EXTERN
-# define PANGO_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _PANGO_EXTERN
-# define PANGO_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _PANGO_EXTERN
+# define PANGO2_DEPRECATED G_DEPRECATED _PANGO2_EXTERN
+# define PANGO2_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _PANGO2_EXTERN
+# define PANGO2_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _PANGO2_EXTERN
#endif
/* XXX: Every new stable minor release should add a set of macros here */
-#if PANGO_VERSION_MIN_REQUIRED >= PANGO_VERSION_2_0
-# define PANGO_DEPRECATED_IN_2_0 PANGO_DEPRECATED
-# define PANGO_DEPRECATED_IN_2_0_FOR(f) PANGO_DEPRECATED_FOR(f)
+#if PANGO2_VERSION_MIN_REQUIRED >= PANGO2_VERSION_2_0
+# define PANGO2_DEPRECATED_IN_2_0 PANGO2_DEPRECATED
+# define PANGO2_DEPRECATED_IN_2_0_FOR(f) PANGO2_DEPRECATED_FOR(f)
#else
-# define PANGO_DEPRECATED_IN_2_0 _PANGO_EXTERN
-# define PANGO_DEPRECATED_IN_2_0_FOR(f) _PANGO_EXTERN
+# define PANGO2_DEPRECATED_IN_2_0 _PANGO2_EXTERN
+# define PANGO2_DEPRECATED_IN_2_0_FOR(f) _PANGO2_EXTERN
#endif
-#if PANGO_VERSION_MAX_ALLOWED < PANGO_VERSION_2_0
-# define PANGO_AVAILABLE_IN_2_0 PANGO_UNAVAILABLE(2, 0)
+#if PANGO2_VERSION_MAX_ALLOWED < PANGO2_VERSION_2_0
+# define PANGO2_AVAILABLE_IN_2_0 PANGO2_UNAVAILABLE(2, 0)
#else
-# define PANGO_AVAILABLE_IN_2_0 _PANGO_EXTERN
+# define PANGO2_AVAILABLE_IN_2_0 _PANGO2_EXTERN
#endif
diff --git a/pango/pangocairo-context.c b/pango/pangocairo-context.c
index 81b4ea17..2346b635 100644
--- a/pango/pangocairo-context.c
+++ b/pango/pangocairo-context.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pangocairo-context.c: Cairo context handling
*
* Copyright (C) 2000-2005 Red Hat Software
@@ -29,31 +29,31 @@
#include <string.h>
/**
- * pango_cairo_update_context:
+ * pango2_cairo_update_context:
* @cr: a Cairo context
- * @context: a `PangoContext`, from a pangocairo font map
+ * @context: a `Pango2Context`, from a pangocairo font map
*
- * Updates a `PangoContext` previously created for use with Cairo to
+ * Updates a `Pango2Context` previously created for use with Cairo to
* match the current transformation and target surface of a Cairo
* context.
*
* If any layouts have been created for the context, it's necessary
- * to call [method@Pango.Layout.context_changed] on those layouts.
+ * to call [method@Pango2.Layout.context_changed] on those layouts.
*/
void
-pango_cairo_update_context (cairo_t *cr,
- PangoContext *context)
+pango2_cairo_update_context (cairo_t *cr,
+ Pango2Context *context)
{
cairo_matrix_t cairo_matrix;
cairo_surface_t *target;
- PangoMatrix pango_matrix;
- const PangoMatrix *current_matrix, identity_matrix = PANGO_MATRIX_INIT;
+ Pango2Matrix pango2_matrix;
+ const Pango2Matrix *current_matrix, identity_matrix = PANGO2_MATRIX_INIT;
const cairo_font_options_t *merged_options;
cairo_font_options_t *old_merged_options;
gboolean changed = FALSE;
g_return_if_fail (cr != NULL);
- g_return_if_fail (PANGO_IS_CONTEXT (context));
+ g_return_if_fail (PANGO2_IS_CONTEXT (context));
target = cairo_get_target (cr);
@@ -70,7 +70,7 @@ pango_cairo_update_context (cairo_t *cr,
old_merged_options = context->merged_options;
context->merged_options = NULL;
- merged_options = pango_cairo_context_get_merged_font_options (context);
+ merged_options = pango2_cairo_context_get_merged_font_options (context);
if (old_merged_options)
{
@@ -83,14 +83,14 @@ pango_cairo_update_context (cairo_t *cr,
changed = TRUE;
cairo_get_matrix (cr, &cairo_matrix);
- pango_matrix.xx = cairo_matrix.xx;
- pango_matrix.yx = cairo_matrix.yx;
- pango_matrix.xy = cairo_matrix.xy;
- pango_matrix.yy = cairo_matrix.yy;
- pango_matrix.x0 = 0;
- pango_matrix.y0 = 0;
-
- current_matrix = pango_context_get_matrix (context);
+ pango2_matrix.xx = cairo_matrix.xx;
+ pango2_matrix.yx = cairo_matrix.yx;
+ pango2_matrix.xy = cairo_matrix.xy;
+ pango2_matrix.yy = cairo_matrix.yy;
+ pango2_matrix.x0 = 0;
+ pango2_matrix.y0 = 0;
+
+ current_matrix = pango2_context_get_matrix (context);
if (!current_matrix)
current_matrix = &identity_matrix;
@@ -98,31 +98,31 @@ pango_cairo_update_context (cairo_t *cr,
* also ignore matrix translation offsets
*/
if ((cairo_font_options_get_hint_metrics (merged_options) != CAIRO_HINT_METRICS_OFF) &&
- (0 != memcmp (&pango_matrix, current_matrix, sizeof (PangoMatrix))))
+ (0 != memcmp (&pango2_matrix, current_matrix, sizeof (Pango2Matrix))))
changed = TRUE;
- pango_context_set_matrix (context, &pango_matrix);
+ pango2_context_set_matrix (context, &pango2_matrix);
if (changed)
- pango_context_changed (context);
+ pango2_context_changed (context);
}
/**
- * pango_cairo_context_set_font_options:
- * @context: a `PangoContext`, from a pangocairo font map
+ * pango2_cairo_context_set_font_options:
+ * @context: a `Pango2Context`, from a pangocairo font map
* @options: (nullable): a `cairo_font_options_t`, or %NULL to unset
* any previously set options. A copy is made.
*
* Sets the font options used when rendering text with this context.
*
- * These options override any options that [func@Pango.cairo_update_context]
+ * These options override any options that [func@Pango2.cairo_update_context]
* derives from the target surface.
*/
void
-pango_cairo_context_set_font_options (PangoContext *context,
- const cairo_font_options_t *options)
+pango2_cairo_context_set_font_options (Pango2Context *context,
+ const cairo_font_options_t *options)
{
- g_return_if_fail (PANGO_IS_CONTEXT (context));
+ g_return_if_fail (PANGO2_IS_CONTEXT (context));
if (!context->set_options && !options)
return;
@@ -132,7 +132,7 @@ pango_cairo_context_set_font_options (PangoContext *context,
return;
if (context->set_options || options)
- pango_context_changed (context);
+ pango2_context_changed (context);
if (context->set_options)
cairo_font_options_destroy (context->set_options);
@@ -156,29 +156,29 @@ pango_cairo_context_set_font_options (PangoContext *context,
}
/**
- * pango_cairo_context_get_font_options:
- * @context: a `PangoContext`, from a pangocairo font map
+ * pango2_cairo_context_get_font_options:
+ * @context: a `Pango2Context`, from a pangocairo font map
*
* Retrieves any font rendering options previously set with
- * [func@Pango.cairo_context_set_font_options].
+ * [func@Pango2.cairo_context_set_font_options].
*
* This function does not report options that are derived from
- * the target surface by [func@Pango.cairo_update_context].
+ * the target surface by [func@Pango2.cairo_update_context].
*
* Return value: (nullable): the font options previously set on the
* context, or %NULL if no options have been set. This value is
* owned by the context and must not be modified or freed.
*/
const cairo_font_options_t *
-pango_cairo_context_get_font_options (PangoContext *context)
+pango2_cairo_context_get_font_options (Pango2Context *context)
{
- g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL);
return context->set_options;
}
const cairo_font_options_t *
-pango_cairo_context_get_merged_font_options (PangoContext *context)
+pango2_cairo_context_get_merged_font_options (Pango2Context *context)
{
if (!context->merged_options)
{
@@ -194,80 +194,80 @@ pango_cairo_context_get_merged_font_options (PangoContext *context)
}
/**
- * pango_cairo_create_context:
+ * pango2_cairo_create_context:
* @cr: a Cairo context
*
* Creates a context object set up to match the current transformation
* and target surface of the Cairo context.
*
* This context can then be
- * used to create a layout using [ctor@Pango.Layout.new].
+ * used to create a layout using [ctor@Pango2.Layout.new].
*
* This function is a convenience function that creates a context
* using the default font map, then updates it to @cr.
*
- * Return value: (transfer full): the newly created `PangoContext`
+ * Return value: (transfer full): the newly created `Pango2Context`
*/
-PangoContext *
-pango_cairo_create_context (cairo_t *cr)
+Pango2Context *
+pango2_cairo_create_context (cairo_t *cr)
{
- PangoContext *context;
+ Pango2Context *context;
g_return_val_if_fail (cr != NULL, NULL);
- context = pango_context_new ();
- pango_cairo_update_context (cr, context);
+ context = pango2_context_new ();
+ pango2_cairo_update_context (cr, context);
return context;
}
/**
- * pango_cairo_update_layout:
+ * pango2_cairo_update_layout:
* @cr: a Cairo context
- * @layout: a `PangoLayout`
+ * @layout: a `Pango2Layout`
*
- * Updates the private `PangoContext` of a `PangoLayout` to match
+ * Updates the private `Pango2Context` of a `Pango2Layout` to match
* the current transformation and target surface of a Cairo context.
*/
void
-pango_cairo_update_layout (cairo_t *cr,
- PangoLayout *layout)
+pango2_cairo_update_layout (cairo_t *cr,
+ Pango2Layout *layout)
{
g_return_if_fail (cr != NULL);
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
- pango_cairo_update_context (cr, pango_layout_get_context (layout));
+ pango2_cairo_update_context (cr, pango2_layout_get_context (layout));
}
/**
- * pango_cairo_create_layout:
+ * pango2_cairo_create_layout:
* @cr: a Cairo context
*
* Creates a layout object set up to match the current transformation
* and target surface of the Cairo context.
*
* This layout can then be used for text measurement with functions
- * like [method@Pango.Lines.get_size] or drawing with functions like
- * [func@Pango.cairo_show_layout]. If you change the transformation or target
- * surface for @cr, you need to call [func@Pango.cairo_update_layout].
+ * like [method@Pango2.Lines.get_size] or drawing with functions like
+ * [func@Pango2.cairo_show_layout]. If you change the transformation or target
+ * surface for @cr, you need to call [func@Pango2.cairo_update_layout].
*
- * This function is the most convenient way to use Cairo with Pango,
+ * This function is the most convenient way to use Cairo with Pango2,
* however it is slightly inefficient since it creates a separate
- * `PangoContext` object for each layout. This might matter in an
+ * `Pango2Context` object for each layout. This might matter in an
* application that was laying out large amounts of text.
*
- * Return value: (transfer full): the newly created `PangoLayout`
+ * Return value: (transfer full): the newly created `Pango2Layout`
*/
-PangoLayout *
-pango_cairo_create_layout (cairo_t *cr)
+Pango2Layout *
+pango2_cairo_create_layout (cairo_t *cr)
{
- PangoContext *context;
- PangoLayout *layout;
+ Pango2Context *context;
+ Pango2Layout *layout;
g_return_val_if_fail (cr != NULL, NULL);
- context = pango_cairo_create_context (cr);
- layout = pango_layout_new (context);
+ context = pango2_cairo_create_context (cr);
+ layout = pango2_layout_new (context);
g_object_unref (context);
return layout;
diff --git a/pango/pangocairo-context.h b/pango/pangocairo-context.h
index 9a2d8d7e..628de27e 100644
--- a/pango/pangocairo-context.h
+++ b/pango/pangocairo-context.h
@@ -24,21 +24,21 @@
G_BEGIN_DECLS
-PANGO_AVAILABLE_IN_ALL
-PangoContext * pango_cairo_create_context (cairo_t *cr);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_update_context (cairo_t *cr,
- PangoContext *context);
-PANGO_AVAILABLE_IN_ALL
-PangoLayout * pango_cairo_create_layout (cairo_t *cr);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_update_layout (cairo_t *cr,
- PangoLayout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_context_set_font_options (PangoContext *context,
- const cairo_font_options_t *options);
-PANGO_AVAILABLE_IN_ALL
+PANGO2_AVAILABLE_IN_ALL
+Pango2Context * pango2_cairo_create_context (cairo_t *cr);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_update_context (cairo_t *cr,
+ Pango2Context *context);
+PANGO2_AVAILABLE_IN_ALL
+Pango2Layout * pango2_cairo_create_layout (cairo_t *cr);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_update_layout (cairo_t *cr,
+ Pango2Layout *layout);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_context_set_font_options (Pango2Context *context,
+ const cairo_font_options_t *options);
+PANGO2_AVAILABLE_IN_ALL
const cairo_font_options_t *
- pango_cairo_context_get_font_options (PangoContext *context);
+ pango2_cairo_context_get_font_options (Pango2Context *context);
G_END_DECLS
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index d23d006a..3eda3d5a 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pangocairo-font.c: Cairo font handling
*
* Copyright (C) 2000-2005 Red Hat Software
@@ -49,31 +49,31 @@
#endif
-static PangoCairoFontPrivate * _pango_font_get_cairo_font_private (PangoFont *font);
-static cairo_scaled_font_t * _pango_font_get_scaled_font (PangoFont *font);
-static void _pango_cairo_font_private_initialize (PangoCairoFontPrivate *cf_priv,
- PangoFont *font,
- PangoGravity gravity,
- const cairo_font_options_t *font_options,
- const PangoMatrix *pango_ctm,
- const cairo_matrix_t *font_matrix);
-static void _pango_cairo_font_private_finalize (PangoCairoFontPrivate *cf_priv);
+static Pango2CairoFontPrivate * _pango2_font_get_cairo_font_private (Pango2Font *font);
+static cairo_scaled_font_t * _pango2_font_get_scaled_font (Pango2Font *font);
+static void _pango2_cairo_font_private_initialize (Pango2CairoFontPrivate *cf_priv,
+ Pango2Font *font,
+ Pango2Gravity gravity,
+ const cairo_font_options_t *font_options,
+ const Pango2Matrix *pango2_ctm,
+ const cairo_matrix_t *font_matrix);
+static void _pango2_cairo_font_private_finalize (Pango2CairoFontPrivate *cf_priv);
-static PangoCairoFontPrivateScaledFontData *
-_pango_cairo_font_private_scaled_font_data_create (void)
+static Pango2CairoFontPrivateScaledFontData *
+_pango2_cairo_font_private_scaled_font_data_create (void)
{
- return g_slice_new (PangoCairoFontPrivateScaledFontData);
+ return g_slice_new (Pango2CairoFontPrivateScaledFontData);
}
static void
-_pango_cairo_font_private_scaled_font_data_destroy (PangoCairoFontPrivateScaledFontData *data)
+_pango2_cairo_font_private_scaled_font_data_destroy (Pango2CairoFontPrivateScaledFontData *data)
{
if (data)
{
cairo_font_options_destroy (data->options);
- g_slice_free (PangoCairoFontPrivateScaledFontData, data);
+ g_slice_free (Pango2CairoFontPrivateScaledFontData, data);
}
}
@@ -86,8 +86,8 @@ render_func (cairo_scaled_font_t *scaled_font,
cairo_text_extents_t *extents)
{
cairo_font_face_t *font_face;
- PangoFont *font;
- PangoUserFace *face;
+ Pango2Font *font;
+ Pango2UserFace *face;
hb_glyph_extents_t glyph_extents;
hb_position_t h_advance;
hb_position_t v_advance;
@@ -95,7 +95,7 @@ render_func (cairo_scaled_font_t *scaled_font,
font_face = cairo_scaled_font_get_font_face (scaled_font);
font = cairo_font_face_get_user_data (font_face, &cairo_user_data);
- face = PANGO_USER_FACE (font->face);
+ face = PANGO2_USER_FACE (font->face);
extents->x_bearing = 0;
extents->y_bearing = 0;
@@ -139,16 +139,16 @@ init_func (cairo_scaled_font_t *scaled_font,
cairo_font_extents_t *extents)
{
cairo_font_face_t *cairo_face;
- PangoFont *font;
- PangoUserFace *face;
+ Pango2Font *font;
+ Pango2UserFace *face;
hb_font_extents_t font_extents;
cairo_face = cairo_scaled_font_get_font_face (scaled_font);
font = cairo_font_face_get_user_data (cairo_face, &cairo_user_data);
- face = (PangoUserFace *) pango_font_get_face (font);
+ face = (Pango2UserFace *) pango2_font_get_face (font);
face->font_info_func (face,
- pango_font_get_size (font),
+ pango2_font_get_size (font),
&font_extents,
face->user_data);
@@ -159,7 +159,7 @@ init_func (cairo_scaled_font_t *scaled_font,
}
static cairo_font_face_t *
-create_cairo_font_face_for_user_font (PangoFont *font)
+create_cairo_font_face_for_user_font (Pango2Font *font)
{
cairo_font_face_t *cairo_face;
@@ -174,14 +174,14 @@ create_cairo_font_face_for_user_font (PangoFont *font)
#if defined (HAVE_CORE_TEXT)
static cairo_font_face_t *
-create_cairo_font_face_for_hb_font (PangoFont *font)
+create_cairo_font_face_for_hb_font (Pango2Font *font)
{
hb_font_t *hbfont;
CTFontRef ctfont;
CGFontRef cgfont;
cairo_font_face_t *cairo_face;
- hbfont = pango_font_get_hb_font (font);
+ hbfont = pango2_font_get_hb_font (font);
ctfont = hb_coretext_font_get_ct_font (hbfont);
cgfont = CTFontCopyGraphicsFont (ctfont, NULL);
@@ -195,19 +195,19 @@ create_cairo_font_face_for_hb_font (PangoFont *font)
#elif defined (HAVE_DIRECT_WRITE)
static cairo_font_face_t *
-create_cairo_font_face_for_hb_font (PangoFont *font)
+create_cairo_font_face_for_hb_font (Pango2Font *font)
{
- return pango_cairo_create_font_face_for_dwrite_pango_font (font);
+ return pango2_cairo_create_font_face_for_dwrite_pango2_font (font);
}
#else
static cairo_font_face_t *
-create_cairo_font_face_for_hb_font (PangoFont *font)
+create_cairo_font_face_for_hb_font (Pango2Font *font)
{
static FT_Library ft_library;
- PangoHbFace *face = PANGO_HB_FACE (font->face);
+ Pango2HbFace *face = PANGO2_HB_FACE (font->face);
hb_blob_t *blob;
const char *blob_data;
unsigned int blob_length;
@@ -227,7 +227,7 @@ create_cairo_font_face_for_hb_font (PangoFont *font)
g_once_init_leave (&ft_library, library);
}
- hb_font = pango_font_get_hb_font (font);
+ hb_font = pango2_font_get_hb_font (font);
blob = hb_face_reference_blob (hb_font_get_face (hb_font));
blob_data = hb_blob_get_data (blob, &blob_length);
@@ -269,7 +269,7 @@ create_cairo_font_face_for_hb_font (PangoFont *font)
#endif
static cairo_scaled_font_t *
-_pango_cairo_font_private_get_scaled_font (PangoCairoFontPrivate *cf_priv)
+_pango2_cairo_font_private_get_scaled_font (Pango2CairoFontPrivate *cf_priv)
{
cairo_font_face_t *font_face;
@@ -284,9 +284,9 @@ _pango_cairo_font_private_get_scaled_font (PangoCairoFontPrivate *cf_priv)
return NULL;
}
- if (PANGO_IS_HB_FONT (cf_priv->cfont))
+ if (PANGO2_IS_HB_FONT (cf_priv->cfont))
font_face = create_cairo_font_face_for_hb_font (cf_priv->cfont);
- else if (PANGO_IS_USER_FONT (cf_priv->cfont))
+ else if (PANGO2_IS_USER_FONT (cf_priv->cfont))
font_face = create_cairo_font_face_for_user_font (cf_priv->cfont);
if (G_UNLIKELY (font_face == NULL))
@@ -304,19 +304,19 @@ done:
if (G_UNLIKELY (cf_priv->scaled_font == NULL || cairo_scaled_font_status (cf_priv->scaled_font) != CAIRO_STATUS_SUCCESS))
{
cairo_scaled_font_t *scaled_font = cf_priv->scaled_font;
- PangoFont *font = cf_priv->cfont;
+ Pango2Font *font = cf_priv->cfont;
static GQuark warned_quark = 0; /* MT-safe */
if (!warned_quark)
warned_quark = g_quark_from_static_string ("pangocairo-scaledfont-warned");
if (!g_object_get_qdata (G_OBJECT (font), warned_quark))
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
char *s;
- desc = pango_font_describe (font);
- s = pango_font_description_to_string (desc);
- pango_font_description_free (desc);
+ desc = pango2_font_describe (font);
+ s = pango2_font_description_to_string (desc);
+ pango2_font_description_free (desc);
g_warning ("failed to create cairo %s, expect ugly output. the offending font is '%s'",
font_face ? "scaled font" : "font face",
@@ -341,28 +341,28 @@ done:
}
}
- _pango_cairo_font_private_scaled_font_data_destroy (cf_priv->data);
+ _pango2_cairo_font_private_scaled_font_data_destroy (cf_priv->data);
cf_priv->data = NULL;
return cf_priv->scaled_font;
}
cairo_scaled_font_t *
-_pango_font_get_scaled_font (PangoFont *font)
+_pango2_font_get_scaled_font (Pango2Font *font)
{
- PangoCairoFontPrivate *cf_priv;
+ Pango2CairoFontPrivate *cf_priv;
- cf_priv = _pango_font_get_cairo_font_private (font);
+ cf_priv = _pango2_font_get_cairo_font_private (font);
if (G_UNLIKELY (!cf_priv))
return NULL;
- return _pango_cairo_font_private_get_scaled_font (cf_priv);
+ return _pango2_cairo_font_private_get_scaled_font (cf_priv);
}
/**
- * _pango_cairo_font_install:
- * @font: a `PangoCairoFont`
+ * _pango2_cairo_font_install:
+ * @font: a `Pango2CairoFont`
* @cr: a #cairo_t
*
* Makes @font the current font for rendering in the specified
@@ -371,12 +371,12 @@ _pango_font_get_scaled_font (PangoFont *font)
* Return value: %TRUE if font was installed successfully, %FALSE otherwise.
*/
gboolean
-_pango_cairo_font_install (PangoFont *font,
- cairo_t *cr)
+_pango2_cairo_font_install (Pango2Font *font,
+ cairo_t *cr)
{
cairo_scaled_font_t *scaled_font;
- scaled_font = _pango_font_get_scaled_font (font);
+ scaled_font = _pango2_font_get_scaled_font (font);
if (G_UNLIKELY (scaled_font == NULL || cairo_scaled_font_status (scaled_font) != CAIRO_STATUS_SUCCESS))
return FALSE;
@@ -386,13 +386,13 @@ _pango_cairo_font_install (PangoFont *font,
return TRUE;
}
-static PangoCairoFontHexBoxInfo *
-_pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
+static Pango2CairoFontHexBoxInfo *
+_pango2_cairo_font_private_get_hex_box_info (Pango2CairoFontPrivate *cf_priv)
{
const char hexdigits[] = "0123456789ABCDEF";
char c[2] = {0, 0};
- PangoFont *mini_font;
- PangoCairoFontHexBoxInfo *hbi;
+ Pango2Font *mini_font;
+ Pango2CairoFontHexBoxInfo *hbi;
/* for metrics hinting */
double scale_x = 1., scale_x_inv = 1., scale_y = 1., scale_y_inv = 1.;
@@ -406,11 +406,11 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
cairo_font_options_t *font_options;
cairo_font_extents_t font_extents;
double size, mini_size;
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
cairo_scaled_font_t *scaled_font, *scaled_mini_font;
- PangoMatrix pango_ctm, pango_font_matrix;
+ Pango2Matrix pango2_ctm, pango2_font_matrix;
cairo_matrix_t cairo_ctm, cairo_font_matrix;
- /*PangoGravity gravity;*/
+ /*Pango2Gravity gravity;*/
if (!cf_priv)
return NULL;
@@ -418,15 +418,15 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
if (cf_priv->hbi)
return cf_priv->hbi;
- scaled_font = _pango_cairo_font_private_get_scaled_font (cf_priv);
+ scaled_font = _pango2_cairo_font_private_get_scaled_font (cf_priv);
if (G_UNLIKELY (scaled_font == NULL || cairo_scaled_font_status (scaled_font) != CAIRO_STATUS_SUCCESS))
return NULL;
is_hinted = cf_priv->is_hinted;
font_options = cairo_font_options_create ();
- desc = pango_font_describe_with_absolute_size (cf_priv->cfont);
- /*gravity = pango_font_description_get_gravity (desc);*/
+ desc = pango2_font_describe_with_absolute_size (cf_priv->cfont);
+ /*gravity = pango2_font_description_get_gravity (desc);*/
cairo_scaled_font_get_ctm (scaled_font, &cairo_ctm);
cairo_scaled_font_get_font_matrix (scaled_font, &cairo_font_matrix);
@@ -435,22 +435,22 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
* work. Easier to do with cairo user fonts and vertical writing mode
* support in cairo.
*/
- /*cairo_matrix_rotate (&cairo_ctm, pango_gravity_to_rotation (gravity));*/
- pango_ctm.xx = cairo_ctm.xx;
- pango_ctm.yx = cairo_ctm.yx;
- pango_ctm.xy = cairo_ctm.xy;
- pango_ctm.yy = cairo_ctm.yy;
- pango_ctm.x0 = cairo_ctm.x0;
- pango_ctm.y0 = cairo_ctm.y0;
- pango_font_matrix.xx = cairo_font_matrix.xx;
- pango_font_matrix.yx = cairo_font_matrix.yx;
- pango_font_matrix.xy = cairo_font_matrix.xy;
- pango_font_matrix.yy = cairo_font_matrix.yy;
- pango_font_matrix.x0 = cairo_font_matrix.x0;
- pango_font_matrix.y0 = cairo_font_matrix.y0;
-
- size = pango_matrix_get_font_scale_factor (&pango_font_matrix) /
- pango_matrix_get_font_scale_factor (&pango_ctm);
+ /*cairo_matrix_rotate (&cairo_ctm, pango2_gravity_to_rotation (gravity));*/
+ pango2_ctm.xx = cairo_ctm.xx;
+ pango2_ctm.yx = cairo_ctm.yx;
+ pango2_ctm.xy = cairo_ctm.xy;
+ pango2_ctm.yy = cairo_ctm.yy;
+ pango2_ctm.x0 = cairo_ctm.x0;
+ pango2_ctm.y0 = cairo_ctm.y0;
+ pango2_font_matrix.xx = cairo_font_matrix.xx;
+ pango2_font_matrix.yx = cairo_font_matrix.yx;
+ pango2_font_matrix.xy = cairo_font_matrix.xy;
+ pango2_font_matrix.yy = cairo_font_matrix.yy;
+ pango2_font_matrix.x0 = cairo_font_matrix.x0;
+ pango2_font_matrix.y0 = cairo_font_matrix.y0;
+
+ size = pango2_matrix_get_font_scale_factor (&pango2_font_matrix) /
+ pango2_matrix_get_font_scale_factor (&pango2_ctm);
if (is_hinted)
{
@@ -475,17 +475,17 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
/* create mini_font description */
{
- PangoFontFace *face;
- PangoFontFamily *family;
- PangoFontMap *fontmap;
- PangoContext *context;
+ Pango2FontFace *face;
+ Pango2FontFamily *family;
+ Pango2FontMap *fontmap;
+ Pango2Context *context;
/* XXX this is racy. need a ref'ing getter... */
- face = pango_font_get_face (cf_priv->cfont);
- family = pango_font_face_get_family (face);
+ face = pango2_font_get_face (cf_priv->cfont);
+ family = pango2_font_face_get_family (face);
if (!family)
return NULL;
- fontmap = pango_font_family_get_font_map (family);
+ fontmap = pango2_font_family_get_font_map (family);
if (!fontmap)
return NULL;
fontmap = g_object_ref (fontmap);
@@ -496,9 +496,9 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
*/
/* We should rotate the box, not glyphs */
- pango_font_description_unset_fields (desc, PANGO_FONT_MASK_GRAVITY);
+ pango2_font_description_unset_fields (desc, PANGO2_FONT_MASK_GRAVITY);
- pango_font_description_set_family_static (desc, "monospace");
+ pango2_font_description_set_family_static (desc, "monospace");
rows = 2;
mini_size = size / 2.2;
@@ -513,25 +513,25 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
}
}
- pango_font_description_set_absolute_size (desc, pango_units_from_double (mini_size));
+ pango2_font_description_set_absolute_size (desc, pango2_units_from_double (mini_size));
/* load mini_font */
- context = pango_context_new_with_font_map (fontmap);
+ context = pango2_context_new_with_font_map (fontmap);
- pango_context_set_matrix (context, &pango_ctm);
- pango_context_set_language (context, pango_script_get_sample_language (G_UNICODE_SCRIPT_LATIN));
- pango_cairo_context_set_font_options (context, font_options);
- mini_font = pango_font_map_load_font (fontmap, context, desc);
+ pango2_context_set_matrix (context, &pango2_ctm);
+ pango2_context_set_language (context, pango2_script_get_sample_language (G_UNICODE_SCRIPT_LATIN));
+ pango2_cairo_context_set_font_options (context, font_options);
+ mini_font = pango2_font_map_load_font (fontmap, context, desc);
g_object_unref (context);
g_object_unref (fontmap);
}
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
cairo_font_options_destroy (font_options);
- scaled_mini_font = _pango_font_get_scaled_font (mini_font);
+ scaled_mini_font = _pango2_font_get_scaled_font (mini_font);
if (G_UNLIKELY (scaled_mini_font == NULL || cairo_scaled_font_status (scaled_mini_font) != CAIRO_STATUS_SUCCESS))
return NULL;
@@ -548,14 +548,14 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
cairo_scaled_font_extents (scaled_font, &font_extents);
if (font_extents.ascent + font_extents.descent <= 0)
{
- font_extents.ascent = PANGO_UNKNOWN_GLYPH_HEIGHT;
+ font_extents.ascent = PANGO2_UNKNOWN_GLYPH_HEIGHT;
font_extents.descent = 0;
}
pad = (font_extents.ascent + font_extents.descent) / 43;
pad = MIN (pad, mini_size);
- hbi = g_slice_new (PangoCairoFontHexBoxInfo);
+ hbi = g_slice_new (Pango2CairoFontHexBoxInfo);
hbi->font = mini_font;
hbi->rows = rows;
@@ -600,27 +600,27 @@ _pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
}
static void
-_pango_cairo_font_hex_box_info_destroy (PangoCairoFontHexBoxInfo *hbi)
+_pango2_cairo_font_hex_box_info_destroy (Pango2CairoFontHexBoxInfo *hbi)
{
if (hbi)
{
g_object_unref (hbi->font);
- g_slice_free (PangoCairoFontHexBoxInfo, hbi);
+ g_slice_free (Pango2CairoFontHexBoxInfo, hbi);
}
}
static void
free_cairo_font_private (gpointer data)
{
- PangoCairoFontPrivate *cf_priv = data;
- _pango_cairo_font_private_finalize (cf_priv);
+ Pango2CairoFontPrivate *cf_priv = data;
+ _pango2_cairo_font_private_finalize (cf_priv);
g_free (data);
}
-static PangoCairoFontPrivate *
-_pango_font_get_cairo_font_private (PangoFont *font)
+static Pango2CairoFontPrivate *
+_pango2_font_get_cairo_font_private (Pango2Font *font)
{
- PangoCairoFontPrivate *cf_priv;
+ Pango2CairoFontPrivate *cf_priv;
cf_priv = g_object_get_data (G_OBJECT (font), "pango-font-cairo_private");
if (!cf_priv)
@@ -633,9 +633,9 @@ _pango_font_get_cairo_font_private (PangoFont *font)
cairo_matrix_init (&font_matrix, 1., 0., 0., 1., 0., 0.);
x_scale = y_scale = 1;
- if (PANGO_IS_HB_FONT (font))
+ if (PANGO2_IS_HB_FONT (font))
{
- PangoHbFace *face = PANGO_HB_FACE (font->face);
+ Pango2HbFace *face = PANGO2_HB_FACE (font->face);
if (face->transform)
cairo_matrix_init (&font_matrix,
face->transform->xx,
@@ -651,10 +651,10 @@ _pango_font_get_cairo_font_private (PangoFont *font)
size = font->size * font->dpi / 72.;
cairo_matrix_scale (&font_matrix,
- x_scale * size / (double)PANGO_SCALE,
- y_scale * size / (double)PANGO_SCALE);
+ x_scale * size / (double)PANGO2_SCALE,
+ y_scale * size / (double)PANGO2_SCALE);
- font_options = (cairo_font_options_t *)pango_cairo_font_get_font_options (font);
+ font_options = (cairo_font_options_t *)pango2_cairo_font_get_font_options (font);
if (font_options)
font_options = cairo_font_options_copy (font_options);
else
@@ -664,8 +664,8 @@ _pango_font_get_cairo_font_private (PangoFont *font)
cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);
}
- cf_priv = g_new0 (PangoCairoFontPrivate, 1);
- _pango_cairo_font_private_initialize (cf_priv,
+ cf_priv = g_new0 (Pango2CairoFontPrivate, 1);
+ _pango2_cairo_font_private_initialize (cf_priv,
font,
font->gravity,
font_options,
@@ -681,28 +681,28 @@ _pango_font_get_cairo_font_private (PangoFont *font)
return cf_priv;
}
-PangoCairoFontHexBoxInfo *
-_pango_cairo_font_get_hex_box_info (PangoFont *font)
+Pango2CairoFontHexBoxInfo *
+_pango2_cairo_font_get_hex_box_info (Pango2Font *font)
{
- PangoCairoFontPrivate *cf_priv = _pango_font_get_cairo_font_private (font);
+ Pango2CairoFontPrivate *cf_priv = _pango2_font_get_cairo_font_private (font);
- return _pango_cairo_font_private_get_hex_box_info (cf_priv);
+ return _pango2_cairo_font_private_get_hex_box_info (cf_priv);
}
void
-_pango_cairo_font_private_initialize (PangoCairoFontPrivate *cf_priv,
- PangoFont *cfont,
- PangoGravity gravity,
- const cairo_font_options_t *font_options,
- const PangoMatrix *pango_ctm,
- const cairo_matrix_t *font_matrix)
+_pango2_cairo_font_private_initialize (Pango2CairoFontPrivate *cf_priv,
+ Pango2Font *cfont,
+ Pango2Gravity gravity,
+ const cairo_font_options_t *font_options,
+ const Pango2Matrix *pango2_ctm,
+ const cairo_matrix_t *font_matrix)
{
cairo_matrix_t gravity_matrix;
cf_priv->cfont = cfont;
- cf_priv->gravity = gravity != PANGO_GRAVITY_AUTO ? gravity : PANGO_GRAVITY_SOUTH;
+ cf_priv->gravity = gravity != PANGO2_GRAVITY_AUTO ? gravity : PANGO2_GRAVITY_SOUTH;
- cf_priv->data = _pango_cairo_font_private_scaled_font_data_create ();
+ cf_priv->data = _pango2_cairo_font_private_scaled_font_data_create ();
/* first apply gravity rotation, then font_matrix, such that
* vertical italic text comes out "correct". we don't do anything
@@ -710,17 +710,17 @@ _pango_cairo_font_private_initialize (PangoCairoFontPrivate *cf_priv,
* handled when we support italic correction.
*/
cairo_matrix_init_rotate (&gravity_matrix,
- pango_gravity_to_rotation (cf_priv->gravity));
+ pango2_gravity_to_rotation (cf_priv->gravity));
cairo_matrix_multiply (&cf_priv->data->font_matrix,
font_matrix,
&gravity_matrix);
- if (pango_ctm)
+ if (pango2_ctm)
cairo_matrix_init (&cf_priv->data->ctm,
- pango_ctm->xx,
- pango_ctm->yx,
- pango_ctm->xy,
- pango_ctm->yy,
+ pango2_ctm->xx,
+ pango2_ctm->yx,
+ pango2_ctm->xy,
+ pango2_ctm->yy,
0., 0.);
else
cairo_matrix_init_identity (&cf_priv->data->ctm);
@@ -733,34 +733,34 @@ _pango_cairo_font_private_initialize (PangoCairoFontPrivate *cf_priv,
}
void
-_pango_cairo_font_private_finalize (PangoCairoFontPrivate *cf_priv)
+_pango2_cairo_font_private_finalize (Pango2CairoFontPrivate *cf_priv)
{
- _pango_cairo_font_private_scaled_font_data_destroy (cf_priv->data);
+ _pango2_cairo_font_private_scaled_font_data_destroy (cf_priv->data);
if (cf_priv->scaled_font)
cairo_scaled_font_destroy (cf_priv->scaled_font);
cf_priv->scaled_font = NULL;
- _pango_cairo_font_hex_box_info_destroy (cf_priv->hbi);
+ _pango2_cairo_font_hex_box_info_destroy (cf_priv->hbi);
cf_priv->hbi = NULL;
}
/**
- * pango_cairo_font_set_font_options:
- * @font: a `PangoFont`
+ * pango2_cairo_font_set_font_options:
+ * @font: a `Pango2Font`
* @options: (nullable): a `cairo_font_options_t`, or %NULL to unset
* any previously set options. A copy is made.
*
* Sets the font options used when rendering text with this font.
*
* This is rarely needed. Fonts usually get font options from the
- * `PangoContext` in which they are loaded.
+ * `Pango2Context` in which they are loaded.
*/
void
-pango_cairo_font_set_font_options (PangoFont *font,
- const cairo_font_options_t *options)
+pango2_cairo_font_set_font_options (Pango2Font *font,
+ const cairo_font_options_t *options)
{
- g_return_if_fail (PANGO_IS_FONT (font));
+ g_return_if_fail (PANGO2_IS_FONT (font));
if (!font->options && !options)
return;
@@ -779,8 +779,8 @@ pango_cairo_font_set_font_options (PangoFont *font,
}
/**
- * pango_cairo_font_get_font_options:
- * @font: a `PangoFont`
+ * pango2_cairo_font_get_font_options:
+ * @font: a `Pango2Font`
*
* Gets font options for the font.
*
@@ -788,9 +788,9 @@ pango_cairo_font_set_font_options (PangoFont *font,
* applied when rendering text with this font
*/
const cairo_font_options_t *
-pango_cairo_font_get_font_options (PangoFont *font)
+pango2_cairo_font_get_font_options (Pango2Font *font)
{
- g_return_val_if_fail (PANGO_IS_FONT (font), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT (font), NULL);
return font->options;
}
diff --git a/pango/pangocairo-font.h b/pango/pangocairo-font.h
index a8a7a1e9..f6c59bdc 100644
--- a/pango/pangocairo-font.h
+++ b/pango/pangocairo-font.h
@@ -24,11 +24,11 @@
G_BEGIN_DECLS
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_font_set_font_options (PangoFont *font,
- const cairo_font_options_t *options);
-PANGO_AVAILABLE_IN_ALL
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_font_set_font_options (Pango2Font *font,
+ const cairo_font_options_t *options);
+PANGO2_AVAILABLE_IN_ALL
const cairo_font_options_t *
- pango_cairo_font_get_font_options (PangoFont *font);
+ pango2_cairo_font_get_font_options (Pango2Font *font);
G_END_DECLS
diff --git a/pango/pangocairo-private.h b/pango/pangocairo-private.h
index bf518580..b9398109 100644
--- a/pango/pangocairo-private.h
+++ b/pango/pangocairo-private.h
@@ -24,51 +24,51 @@
G_BEGIN_DECLS
-typedef struct _PangoCairoFontPrivate PangoCairoFontPrivate;
-typedef struct _HexBoxInfo PangoCairoFontHexBoxInfo;
-typedef struct _PangoCairoFontPrivateScaledFontData PangoCairoFontPrivateScaledFontData;
+typedef struct _Pango2CairoFontPrivate Pango2CairoFontPrivate;
+typedef struct _HexBoxInfo Pango2CairoFontHexBoxInfo;
+typedef struct _Pango2CairoFontPrivateScaledFontData Pango2CairoFontPrivateScaledFontData;
-struct _PangoCairoFontPrivateScaledFontData
+struct _Pango2CairoFontPrivateScaledFontData
{
cairo_matrix_t font_matrix;
cairo_matrix_t ctm;
cairo_font_options_t *options;
};
-struct _PangoCairoFontPrivate
+struct _Pango2CairoFontPrivate
{
- PangoFont *cfont;
+ Pango2Font *cfont;
- PangoCairoFontPrivateScaledFontData *data;
+ Pango2CairoFontPrivateScaledFontData *data;
cairo_scaled_font_t *scaled_font;
- PangoCairoFontHexBoxInfo *hbi;
+ Pango2CairoFontHexBoxInfo *hbi;
gboolean is_hinted;
- PangoGravity gravity;
+ Pango2Gravity gravity;
- PangoRectangle font_extents;
+ Pango2Rectangle font_extents;
};
-gboolean _pango_cairo_font_install (PangoFont *font,
- cairo_t *cr);
-PangoCairoFontHexBoxInfo *_pango_cairo_font_get_hex_box_info (PangoFont *font);
+gboolean _pango2_cairo_font_install (Pango2Font *font,
+ cairo_t *cr);
+Pango2CairoFontHexBoxInfo *_pango2_cairo_font_get_hex_box_info (Pango2Font *font);
-#define PANGO_TYPE_CAIRO_RENDERER (pango_cairo_renderer_get_type())
-#define PANGO_CAIRO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_CAIRO_RENDERER, PangoCairoRenderer))
-#define PANGO_IS_CAIRO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_CAIRO_RENDERER))
+#define PANGO2_TYPE_CAIRO_RENDERER (pango2_cairo_renderer_get_type())
+#define PANGO2_CAIRO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO2_TYPE_CAIRO_RENDERER, Pango2CairoRenderer))
+#define PANGO2_IS_CAIRO_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO2_TYPE_CAIRO_RENDERER))
-typedef struct _PangoCairoRenderer PangoCairoRenderer;
+typedef struct _Pango2CairoRenderer Pango2CairoRenderer;
-_PANGO_EXTERN
-GType pango_cairo_renderer_get_type (void) G_GNUC_CONST;
+_PANGO2_EXTERN
+GType pango2_cairo_renderer_get_type (void) G_GNUC_CONST;
const cairo_font_options_t *
- pango_cairo_context_get_merged_font_options (PangoContext *context);
+ pango2_cairo_context_get_merged_font_options (Pango2Context *context);
#ifdef HAVE_DIRECT_WRITE
cairo_font_face_t *
-pango_cairo_create_font_face_for_dwrite_pango_font (PangoFont *font);
+pango2_cairo_create_font_face_for_dwrite_pango2_font (Pango2Font *font);
#endif
G_END_DECLS
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 533cf638..b5189bee 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pangocairo-render.c: Rendering routines to Cairo surfaces
*
* Copyright (C) 2004 Red Hat, Inc.
@@ -32,15 +32,15 @@
#include "pango-impl-utils.h"
#include "pango-hbfont-private.h"
-typedef struct _PangoCairoRendererClass PangoCairoRendererClass;
+typedef struct _Pango2CairoRendererClass Pango2CairoRendererClass;
-#define PANGO_CAIRO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_CAIRO_RENDERER, PangoCairoRendererClass))
-#define PANGO_IS_CAIRO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_CAIRO_RENDERER))
-#define PANGO_CAIRO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_CAIRO_RENDERER, PangoCairoRendererClass))
+#define PANGO2_CAIRO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO2_TYPE_CAIRO_RENDERER, Pango2CairoRendererClass))
+#define PANGO2_IS_CAIRO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO2_TYPE_CAIRO_RENDERER))
+#define PANGO2_CAIRO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO2_TYPE_CAIRO_RENDERER, Pango2CairoRendererClass))
-struct _PangoCairoRenderer
+struct _Pango2CairoRenderer
{
- PangoRenderer parent_instance;
+ Pango2Renderer parent_instance;
cairo_t *cr;
gboolean do_path;
@@ -52,18 +52,18 @@ struct _PangoCairoRenderer
gboolean cr_had_current_point;
};
-struct _PangoCairoRendererClass
+struct _Pango2CairoRendererClass
{
- PangoRendererClass parent_class;
+ Pango2RendererClass parent_class;
};
-G_DEFINE_TYPE (PangoCairoRenderer, pango_cairo_renderer, PANGO_TYPE_RENDERER)
+G_DEFINE_TYPE (Pango2CairoRenderer, pango2_cairo_renderer, PANGO2_TYPE_RENDERER)
static void
-set_color (PangoCairoRenderer *crenderer,
- PangoRenderPart part)
+set_color (Pango2CairoRenderer *crenderer,
+ Pango2RenderPart part)
{
- PangoColor *color = pango_renderer_get_color ((PangoRenderer *) (crenderer), part);
+ Pango2Color *color = pango2_renderer_get_color ((Pango2Renderer *) (crenderer), part);
double red, green, blue, alpha;
if (!color)
@@ -96,13 +96,13 @@ set_color (PangoCairoRenderer *crenderer,
/* note: modifies crenderer->cr without doing cairo_save/restore() */
static void
-_pango_cairo_renderer_draw_frame (PangoCairoRenderer *crenderer,
- double x,
- double y,
- double width,
- double height,
- double line_width,
- gboolean invalid)
+_pango2_cairo_renderer_draw_frame (Pango2CairoRenderer *crenderer,
+ double x,
+ double y,
+ double width,
+ double height,
+ double line_width,
+ gboolean invalid)
{
cairo_t *cr = crenderer->cr;
@@ -206,31 +206,31 @@ _pango_cairo_renderer_draw_frame (PangoCairoRenderer *crenderer,
}
static void
-_pango_cairo_renderer_draw_box_glyph (PangoCairoRenderer *crenderer,
- PangoGlyphInfo *gi,
- double cx,
- double cy,
- gboolean invalid)
+_pango2_cairo_renderer_draw_box_glyph (Pango2CairoRenderer *crenderer,
+ Pango2GlyphInfo *gi,
+ double cx,
+ double cy,
+ gboolean invalid)
{
cairo_save (crenderer->cr);
- _pango_cairo_renderer_draw_frame (crenderer,
- cx + 1.5,
- cy + 1.5 - PANGO_UNKNOWN_GLYPH_HEIGHT,
- (double)gi->geometry.width / PANGO_SCALE - 3.0,
- PANGO_UNKNOWN_GLYPH_HEIGHT - 3.0,
- 1.0,
- invalid);
+ _pango2_cairo_renderer_draw_frame (crenderer,
+ cx + 1.5,
+ cy + 1.5 - PANGO2_UNKNOWN_GLYPH_HEIGHT,
+ (double)gi->geometry.width / PANGO2_SCALE - 3.0,
+ PANGO2_UNKNOWN_GLYPH_HEIGHT - 3.0,
+ 1.0,
+ invalid);
cairo_restore (crenderer->cr);
}
static void
-_pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
- PangoFont *font,
- PangoGlyphInfo *gi,
- double cx,
- double cy)
+_pango2_cairo_renderer_draw_unknown_glyph (Pango2CairoRenderer *crenderer,
+ Pango2Font *font,
+ Pango2GlyphInfo *gi,
+ double cx,
+ double cy)
{
char buf[7];
double x0, y0;
@@ -238,7 +238,7 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
int rows, cols;
double width, lsb;
char hexbox_string[2] = { 0, 0 };
- PangoCairoFontHexBoxInfo *hbi;
+ Pango2CairoFontHexBoxInfo *hbi;
gunichar ch;
gboolean invalid_input;
const char *p;
@@ -246,16 +246,16 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
cairo_save (crenderer->cr);
- ch = gi->glyph & ~PANGO_GLYPH_UNKNOWN_FLAG;
- invalid_input = G_UNLIKELY (gi->glyph == PANGO_GLYPH_INVALID_INPUT || ch > 0x10FFFF);
+ ch = gi->glyph & ~PANGO2_GLYPH_UNKNOWN_FLAG;
+ invalid_input = G_UNLIKELY (gi->glyph == PANGO2_GLYPH_INVALID_INPUT || ch > 0x10FFFF);
- if (PANGO_IS_HB_FONT (font))
- hbi = PANGO_HB_FONT (font)->hex_box_info;
+ if (PANGO2_IS_HB_FONT (font))
+ hbi = PANGO2_HB_FONT (font)->hex_box_info;
else
- hbi = _pango_cairo_font_get_hex_box_info (font);
- if (!hbi || !_pango_cairo_font_install ((PangoFont *)(hbi->font), crenderer->cr))
+ hbi = _pango2_cairo_font_get_hex_box_info (font);
+ if (!hbi || !_pango2_cairo_font_install ((Pango2Font *)(hbi->font), crenderer->cr))
{
- _pango_cairo_renderer_draw_box_glyph (crenderer, gi, cx, cy, invalid_input);
+ _pango2_cairo_renderer_draw_box_glyph (crenderer, gi, cx, cy, invalid_input);
goto done;
}
@@ -274,7 +274,7 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
* Since we don't want to rely on glyph availability,
* we render a centered dot ourselves.
*/
- double x = cx + 0.5 *((double)gi->geometry.width / PANGO_SCALE);
+ double x = cx + 0.5 *((double)gi->geometry.width / PANGO2_SCALE);
double y = cy + hbi->box_descent - 0.5 * hbi->box_height;
cairo_new_sub_path (crenderer->cr);
@@ -289,7 +289,7 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
* we render an arrow like ↦ ourselves.
*/
double y = cy + hbi->box_descent - 0.5 * hbi->box_height;
- double width = (double)gi->geometry.width / PANGO_SCALE;
+ double width = (double)gi->geometry.width / PANGO2_SCALE;
double offset = 0.2 * width;
double x = cx + offset;
double al = width - 2 * offset; /* arrow length */
@@ -317,7 +317,7 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
/* Since we don't want to rely on glyph availability,
* we render an arrow like ↵ ourselves.
*/
- double width = (double)gi->geometry.width / PANGO_SCALE;
+ double width = (double)gi->geometry.width / PANGO2_SCALE;
double offset = 0.2 * width;
double al = width - 2 * offset; /* arrow length */
double tl = MIN (hbi->digit_width, 0.75 * al); /* tip length */
@@ -340,7 +340,7 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
cairo_fill (crenderer->cr);
goto done;
}
- else if ((name = pango_get_ignorable_size (ch, &rows, &cols)))
+ else if ((name = pango2_get_ignorable_size (ch, &rows, &cols)))
{
/* Nothing else to do, we render 'default ignorable' chars
* as hex box with their nick.
@@ -356,16 +356,16 @@ _pango_cairo_renderer_draw_unknown_glyph (PangoCairoRenderer *crenderer,
}
width = (3 * hbi->pad_x + cols * (hbi->digit_width + hbi->pad_x));
- lsb = ((double)gi->geometry.width / PANGO_SCALE - width) * .5;
+ lsb = ((double)gi->geometry.width / PANGO2_SCALE - width) * .5;
lsb = floor (lsb / hbi->pad_x) * hbi->pad_x;
- _pango_cairo_renderer_draw_frame (crenderer,
- cx + lsb + .5 * hbi->pad_x,
- cy + hbi->box_descent - hbi->box_height + hbi->pad_y * 0.5,
- width - hbi->pad_x,
- (hbi->box_height - hbi->pad_y),
- hbi->line_width,
- invalid_input);
+ _pango2_cairo_renderer_draw_frame (crenderer,
+ cx + lsb + .5 * hbi->pad_x,
+ cy + hbi->box_descent - hbi->box_height + hbi->pad_y * 0.5,
+ width - hbi->pad_x,
+ (hbi->box_height - hbi->pad_y),
+ hbi->line_width,
+ invalid_input);
if (invalid_input)
goto done;
@@ -405,44 +405,44 @@ done:
#define STACK_ARRAY_LENGTH(T) (STACK_BUFFER_SIZE / sizeof(T))
static void
-pango_cairo_renderer_show_text_glyphs (PangoRenderer *renderer,
- const char *text,
- int text_len,
- PangoGlyphString *glyphs,
- cairo_text_cluster_t *clusters,
- int num_clusters,
- gboolean backward,
- PangoFont *font,
- int x,
- int y)
+pango2_cairo_renderer_show_text_glyphs (Pango2Renderer *renderer,
+ const char *text,
+ int text_len,
+ Pango2GlyphString *glyphs,
+ cairo_text_cluster_t *clusters,
+ int num_clusters,
+ gboolean backward,
+ Pango2Font *font,
+ int x,
+ int y)
{
- PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer);
+ Pango2CairoRenderer *crenderer = (Pango2CairoRenderer *) (renderer);
int i, count;
int x_position = 0;
cairo_glyph_t *cairo_glyphs;
cairo_glyph_t stack_glyphs[STACK_ARRAY_LENGTH (cairo_glyph_t)];
- double base_x = crenderer->x_offset + (double)x / PANGO_SCALE;
- double base_y = crenderer->y_offset + (double)y / PANGO_SCALE;
+ double base_x = crenderer->x_offset + (double)x / PANGO2_SCALE;
+ double base_y = crenderer->y_offset + (double)y / PANGO2_SCALE;
cairo_save (crenderer->cr);
if (!crenderer->do_path)
- set_color (crenderer, PANGO_RENDER_PART_FOREGROUND);
+ set_color (crenderer, PANGO2_RENDER_PART_FOREGROUND);
- if (!_pango_cairo_font_install (font, crenderer->cr))
+ if (!_pango2_cairo_font_install (font, crenderer->cr))
{
for (i = 0; i < glyphs->num_glyphs; i++)
{
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
+ Pango2GlyphInfo *gi = &glyphs->glyphs[i];
- if (gi->glyph != PANGO_GLYPH_EMPTY)
+ if (gi->glyph != PANGO2_GLYPH_EMPTY)
{
- double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO_SCALE;
+ double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO2_SCALE;
double cy = gi->geometry.y_offset == 0 ?
base_y :
- base_y + (double)(gi->geometry.y_offset) / PANGO_SCALE;
+ base_y + (double)(gi->geometry.y_offset) / PANGO2_SCALE;
- _pango_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy);
+ _pango2_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy);
}
x_position += gi->geometry.width;
}
@@ -458,21 +458,21 @@ pango_cairo_renderer_show_text_glyphs (PangoRenderer *renderer,
count = 0;
for (i = 0; i < glyphs->num_glyphs; i++)
{
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
+ Pango2GlyphInfo *gi = &glyphs->glyphs[i];
- if (gi->glyph != PANGO_GLYPH_EMPTY)
+ if (gi->glyph != PANGO2_GLYPH_EMPTY)
{
- double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO_SCALE;
+ double cx = base_x + (double)(x_position + gi->geometry.x_offset) / PANGO2_SCALE;
double cy = gi->geometry.y_offset == 0 ?
base_y :
- base_y + (double)(gi->geometry.y_offset) / PANGO_SCALE;
+ base_y + (double)(gi->geometry.y_offset) / PANGO2_SCALE;
- if (gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ if (gi->glyph & PANGO2_GLYPH_UNKNOWN_FLAG)
{
- if (gi->glyph == (0x20 | PANGO_GLYPH_UNKNOWN_FLAG))
+ if (gi->glyph == (0x20 | PANGO2_GLYPH_UNKNOWN_FLAG))
; /* no hex boxes for space, please */
else
- _pango_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy);
+ _pango2_cairo_renderer_draw_unknown_glyph (crenderer, font, gi, cx, cy);
}
else
{
@@ -505,48 +505,36 @@ done:
}
static void
-pango_cairo_renderer_draw_glyphs (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y)
+pango2_cairo_renderer_draw_glyphs (Pango2Renderer *renderer,
+ Pango2Font *font,
+ Pango2GlyphString *glyphs,
+ int x,
+ int y)
{
- pango_cairo_renderer_show_text_glyphs (renderer,
- NULL, 0,
- glyphs,
- NULL, 0,
- FALSE,
- font,
- x, y);
+ pango2_cairo_renderer_show_text_glyphs (renderer, NULL, 0, glyphs, NULL, 0, FALSE, font, x, y);
}
static void
-pango_cairo_renderer_draw_run (PangoRenderer *renderer,
- const char *text,
- PangoRun *run,
- int x,
- int y)
+pango2_cairo_renderer_draw_run (Pango2Renderer *renderer,
+ const char *text,
+ Pango2Run *run,
+ int x,
+ int y)
{
- PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer);
- PangoItem *item = pango_run_get_item (run);
- PangoGlyphString *glyphs = pango_run_get_glyphs (run);
- PangoFont *font = item->analysis.font;
+ Pango2CairoRenderer *crenderer = (Pango2CairoRenderer *) (renderer);
+ Pango2Item *item = pango2_run_get_item (run);
+ Pango2GlyphString *glyphs = pango2_run_get_glyphs (run);
+ Pango2Font *font = item->analysis.font;
gboolean backward = (item->analysis.level & 1) != 0;
- PangoGlyphItem *glyph_item = pango_run_get_glyph_item (run);
- PangoGlyphItemIter iter;
+ Pango2GlyphItem *glyph_item = pango2_run_get_glyph_item (run);
+ Pango2GlyphItemIter iter;
cairo_text_cluster_t *cairo_clusters;
cairo_text_cluster_t stack_clusters[STACK_ARRAY_LENGTH (cairo_text_cluster_t)];
int num_clusters;
if (!crenderer->has_show_text_glyphs || crenderer->do_path)
{
- pango_cairo_renderer_show_text_glyphs (renderer,
- NULL, 0,
- glyphs,
- NULL, 0,
- FALSE,
- font,
- x, y);
+ pango2_cairo_renderer_show_text_glyphs (renderer, NULL, 0, glyphs, NULL, 0, FALSE, font, x, y);
return;
}
@@ -556,7 +544,7 @@ pango_cairo_renderer_draw_run (PangoRenderer *renderer,
cairo_clusters = stack_clusters;
num_clusters = 0;
- if (pango_glyph_item_iter_init_start (&iter, glyph_item, text))
+ if (pango2_glyph_item_iter_init_start (&iter, glyph_item, text))
{
do {
int num_bytes, num_glyphs, i;
@@ -565,49 +553,49 @@ pango_cairo_renderer_draw_run (PangoRenderer *renderer,
num_glyphs = backward ? iter.start_glyph - iter.end_glyph : iter.end_glyph - iter.start_glyph;
if (num_bytes < 1)
- g_warning ("pango_cairo_renderer_draw_glyph_item: bad cluster has num_bytes %d", num_bytes);
+ g_warning ("pango2_cairo_renderer_draw_glyph_item: bad cluster has num_bytes %d", num_bytes);
if (num_glyphs < 1)
- g_warning ("pango_cairo_renderer_draw_glyph_item: bad cluster has num_glyphs %d", num_glyphs);
+ g_warning ("pango2_cairo_renderer_draw_glyph_item: bad cluster has num_glyphs %d", num_glyphs);
/* Discount empty and unknown glyphs */
for (i = MIN (iter.start_glyph, iter.end_glyph+1);
i < MAX (iter.start_glyph+1, iter.end_glyph);
i++)
{
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
+ Pango2GlyphInfo *gi = &glyphs->glyphs[i];
- if (gi->glyph == PANGO_GLYPH_EMPTY ||
- gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ if (gi->glyph == PANGO2_GLYPH_EMPTY ||
+ gi->glyph & PANGO2_GLYPH_UNKNOWN_FLAG)
num_glyphs--;
}
cairo_clusters[num_clusters].num_bytes = num_bytes;
cairo_clusters[num_clusters].num_glyphs = num_glyphs;
num_clusters++;
- } while (pango_glyph_item_iter_next_cluster (&iter));
+ } while (pango2_glyph_item_iter_next_cluster (&iter));
}
- pango_cairo_renderer_show_text_glyphs (renderer,
- text + item->offset, item->length,
- glyphs,
- cairo_clusters, num_clusters,
- backward,
- font,
- x, y);
+ pango2_cairo_renderer_show_text_glyphs (renderer,
+ text + item->offset, item->length,
+ glyphs,
+ cairo_clusters, num_clusters,
+ backward,
+ font,
+ x, y);
if (cairo_clusters != stack_clusters)
g_free (cairo_clusters);
}
static void
-pango_cairo_renderer_draw_rectangle (PangoRenderer *renderer,
- PangoRenderPart part,
- int x,
- int y,
- int width,
- int height)
+pango2_cairo_renderer_draw_rectangle (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ int x,
+ int y,
+ int width,
+ int height)
{
- PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer);
+ Pango2CairoRenderer *crenderer = (Pango2CairoRenderer *) (renderer);
if (!crenderer->do_path)
{
@@ -617,9 +605,9 @@ pango_cairo_renderer_draw_rectangle (PangoRenderer *renderer,
}
cairo_rectangle (crenderer->cr,
- crenderer->x_offset + (double)x / PANGO_SCALE,
- crenderer->y_offset + (double)y / PANGO_SCALE,
- (double)width / PANGO_SCALE, (double)height / PANGO_SCALE);
+ crenderer->x_offset + (double)x / PANGO2_SCALE,
+ crenderer->y_offset + (double)y / PANGO2_SCALE,
+ (double)width / PANGO2_SCALE, (double)height / PANGO2_SCALE);
if (!crenderer->do_path)
{
@@ -630,16 +618,16 @@ pango_cairo_renderer_draw_rectangle (PangoRenderer *renderer,
}
static void
-pango_cairo_renderer_draw_trapezoid (PangoRenderer *renderer,
- PangoRenderPart part,
- double y1_,
- double x11,
- double x21,
- double y2,
- double x12,
- double x22)
+pango2_cairo_renderer_draw_trapezoid (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ double y1_,
+ double x11,
+ double x21,
+ double y2,
+ double x12,
+ double x22)
{
- PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer);
+ Pango2CairoRenderer *crenderer = (Pango2CairoRenderer *) (renderer);
cairo_t *cr;
double x, y;
@@ -742,15 +730,15 @@ draw_wavy_line (cairo_t *cr,
}
static void
-pango_cairo_renderer_draw_styled_line (PangoRenderer *renderer,
- PangoRenderPart part,
- PangoLineStyle style,
- int x,
- int y,
- int width,
- int height)
+pango2_cairo_renderer_draw_styled_line (Pango2Renderer *renderer,
+ Pango2RenderPart part,
+ Pango2LineStyle style,
+ int x,
+ int y,
+ int width,
+ int height)
{
- PangoCairoRenderer *crenderer = (PangoCairoRenderer *) (renderer);
+ Pango2CairoRenderer *crenderer = (Pango2CairoRenderer *) (renderer);
cairo_t *cr = crenderer->cr;
if (!crenderer->do_path)
@@ -764,57 +752,57 @@ pango_cairo_renderer_draw_styled_line (PangoRenderer *renderer,
switch (style)
{
- case PANGO_LINE_STYLE_NONE:
+ case PANGO2_LINE_STYLE_NONE:
break;
- case PANGO_LINE_STYLE_DOTTED:
- case PANGO_LINE_STYLE_DASHED:
+ case PANGO2_LINE_STYLE_DOTTED:
+ case PANGO2_LINE_STYLE_DASHED:
cairo_save (cr);
- cairo_set_line_width (cr, (double)height / PANGO_SCALE);
- if (style == PANGO_LINE_STYLE_DOTTED)
+ cairo_set_line_width (cr, (double)height / PANGO2_SCALE);
+ if (style == PANGO2_LINE_STYLE_DOTTED)
{
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
- cairo_set_dash (cr, (const double []){0., (double)(2 * height) / PANGO_SCALE}, 2, 0.);
+ cairo_set_dash (cr, (const double []){0., (double)(2 * height) / PANGO2_SCALE}, 2, 0.);
}
else
{
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
- cairo_set_dash (cr, (const double []){(double)(3 * height) / PANGO_SCALE, (double)(3 * height) / PANGO_SCALE}, 2, 0.);
+ cairo_set_dash (cr, (const double []){(double)(3 * height) / PANGO2_SCALE, (double)(3 * height) / PANGO2_SCALE}, 2, 0.);
}
cairo_move_to (cr,
- crenderer->x_offset + (double)x / PANGO_SCALE + (double)height / (2 * PANGO_SCALE),
- crenderer->y_offset + (double)y / PANGO_SCALE + (double)height / (2 * PANGO_SCALE));
+ crenderer->x_offset + (double)x / PANGO2_SCALE + (double)height / (2 * PANGO2_SCALE),
+ crenderer->y_offset + (double)y / PANGO2_SCALE + (double)height / (2 * PANGO2_SCALE));
cairo_line_to (cr,
- crenderer->x_offset + (double)x / PANGO_SCALE + (double)width / PANGO_SCALE - (double)height / PANGO_SCALE,
- crenderer->y_offset + (double)y / PANGO_SCALE + (double)height / (2 * PANGO_SCALE));
+ crenderer->x_offset + (double)x / PANGO2_SCALE + (double)width / PANGO2_SCALE - (double)height / PANGO2_SCALE,
+ crenderer->y_offset + (double)y / PANGO2_SCALE + (double)height / (2 * PANGO2_SCALE));
cairo_stroke (cr);
cairo_restore (cr);
break;
- case PANGO_LINE_STYLE_SOLID:
+ case PANGO2_LINE_STYLE_SOLID:
cairo_rectangle (cr,
- crenderer->x_offset + (double)x / PANGO_SCALE,
- crenderer->y_offset + (double)y / PANGO_SCALE,
- (double)width / PANGO_SCALE, (double)height / PANGO_SCALE);
+ crenderer->x_offset + (double)x / PANGO2_SCALE,
+ crenderer->y_offset + (double)y / PANGO2_SCALE,
+ (double)width / PANGO2_SCALE, (double)height / PANGO2_SCALE);
break;
- case PANGO_LINE_STYLE_DOUBLE:
+ case PANGO2_LINE_STYLE_DOUBLE:
cairo_rectangle (cr,
- crenderer->x_offset + (double)x / PANGO_SCALE,
- crenderer->y_offset + (double)y / PANGO_SCALE,
- (double)width / PANGO_SCALE, (double)height / (3 * PANGO_SCALE));
+ crenderer->x_offset + (double)x / PANGO2_SCALE,
+ crenderer->y_offset + (double)y / PANGO2_SCALE,
+ (double)width / PANGO2_SCALE, (double)height / (3 * PANGO2_SCALE));
cairo_rectangle (cr,
- crenderer->x_offset + (double)x / PANGO_SCALE,
- crenderer->y_offset + (double)y / PANGO_SCALE + (double)(2 * height) / (3 * PANGO_SCALE),
- (double)width / PANGO_SCALE, (double)height / (3 * PANGO_SCALE));
+ crenderer->x_offset + (double)x / PANGO2_SCALE,
+ crenderer->y_offset + (double)y / PANGO2_SCALE + (double)(2 * height) / (3 * PANGO2_SCALE),
+ (double)width / PANGO2_SCALE, (double)height / (3 * PANGO2_SCALE));
break;
- case PANGO_LINE_STYLE_WAVY:
+ case PANGO2_LINE_STYLE_WAVY:
draw_wavy_line (cr,
- crenderer->x_offset + (double)x / PANGO_SCALE,
- crenderer->y_offset + (double)y / PANGO_SCALE,
- (double)width / PANGO_SCALE, (double)height / PANGO_SCALE);
+ crenderer->x_offset + (double)x / PANGO2_SCALE,
+ crenderer->y_offset + (double)y / PANGO2_SCALE,
+ (double)width / PANGO2_SCALE, (double)height / PANGO2_SCALE);
break;
default:
g_assert_not_reached ();
@@ -829,35 +817,35 @@ pango_cairo_renderer_draw_styled_line (PangoRenderer *renderer,
}
static void
-pango_cairo_renderer_init (PangoCairoRenderer *renderer G_GNUC_UNUSED)
+pango2_cairo_renderer_init (Pango2CairoRenderer *renderer G_GNUC_UNUSED)
{
}
static void
-pango_cairo_renderer_class_init (PangoCairoRendererClass *klass)
+pango2_cairo_renderer_class_init (Pango2CairoRendererClass *klass)
{
- PangoRendererClass *renderer_class = PANGO_RENDERER_CLASS (klass);
+ Pango2RendererClass *renderer_class = PANGO2_RENDERER_CLASS (klass);
- renderer_class->draw_glyphs = pango_cairo_renderer_draw_glyphs;
- renderer_class->draw_run = pango_cairo_renderer_draw_run;
- renderer_class->draw_rectangle = pango_cairo_renderer_draw_rectangle;
- renderer_class->draw_styled_line = pango_cairo_renderer_draw_styled_line;
- renderer_class->draw_trapezoid = pango_cairo_renderer_draw_trapezoid;
+ renderer_class->draw_glyphs = pango2_cairo_renderer_draw_glyphs;
+ renderer_class->draw_run = pango2_cairo_renderer_draw_run;
+ renderer_class->draw_rectangle = pango2_cairo_renderer_draw_rectangle;
+ renderer_class->draw_styled_line = pango2_cairo_renderer_draw_styled_line;
+ renderer_class->draw_trapezoid = pango2_cairo_renderer_draw_trapezoid;
}
-static PangoCairoRenderer *cached_renderer = NULL; /* MT-safe */
+static Pango2CairoRenderer *cached_renderer = NULL; /* MT-safe */
G_LOCK_DEFINE_STATIC (cached_renderer);
-static PangoCairoRenderer *
+static Pango2CairoRenderer *
acquire_renderer (void)
{
- PangoCairoRenderer *renderer;
+ Pango2CairoRenderer *renderer;
if (G_LIKELY (G_TRYLOCK (cached_renderer)))
{
if (G_UNLIKELY (!cached_renderer))
{
- cached_renderer = g_object_new (PANGO_TYPE_CAIRO_RENDERER, NULL);
+ cached_renderer = g_object_new (PANGO2_TYPE_CAIRO_RENDERER, NULL);
cached_renderer->is_cached_renderer = TRUE;
}
@@ -865,14 +853,14 @@ acquire_renderer (void)
}
else
{
- renderer = g_object_new (PANGO_TYPE_CAIRO_RENDERER, NULL);
+ renderer = g_object_new (PANGO2_TYPE_CAIRO_RENDERER, NULL);
}
return renderer;
}
static void
-release_renderer (PangoCairoRenderer *renderer)
+release_renderer (Pango2CairoRenderer *renderer)
{
if (G_LIKELY (renderer->is_cached_renderer))
{
@@ -889,7 +877,7 @@ release_renderer (PangoCairoRenderer *renderer)
}
static void
-save_current_point (PangoCairoRenderer *renderer)
+save_current_point (Pango2CairoRenderer *renderer)
{
renderer->cr_had_current_point = cairo_has_current_point (renderer->cr);
cairo_get_current_point (renderer->cr, &renderer->x_offset, &renderer->y_offset);
@@ -899,7 +887,7 @@ save_current_point (PangoCairoRenderer *renderer)
}
static void
-restore_current_point (PangoCairoRenderer *renderer)
+restore_current_point (Pango2CairoRenderer *renderer)
{
if (renderer->cr_had_current_point)
/* XXX should do cairo_set_current_point() when we have that function */
@@ -913,13 +901,13 @@ restore_current_point (PangoCairoRenderer *renderer)
static void
-_pango_cairo_do_glyph_string (cairo_t *cr,
- PangoFont *font,
- PangoGlyphString *glyphs,
- gboolean do_path)
+_pango2_cairo_do_glyph_string (cairo_t *cr,
+ Pango2Font *font,
+ Pango2GlyphString *glyphs,
+ gboolean do_path)
{
- PangoCairoRenderer *crenderer = acquire_renderer ();
- PangoRenderer *renderer = (PangoRenderer *) crenderer;
+ Pango2CairoRenderer *crenderer = acquire_renderer ();
+ Pango2Renderer *renderer = (Pango2Renderer *) crenderer;
crenderer->cr = cr;
crenderer->do_path = do_path;
@@ -931,20 +919,20 @@ _pango_cairo_do_glyph_string (cairo_t *cr,
* prepare_run() isn't called.
*/
- pango_renderer_activate (renderer);
+ pango2_renderer_activate (renderer);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_FOREGROUND, NULL);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_BACKGROUND, NULL);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_UNDERLINE, NULL);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_STRIKETHROUGH, NULL);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_OVERLINE, NULL);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_FOREGROUND, NULL);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_BACKGROUND, NULL);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_UNDERLINE, NULL);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_STRIKETHROUGH, NULL);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_OVERLINE, NULL);
}
- pango_renderer_draw_glyphs (renderer, font, glyphs, 0, 0);
+ pango2_renderer_draw_glyphs (renderer, font, glyphs, 0, 0);
if (!do_path)
{
- pango_renderer_deactivate (renderer);
+ pango2_renderer_deactivate (renderer);
}
restore_current_point (crenderer);
@@ -953,13 +941,13 @@ _pango_cairo_do_glyph_string (cairo_t *cr,
}
static void
-_pango_cairo_do_run (cairo_t *cr,
- const char *text,
- PangoRun *run,
- gboolean do_path)
+_pango2_cairo_do_run (cairo_t *cr,
+ const char *text,
+ Pango2Run *run,
+ gboolean do_path)
{
- PangoCairoRenderer *crenderer = acquire_renderer ();
- PangoRenderer *renderer = (PangoRenderer *) crenderer;
+ Pango2CairoRenderer *crenderer = acquire_renderer ();
+ Pango2Renderer *renderer = (Pango2Renderer *) crenderer;
crenderer->cr = cr;
crenderer->do_path = do_path;
@@ -971,19 +959,19 @@ _pango_cairo_do_run (cairo_t *cr,
* prepare_run() isn't called.
*/
- pango_renderer_activate (renderer);
+ pango2_renderer_activate (renderer);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_FOREGROUND, NULL);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_BACKGROUND, NULL);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_UNDERLINE, NULL);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_STRIKETHROUGH, NULL);
- pango_renderer_set_color (renderer, PANGO_RENDER_PART_OVERLINE, NULL);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_FOREGROUND, NULL);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_BACKGROUND, NULL);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_UNDERLINE, NULL);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_STRIKETHROUGH, NULL);
+ pango2_renderer_set_color (renderer, PANGO2_RENDER_PART_OVERLINE, NULL);
}
- pango_renderer_draw_run (renderer, text, run, 0, 0);
+ pango2_renderer_draw_run (renderer, text, run, 0, 0);
if (!do_path)
- pango_renderer_deactivate (renderer);
+ pango2_renderer_deactivate (renderer);
restore_current_point (crenderer);
@@ -991,18 +979,18 @@ _pango_cairo_do_run (cairo_t *cr,
}
static void
-_pango_cairo_do_line (cairo_t *cr,
- PangoLine *line,
- gboolean do_path)
+_pango2_cairo_do_line (cairo_t *cr,
+ Pango2Line *line,
+ gboolean do_path)
{
- PangoCairoRenderer *crenderer = acquire_renderer ();
- PangoRenderer *renderer = (PangoRenderer *) crenderer;
+ Pango2CairoRenderer *crenderer = acquire_renderer ();
+ Pango2Renderer *renderer = (Pango2Renderer *) crenderer;
crenderer->cr = cr;
crenderer->do_path = do_path;
save_current_point (crenderer);
- pango_renderer_draw_line (renderer, line, 0, 0);
+ pango2_renderer_draw_line (renderer, line, 0, 0);
restore_current_point (crenderer);
@@ -1010,18 +998,18 @@ _pango_cairo_do_line (cairo_t *cr,
}
static void
-_pango_cairo_do_lines (cairo_t *cr,
- PangoLines *lines,
- gboolean do_path)
+_pango2_cairo_do_lines (cairo_t *cr,
+ Pango2Lines *lines,
+ gboolean do_path)
{
- PangoCairoRenderer *crenderer = acquire_renderer ();
- PangoRenderer *renderer = (PangoRenderer *) crenderer;
+ Pango2CairoRenderer *crenderer = acquire_renderer ();
+ Pango2Renderer *renderer = (Pango2Renderer *) crenderer;
crenderer->cr = cr;
crenderer->do_path = do_path;
save_current_point (crenderer);
- pango_renderer_draw_lines (renderer, lines, 0, 0);
+ pango2_renderer_draw_lines (renderer, lines, 0, 0);
restore_current_point (crenderer);
@@ -1029,18 +1017,18 @@ _pango_cairo_do_lines (cairo_t *cr,
}
static void
-_pango_cairo_do_layout (cairo_t *cr,
- PangoLayout *layout,
- gboolean do_path)
+_pango2_cairo_do_layout (cairo_t *cr,
+ Pango2Layout *layout,
+ gboolean do_path)
{
- PangoCairoRenderer *crenderer = acquire_renderer ();
- PangoRenderer *renderer = (PangoRenderer *) crenderer;
+ Pango2CairoRenderer *crenderer = acquire_renderer ();
+ Pango2Renderer *renderer = (Pango2Renderer *) crenderer;
crenderer->cr = cr;
crenderer->do_path = do_path;
save_current_point (crenderer);
- pango_renderer_draw_lines (renderer, pango_layout_get_lines (layout), 0, 0);
+ pango2_renderer_draw_lines (renderer, pango2_layout_get_lines (layout), 0, 0);
restore_current_point (crenderer);
@@ -1051,10 +1039,10 @@ _pango_cairo_do_layout (cairo_t *cr,
/**
- * pango_cairo_show_glyph_string:
+ * pango2_cairo_show_glyph_string:
* @cr: a Cairo context
- * @font: a `PangoFont` from a `PangoCairoFontMap`
- * @glyphs: a `PangoGlyphString`
+ * @font: a `Pango2Font` from a `Pango2CairoFontMap`
+ * @glyphs: a `Pango2GlyphString`
*
* Draws the glyphs in @glyphs in the specified cairo context.
*
@@ -1062,27 +1050,26 @@ _pango_cairo_do_layout (cairo_t *cr,
* be drawn at the current point of the cairo context.
*/
void
-pango_cairo_show_glyph_string (cairo_t *cr,
- PangoFont *font,
- PangoGlyphString *glyphs)
+pango2_cairo_show_glyph_string (cairo_t *cr,
+ Pango2Font *font,
+ Pango2GlyphString *glyphs)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (glyphs != NULL);
- _pango_cairo_do_glyph_string (cr, font, glyphs, FALSE);
+ _pango2_cairo_do_glyph_string (cr, font, glyphs, FALSE);
}
-
/**
- * pango_cairo_show_run:
+ * pango2_cairo_show_run:
* @cr: a Cairo context
* @text: the UTF-8 text that @run refers to
- * @run: a `PangoRun`
+ * @run: a `Pango2Run`
*
* Draws the glyphs in @run in the specified cairo context,
* embedding the text associated with the glyphs in the output if the
* output format supports it (PDF for example), otherwise it acts
- * similar to [func@Pango.cairo_show_glyph_string].
+ * similar to [func@Pango2.cairo_show_glyph_string].
*
* The origin of the glyphs (the left edge of the baseline) will
* be drawn at the current point of the cairo context.
@@ -1091,82 +1078,82 @@ pango_cairo_show_glyph_string (cairo_t *cr,
* indexed by `run->item->offset`.
*/
void
-pango_cairo_show_run (cairo_t *cr,
- const char *text,
- PangoRun *run)
+pango2_cairo_show_run (cairo_t *cr,
+ const char *text,
+ Pango2Run *run)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (text != NULL);
g_return_if_fail (run != NULL);
- _pango_cairo_do_run (cr, text, run, FALSE);
+ _pango2_cairo_do_run (cr, text, run, FALSE);
}
/**
- * pango_cairo_show_line:
+ * pango2_cairo_show_line:
* @cr: a Cairo context
- * @line: a `PangoLine`
+ * @line: a `Pango2Line`
*
- * Draws a `PangoLine` in the specified cairo context.
+ * Draws a `Pango2Line` in the specified cairo context.
*
* The origin of the glyphs (the left edge of the line) will
* be drawn at the current point of the cairo context.
*/
void
-pango_cairo_show_line (cairo_t *cr,
- PangoLine *line)
+pango2_cairo_show_line (cairo_t *cr,
+ Pango2Line *line)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (line != NULL);
- _pango_cairo_do_line (cr, line, FALSE);
+ _pango2_cairo_do_line (cr, line, FALSE);
}
/**
- * pango_cairo_show_lines:
+ * pango2_cairo_show_lines:
* @cr: a Cairo context
- * @lines: a `PangoLines` object
+ * @lines: a `Pango2Lines` object
*
- * Draws a `PangoLines` object in the specified cairo context.
+ * Draws a `Pango2Lines` object in the specified cairo context.
*
- * The top-left corner of the `PangoLines` will be drawn
+ * The top-left corner of the `Pango2Lines` will be drawn
* at the current point of the cairo context.
*/
void
-pango_cairo_show_lines (cairo_t *cr,
- PangoLines *lines)
+pango2_cairo_show_lines (cairo_t *cr,
+ Pango2Lines *lines)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (lines != NULL);
- _pango_cairo_do_lines (cr, lines, FALSE);
+ _pango2_cairo_do_lines (cr, lines, FALSE);
}
/**
- * pango_cairo_show_layout:
+ * pango2_cairo_show_layout:
* @cr: a Cairo context
- * @layout: a Pango layout
+ * @layout: a Pango2 layout
*
- * Draws a `PangoLayout` in the specified cairo context.
+ * Draws a `Pango2Layout` in the specified cairo context.
*
- * The top-left corner of the `PangoLayout` will be drawn
+ * The top-left corner of the `Pango2Layout` will be drawn
* at the current point of the cairo context.
*/
void
-pango_cairo_show_layout (cairo_t *cr,
- PangoLayout *layout)
+pango2_cairo_show_layout (cairo_t *cr,
+ Pango2Layout *layout)
{
g_return_if_fail (cr != NULL);
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
- _pango_cairo_do_layout (cr, layout, FALSE);
+ _pango2_cairo_do_layout (cr, layout, FALSE);
}
/**
- * pango_cairo_glyph_string_path:
+ * pango2_cairo_glyph_string_path:
* @cr: a Cairo context
- * @font: a `PangoFont` from a `PangoCairoFontMap`
- * @glyphs: a `PangoGlyphString`
+ * @font: a `Pango2Font` from a `Pango2CairoFontMap`
+ * @glyphs: a `Pango2GlyphString`
*
* Adds the glyphs in @glyphs to the current path in the specified
* cairo context.
@@ -1175,94 +1162,94 @@ pango_cairo_show_layout (cairo_t *cr,
* will be at the current point of the cairo context.
*/
void
-pango_cairo_glyph_string_path (cairo_t *cr,
- PangoFont *font,
- PangoGlyphString *glyphs)
+pango2_cairo_glyph_string_path (cairo_t *cr,
+ Pango2Font *font,
+ Pango2GlyphString *glyphs)
{
g_return_if_fail (cr != NULL);
g_return_if_fail (glyphs != NULL);
- _pango_cairo_do_glyph_string (cr, font, glyphs, TRUE);
+ _pango2_cairo_do_glyph_string (cr, font, glyphs, TRUE);
}
/**
- * pango_cairo_run_path:
+ * pango2_cairo_run_path:
* @cr: a Cairo context
* @text: the UTF-8 text that @run refers to
- * @run: a `PangoRun`
+ * @run: a `Pango2Run`
*
- * Adds the text in `PangoRun` to the current path in the
+ * Adds the text in `Pango2Run` to the current path in the
* specified cairo context.
*
* The origin of the glyphs (the left edge of the line) will be
* at the current point of the cairo context.
*/
void
-pango_cairo_run_path (cairo_t *cr,
- const char *text,
- PangoRun *run)
+pango2_cairo_run_path (cairo_t *cr,
+ const char *text,
+ Pango2Run *run)
{
- _pango_cairo_do_run (cr, text, run, TRUE);
+ _pango2_cairo_do_run (cr, text, run, TRUE);
}
/**
- * pango_cairo_line_path:
+ * pango2_cairo_line_path:
* @cr: a Cairo context
- * @line: a `PangoLine`
+ * @line: a `Pango2Line`
*
- * Adds the text in `PangoLine` to the current path in the
+ * Adds the text in `Pango2Line` to the current path in the
* specified cairo context.
*
* The origin of the glyphs (the left edge of the line) will be
* at the current point of the cairo context.
*/
void
-pango_cairo_line_path (cairo_t *cr,
- PangoLine *line)
+pango2_cairo_line_path (cairo_t *cr,
+ Pango2Line *line)
{
g_return_if_fail (cr != NULL);
- _pango_cairo_do_line (cr, line, TRUE);
+ _pango2_cairo_do_line (cr, line, TRUE);
}
/**
- * pango_cairo_layout_path:
+ * pango2_cairo_layout_path:
* @cr: a Cairo context
- * @layout: a Pango layout
+ * @layout: a Pango2 layout
*
- * Adds the text in a `PangoLayout` to the current path in the
+ * Adds the text in a `Pango2Layout` to the current path in the
* specified cairo context.
*
- * The top-left corner of the `PangoLayout` will be at the
+ * The top-left corner of the `Pango2Layout` will be at the
* current point of the cairo context.
*/
void
-pango_cairo_layout_path (cairo_t *cr,
- PangoLayout *layout)
+pango2_cairo_layout_path (cairo_t *cr,
+ Pango2Layout *layout)
{
g_return_if_fail (cr != NULL);
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
+ g_return_if_fail (PANGO2_IS_LAYOUT (layout));
- _pango_cairo_do_layout (cr, layout, TRUE);
+ _pango2_cairo_do_layout (cr, layout, TRUE);
}
/**
- * pango_cairo_lines_path:
+ * pango2_cairo_lines_path:
* @cr: a Cairo context
- * @lines: a `PangoLines` object
+ * @lines: a `Pango2Lines` object
*
- * Adds the text in a `PangoLines` to the current path in the
+ * Adds the text in a `Pango2Lines` to the current path in the
* specified cairo context.
*
- * The top-left corner of the `PangoLayout` will be at the
+ * The top-left corner of the `Pango2Layout` will be at the
* current point of the cairo context.
*/
void
-pango_cairo_lines_path (cairo_t *cr,
- PangoLines *lines)
+pango2_cairo_lines_path (cairo_t *cr,
+ Pango2Lines *lines)
{
g_return_if_fail (cr != NULL);
- g_return_if_fail (PANGO_IS_LINES (lines));
+ g_return_if_fail (PANGO2_IS_LINES (lines));
- _pango_cairo_do_lines (cr, lines, TRUE);
+ _pango2_cairo_do_lines (cr, lines, TRUE);
}
diff --git a/pango/pangocairo-render.h b/pango/pangocairo-render.h
index b9386142..fcd767f4 100644
--- a/pango/pangocairo-render.h
+++ b/pango/pangocairo-render.h
@@ -24,40 +24,40 @@
G_BEGIN_DECLS
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_glyph_string (cairo_t *cr,
- PangoFont *font,
- PangoGlyphString *glyphs);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_show_glyph_string (cairo_t *cr,
+ Pango2Font *font,
+ Pango2GlyphString *glyphs);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_run (cairo_t *cr,
- const char *text,
- PangoRun *run);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_line (cairo_t *cr,
- PangoLine *line);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_lines (cairo_t *cr,
- PangoLines *lines);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_show_layout (cairo_t *cr,
- PangoLayout *layout);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_glyph_string_path (cairo_t *cr,
- PangoFont *font,
- PangoGlyphString *glyphs);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_run_path (cairo_t *cr,
- const char *text,
- PangoRun *run);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_line_path (cairo_t *cr,
- PangoLine *line);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_lines_path (cairo_t *cr,
- PangoLines *lines);
-PANGO_AVAILABLE_IN_ALL
-void pango_cairo_layout_path (cairo_t *cr,
- PangoLayout *layout);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_show_run (cairo_t *cr,
+ const char *text,
+ Pango2Run *run);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_show_line (cairo_t *cr,
+ Pango2Line *line);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_show_lines (cairo_t *cr,
+ Pango2Lines *lines);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_show_layout (cairo_t *cr,
+ Pango2Layout *layout);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_glyph_string_path (cairo_t *cr,
+ Pango2Font *font,
+ Pango2GlyphString *glyphs);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_run_path (cairo_t *cr,
+ const char *text,
+ Pango2Run *run);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_line_path (cairo_t *cr,
+ Pango2Line *line);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_lines_path (cairo_t *cr,
+ Pango2Lines *lines);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_cairo_layout_path (cairo_t *cr,
+ Pango2Layout *layout);
G_END_DECLS
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
index c0558c0b..3b7cdd47 100644
--- a/pango/pangocoretext-fontmap.c
+++ b/pango/pangocoretext-fontmap.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Red Hat, Inc.
*
@@ -38,21 +38,21 @@
/**
- * PangoCoreTextFontMap:
+ * Pango2CoreTextFontMap:
*
- * `PangoCoreTextFontMap` is a subclass of `PangoFontMap` that uses
+ * `Pango2CoreTextFontMap` is a subclass of `Pango2FontMap` that uses
* CoreText to populate the fontmap with the available fonts.
*/
-struct _PangoCoreTextFontMap
+struct _Pango2CoreTextFontMap
{
- PangoFontMap parent_instance;
+ Pango2FontMap parent_instance;
};
-struct _PangoCoreTextFontMapClass
+struct _Pango2CoreTextFontMapClass
{
- PangoFontMapClass parent_class;
+ Pango2FontMapClass parent_class;
};
/* {{{ CoreText utilities */
@@ -68,18 +68,18 @@ struct _PangoCoreTextFontMapClass
static struct {
float ct_weight;
- PangoWeight pango_weight;
+ Pango2Weight pango2_weight;
} ct_weight_map[] = {
- { ct_weight_min, PANGO_WEIGHT_THIN },
- { -0.5, PANGO_WEIGHT_ULTRALIGHT },
- { -0.23, PANGO_WEIGHT_LIGHT },
- { -0.115, PANGO_WEIGHT_SEMILIGHT },
- { 0.00, PANGO_WEIGHT_NORMAL },
- { 0.2, PANGO_WEIGHT_MEDIUM },
- { 0.3, PANGO_WEIGHT_SEMIBOLD },
- { 0.4, PANGO_WEIGHT_BOLD },
- { 0.6, PANGO_WEIGHT_ULTRABOLD },
- { ct_weight_max, PANGO_WEIGHT_HEAVY }
+ { ct_weight_min, PANGO2_WEIGHT_THIN },
+ { -0.5, PANGO2_WEIGHT_ULTRALIGHT },
+ { -0.23, PANGO2_WEIGHT_LIGHT },
+ { -0.115, PANGO2_WEIGHT_SEMILIGHT },
+ { 0.00, PANGO2_WEIGHT_NORMAL },
+ { 0.2, PANGO2_WEIGHT_MEDIUM },
+ { 0.3, PANGO2_WEIGHT_SEMIBOLD },
+ { 0.4, PANGO2_WEIGHT_BOLD },
+ { 0.6, PANGO2_WEIGHT_ULTRABOLD },
+ { ct_weight_max, PANGO2_WEIGHT_HEAVY }
};
static int
@@ -90,13 +90,13 @@ lerp (float x, float x1, float x2, int y1, int y2)
return y1 + (dy * (x - x1) + dx / 2) / dx;
}
-static PangoWeight
+static Pango2Weight
ct_font_descriptor_get_weight (CTFontDescriptorRef desc)
{
CFDictionaryRef dict;
CFNumberRef cf_number;
CGFloat value;
- PangoWeight weight = PANGO_WEIGHT_NORMAL;
+ Pango2Weight weight = PANGO2_WEIGHT_NORMAL;
guint i;
dict = CTFontDescriptorCopyAttribute (desc, kCTFontTraitsAttribute);
@@ -115,12 +115,12 @@ ct_font_descriptor_get_weight (CTFontDescriptorRef desc)
;
weight = lerp (value, ct_weight_map[i-1].ct_weight, ct_weight_map[i].ct_weight,
- ct_weight_map[i-1].pango_weight, ct_weight_map[i].pango_weight);
+ ct_weight_map[i-1].pango2_weight, ct_weight_map[i].pango2_weight);
}
}
else
- weight = PANGO_WEIGHT_NORMAL;
+ weight = PANGO2_WEIGHT_NORMAL;
CFRelease (dict);
@@ -279,59 +279,59 @@ ct_font_descriptor_is_small_caps (CTFontDescriptorRef desc)
}
static gboolean
-pango_core_text_style_name_is_oblique (const char *style_name)
+pango2_core_text_style_name_is_oblique (const char *style_name)
{
return style_name && strstr (style_name, "Oblique");
}
-static PangoFontDescription *
+static Pango2FontDescription *
font_description_from_ct_font_descriptor (CTFontDescriptorRef desc)
{
SInt64 font_traits;
char *family_name;
char *style_name;
- PangoFontDescription *font_desc;
+ Pango2FontDescription *font_desc;
- font_desc = pango_font_description_new ();
+ font_desc = pango2_font_description_new ();
family_name = ct_font_descriptor_get_family_name (desc, FALSE);
- pango_font_description_set_family (font_desc, family_name);
+ pango2_font_description_set_family (font_desc, family_name);
g_free (family_name);
- pango_font_description_set_weight (font_desc, ct_font_descriptor_get_weight (desc));
+ pango2_font_description_set_weight (font_desc, ct_font_descriptor_get_weight (desc));
font_traits = ct_font_descriptor_get_traits (desc);
style_name = ct_font_descriptor_get_style_name (desc);
if ((font_traits & kCTFontItalicTrait) == kCTFontItalicTrait)
- pango_font_description_set_style (font_desc, PANGO_STYLE_ITALIC);
- else if (pango_core_text_style_name_is_oblique (style_name))
- pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+ pango2_font_description_set_style (font_desc, PANGO2_STYLE_ITALIC);
+ else if (pango2_core_text_style_name_is_oblique (style_name))
+ pango2_font_description_set_style (font_desc, PANGO2_STYLE_OBLIQUE);
else
- pango_font_description_set_style (font_desc, PANGO_STYLE_NORMAL);
+ pango2_font_description_set_style (font_desc, PANGO2_STYLE_NORMAL);
if ((font_traits & kCTFontCondensedTrait) == kCTFontCondensedTrait)
- pango_font_description_set_stretch (font_desc, PANGO_STRETCH_CONDENSED);
+ pango2_font_description_set_stretch (font_desc, PANGO2_STRETCH_CONDENSED);
if (ct_font_descriptor_is_small_caps (desc))
- pango_font_description_set_variant (font_desc, PANGO_VARIANT_SMALL_CAPS);
+ pango2_font_description_set_variant (font_desc, PANGO2_VARIANT_SMALL_CAPS);
else
- pango_font_description_set_variant (font_desc, PANGO_VARIANT_NORMAL);
+ pango2_font_description_set_variant (font_desc, PANGO2_VARIANT_NORMAL);
g_free (style_name);
return font_desc;
}
-static PangoHbFace *
+static Pango2HbFace *
face_from_ct_font_descriptor (CTFontDescriptorRef desc)
{
- PangoHbFace *face;
+ Pango2HbFace *face;
CTFontRef ctfont;
CGFontRef cgfont;
hb_face_t *hb_face;
char *name;
- PangoFontDescription *description;
+ Pango2FontDescription *description;
ctfont = CTFontCreateWithFontDescriptor (desc, 0.0, NULL);
cgfont = CTFontCopyGraphicsFont (ctfont, NULL);
@@ -343,16 +343,16 @@ face_from_ct_font_descriptor (CTFontDescriptorRef desc)
name = ct_font_descriptor_get_style_name (desc);
description = font_description_from_ct_font_descriptor (desc);
- pango_font_description_unset_fields (description, PANGO_FONT_MASK_VARIANT |
- PANGO_FONT_MASK_SIZE |
- PANGO_FONT_MASK_GRAVITY);
+ pango2_font_description_unset_fields (description, PANGO2_FONT_MASK_VARIANT |
+ PANGO2_FONT_MASK_SIZE |
+ PANGO2_FONT_MASK_GRAVITY);
hb_face_make_immutable (hb_face);
- face = pango_hb_face_new_from_hb_face (hb_face, -1, name, description);
+ face = pango2_hb_face_new_from_hb_face (hb_face, -1, name, description);
// FIXME: what about languages? see CTFontCopySupportedLanguages
- pango_font_description_free (description);
+ pango2_font_description_free (description);
g_free (name);
hb_face_destroy (hb_face);
@@ -360,10 +360,10 @@ face_from_ct_font_descriptor (CTFontDescriptorRef desc)
}
/* }}} */
-/* {{{ PangoFontMap implementation */
+/* {{{ Pango2FontMap implementation */
static void
-pango_core_text_font_map_populate (PangoFontMap *map)
+pango2_core_text_font_map_populate (Pango2FontMap *map)
{
CTFontCollectionRef collection;
CFArrayRef ctfaces;
@@ -377,8 +377,8 @@ pango_core_text_font_map_populate (PangoFontMap *map)
for (int i = 0; i < count; i++)
{
CTFontDescriptorRef desc = CFArrayGetValueAtIndex (ctfaces, i);
- PangoHbFace *face = face_from_ct_font_descriptor (desc);
- pango_font_map_add_face (map, PANGO_FONT_FACE (face));
+ Pango2HbFace *face = face_from_ct_font_descriptor (desc);
+ pango2_font_map_add_face (map, PANGO2_FONT_FACE (face));
}
/* Add generic aliases */
@@ -398,61 +398,61 @@ pango_core_text_font_map_populate (PangoFontMap *map)
for (int i = 0; i < G_N_ELEMENTS (aliases); i++)
{
- PangoFontFamily *family = pango_font_map_get_family (map, aliases[i].family_name);
+ Pango2FontFamily *family = pango2_font_map_get_family (map, aliases[i].family_name);
if (family)
{
- PangoGenericFamily *alias_family;
+ Pango2GenericFamily *alias_family;
- alias_family = pango_generic_family_new (aliases[i].alias_name);
- pango_generic_family_add_family (alias_family, family);
- pango_font_map_add_family (map, PANGO_FONT_FAMILY (alias_family));
+ alias_family = pango2_generic_family_new (aliases[i].alias_name);
+ pango2_generic_family_add_family (alias_family, family);
+ pango2_font_map_add_family (map, PANGO2_FONT_FAMILY (alias_family));
}
}
}
/* }}} */
-/* {{{ PangoCoreTextFontMap implementation */
+/* {{{ Pango2CoreTextFontMap implementation */
-G_DEFINE_FINAL_TYPE (PangoCoreTextFontMap, pango_core_text_font_map, PANGO_TYPE_FONT_MAP)
+G_DEFINE_FINAL_TYPE (Pango2CoreTextFontMap, pango2_core_text_font_map, PANGO2_TYPE_FONT_MAP)
static void
-pango_core_text_font_map_init (PangoCoreTextFontMap *self)
+pango2_core_text_font_map_init (Pango2CoreTextFontMap *self)
{
- pango_font_map_repopulate (PANGO_FONT_MAP (self), TRUE);
+ pango2_font_map_repopulate (PANGO2_FONT_MAP (self), TRUE);
}
static void
-pango_core_text_font_map_finalize (GObject *object)
+pango2_core_text_font_map_finalize (GObject *object)
{
- G_OBJECT_CLASS (pango_core_text_font_map_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_core_text_font_map_parent_class)->finalize (object);
}
static void
-pango_core_text_font_map_class_init (PangoCoreTextFontMapClass *class)
+pango2_core_text_font_map_class_init (Pango2CoreTextFontMapClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontMapClass *font_map_class = PANGO_FONT_MAP_CLASS (class);
+ Pango2FontMapClass *font_map_class = PANGO2_FONT_MAP_CLASS (class);
- object_class->finalize = pango_core_text_font_map_finalize;
+ object_class->finalize = pango2_core_text_font_map_finalize;
- font_map_class->populate = pango_core_text_font_map_populate;
+ font_map_class->populate = pango2_core_text_font_map_populate;
}
/* }}} */
/* {{{ Public API */
/**
- * pango_core_text_font_map_new:
+ * pango2_core_text_font_map_new:
*
- * Creates a new `PangoCoreTextFontMap` object.
+ * Creates a new `Pango2CoreTextFontMap` object.
*
- * Returns: a new `PangoCoreTextFontMap`
+ * Returns: a new `Pango2CoreTextFontMap`
*/
-PangoCoreTextFontMap *
-pango_core_text_font_map_new (void)
+Pango2CoreTextFontMap *
+pango2_core_text_font_map_new (void)
{
- return g_object_new (PANGO_TYPE_CORE_TEXT_FONT_MAP, NULL);
+ return g_object_new (PANGO2_TYPE_CORE_TEXT_FONT_MAP, NULL);
}
/* }}} */
diff --git a/pango/pangocoretext-fontmap.h b/pango/pangocoretext-fontmap.h
index 5c96cf75..c7602e69 100644
--- a/pango/pangocoretext-fontmap.h
+++ b/pango/pangocoretext-fontmap.h
@@ -23,13 +23,13 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_CORE_TEXT_FONT_MAP (pango_core_text_font_map_get_type ())
+#define PANGO2_TYPE_CORE_TEXT_FONT_MAP (pango2_core_text_font_map_get_type ())
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoCoreTextFontMap, pango_core_text_font_map, PANGO, CORE_TEXT_FONT_MAP, PangoFontMap)
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2CoreTextFontMap, pango2_core_text_font_map, PANGO2, CORE_TEXT_FONT_MAP, Pango2FontMap)
-PANGO_AVAILABLE_IN_ALL
-PangoCoreTextFontMap * pango_core_text_font_map_new (void);
+PANGO2_AVAILABLE_IN_ALL
+Pango2CoreTextFontMap * pango2_core_text_font_map_new (void);
G_END_DECLS
diff --git a/pango/pangodwrite-fontmap.h b/pango/pangodwrite-fontmap.h
index ed18d866..4cb3b2c7 100644
--- a/pango/pangodwrite-fontmap.h
+++ b/pango/pangodwrite-fontmap.h
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* pangodwrite-fontmap.h: Fontmap using DirectWrite
*
* Copyright (C) 2022 the GTK team
@@ -25,16 +25,16 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_DIRECT_WRITE_FONT_MAP (pango_direct_write_font_map_get_type ())
+#define PANGO2_TYPE_DIRECT_WRITE_FONT_MAP (pango2_direct_write_font_map_get_type ())
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoDirectWriteFontMap,
- pango_direct_write_font_map,
- PANGO, DIRECT_WRITE_FONT_MAP,
- PangoFontMap)
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2DirectWriteFontMap,
+ pango2_direct_write_font_map,
+ PANGO2, DIRECT_WRITE_FONT_MAP,
+ Pango2FontMap)
-PANGO_AVAILABLE_IN_ALL
-PangoDirectWriteFontMap * pango_direct_write_font_map_new (void);
+PANGO2_AVAILABLE_IN_ALL
+Pango2DirectWriteFontMap * pango2_direct_write_font_map_new (void);
G_END_DECLS
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 49733a7f..c3d026e2 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Red Hat, Inc.
*
@@ -39,23 +39,23 @@
/**
- * PangoFcFontMap:
+ * Pango2FcFontMap:
*
- * `PangoFcFontMap` is a subclass of `PangoFontMap` that uses
+ * `Pango2FcFontMap` is a subclass of `Pango2FontMap` that uses
* fontconfig to populate the fontmap with the available fonts.
*/
-struct _PangoFcFontMap
+struct _Pango2FcFontMap
{
- PangoFontMap parent_instance;
+ Pango2FontMap parent_instance;
FcConfig *config;
};
-struct _PangoFcFontMapClass
+struct _Pango2FcFontMapClass
{
- PangoFontMapClass parent_class;
+ Pango2FontMapClass parent_class;
};
/* {{{ Fontconfig utilities */
@@ -90,103 +90,103 @@ is_supported_font_format (FcPattern *pattern)
return FALSE;
}
-static PangoStyle
+static Pango2Style
convert_fc_slant_to_pango (int fc_style)
{
switch (fc_style)
{
case FC_SLANT_ROMAN:
- return PANGO_STYLE_NORMAL;
+ return PANGO2_STYLE_NORMAL;
case FC_SLANT_ITALIC:
- return PANGO_STYLE_ITALIC;
+ return PANGO2_STYLE_ITALIC;
case FC_SLANT_OBLIQUE:
- return PANGO_STYLE_OBLIQUE;
+ return PANGO2_STYLE_OBLIQUE;
default:
- return PANGO_STYLE_NORMAL;
+ return PANGO2_STYLE_NORMAL;
}
}
-static PangoStretch
+static Pango2Stretch
convert_fc_width_to_pango (int fc_stretch)
{
switch (fc_stretch)
{
case FC_WIDTH_NORMAL:
- return PANGO_STRETCH_NORMAL;
+ return PANGO2_STRETCH_NORMAL;
case FC_WIDTH_ULTRACONDENSED:
- return PANGO_STRETCH_ULTRA_CONDENSED;
+ return PANGO2_STRETCH_ULTRA_CONDENSED;
case FC_WIDTH_EXTRACONDENSED:
- return PANGO_STRETCH_EXTRA_CONDENSED;
+ return PANGO2_STRETCH_EXTRA_CONDENSED;
case FC_WIDTH_CONDENSED:
- return PANGO_STRETCH_CONDENSED;
+ return PANGO2_STRETCH_CONDENSED;
case FC_WIDTH_SEMICONDENSED:
- return PANGO_STRETCH_SEMI_CONDENSED;
+ return PANGO2_STRETCH_SEMI_CONDENSED;
case FC_WIDTH_SEMIEXPANDED:
- return PANGO_STRETCH_SEMI_EXPANDED;
+ return PANGO2_STRETCH_SEMI_EXPANDED;
case FC_WIDTH_EXPANDED:
- return PANGO_STRETCH_EXPANDED;
+ return PANGO2_STRETCH_EXPANDED;
case FC_WIDTH_EXTRAEXPANDED:
- return PANGO_STRETCH_EXTRA_EXPANDED;
+ return PANGO2_STRETCH_EXTRA_EXPANDED;
case FC_WIDTH_ULTRAEXPANDED:
- return PANGO_STRETCH_ULTRA_EXPANDED;
+ return PANGO2_STRETCH_ULTRA_EXPANDED;
default:
- return PANGO_STRETCH_NORMAL;
+ return PANGO2_STRETCH_NORMAL;
}
}
-static PangoWeight
+static Pango2Weight
convert_fc_weight_to_pango (double fc_weight)
{
return FcWeightToOpenTypeDouble (fc_weight);
}
-#define PANGO_FC_GRAVITY "gravity"
+#define PANGO2_FC_GRAVITY "gravity"
/* Create font description that matches the pattern.
* We explicitly don't want to include variant, gravity,
* variations and font features here, since there are
- * handled on the font level, by PangoHbFont, not
- * by PangoHbFace.
+ * handled on the font level, by Pango2HbFont, not
+ * by Pango2HbFace.
*/
-static PangoFontDescription *
-pango_font_description_from_pattern (FcPattern *pattern)
+static Pango2FontDescription *
+pango2_font_description_from_pattern (FcPattern *pattern)
{
- PangoFontDescription *desc;
- PangoStyle style;
- PangoWeight weight;
- PangoStretch stretch;
+ Pango2FontDescription *desc;
+ Pango2Style style;
+ Pango2Weight weight;
+ Pango2Stretch stretch;
FcChar8 *s;
int i;
double d;
FcResult res;
- desc = pango_font_description_new ();
+ desc = pango2_font_description_new ();
res = FcPatternGetString (pattern, FC_FAMILY, 0, (FcChar8 **) &s);
g_assert (res == FcResultMatch);
- pango_font_description_set_family (desc, (char *)s);
+ pango2_font_description_set_family (desc, (char *)s);
if (FcPatternGetInteger (pattern, FC_SLANT, 0, &i) == FcResultMatch)
style = convert_fc_slant_to_pango (i);
else
- style = PANGO_STYLE_NORMAL;
+ style = PANGO2_STYLE_NORMAL;
- pango_font_description_set_style (desc, style);
+ pango2_font_description_set_style (desc, style);
if (FcPatternGetDouble (pattern, FC_WEIGHT, 0, &d) == FcResultMatch)
weight = convert_fc_weight_to_pango (d);
else
- weight = PANGO_WEIGHT_NORMAL;
+ weight = PANGO2_WEIGHT_NORMAL;
- pango_font_description_set_weight (desc, weight);
+ pango2_font_description_set_weight (desc, weight);
if (FcPatternGetInteger (pattern, FC_WIDTH, 0, &i) == FcResultMatch)
stretch = convert_fc_width_to_pango (i);
else
- stretch = PANGO_STRETCH_NORMAL;
+ stretch = PANGO2_STRETCH_NORMAL;
- pango_font_description_set_stretch (desc, stretch);
+ pango2_font_description_set_stretch (desc, stretch);
return desc;
}
@@ -225,8 +225,8 @@ style_name_from_pattern (FcPattern *pattern)
}
static gboolean
-font_matrix_from_pattern (FcPattern *pattern,
- PangoMatrix *matrix)
+font_matrix_from_pattern (FcPattern *pattern,
+ Pango2Matrix *matrix)
{
FcMatrix fc_matrix, *fc_matrix_val;
int i;
@@ -248,18 +248,18 @@ font_matrix_from_pattern (FcPattern *pattern,
return FALSE;
}
-static PangoHbFace *
-pango_hb_face_from_pattern (PangoFcFontMap *self,
- FcPattern *pattern,
- GHashTable *lang_hash)
+static Pango2HbFace *
+pango2_hb_face_from_pattern (Pango2FcFontMap *self,
+ FcPattern *pattern,
+ GHashTable *lang_hash)
{
const char *family_name, *file;
int index;
int instance_id;
- PangoFontDescription *description;
+ Pango2FontDescription *description;
const char *name;
- PangoHbFace *face;
- PangoMatrix font_matrix;
+ Pango2HbFace *face;
+ Pango2Matrix font_matrix;
FcLangSet *langs;
gboolean variable;
@@ -284,20 +284,20 @@ pango_hb_face_from_pattern (PangoFcFontMap *self,
if (variable)
instance_id = -2;
- description = pango_font_description_from_pattern (pattern);
+ description = pango2_font_description_from_pattern (pattern);
name = style_name_from_pattern (pattern);
- face = pango_hb_face_new_from_file (file, index, instance_id, name, description);
+ face = pango2_hb_face_new_from_file (file, index, instance_id, name, description);
- pango_font_description_free (description);
+ pango2_font_description_free (description);
if (font_matrix_from_pattern (pattern, &font_matrix))
- pango_hb_face_set_matrix (face, &font_matrix);
+ pango2_hb_face_set_matrix (face, &font_matrix);
if (FcPatternGetLangSet (pattern, FC_LANG, 0, &langs) == FcResultMatch)
{
- PangoFcLanguageSet lookup;
- PangoLanguageSet *languages;
+ Pango2FcLanguageSet lookup;
+ Pango2LanguageSet *languages;
FcLangSet *empty = FcLangSetCreate ();
if (!FcLangSetEqual (langs, empty))
@@ -306,10 +306,10 @@ pango_hb_face_from_pattern (PangoFcFontMap *self,
languages = g_hash_table_lookup (lang_hash, &lookup);
if (!languages)
{
- languages = PANGO_LANGUAGE_SET (pango_fc_language_set_new (langs));
+ languages = PANGO2_LANGUAGE_SET (pango2_fc_language_set_new (langs));
g_hash_table_add (lang_hash, languages);
}
- pango_hb_face_set_language_set (face, languages);
+ pango2_hb_face_set_language_set (face, languages);
}
FcLangSetDestroy (empty);
@@ -319,12 +319,12 @@ pango_hb_face_from_pattern (PangoFcFontMap *self,
}
/* }}} */
-/* {{{ PangoFontMap implementation */
+/* {{{ Pango2FontMap implementation */
static void
-pango_fc_font_map_populate (PangoFontMap *map)
+pango2_fc_font_map_populate (Pango2FontMap *map)
{
- PangoFcFontMap *self = PANGO_FC_FONT_MAP (map);
+ Pango2FcFontMap *self = PANGO2_FC_FONT_MAP (map);
FcPattern *pat;
FcFontSet *fontset;
int k;
@@ -332,7 +332,7 @@ pango_fc_font_map_populate (PangoFontMap *map)
FcObjectSet *os;
gint64 before G_GNUC_UNUSED;
- before = PANGO_TRACE_CURRENT_TIME;
+ before = PANGO2_TRACE_CURRENT_TIME;
os = FcObjectSetBuild (FC_FAMILY, FC_SPACING, FC_STYLE, FC_WEIGHT,
FC_WIDTH, FC_SLANT, FC_VARIABLE, FC_FONTFORMAT,
@@ -342,17 +342,17 @@ pango_fc_font_map_populate (PangoFontMap *map)
fontset = FcFontList (self->config, pat, os);
FcPatternDestroy (pat);
- lang_hash = g_hash_table_new_full ((GHashFunc) pango_fc_language_set_hash,
- (GEqualFunc) pango_fc_language_set_equal,
+ lang_hash = g_hash_table_new_full ((GHashFunc) pango2_fc_language_set_hash,
+ (GEqualFunc) pango2_fc_language_set_equal,
NULL, g_object_unref);
for (k = 0; k < fontset->nfont; k++)
{
- PangoHbFace *face = pango_hb_face_from_pattern (self, fontset->fonts[k], lang_hash);
+ Pango2HbFace *face = pango2_hb_face_from_pattern (self, fontset->fonts[k], lang_hash);
if (!face)
continue;
- pango_font_map_add_face (PANGO_FONT_MAP (self), PANGO_FONT_FACE (face));
+ pango2_font_map_add_face (PANGO2_FONT_MAP (self), PANGO2_FONT_FACE (face));
}
g_hash_table_unref (lang_hash);
@@ -372,7 +372,7 @@ pango_fc_font_map_populate (PangoFontMap *map)
FcResult res;
const char *family_name;
- if (pango_font_map_get_family (map, alias_names[i]))
+ if (pango2_font_map_get_family (map, alias_names[i]))
continue;
pattern = FcPatternCreate ();
@@ -385,14 +385,14 @@ pango_fc_font_map_populate (PangoFontMap *map)
if (FcPatternGetString (ret, FC_FAMILY, 0, (FcChar8 **)(void*)&family_name) == FcResultMatch)
{
- PangoFontFamily *family = pango_font_map_get_family (map, family_name);
+ Pango2FontFamily *family = pango2_font_map_get_family (map, family_name);
if (family)
{
- PangoGenericFamily *alias_family;
+ Pango2GenericFamily *alias_family;
- alias_family = pango_generic_family_new (alias_names[i]);
- pango_generic_family_add_family (alias_family, family);
- pango_font_map_add_family (map, PANGO_FONT_FAMILY (alias_family));
+ alias_family = pango2_generic_family_new (alias_names[i]);
+ pango2_generic_family_add_family (alias_family, family);
+ pango2_font_map_add_family (map, PANGO2_FONT_FAMILY (alias_family));
}
}
@@ -419,16 +419,16 @@ pango_fc_font_map_populate (PangoFontMap *map)
for (int i = 0; i < G_N_ELEMENTS (generic_names); i++)
{
- PangoGenericFamily *generic_family;
+ Pango2GenericFamily *generic_family;
GHashTable *families_hash;
FcPattern *pattern;
FcFontSet *ret;
FcResult res;
- if (pango_font_map_get_family (map, generic_names[i]))
+ if (pango2_font_map_get_family (map, generic_names[i]))
continue;
- generic_family = pango_generic_family_new (generic_names[i]);
+ generic_family = pango2_generic_family_new (generic_names[i]);
families_hash = g_hash_table_new (NULL, NULL);
@@ -441,7 +441,7 @@ pango_fc_font_map_populate (PangoFontMap *map)
ret = FcFontSort (self->config, pattern, TRUE, NULL, &res);
for (int j = 0; j < ret->nfont; j++)
{
- PangoHbFamily *family;
+ Pango2HbFamily *family;
const char *file;
int index;
FcLangSet *langs;
@@ -479,14 +479,14 @@ pango_fc_font_map_populate (PangoFontMap *map)
index = index & 0xffff;
- family = PANGO_HB_FAMILY (pango_font_map_get_family (map, family_name));
+ family = PANGO2_HB_FAMILY (pango2_font_map_get_family (map, family_name));
if (!family)
continue;
if (g_hash_table_contains (families_hash, family))
continue;
- pango_generic_family_add_family (generic_family, PANGO_FONT_FAMILY (family));
+ pango2_generic_family_add_family (generic_family, PANGO2_FONT_FAMILY (family));
g_hash_table_add (families_hash, family);
}
@@ -495,7 +495,7 @@ pango_fc_font_map_populate (PangoFontMap *map)
g_hash_table_unref (families_hash);
if (g_list_model_get_n_items (G_LIST_MODEL (generic_family)) > 0)
- pango_font_map_add_family (map, PANGO_FONT_FAMILY (generic_family));
+ pango2_font_map_add_family (map, PANGO2_FONT_FAMILY (generic_family));
else
g_object_unref (generic_family);
}
@@ -505,69 +505,69 @@ pango_fc_font_map_populate (PangoFontMap *map)
FcObjectSetDestroy (os);
- pango_trace_mark (before, "populate FcFontMap", NULL);
+ pango2_trace_mark (before, "populate FcFontMap", NULL);
}
/* }}} */
-/* {{{ PangoFcFontMap implementation */
+/* {{{ Pango2FcFontMap implementation */
-G_DEFINE_FINAL_TYPE (PangoFcFontMap, pango_fc_font_map, PANGO_TYPE_FONT_MAP)
+G_DEFINE_FINAL_TYPE (Pango2FcFontMap, pango2_fc_font_map, PANGO2_TYPE_FONT_MAP)
static void
-pango_fc_font_map_init (PangoFcFontMap *self)
+pango2_fc_font_map_init (Pango2FcFontMap *self)
{
- pango_font_map_repopulate (PANGO_FONT_MAP (self), TRUE);
+ pango2_font_map_repopulate (PANGO2_FONT_MAP (self), TRUE);
}
static void
-pango_fc_font_map_finalize (GObject *object)
+pango2_fc_font_map_finalize (GObject *object)
{
- PangoFcFontMap *self = PANGO_FC_FONT_MAP (object);
+ Pango2FcFontMap *self = PANGO2_FC_FONT_MAP (object);
if (self->config)
FcConfigDestroy (self->config);
- G_OBJECT_CLASS (pango_fc_font_map_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_fc_font_map_parent_class)->finalize (object);
}
static void
-pango_fc_font_map_class_init (PangoFcFontMapClass *class)
+pango2_fc_font_map_class_init (Pango2FcFontMapClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontMapClass *font_map_class = PANGO_FONT_MAP_CLASS (class);
+ Pango2FontMapClass *font_map_class = PANGO2_FONT_MAP_CLASS (class);
gint64 before G_GNUC_UNUSED;
- before = PANGO_TRACE_CURRENT_TIME;
+ before = PANGO2_TRACE_CURRENT_TIME;
FcInit ();
- pango_trace_mark (before, "FcInit", NULL);
+ pango2_trace_mark (before, "FcInit", NULL);
- object_class->finalize = pango_fc_font_map_finalize;
+ object_class->finalize = pango2_fc_font_map_finalize;
- font_map_class->populate = pango_fc_font_map_populate;
+ font_map_class->populate = pango2_fc_font_map_populate;
}
/* }}} */
/* {{{ Public API */
/**
- * pango_fc_font_map_new:
+ * pango2_fc_font_map_new:
*
- * Creates a new `PangoFcFontMap` using the default
+ * Creates a new `Pango2FcFontMap` using the default
* fontconfig configuration.
*
- * Returns: a new `PangoFcFontMap`
+ * Returns: a new `Pango2FcFontMap`
*/
-PangoFcFontMap *
-pango_fc_font_map_new (void)
+Pango2FcFontMap *
+pango2_fc_font_map_new (void)
{
- return g_object_new (PANGO_TYPE_FC_FONT_MAP, NULL);
+ return g_object_new (PANGO2_TYPE_FC_FONT_MAP, NULL);
}
/**
- * pango_fc_font_map_set_config: (skip)
- * @self: a `PangoFcFontMap`
+ * pango2_fc_font_map_set_config: (skip)
+ * @self: a `Pango2FcFontMap`
* @config: (nullable): the `FcConfig` to use, or `NULL` to use
* the default configuration
*
@@ -577,10 +577,10 @@ pango_fc_font_map_new (void)
* removes all cached font families, faces and fonts.
*/
void
-pango_fc_font_map_set_config (PangoFcFontMap *self,
- FcConfig *config)
+pango2_fc_font_map_set_config (Pango2FcFontMap *self,
+ FcConfig *config)
{
- g_return_if_fail (PANGO_IS_FC_FONT_MAP (self));
+ g_return_if_fail (PANGO2_IS_FC_FONT_MAP (self));
if (self->config == config && FcConfigUptoDate (config))
return;
@@ -596,25 +596,25 @@ pango_fc_font_map_set_config (PangoFcFontMap *self,
FcConfigReference (self->config);
}
- pango_font_map_repopulate (PANGO_FONT_MAP (self), TRUE);
+ pango2_font_map_repopulate (PANGO2_FONT_MAP (self), TRUE);
}
/**
- * pango_fc_font_map_get_config: (skip)
- * @self: a `PangoFcFontMap`
+ * pango2_fc_font_map_get_config: (skip)
+ * @self: a `Pango2FcFontMap`
*
* Fetches the fontconfig configuration of the fontmap.
*
- * See also: [method@PangoFc.FontMap.set_config].
+ * See also: [method@Pango2Fc.FontMap.set_config].
*
* Returns: (nullable): the `FcConfig` object attached to
* @self, which might be `NULL`. The return value is
- * owned by Pango and should not be freed.
+ * owned by Pango2 and should not be freed.
*/
FcConfig *
-pango_fc_font_map_get_config (PangoFcFontMap *self)
+pango2_fc_font_map_get_config (Pango2FcFontMap *self)
{
- g_return_val_if_fail (PANGO_IS_FC_FONT_MAP (self), NULL);
+ g_return_val_if_fail (PANGO2_IS_FC_FONT_MAP (self), NULL);
return self->config;
}
diff --git a/pango/pangofc-fontmap.h b/pango/pangofc-fontmap.h
index abe12d23..f11d17b3 100644
--- a/pango/pangofc-fontmap.h
+++ b/pango/pangofc-fontmap.h
@@ -24,19 +24,19 @@
G_BEGIN_DECLS
-#define PANGO_TYPE_FC_FONT_MAP (pango_fc_font_map_get_type ())
+#define PANGO2_TYPE_FC_FONT_MAP (pango2_fc_font_map_get_type ())
-PANGO_AVAILABLE_IN_ALL
-PANGO_DECLARE_INTERNAL_TYPE (PangoFcFontMap, pango_fc_font_map, PANGO, FC_FONT_MAP, PangoFontMap)
+PANGO2_AVAILABLE_IN_ALL
+PANGO2_DECLARE_INTERNAL_TYPE (Pango2FcFontMap, pango2_fc_font_map, PANGO2, FC_FONT_MAP, Pango2FontMap)
-PANGO_AVAILABLE_IN_ALL
-PangoFcFontMap * pango_fc_font_map_new (void);
+PANGO2_AVAILABLE_IN_ALL
+Pango2FcFontMap * pango2_fc_font_map_new (void);
-PANGO_AVAILABLE_IN_ALL
-void pango_fc_font_map_set_config (PangoFcFontMap *self,
- FcConfig *config);
+PANGO2_AVAILABLE_IN_ALL
+void pango2_fc_font_map_set_config (Pango2FcFontMap *self,
+ FcConfig *config);
-PANGO_AVAILABLE_IN_ALL
-FcConfig * pango_fc_font_map_get_config (PangoFcFontMap *self);
+PANGO2_AVAILABLE_IN_ALL
+FcConfig * pango2_fc_font_map_get_config (Pango2FcFontMap *self);
G_END_DECLS
diff --git a/pango/pangofc-language-set-private.h b/pango/pangofc-language-set-private.h
index ce216ad7..e1c48d4c 100644
--- a/pango/pangofc-language-set-private.h
+++ b/pango/pangofc-language-set-private.h
@@ -23,24 +23,24 @@
#include <fontconfig/fontconfig.h>
-#define PANGO_TYPE_FC_LANGUAGE_SET (pango_fc_language_set_get_type ())
+#define PANGO2_TYPE_FC_LANGUAGE_SET (pango2_fc_language_set_get_type ())
-G_DECLARE_FINAL_TYPE (PangoFcLanguageSet, pango_fc_language_set, PANGO, FC_LANGUAGE_SET, PangoLanguageSet)
+G_DECLARE_FINAL_TYPE (Pango2FcLanguageSet, pango2_fc_language_set, PANGO2, FC_LANGUAGE_SET, Pango2LanguageSet)
-struct _PangoFcLanguageSet
+struct _Pango2FcLanguageSet
{
- PangoLanguageSet parent_instance;
+ Pango2LanguageSet parent_instance;
FcLangSet *langs;
};
-struct _PangoFcLanguageSetClass
+struct _Pango2FcLanguageSetClass
{
- PangoLanguageSetClass parent_class;
+ Pango2LanguageSetClass parent_class;
};
-PangoFcLanguageSet * pango_fc_language_set_new (FcLangSet *langs);
+Pango2FcLanguageSet * pango2_fc_language_set_new (FcLangSet *langs);
-guint pango_fc_language_set_hash (const PangoFcLanguageSet *self);
-gboolean pango_fc_language_set_equal (const PangoFcLanguageSet *a,
- const PangoFcLanguageSet *b);
+guint pango2_fc_language_set_hash (const Pango2FcLanguageSet *self);
+gboolean pango2_fc_language_set_equal (const Pango2FcLanguageSet *a,
+ const Pango2FcLanguageSet *b);
diff --git a/pango/pangofc-language-set.c b/pango/pangofc-language-set.c
index 56a32e20..1c4534c2 100644
--- a/pango/pangofc-language-set.c
+++ b/pango/pangofc-language-set.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Red Hat, Inc.
*
@@ -23,37 +23,37 @@
#include "pangofc-language-set-private.h"
-G_DEFINE_TYPE (PangoFcLanguageSet, pango_fc_language_set, PANGO_TYPE_LANGUAGE_SET)
+G_DEFINE_TYPE (Pango2FcLanguageSet, pango2_fc_language_set, PANGO2_TYPE_LANGUAGE_SET)
static void
-pango_fc_language_set_init (PangoFcLanguageSet *self)
+pango2_fc_language_set_init (Pango2FcLanguageSet *self)
{
}
static void
-pango_fc_language_set_finalize (GObject *object)
+pango2_fc_language_set_finalize (GObject *object)
{
- PangoFcLanguageSet *self = PANGO_FC_LANGUAGE_SET (object);
+ Pango2FcLanguageSet *self = PANGO2_FC_LANGUAGE_SET (object);
FcLangSetDestroy (self->langs);
- G_OBJECT_CLASS (pango_fc_language_set_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango2_fc_language_set_parent_class)->finalize (object);
}
static gboolean
-pango_fc_language_set_matches_language (PangoLanguageSet *set,
- PangoLanguage *language)
+pango2_fc_language_set_matches_language (Pango2LanguageSet *set,
+ Pango2Language *language)
{
- PangoFcLanguageSet *self = PANGO_FC_LANGUAGE_SET (set);
+ Pango2FcLanguageSet *self = PANGO2_FC_LANGUAGE_SET (set);
const char *s;
- if (language == pango_language_from_string ("c"))
+ if (language == pango2_language_from_string ("c"))
return TRUE;
- if (FcLangSetHasLang (self->langs, (FcChar8 *) pango_language_to_string (language)) != FcLangDifferentLang)
+ if (FcLangSetHasLang (self->langs, (FcChar8 *) pango2_language_to_string (language)) != FcLangDifferentLang)
return TRUE;
- s = pango_language_to_string (language);
+ s = pango2_language_to_string (language);
if (strchr (s, '-'))
{
char buf[10];
@@ -76,10 +76,10 @@ pango_fc_language_set_matches_language (PangoLanguageSet *set,
return FALSE;
}
-static PangoLanguage **
-pango_fc_language_set_get_languages (PangoLanguageSet *set)
+static Pango2Language **
+pango2_fc_language_set_get_languages (Pango2LanguageSet *set)
{
- PangoFcLanguageSet *self = PANGO_FC_LANGUAGE_SET (set);
+ Pango2FcLanguageSet *self = PANGO2_FC_LANGUAGE_SET (set);
FcStrSet *strset;
FcStrList *list;
FcChar8 *s;
@@ -92,34 +92,34 @@ pango_fc_language_set_get_languages (PangoLanguageSet *set)
FcStrListFirst (list);
while ((s = FcStrListNext (list)))
- g_ptr_array_add (langs, pango_language_from_string ((const char *)s));
+ g_ptr_array_add (langs, pango2_language_from_string ((const char *)s));
FcStrListDone (list);
FcStrSetDestroy (strset);
g_ptr_array_add (langs, NULL);
- return (PangoLanguage **) g_ptr_array_free (langs, FALSE);
+ return (Pango2Language **) g_ptr_array_free (langs, FALSE);
}
static void
-pango_fc_language_set_class_init (PangoFcLanguageSetClass *class)
+pango2_fc_language_set_class_init (Pango2FcLanguageSetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoLanguageSetClass *language_set_class = PANGO_LANGUAGE_SET_CLASS (class);
+ Pango2LanguageSetClass *language_set_class = PANGO2_LANGUAGE_SET_CLASS (class);
- object_class->finalize = pango_fc_language_set_finalize;
+ object_class->finalize = pango2_fc_language_set_finalize;
- language_set_class->matches_language = pango_fc_language_set_matches_language;
- language_set_class->get_languages = pango_fc_language_set_get_languages;
+ language_set_class->matches_language = pango2_fc_language_set_matches_language;
+ language_set_class->get_languages = pango2_fc_language_set_get_languages;
}
-PangoFcLanguageSet *
-pango_fc_language_set_new (FcLangSet *langs)
+Pango2FcLanguageSet *
+pango2_fc_language_set_new (FcLangSet *langs)
{
- PangoFcLanguageSet *self;
+ Pango2FcLanguageSet *self;
- self = g_object_new (PANGO_TYPE_FC_LANGUAGE_SET, NULL);
+ self = g_object_new (PANGO2_TYPE_FC_LANGUAGE_SET, NULL);
self->langs = FcLangSetCopy (langs);
@@ -127,14 +127,14 @@ pango_fc_language_set_new (FcLangSet *langs)
}
guint
-pango_fc_language_set_hash (const PangoFcLanguageSet *self)
+pango2_fc_language_set_hash (const Pango2FcLanguageSet *self)
{
return (guint) FcLangSetHash (self->langs);
}
gboolean
-pango_fc_language_set_equal (const PangoFcLanguageSet *a,
- const PangoFcLanguageSet *b)
+pango2_fc_language_set_equal (const Pango2FcLanguageSet *a,
+ const Pango2FcLanguageSet *b)
{
return FcLangSetEqual (a->langs, b->langs);
}
diff --git a/pango/serializer.c b/pango/serializer.c
index de8494fd..07e28ff9 100644
--- a/pango/serializer.c
+++ b/pango/serializer.c
@@ -1,5 +1,5 @@
-/* Pango
- * serializer.c: Code to serialize various Pango objects
+/* Pango2
+ * serializer.c: Code to serialize various Pango2 objects
*
* Copyright (C) 2021 Red Hat, Inc
*
@@ -38,7 +38,7 @@
/* {{{ Error handling */
-G_DEFINE_QUARK(pango-layout-deserialize-error-quark, pango_layout_deserialize_error)
+G_DEFINE_QUARK(pango-layout-deserialize-error-quark, pango2_layout_deserialize_error)
/* }}} */
/* {{{ Enum names */
@@ -165,13 +165,13 @@ get_weight_name (int weight)
return NULL;
}
-static PangoAttrType
+static Pango2AttrType
get_attr_type (const char *nick)
{
GEnumClass *enum_class;
GEnumValue *enum_value = NULL;
- enum_class = g_type_class_ref (PANGO_TYPE_ATTR_TYPE);
+ enum_class = g_type_class_ref (PANGO2_TYPE_ATTR_TYPE);
for (int i = 0; i < enum_class->n_values; i++)
{
enum_value = &enum_class->values[i];
@@ -188,12 +188,12 @@ get_attr_type (const char *nick)
}
static const char *
-get_attr_type_name (PangoAttrType type)
+get_attr_type_name (Pango2AttrType type)
{
GEnumClass *enum_class;
GEnumValue *enum_value = NULL;
- enum_class = g_type_class_ref (PANGO_TYPE_ATTR_TYPE);
+ enum_class = g_type_class_ref (PANGO2_TYPE_ATTR_TYPE);
for (int i = 0; i < enum_class->n_values; i++)
{
enum_value = &enum_class->values[i];
@@ -264,84 +264,84 @@ static const char *ellipsize_names[] = {
/* {{{ Serialization */
static char *
-font_description_to_string (PangoFontDescription *desc)
+font_description_to_string (Pango2FontDescription *desc)
{
- PangoFontDescription *copy;
+ Pango2FontDescription *copy;
char *s;
/* Leave out the faceid for now, since it would make serialization
* backend-dependent.
*/
- copy = pango_font_description_copy_static (desc);
- pango_font_description_unset_fields (copy, PANGO_FONT_MASK_FACEID);
- s = pango_font_description_to_string (copy);
- pango_font_description_free (copy);
+ copy = pango2_font_description_copy_static (desc);
+ pango2_font_description_unset_fields (copy, PANGO2_FONT_MASK_FACEID);
+ s = pango2_font_description_to_string (copy);
+ pango2_font_description_free (copy);
return s;
}
static void
add_attribute (GtkJsonPrinter *printer,
- PangoAttribute *attr)
+ Pango2Attribute *attr)
{
char *str;
gtk_json_printer_start_object (printer, NULL);
- if (attr->start_index != PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING)
+ if (attr->start_index != PANGO2_ATTR_INDEX_FROM_TEXT_BEGINNING)
gtk_json_printer_add_integer (printer, "start", (int)attr->start_index);
- if (attr->end_index != PANGO_ATTR_INDEX_TO_TEXT_END)
+ if (attr->end_index != PANGO2_ATTR_INDEX_TO_TEXT_END)
gtk_json_printer_add_integer (printer, "end", (int)attr->end_index);
gtk_json_printer_add_string (printer, "type", get_attr_type_name (attr->type));
- switch (PANGO_ATTR_VALUE_TYPE (attr))
+ switch (PANGO2_ATTR_VALUE_TYPE (attr))
{
- case PANGO_ATTR_VALUE_STRING:
+ case PANGO2_ATTR_VALUE_STRING:
gtk_json_printer_add_string (printer, "value", attr->str_value);
break;
- case PANGO_ATTR_VALUE_INT:
+ case PANGO2_ATTR_VALUE_INT:
switch ((int)attr->type)
{
- case PANGO_ATTR_STYLE:
+ case PANGO2_ATTR_STYLE:
gtk_json_printer_add_string (printer, "value", style_names[attr->int_value]);
break;
- case PANGO_ATTR_VARIANT:
+ case PANGO2_ATTR_VARIANT:
gtk_json_printer_add_string (printer, "value", variant_names[attr->int_value]);
break;
- case PANGO_ATTR_STRETCH:
+ case PANGO2_ATTR_STRETCH:
gtk_json_printer_add_string (printer, "value", stretch_names[attr->int_value]);
break;
- case PANGO_ATTR_UNDERLINE:
- case PANGO_ATTR_STRIKETHROUGH:
- case PANGO_ATTR_OVERLINE:
+ case PANGO2_ATTR_UNDERLINE:
+ case PANGO2_ATTR_STRIKETHROUGH:
+ case PANGO2_ATTR_OVERLINE:
gtk_json_printer_add_string (printer, "value", line_style_names[attr->int_value]);
break;
- case PANGO_ATTR_UNDERLINE_POSITION:
+ case PANGO2_ATTR_UNDERLINE_POSITION:
gtk_json_printer_add_string (printer, "value", underline_position_names[attr->int_value]);
break;
- case PANGO_ATTR_GRAVITY:
+ case PANGO2_ATTR_GRAVITY:
gtk_json_printer_add_string (printer, "value", gravity_names[attr->int_value]);
break;
- case PANGO_ATTR_GRAVITY_HINT:
+ case PANGO2_ATTR_GRAVITY_HINT:
gtk_json_printer_add_string (printer, "value", gravity_hint_names[attr->int_value]);
break;
- case PANGO_ATTR_TEXT_TRANSFORM:
+ case PANGO2_ATTR_TEXT_TRANSFORM:
gtk_json_printer_add_string (printer, "value", text_transform_names[attr->int_value]);
break;
- case PANGO_ATTR_FONT_SCALE:
+ case PANGO2_ATTR_FONT_SCALE:
gtk_json_printer_add_string (printer, "value", font_scale_names[attr->int_value]);
break;
- case PANGO_ATTR_WEIGHT:
+ case PANGO2_ATTR_WEIGHT:
{
const char *name = get_weight_name (attr->int_value);
if (name)
@@ -351,7 +351,7 @@ add_attribute (GtkJsonPrinter *printer,
}
break;
- case PANGO_ATTR_BASELINE_SHIFT:
+ case PANGO2_ATTR_BASELINE_SHIFT:
gtk_json_printer_add_string (printer, "value", baseline_shift_names[attr->int_value]);
break;
@@ -362,32 +362,32 @@ add_attribute (GtkJsonPrinter *printer,
break;
- case PANGO_ATTR_VALUE_BOOLEAN:
+ case PANGO2_ATTR_VALUE_BOOLEAN:
gtk_json_printer_add_boolean (printer, "value", attr->boolean_value);
break;
- case PANGO_ATTR_VALUE_LANGUAGE:
- gtk_json_printer_add_string (printer, "value", pango_language_to_string (attr->lang_value));
+ case PANGO2_ATTR_VALUE_LANGUAGE:
+ gtk_json_printer_add_string (printer, "value", pango2_language_to_string (attr->lang_value));
break;
- case PANGO_ATTR_VALUE_FONT_DESC:
+ case PANGO2_ATTR_VALUE_FONT_DESC:
str = font_description_to_string (attr->font_value);
gtk_json_printer_add_string (printer, "value", str);
g_free (str);
break;
- case PANGO_ATTR_VALUE_COLOR:
- str = pango_color_to_string (&attr->color_value);
+ case PANGO2_ATTR_VALUE_COLOR:
+ str = pango2_color_to_string (&attr->color_value);
gtk_json_printer_add_string (printer, "value", str);
g_free (str);
break;
- case PANGO_ATTR_VALUE_FLOAT:
+ case PANGO2_ATTR_VALUE_FLOAT:
gtk_json_printer_add_number (printer, "value", attr->double_value);
break;
- case PANGO_ATTR_VALUE_POINTER:
- str = pango_attr_value_serialize (attr);
+ case PANGO2_ATTR_VALUE_POINTER:
+ str = pango2_attr_value_serialize (attr);
gtk_json_printer_add_string (printer, "value", str);
g_free (str);
break;
@@ -401,14 +401,14 @@ add_attribute (GtkJsonPrinter *printer,
static void
add_attr_list (GtkJsonPrinter *printer,
- PangoAttrList *attrs)
+ Pango2AttrList *attrs)
{
GSList *attributes, *l;
if (!attrs)
return;
- attributes = pango_attr_list_get_attributes (attrs);
+ attributes = pango2_attr_list_get_attributes (attrs);
if (!attributes)
return;
@@ -417,34 +417,34 @@ add_attr_list (GtkJsonPrinter *printer,
for (l = attributes; l; l = l->next)
{
- PangoAttribute *attr = l->data;
+ Pango2Attribute *attr = l->data;
add_attribute (printer, attr);
}
- g_slist_free_full (attributes, (GDestroyNotify) pango_attribute_destroy);
+ g_slist_free_full (attributes, (GDestroyNotify) pango2_attribute_destroy);
gtk_json_printer_end (printer);
}
static void
add_tab_array (GtkJsonPrinter *printer,
- PangoTabArray *tabs)
+ Pango2TabArray *tabs)
{
- if (!tabs || pango_tab_array_get_size (tabs) == 0)
+ if (!tabs || pango2_tab_array_get_size (tabs) == 0)
return;
gtk_json_printer_start_object (printer, "tabs");
- gtk_json_printer_add_boolean (printer, "positions-in-pixels", pango_tab_array_get_positions_in_pixels (tabs));
+ gtk_json_printer_add_boolean (printer, "positions-in-pixels", pango2_tab_array_get_positions_in_pixels (tabs));
gtk_json_printer_start_array (printer, "positions");
- for (int i = 0; i < pango_tab_array_get_size (tabs); i++)
+ for (int i = 0; i < pango2_tab_array_get_size (tabs); i++)
{
- PangoTabAlign align;
+ Pango2TabAlign align;
int pos;
- pango_tab_array_get_tab (tabs, i, &align, &pos);
+ pango2_tab_array_get_tab (tabs, i, &align, &pos);
gtk_json_printer_start_object (printer, NULL);
gtk_json_printer_add_integer (printer, "position", pos);
gtk_json_printer_add_string (printer, "alignment", tab_align_names[align]);
- gtk_json_printer_add_integer (printer, "decimal-point", pango_tab_array_get_decimal_point (tabs, i));
+ gtk_json_printer_add_integer (printer, "decimal-point", pango2_tab_array_get_decimal_point (tabs, i));
gtk_json_printer_end (printer);
}
gtk_json_printer_end (printer);
@@ -454,11 +454,11 @@ add_tab_array (GtkJsonPrinter *printer,
static void
add_context (GtkJsonPrinter *printer,
- PangoContext *context)
+ Pango2Context *context)
{
char *str;
- const PangoMatrix *matrix;
- PangoMatrix identity = PANGO_MATRIX_INIT;
+ const Pango2Matrix *matrix;
+ Pango2Matrix identity = PANGO2_MATRIX_INIT;
gtk_json_printer_start_object (printer, "context");
@@ -472,14 +472,14 @@ add_context (GtkJsonPrinter *printer,
g_free (str);
if (context->set_language)
- gtk_json_printer_add_string (printer, "language", pango_language_to_string (context->set_language));
+ gtk_json_printer_add_string (printer, "language", pango2_language_to_string (context->set_language));
gtk_json_printer_add_string (printer, "base-gravity", gravity_names[context->base_gravity]);
gtk_json_printer_add_string (printer, "gravity-hint", gravity_hint_names[context->gravity_hint]);
gtk_json_printer_add_string (printer, "base-dir", direction_names[context->base_dir]);
gtk_json_printer_add_boolean (printer, "round-glyph-positions", context->round_glyph_positions);
- matrix = pango_context_get_matrix (context);
+ matrix = pango2_context_get_matrix (context);
if (!matrix)
matrix = &identity;
@@ -497,7 +497,7 @@ add_context (GtkJsonPrinter *printer,
static void
add_log_attrs (GtkJsonPrinter *printer,
- const PangoLogAttr *log_attrs,
+ const Pango2LogAttr *log_attrs,
int n_attrs)
{
gtk_json_printer_start_array (printer, "log-attrs");
@@ -544,9 +544,9 @@ add_log_attrs (GtkJsonPrinter *printer,
static void
add_font (GtkJsonPrinter *printer,
const char *member,
- PangoFont *font)
+ Pango2Font *font)
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
char *str;
hb_font_t *hb_font;
hb_face_t *face;
@@ -555,17 +555,17 @@ add_font (GtkJsonPrinter *printer,
guint length;
const int *coords;
const hb_feature_t *features;
- PangoMatrix matrix;
+ Pango2Matrix matrix;
gtk_json_printer_start_object (printer, member);
- desc = pango_font_describe (font);
+ desc = pango2_font_describe (font);
str = font_description_to_string (desc);
gtk_json_printer_add_string (printer, "description", str);
g_free (str);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
- hb_font = pango_font_get_hb_font (font);
+ hb_font = pango2_font_get_hb_font (font);
face = hb_font_get_face (hb_font);
blob = hb_face_reference_blob (face);
@@ -603,8 +603,8 @@ add_font (GtkJsonPrinter *printer,
}
length = 0;
- if (PANGO_IS_HB_FONT (font))
- features = pango_hb_font_get_features (PANGO_HB_FONT (font), &length);
+ if (PANGO2_IS_HB_FONT (font))
+ features = pango2_hb_font_get_features (PANGO2_HB_FONT (font), &length);
if (length > 0)
{
gtk_json_printer_start_object (printer, "features");
@@ -620,8 +620,8 @@ add_font (GtkJsonPrinter *printer,
gtk_json_printer_end (printer);
}
- pango_font_get_transform (font, &matrix);
- if (!pango_matrix_equal (&matrix, &(const PangoMatrix)PANGO_MATRIX_INIT))
+ pango2_font_get_transform (font, &matrix);
+ if (!pango2_matrix_equal (&matrix, &(const Pango2Matrix)PANGO2_MATRIX_INIT))
{
gtk_json_printer_start_array (printer, "matrix");
gtk_json_printer_add_number (printer, NULL, matrix.xx);
@@ -636,14 +636,14 @@ add_font (GtkJsonPrinter *printer,
gtk_json_printer_end (printer);
}
-#define ANALYSIS_FLAGS (PANGO_ANALYSIS_FLAG_CENTERED_BASELINE | \
- PANGO_ANALYSIS_FLAG_IS_ELLIPSIS | \
- PANGO_ANALYSIS_FLAG_NEED_HYPHEN)
+#define ANALYSIS_FLAGS (PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE | \
+ PANGO2_ANALYSIS_FLAG_IS_ELLIPSIS | \
+ PANGO2_ANALYSIS_FLAG_NEED_HYPHEN)
static void
add_run (GtkJsonPrinter *printer,
const char *text,
- PangoGlyphItem *run)
+ Pango2GlyphItem *run)
{
char *str;
char buf[5] = { 0, };
@@ -659,7 +659,7 @@ add_run (GtkJsonPrinter *printer,
gtk_json_printer_add_integer (printer, "bidi-level", run->item->analysis.level);
gtk_json_printer_add_string (printer, "gravity", gravity_names[run->item->analysis.gravity]);
- gtk_json_printer_add_string (printer, "language", pango_language_to_string (run->item->analysis.language));
+ gtk_json_printer_add_string (printer, "language", pango2_language_to_string (run->item->analysis.language));
get_script_name (run->item->analysis.script, buf);
gtk_json_printer_add_string (printer, "script", buf);
@@ -674,7 +674,7 @@ add_run (GtkJsonPrinter *printer,
gtk_json_printer_start_array (printer, "extra-attributes");
for (l = run->item->analysis.extra_attrs; l; l = l->next)
{
- PangoAttribute *attr = l->data;
+ Pango2Attribute *attr = l->data;
add_attribute (printer, attr);
}
gtk_json_printer_end (printer);
@@ -718,7 +718,7 @@ add_run (GtkJsonPrinter *printer,
static void
line_to_json (GtkJsonPrinter *printer,
- PangoLine *line,
+ Pango2Line *line,
int x,
int y)
{
@@ -747,7 +747,7 @@ line_to_json (GtkJsonPrinter *printer,
gtk_json_printer_start_array (printer, "runs");
for (GSList *l = line->runs; l; l = l->next)
{
- PangoGlyphItem *run = l->data;
+ Pango2GlyphItem *run = l->data;
add_run (printer, line->data->text, run);
}
gtk_json_printer_end (printer);
@@ -759,28 +759,28 @@ line_to_json (GtkJsonPrinter *printer,
static void
lines_to_json (GtkJsonPrinter *printer,
- PangoLines *lines)
+ Pango2Lines *lines)
{
int width, height;
- PangoLine **l;
+ Pango2Line **l;
gtk_json_printer_start_object (printer, "output");
- gtk_json_printer_add_boolean (printer, "wrapped", pango_lines_is_wrapped (lines));
- gtk_json_printer_add_boolean (printer, "ellipsized", pango_lines_is_ellipsized (lines));
- gtk_json_printer_add_boolean (printer, "hypenated", pango_lines_is_hyphenated (lines));
- gtk_json_printer_add_integer (printer, "unknown-glyphs", pango_lines_get_unknown_glyphs_count (lines));
- pango_lines_get_size (lines, &width, &height);
+ gtk_json_printer_add_boolean (printer, "wrapped", pango2_lines_is_wrapped (lines));
+ gtk_json_printer_add_boolean (printer, "ellipsized", pango2_lines_is_ellipsized (lines));
+ gtk_json_printer_add_boolean (printer, "hypenated", pango2_lines_is_hyphenated (lines));
+ gtk_json_printer_add_integer (printer, "unknown-glyphs", pango2_lines_get_unknown_glyphs_count (lines));
+ pango2_lines_get_size (lines, &width, &height);
gtk_json_printer_add_integer (printer, "width", width);
gtk_json_printer_add_integer (printer, "height", height);
gtk_json_printer_start_array (printer, "lines");
- l = pango_lines_get_lines (lines);
- for (int i = 0; i < pango_lines_get_line_count (lines); i++)
+ l = pango2_lines_get_lines (lines);
+ for (int i = 0; i < pango2_lines_get_line_count (lines); i++)
{
int x, y;
- pango_lines_get_line_position (lines, i, &x, &y);
+ pango2_lines_get_line_position (lines, i, &x, &y);
line_to_json (printer, l[i], x, y);
}
@@ -791,69 +791,69 @@ lines_to_json (GtkJsonPrinter *printer,
static void
layout_to_json (GtkJsonPrinter *printer,
- PangoLayout *layout,
- PangoLayoutSerializeFlags flags)
+ Pango2Layout *layout,
+ Pango2LayoutSerializeFlags flags)
{
const char *str;
gtk_json_printer_start_object (printer, NULL);
- if (flags & PANGO_LAYOUT_SERIALIZE_CONTEXT)
- add_context (printer, pango_layout_get_context (layout));
+ if (flags & PANGO2_LAYOUT_SERIALIZE_CONTEXT)
+ add_context (printer, pango2_layout_get_context (layout));
str = (const char *) g_object_get_data (G_OBJECT (layout), "comment");
if (str)
gtk_json_printer_add_string (printer, "comment", str);
- gtk_json_printer_add_string (printer, "text", pango_layout_get_text (layout));
+ gtk_json_printer_add_string (printer, "text", pango2_layout_get_text (layout));
- add_attr_list (printer, pango_layout_get_attributes (layout));
+ add_attr_list (printer, pango2_layout_get_attributes (layout));
- if (pango_layout_get_font_description (layout))
+ if (pango2_layout_get_font_description (layout))
{
- char *str = pango_font_description_to_string (pango_layout_get_font_description (layout));
+ char *str = pango2_font_description_to_string (pango2_layout_get_font_description (layout));
gtk_json_printer_add_string (printer, "font", str);
g_free (str);
}
- add_tab_array (printer, pango_layout_get_tabs (layout));
+ add_tab_array (printer, pango2_layout_get_tabs (layout));
- if (!pango_layout_get_auto_dir (layout))
+ if (!pango2_layout_get_auto_dir (layout))
gtk_json_printer_add_boolean (printer, "auto-dir", FALSE);
- if (pango_layout_get_alignment (layout) != PANGO_ALIGN_NATURAL)
- gtk_json_printer_add_string (printer, "alignment", alignment_names[pango_layout_get_alignment (layout)]);
+ if (pango2_layout_get_alignment (layout) != PANGO2_ALIGN_NATURAL)
+ gtk_json_printer_add_string (printer, "alignment", alignment_names[pango2_layout_get_alignment (layout)]);
- if (pango_layout_get_wrap (layout) != PANGO_WRAP_WORD)
- gtk_json_printer_add_string (printer, "wrap", wrap_names[pango_layout_get_wrap (layout)]);
+ if (pango2_layout_get_wrap (layout) != PANGO2_WRAP_WORD)
+ gtk_json_printer_add_string (printer, "wrap", wrap_names[pango2_layout_get_wrap (layout)]);
- if (pango_layout_get_ellipsize (layout) != PANGO_ELLIPSIZE_NONE)
- gtk_json_printer_add_string (printer, "ellipsize", ellipsize_names[pango_layout_get_ellipsize (layout)]);
+ if (pango2_layout_get_ellipsize (layout) != PANGO2_ELLIPSIZE_NONE)
+ gtk_json_printer_add_string (printer, "ellipsize", ellipsize_names[pango2_layout_get_ellipsize (layout)]);
- if (pango_layout_get_width (layout) != -1)
- gtk_json_printer_add_integer (printer, "width", pango_layout_get_width (layout));
+ if (pango2_layout_get_width (layout) != -1)
+ gtk_json_printer_add_integer (printer, "width", pango2_layout_get_width (layout));
- if (pango_layout_get_height (layout) != -1)
- gtk_json_printer_add_integer (printer, "height", pango_layout_get_height (layout));
+ if (pango2_layout_get_height (layout) != -1)
+ gtk_json_printer_add_integer (printer, "height", pango2_layout_get_height (layout));
- if (pango_layout_get_indent (layout) != 0)
- gtk_json_printer_add_integer (printer, "indent", pango_layout_get_indent (layout));
+ if (pango2_layout_get_indent (layout) != 0)
+ gtk_json_printer_add_integer (printer, "indent", pango2_layout_get_indent (layout));
- if (pango_layout_get_line_height (layout) != 0.)
- gtk_json_printer_add_number (printer, "line-height", pango_layout_get_line_height (layout));
+ if (pango2_layout_get_line_height (layout) != 0.)
+ gtk_json_printer_add_number (printer, "line-height", pango2_layout_get_line_height (layout));
- if (pango_layout_get_spacing (layout) != 0)
- gtk_json_printer_add_integer (printer, "spacing", pango_layout_get_spacing (layout));
+ if (pango2_layout_get_spacing (layout) != 0)
+ gtk_json_printer_add_integer (printer, "spacing", pango2_layout_get_spacing (layout));
- if (flags & PANGO_LAYOUT_SERIALIZE_OUTPUT)
+ if (flags & PANGO2_LAYOUT_SERIALIZE_OUTPUT)
{
- const PangoLogAttr *log_attrs;
+ const Pango2LogAttr *log_attrs;
int n_attrs;
- log_attrs = pango_layout_get_log_attrs (layout, &n_attrs);
+ log_attrs = pango2_layout_get_log_attrs (layout, &n_attrs);
add_log_attrs (printer, log_attrs, n_attrs);
- lines_to_json (printer, pango_layout_get_lines (layout));
+ lines_to_json (printer, pango2_layout_get_lines (layout));
}
gtk_json_printer_end (printer);
@@ -896,11 +896,11 @@ parser_select_string (GtkJsonParser *parser,
return value;
}
-static PangoFontDescription *
+static Pango2FontDescription *
parser_get_font_description (GtkJsonParser *parser)
{
char *str = gtk_json_parser_get_string (parser);
- PangoFontDescription *desc = pango_font_description_from_string (str);
+ Pango2FontDescription *desc = pango2_font_description_from_string (str);
if (!desc)
gtk_json_parser_value_error (parser,
@@ -912,10 +912,10 @@ parser_get_font_description (GtkJsonParser *parser)
static void
parser_get_color (GtkJsonParser *parser,
- PangoColor *color)
+ Pango2Color *color)
{
char *str = gtk_json_parser_get_string (parser);
- if (!pango_color_parse (color, str))
+ if (!pango2_color_parse (color, str))
{
gtk_json_parser_value_error (parser,
"Failed to parse color: %s", str);
@@ -925,189 +925,189 @@ parser_get_color (GtkJsonParser *parser,
g_free (str);
}
-static PangoAttribute *
+static Pango2Attribute *
attr_for_type (GtkJsonParser *parser,
- PangoAttrType type,
+ Pango2AttrType type,
int start,
int end)
{
- PangoAttribute *attr;
- PangoFontDescription *desc;
- PangoColor color;
+ Pango2Attribute *attr;
+ Pango2FontDescription *desc;
+ Pango2Color color;
char *str;
switch (type)
{
- case PANGO_ATTR_SHAPE:
+ case PANGO2_ATTR_SHAPE:
default:
g_assert_not_reached ();
- case PANGO_ATTR_INVALID:
+ case PANGO2_ATTR_INVALID:
gtk_json_parser_schema_error (parser, "Missing attribute type");
return NULL;
- case PANGO_ATTR_LANGUAGE:
+ case PANGO2_ATTR_LANGUAGE:
str = gtk_json_parser_get_string (parser);
- attr = pango_attr_language_new (pango_language_from_string (str));
+ attr = pango2_attr_language_new (pango2_language_from_string (str));
g_free (str);
break;
- case PANGO_ATTR_FAMILY:
+ case PANGO2_ATTR_FAMILY:
str = gtk_json_parser_get_string (parser);
- attr = pango_attr_family_new (str);
+ attr = pango2_attr_family_new (str);
g_free (str);
break;
- case PANGO_ATTR_STYLE:
- attr = pango_attr_style_new ((PangoStyle) parser_select_string (parser, style_names));
+ case PANGO2_ATTR_STYLE:
+ attr = pango2_attr_style_new ((Pango2Style) parser_select_string (parser, style_names));
break;
- case PANGO_ATTR_WEIGHT:
+ case PANGO2_ATTR_WEIGHT:
if (gtk_json_parser_get_node (parser) == GTK_JSON_STRING)
- attr = pango_attr_weight_new (get_weight (parser_select_string (parser, weight_names)));
+ attr = pango2_attr_weight_new (get_weight (parser_select_string (parser, weight_names)));
else
- attr = pango_attr_weight_new ((int) gtk_json_parser_get_int (parser));
+ attr = pango2_attr_weight_new ((int) gtk_json_parser_get_int (parser));
break;
- case PANGO_ATTR_VARIANT:
- attr = pango_attr_variant_new ((PangoVariant) parser_select_string (parser, variant_names));
+ case PANGO2_ATTR_VARIANT:
+ attr = pango2_attr_variant_new ((Pango2Variant) parser_select_string (parser, variant_names));
break;
- case PANGO_ATTR_STRETCH:
- attr = pango_attr_stretch_new ((PangoStretch) parser_select_string (parser, stretch_names));
+ case PANGO2_ATTR_STRETCH:
+ attr = pango2_attr_stretch_new ((Pango2Stretch) parser_select_string (parser, stretch_names));
break;
- case PANGO_ATTR_SIZE:
- attr = pango_attr_size_new ((int) gtk_json_parser_get_number (parser));
+ case PANGO2_ATTR_SIZE:
+ attr = pango2_attr_size_new ((int) gtk_json_parser_get_number (parser));
break;
- case PANGO_ATTR_FONT_DESC:
+ case PANGO2_ATTR_FONT_DESC:
desc = parser_get_font_description (parser);
- attr = pango_attr_font_desc_new (desc);
- pango_font_description_free (desc);
+ attr = pango2_attr_font_desc_new (desc);
+ pango2_font_description_free (desc);
break;
- case PANGO_ATTR_FOREGROUND:
+ case PANGO2_ATTR_FOREGROUND:
parser_get_color (parser, &color);
- attr = pango_attr_foreground_new (&color);
+ attr = pango2_attr_foreground_new (&color);
break;
- case PANGO_ATTR_BACKGROUND:
+ case PANGO2_ATTR_BACKGROUND:
parser_get_color (parser, &color);
- attr = pango_attr_background_new (&color);
+ attr = pango2_attr_background_new (&color);
break;
- case PANGO_ATTR_UNDERLINE:
- attr = pango_attr_underline_new ((PangoLineStyle) parser_select_string (parser, line_style_names));
+ case PANGO2_ATTR_UNDERLINE:
+ attr = pango2_attr_underline_new ((Pango2LineStyle) parser_select_string (parser, line_style_names));
break;
- case PANGO_ATTR_UNDERLINE_POSITION:
- attr = pango_attr_underline_position_new ((PangoUnderlinePosition) parser_select_string (parser, underline_position_names));
+ case PANGO2_ATTR_UNDERLINE_POSITION:
+ attr = pango2_attr_underline_position_new ((Pango2UnderlinePosition) parser_select_string (parser, underline_position_names));
break;
- case PANGO_ATTR_STRIKETHROUGH:
- attr = pango_attr_strikethrough_new ((PangoLineStyle) parser_select_string (parser, line_style_names));
+ case PANGO2_ATTR_STRIKETHROUGH:
+ attr = pango2_attr_strikethrough_new ((Pango2LineStyle) parser_select_string (parser, line_style_names));
break;
- case PANGO_ATTR_RISE:
- attr = pango_attr_rise_new ((int) gtk_json_parser_get_number (parser));
+ case PANGO2_ATTR_RISE:
+ attr = pango2_attr_rise_new ((int) gtk_json_parser_get_number (parser));
break;
- case PANGO_ATTR_SCALE:
- attr = pango_attr_scale_new (gtk_json_parser_get_number (parser));
+ case PANGO2_ATTR_SCALE:
+ attr = pango2_attr_scale_new (gtk_json_parser_get_number (parser));
break;
- case PANGO_ATTR_FALLBACK:
- attr = pango_attr_fallback_new (gtk_json_parser_get_boolean (parser));
+ case PANGO2_ATTR_FALLBACK:
+ attr = pango2_attr_fallback_new (gtk_json_parser_get_boolean (parser));
break;
- case PANGO_ATTR_LETTER_SPACING:
- attr = pango_attr_letter_spacing_new ((int) gtk_json_parser_get_number (parser));
+ case PANGO2_ATTR_LETTER_SPACING:
+ attr = pango2_attr_letter_spacing_new ((int) gtk_json_parser_get_number (parser));
break;
- case PANGO_ATTR_UNDERLINE_COLOR:
+ case PANGO2_ATTR_UNDERLINE_COLOR:
parser_get_color (parser, &color);
- attr = pango_attr_underline_color_new (&color);
+ attr = pango2_attr_underline_color_new (&color);
break;
- case PANGO_ATTR_STRIKETHROUGH_COLOR:
+ case PANGO2_ATTR_STRIKETHROUGH_COLOR:
parser_get_color (parser, &color);
- attr = pango_attr_strikethrough_color_new (&color);
+ attr = pango2_attr_strikethrough_color_new (&color);
break;
- case PANGO_ATTR_ABSOLUTE_SIZE:
- attr = pango_attr_size_new_absolute ((int) gtk_json_parser_get_number (parser));
+ case PANGO2_ATTR_ABSOLUTE_SIZE:
+ attr = pango2_attr_size_new_absolute ((int) gtk_json_parser_get_number (parser));
break;
- case PANGO_ATTR_GRAVITY:
- attr = pango_attr_gravity_new ((PangoGravity) parser_select_string (parser, gravity_names));
+ case PANGO2_ATTR_GRAVITY:
+ attr = pango2_attr_gravity_new ((Pango2Gravity) parser_select_string (parser, gravity_names));
break;
- case PANGO_ATTR_GRAVITY_HINT:
- attr = pango_attr_gravity_hint_new ((PangoGravityHint) parser_select_string (parser, gravity_hint_names));
+ case PANGO2_ATTR_GRAVITY_HINT:
+ attr = pango2_attr_gravity_hint_new ((Pango2GravityHint) parser_select_string (parser, gravity_hint_names));
break;
- case PANGO_ATTR_FONT_FEATURES:
+ case PANGO2_ATTR_FONT_FEATURES:
str = gtk_json_parser_get_string (parser);
- attr = pango_attr_font_features_new (str);
+ attr = pango2_attr_font_features_new (str);
g_free (str);
break;
- case PANGO_ATTR_ALLOW_BREAKS:
- attr = pango_attr_allow_breaks_new (gtk_json_parser_get_boolean (parser));
+ case PANGO2_ATTR_ALLOW_BREAKS:
+ attr = pango2_attr_allow_breaks_new (gtk_json_parser_get_boolean (parser));
break;
- case PANGO_ATTR_SHOW:
- attr = pango_attr_show_new ((int) gtk_json_parser_get_number (parser));
+ case PANGO2_ATTR_SHOW:
+ attr = pango2_attr_show_new ((int) gtk_json_parser_get_number (parser));
break;
- case PANGO_ATTR_INSERT_HYPHENS:
- attr = pango_attr_insert_hyphens_new ((int) gtk_json_parser_get_number (parser));
+ case PANGO2_ATTR_INSERT_HYPHENS:
+ attr = pango2_attr_insert_hyphens_new ((int) gtk_json_parser_get_number (parser));
break;
- case PANGO_ATTR_OVERLINE:
- attr = pango_attr_overline_new ((PangoLineStyle) parser_select_string (parser, line_style_names));
+ case PANGO2_ATTR_OVERLINE:
+ attr = pango2_attr_overline_new ((Pango2LineStyle) parser_select_string (parser, line_style_names));
break;
- case PANGO_ATTR_OVERLINE_COLOR:
+ case PANGO2_ATTR_OVERLINE_COLOR:
parser_get_color (parser, &color);
- attr = pango_attr_overline_color_new (&color);
+ attr = pango2_attr_overline_color_new (&color);
break;
- case PANGO_ATTR_LINE_HEIGHT:
- attr = pango_attr_line_height_new (gtk_json_parser_get_number (parser));
+ case PANGO2_ATTR_LINE_HEIGHT:
+ attr = pango2_attr_line_height_new (gtk_json_parser_get_number (parser));
break;
- case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT:
- attr = pango_attr_line_height_new_absolute ((int) gtk_json_parser_get_number (parser));
+ case PANGO2_ATTR_ABSOLUTE_LINE_HEIGHT:
+ attr = pango2_attr_line_height_new_absolute ((int) gtk_json_parser_get_number (parser));
break;
- case PANGO_ATTR_LINE_SPACING:
- attr = pango_attr_line_spacing_new ((int) gtk_json_parser_get_number (parser));
+ case PANGO2_ATTR_LINE_SPACING:
+ attr = pango2_attr_line_spacing_new ((int) gtk_json_parser_get_number (parser));
break;
- case PANGO_ATTR_TEXT_TRANSFORM:
- attr = pango_attr_text_transform_new ((PangoTextTransform) parser_select_string (parser, text_transform_names));
+ case PANGO2_ATTR_TEXT_TRANSFORM:
+ attr = pango2_attr_text_transform_new ((Pango2TextTransform) parser_select_string (parser, text_transform_names));
break;
- case PANGO_ATTR_WORD:
- attr = pango_attr_word_new ();
+ case PANGO2_ATTR_WORD:
+ attr = pango2_attr_word_new ();
break;
- case PANGO_ATTR_SENTENCE:
- attr = pango_attr_sentence_new ();
+ case PANGO2_ATTR_SENTENCE:
+ attr = pango2_attr_sentence_new ();
break;
- case PANGO_ATTR_BASELINE_SHIFT:
- attr = pango_attr_baseline_shift_new (parser_select_string (parser, baseline_shift_names));
+ case PANGO2_ATTR_BASELINE_SHIFT:
+ attr = pango2_attr_baseline_shift_new (parser_select_string (parser, baseline_shift_names));
break;
- case PANGO_ATTR_FONT_SCALE:
- attr = pango_attr_font_scale_new ((PangoFontScale) parser_select_string (parser, font_scale_names));
+ case PANGO2_ATTR_FONT_SCALE:
+ attr = pango2_attr_font_scale_new ((Pango2FontScale) parser_select_string (parser, font_scale_names));
break;
- case PANGO_ATTR_PARAGRAPH:
- attr = pango_attr_paragraph_new ();
+ case PANGO2_ATTR_PARAGRAPH:
+ attr = pango2_attr_paragraph_new ();
break;
}
@@ -1133,13 +1133,13 @@ static const char *attr_members[] = {
NULL
};
-static PangoAttribute *
+static Pango2Attribute *
json_to_attribute (GtkJsonParser *parser)
{
- PangoAttribute *attr = NULL;
- PangoAttrType type = PANGO_ATTR_INVALID;
- guint start = PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING;
- guint end = PANGO_ATTR_INDEX_TO_TEXT_END;
+ Pango2Attribute *attr = NULL;
+ Pango2AttrType type = PANGO2_ATTR_INVALID;
+ guint start = PANGO2_ATTR_INDEX_FROM_TEXT_BEGINNING;
+ guint end = PANGO2_ATTR_INDEX_TO_TEXT_END;
gtk_json_parser_start_object (parser);
@@ -1171,7 +1171,7 @@ json_to_attribute (GtkJsonParser *parser)
if (!attr && !gtk_json_parser_get_error (parser))
{
- if (type == PANGO_ATTR_INVALID)
+ if (type == PANGO2_ATTR_INVALID)
gtk_json_parser_schema_error (parser, "Invalid attribute \"type\"");
else
gtk_json_parser_schema_error (parser, "Attribute missing \"value\"");
@@ -1184,15 +1184,15 @@ json_to_attribute (GtkJsonParser *parser)
static void
json_parser_fill_attr_list (GtkJsonParser *parser,
- PangoAttrList *attributes)
+ Pango2AttrList *attributes)
{
gtk_json_parser_start_array (parser);
do
{
- PangoAttribute *attr = json_to_attribute (parser);
+ Pango2Attribute *attr = json_to_attribute (parser);
if (attr)
- pango_attr_list_insert (attributes, attr);
+ pango2_attr_list_insert (attributes, attr);
}
while (gtk_json_parser_next (parser));
@@ -1215,7 +1215,7 @@ static const char *tab_members[] = {
static void
json_parser_fill_tabs (GtkJsonParser *parser,
- PangoTabArray *tabs)
+ Pango2TabArray *tabs)
{
int index;
@@ -1225,7 +1225,7 @@ json_parser_fill_tabs (GtkJsonParser *parser,
do
{
int pos;
- PangoTabAlign align = PANGO_TAB_LEFT;
+ Pango2TabAlign align = PANGO2_TAB_LEFT;
gunichar ch = 0;
if (gtk_json_parser_get_node (parser) == GTK_JSON_OBJECT)
@@ -1240,7 +1240,7 @@ json_parser_fill_tabs (GtkJsonParser *parser,
break;
case TAB_ALIGNMENT:
- align = (PangoTabAlign) parser_select_string (parser, tab_align_names);
+ align = (Pango2TabAlign) parser_select_string (parser, tab_align_names);
break;
case TAB_DECIMAL_POINT:
@@ -1258,8 +1258,8 @@ json_parser_fill_tabs (GtkJsonParser *parser,
else
pos = (int) gtk_json_parser_get_number (parser);
- pango_tab_array_set_tab (tabs, index, align, pos);
- pango_tab_array_set_decimal_point (tabs, index, ch);
+ pango2_tab_array_set_tab (tabs, index, align, pos);
+ pango2_tab_array_set_decimal_point (tabs, index, ch);
index++;
}
while (gtk_json_parser_next (parser));
@@ -1280,7 +1280,7 @@ static const char *tabs_members[] = {
static void
json_parser_fill_tab_array (GtkJsonParser *parser,
- PangoTabArray *tabs)
+ Pango2TabArray *tabs)
{
gtk_json_parser_start_object (parser);
@@ -1289,7 +1289,7 @@ json_parser_fill_tab_array (GtkJsonParser *parser,
switch (gtk_json_parser_select_member (parser, tabs_members))
{
case TABS_POSITIONS_IN_PIXELS:
- pango_tab_array_set_positions_in_pixels (tabs, gtk_json_parser_get_boolean (parser));
+ pango2_tab_array_set_positions_in_pixels (tabs, gtk_json_parser_get_boolean (parser));
break;
case TABS_POSITIONS:
@@ -1328,7 +1328,7 @@ static const char *context_members[] = {
static void
json_parser_fill_context (GtkJsonParser *parser,
- PangoContext *context)
+ Pango2Context *context)
{
gtk_json_parser_start_object (parser);
@@ -1340,38 +1340,38 @@ json_parser_fill_context (GtkJsonParser *parser,
{
case CONTEXT_LANGUAGE:
str = gtk_json_parser_get_string (parser);
- PangoLanguage *language = pango_language_from_string (str);
- pango_context_set_language (context, language);
+ Pango2Language *language = pango2_language_from_string (str);
+ pango2_context_set_language (context, language);
g_free (str);
break;
case CONTEXT_FONT:
{
- PangoFontDescription *desc = parser_get_font_description (parser);
- pango_context_set_font_description (context, desc);
- pango_font_description_free (desc);
+ Pango2FontDescription *desc = parser_get_font_description (parser);
+ pango2_context_set_font_description (context, desc);
+ pango2_font_description_free (desc);
}
break;
case CONTEXT_BASE_GRAVITY:
- pango_context_set_base_gravity (context, (PangoGravity) parser_select_string (parser, gravity_names));
+ pango2_context_set_base_gravity (context, (Pango2Gravity) parser_select_string (parser, gravity_names));
break;
case CONTEXT_GRAVITY_HINT:
- pango_context_set_gravity_hint (context, (PangoGravityHint) parser_select_string (parser, gravity_hint_names));
+ pango2_context_set_gravity_hint (context, (Pango2GravityHint) parser_select_string (parser, gravity_hint_names));
break;
case CONTEXT_BASE_DIR:
- pango_context_set_base_dir (context, (PangoDirection) parser_select_string (parser, direction_names));
+ pango2_context_set_base_dir (context, (Pango2Direction) parser_select_string (parser, direction_names));
break;
case CONTEXT_ROUND_GLYPH_POSITIONS:
- pango_context_set_round_glyph_positions (context, gtk_json_parser_get_boolean (parser));
+ pango2_context_set_round_glyph_positions (context, gtk_json_parser_get_boolean (parser));
break;
case CONTEXT_TRANSFORM:
{
- PangoMatrix m = PANGO_MATRIX_INIT;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
gtk_json_parser_start_array (parser);
m.xx = gtk_json_parser_get_number (parser);
@@ -1387,7 +1387,7 @@ json_parser_fill_context (GtkJsonParser *parser,
m.y0 = gtk_json_parser_get_number (parser);
gtk_json_parser_end (parser);
- pango_context_set_matrix (context, &m);
+ pango2_context_set_matrix (context, &m);
}
break;
@@ -1439,8 +1439,8 @@ static const char *layout_members[] = {
static void
json_parser_fill_layout (GtkJsonParser *parser,
- PangoLayout *layout,
- PangoLayoutDeserializeFlags flags)
+ Pango2Layout *layout,
+ Pango2LayoutDeserializeFlags flags)
{
gtk_json_parser_start_object (parser);
@@ -1451,8 +1451,8 @@ json_parser_fill_layout (GtkJsonParser *parser,
switch (gtk_json_parser_select_member (parser, layout_members))
{
case LAYOUT_CONTEXT:
- if (flags & PANGO_LAYOUT_DESERIALIZE_CONTEXT)
- json_parser_fill_context (parser, pango_layout_get_context (layout));
+ if (flags & PANGO2_LAYOUT_DESERIALIZE_CONTEXT)
+ json_parser_fill_context (parser, pango2_layout_get_context (layout));
break;
case LAYOUT_COMMENT:
@@ -1462,66 +1462,66 @@ json_parser_fill_layout (GtkJsonParser *parser,
case LAYOUT_TEXT:
str = gtk_json_parser_get_string (parser);
- pango_layout_set_text (layout, str, -1);
+ pango2_layout_set_text (layout, str, -1);
g_free (str);
break;
case LAYOUT_ATTRIBUTES:
{
- PangoAttrList *attributes = pango_attr_list_new ();
+ Pango2AttrList *attributes = pango2_attr_list_new ();
json_parser_fill_attr_list (parser, attributes);
- pango_layout_set_attributes (layout, attributes);
- pango_attr_list_unref (attributes);
+ pango2_layout_set_attributes (layout, attributes);
+ pango2_attr_list_unref (attributes);
}
break;
case LAYOUT_FONT:
{
- PangoFontDescription *desc = parser_get_font_description (parser);;
- pango_layout_set_font_description (layout, desc);
- pango_font_description_free (desc);
+ Pango2FontDescription *desc = parser_get_font_description (parser);;
+ pango2_layout_set_font_description (layout, desc);
+ pango2_font_description_free (desc);
}
break;
case LAYOUT_AUTO_DIR:
- pango_layout_set_auto_dir (layout, gtk_json_parser_get_boolean (parser));
+ pango2_layout_set_auto_dir (layout, gtk_json_parser_get_boolean (parser));
break;
case LAYOUT_LINE_HEIGHT:
- pango_layout_set_line_height (layout, gtk_json_parser_get_number (parser));
+ pango2_layout_set_line_height (layout, gtk_json_parser_get_number (parser));
break;
case LAYOUT_TABS:
{
- PangoTabArray *tabs = pango_tab_array_new (0, FALSE);
+ Pango2TabArray *tabs = pango2_tab_array_new (0, FALSE);
json_parser_fill_tab_array (parser, tabs);
- pango_layout_set_tabs (layout, tabs);
- pango_tab_array_free (tabs);
+ pango2_layout_set_tabs (layout, tabs);
+ pango2_tab_array_free (tabs);
}
break;
case LAYOUT_ALIGNMENT:
- pango_layout_set_alignment (layout, (PangoAlignment) parser_select_string (parser, alignment_names));
+ pango2_layout_set_alignment (layout, (Pango2Alignment) parser_select_string (parser, alignment_names));
break;
case LAYOUT_WRAP:
- pango_layout_set_wrap (layout, (PangoWrapMode) parser_select_string (parser, wrap_names));
+ pango2_layout_set_wrap (layout, (Pango2WrapMode) parser_select_string (parser, wrap_names));
break;
case LAYOUT_ELLIPSIZE:
- pango_layout_set_ellipsize (layout, (PangoEllipsizeMode) parser_select_string (parser, ellipsize_names));
+ pango2_layout_set_ellipsize (layout, (Pango2EllipsizeMode) parser_select_string (parser, ellipsize_names));
break;
case LAYOUT_WIDTH:
- pango_layout_set_width (layout, (int) gtk_json_parser_get_number (parser));
+ pango2_layout_set_width (layout, (int) gtk_json_parser_get_number (parser));
break;
case LAYOUT_HEIGHT:
- pango_layout_set_height (layout, (int) gtk_json_parser_get_number (parser));
+ pango2_layout_set_height (layout, (int) gtk_json_parser_get_number (parser));
break;
case LAYOUT_INDENT:
- pango_layout_set_indent (layout, (int) gtk_json_parser_get_number (parser));
+ pango2_layout_set_indent (layout, (int) gtk_json_parser_get_number (parser));
break;
case LAYOUT_LINES:
@@ -1553,12 +1553,12 @@ static const char *font_members[] = {
NULL
};
-static PangoFont *
+static Pango2Font *
json_parser_load_font (GtkJsonParser *parser,
- PangoContext *context,
+ Pango2Context *context,
GError **error)
{
- PangoFont *font = NULL;
+ Pango2Font *font = NULL;
gtk_json_parser_start_object (parser);
@@ -1566,9 +1566,9 @@ json_parser_load_font (GtkJsonParser *parser,
{
case FONT_DESCRIPTION:
{
- PangoFontDescription *desc = parser_get_font_description (parser);
- font = pango_context_load_font (context, desc);
- pango_font_description_free (desc);
+ Pango2FontDescription *desc = parser_get_font_description (parser);
+ font = pango2_context_load_font (context, desc);
+ pango2_font_description_free (desc);
}
break;
@@ -1585,14 +1585,14 @@ json_parser_load_font (GtkJsonParser *parser,
/* {{{ Public API */
/**
- * pango_layout_serialize:
- * @layout: a `PangoLayout`
- * @flags: `PangoLayoutSerializeFlags`
+ * pango2_layout_serialize:
+ * @layout: a `Pango2Layout`
+ * @flags: `Pango2LayoutSerializeFlags`
*
- * Serializes the @layout for later deserialization via [func@Pango.Layout.deserialize].
+ * Serializes the @layout for later deserialization via [func@Pango2.Layout.deserialize].
*
* There are no guarantees about the format of the output across different
- * versions of Pango and [func@Pango.Layout.deserialize] will reject data
+ * versions of Pango2 and [func@Pango2.Layout.deserialize] will reject data
* that it cannot parse.
*
* The intended use of this function is testing, benchmarking and debugging.
@@ -1601,15 +1601,15 @@ json_parser_load_font (GtkJsonParser *parser,
* Returns: a `GBytes` containing the serialized form of @layout
*/
GBytes *
-pango_layout_serialize (PangoLayout *layout,
- PangoLayoutSerializeFlags flags)
+pango2_layout_serialize (Pango2Layout *layout,
+ Pango2LayoutSerializeFlags flags)
{
GString *str;
GtkJsonPrinter *printer;
char *data;
gsize size;
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), NULL);
str = g_string_new ("");
@@ -1627,12 +1627,12 @@ pango_layout_serialize (PangoLayout *layout,
}
/**
- * pango_layout_write_to_file:
- * @layout: a `PangoLayout`
+ * pango2_layout_write_to_file:
+ * @layout: a `Pango2Layout`
*
* A convenience method to serialize a layout to a file.
*
- * It is equivalent to calling [method@Pango.Layout.serialize]
+ * It is equivalent to calling [method@Pango2.Layout.serialize]
* followed by [func@GLib.file_set_contents].
*
* See those two functions for details on the arguments.
@@ -1643,17 +1643,17 @@ pango_layout_serialize (PangoLayout *layout,
* Returns: %TRUE if saving was successful
*/
gboolean
-pango_layout_write_to_file (PangoLayout *layout,
+pango2_layout_write_to_file (Pango2Layout *layout,
const char *filename)
{
GBytes *bytes;
gboolean result;
- g_return_val_if_fail (PANGO_IS_LAYOUT (layout), FALSE);
+ g_return_val_if_fail (PANGO2_IS_LAYOUT (layout), FALSE);
g_return_val_if_fail (filename != NULL, FALSE);
- bytes = pango_layout_serialize (layout, PANGO_LAYOUT_SERIALIZE_CONTEXT |
- PANGO_LAYOUT_SERIALIZE_OUTPUT);
+ bytes = pango2_layout_serialize (layout, PANGO2_LAYOUT_SERIALIZE_CONTEXT |
+ PANGO2_LAYOUT_SERIALIZE_OUTPUT);
result = g_file_set_contents (filename,
g_bytes_get_data (bytes, NULL),
@@ -1665,13 +1665,13 @@ pango_layout_write_to_file (PangoLayout *layout,
}
/**
- * pango_layout_deserialize:
- * @context: a `PangoContext`
- * @flags: `PangoLayoutDeserializeFlags`
+ * pango2_layout_deserialize:
+ * @context: a `Pango2Context`
+ * @flags: `Pango2LayoutDeserializeFlags`
* @bytes: the bytes containing the data
* @error: return location for an error
*
- * Loads data previously created via [method@Pango.Layout.serialize].
+ * Loads data previously created via [method@Pango2.Layout.serialize].
*
* For a discussion of the supported format, see that function.
*
@@ -1679,21 +1679,21 @@ pango_layout_write_to_file (PangoLayout *layout,
* the one that was serialized, you can compare @bytes to the
* result of serializing the layout again.
*
- * Returns: (nullable) (transfer full): a new `PangoLayout`
+ * Returns: (nullable) (transfer full): a new `Pango2Layout`
*/
-PangoLayout *
-pango_layout_deserialize (PangoContext *context,
+Pango2Layout *
+pango2_layout_deserialize (Pango2Context *context,
GBytes *bytes,
- PangoLayoutDeserializeFlags flags,
+ Pango2LayoutDeserializeFlags flags,
GError **error)
{
- PangoLayout *layout;
+ Pango2Layout *layout;
GtkJsonParser *parser;
const GError *parser_error;
- g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL);
- layout = pango_layout_new (context);
+ layout = pango2_layout_new (context);
parser = gtk_json_parser_new_for_bytes (bytes);
json_parser_fill_layout (parser, layout, flags);
@@ -1708,13 +1708,13 @@ pango_layout_deserialize (PangoContext *context,
gtk_json_parser_get_error_offset (parser, &start, &end);
if (g_error_matches (parser_error, GTK_JSON_ERROR, GTK_JSON_ERROR_VALUE))
- code = PANGO_LAYOUT_DESERIALIZE_INVALID_VALUE;
+ code = PANGO2_LAYOUT_DESERIALIZE_INVALID_VALUE;
else if (g_error_matches (parser_error, GTK_JSON_ERROR, GTK_JSON_ERROR_SCHEMA))
- code = PANGO_LAYOUT_DESERIALIZE_MISSING_VALUE;
+ code = PANGO2_LAYOUT_DESERIALIZE_MISSING_VALUE;
else
- code = PANGO_LAYOUT_DESERIALIZE_INVALID;
+ code = PANGO2_LAYOUT_DESERIALIZE_INVALID;
- g_set_error (error, PANGO_LAYOUT_DESERIALIZE_ERROR, code,
+ g_set_error (error, PANGO2_LAYOUT_DESERIALIZE_ERROR, code,
"%" G_GSIZE_FORMAT ":%" G_GSIZE_FORMAT ": %s",
start, end, parser_error->message);
@@ -1727,30 +1727,30 @@ pango_layout_deserialize (PangoContext *context,
}
/**
- * pango_font_serialize:
- * @font: a `PangoFont`
+ * pango2_font_serialize:
+ * @font: a `Pango2Font`
*
* Serializes the @font in a way that can be uniquely identified.
*
* There are no guarantees about the format of the output across different
- * versions of Pango.
+ * versions of Pango2.
*
* The intended use of this function is testing, benchmarking and debugging.
* The format is not meant as a permanent storage format.
*
- * To recreate a font from its serialized form, use [func@Pango.Font.deserialize].
+ * To recreate a font from its serialized form, use [func@Pango2.Font.deserialize].
*
* Returns: a `GBytes` containing the serialized form of @font
*/
GBytes *
-pango_font_serialize (PangoFont *font)
+pango2_font_serialize (Pango2Font *font)
{
GString *str;
GtkJsonPrinter *printer;
char *data;
gsize size;
- g_return_val_if_fail (PANGO_IS_FONT (font), NULL);
+ g_return_val_if_fail (PANGO2_IS_FONT (font), NULL);
str = g_string_new ("");
@@ -1766,12 +1766,12 @@ pango_font_serialize (PangoFont *font)
}
/**
- * pango_font_deserialize:
- * @context: a `PangoContext`
+ * pango2_font_deserialize:
+ * @context: a `Pango2Context`
* @bytes: the bytes containing the data
* @error: return location for an error
*
- * Loads data previously created via [method@Pango.Font.serialize].
+ * Loads data previously created via [method@Pango2.Font.serialize].
*
* For a discussion of the supported format, see that function.
*
@@ -1779,17 +1779,17 @@ pango_font_serialize (PangoFont *font)
* the one that was serialized, you can compare @bytes to the
* result of serializing the font again.
*
- * Returns: (nullable) (transfer full): a new `PangoFont`
+ * Returns: (nullable) (transfer full): a new `Pango2Font`
*/
-PangoFont *
-pango_font_deserialize (PangoContext *context,
+Pango2Font *
+pango2_font_deserialize (Pango2Context *context,
GBytes *bytes,
GError **error)
{
- PangoFont *font;
+ Pango2Font *font;
GtkJsonParser *parser;
- g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL);
+ g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL);
parser = gtk_json_parser_new_for_bytes (bytes);
font = json_parser_load_font (parser, context, error);
diff --git a/pango/shape.c b/pango/shape.c
index 79a9417e..62ea953a 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* shape.c: Convert characters into glyphs.
*
* Copyright (C) 1999 Red Hat Software
@@ -78,27 +78,27 @@ release_buffer (hb_buffer_t *buffer,
}
/* }}} */
-/* {{{ Use PangoFont with Harfbuzz */
+/* {{{ Use Pango2Font with Harfbuzz */
typedef struct
{
- PangoFont *font;
+ Pango2Font *font;
hb_font_t *parent;
- PangoShowFlags show_flags;
-} PangoHbShapeContext;
+ Pango2ShowFlags show_flags;
+} Pango2HbShapeContext;
static hb_bool_t
-pango_hb_font_get_nominal_glyph (hb_font_t *font,
+pango2_hb_font_get_nominal_glyph (hb_font_t *font,
void *font_data,
hb_codepoint_t unicode,
hb_codepoint_t *glyph,
void *user_data G_GNUC_UNUSED)
{
- PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+ Pango2HbShapeContext *context = (Pango2HbShapeContext *) font_data;
if (context->show_flags != 0)
{
- if ((context->show_flags & PANGO_SHOW_SPACES) != 0 &&
+ if ((context->show_flags & PANGO2_SHOW_SPACES) != 0 &&
g_unichar_type (unicode) == G_UNICODE_SPACE_SEPARATOR)
{
/* Replace 0x20 by visible space, since we
@@ -108,22 +108,22 @@ pango_hb_font_get_nominal_glyph (hb_font_t *font,
unicode = 0x2423;
else
{
- *glyph = PANGO_GET_UNKNOWN_GLYPH (unicode);
+ *glyph = PANGO2_GET_UNKNOWN_GLYPH (unicode);
return TRUE;
}
}
- if ((context->show_flags & PANGO_SHOW_IGNORABLES) != 0 &&
- pango_is_default_ignorable (unicode))
+ if ((context->show_flags & PANGO2_SHOW_IGNORABLES) != 0 &&
+ pango2_is_default_ignorable (unicode))
{
- if (pango_get_ignorable (unicode))
- *glyph = PANGO_GET_UNKNOWN_GLYPH (unicode);
+ if (pango2_get_ignorable (unicode))
+ *glyph = PANGO2_GET_UNKNOWN_GLYPH (unicode);
else
- *glyph = PANGO_GLYPH_EMPTY;
+ *glyph = PANGO2_GLYPH_EMPTY;
return TRUE;
}
- if ((context->show_flags & PANGO_SHOW_LINE_BREAKS) != 0 &&
+ if ((context->show_flags & PANGO2_SHOW_LINE_BREAKS) != 0 &&
unicode == 0x2028)
{
/* Always mark LS as unknown. If it ends up at the line end,
@@ -131,7 +131,7 @@ pango_hb_font_get_nominal_glyph (hb_font_t *font,
* they end up in the middle of a line, we are in single
* paragraph mode and want to show the LS.
*/
- *glyph = PANGO_GET_UNKNOWN_GLYPH (unicode);
+ *glyph = PANGO2_GET_UNKNOWN_GLYPH (unicode);
return TRUE;
}
}
@@ -145,20 +145,20 @@ pango_hb_font_get_nominal_glyph (hb_font_t *font,
*
* For 0x20, on the other hand, we need to pretend that we have a glyph
* and rely on our glyph extents code to provide a reasonable width for
- * PANGO_GET_UNKNOWN_WIDTH (0x20).
+ * PANGO2_GET_UNKNOWN_WIDTH (0x20).
*/
if (g_unichar_type (unicode) == G_UNICODE_SPACE_SEPARATOR)
{
if (unicode == 0x20)
{
- *glyph = PANGO_GET_UNKNOWN_GLYPH (0x20);
+ *glyph = PANGO2_GET_UNKNOWN_GLYPH (0x20);
return TRUE;
}
return FALSE;
}
- *glyph = PANGO_GET_UNKNOWN_GLYPH (unicode);
+ *glyph = PANGO2_GET_UNKNOWN_GLYPH (unicode);
/* We draw our own invalid-Unicode shape, so prevent HarfBuzz
* from using REPLACEMENT CHARACTER.
@@ -170,18 +170,18 @@ pango_hb_font_get_nominal_glyph (hb_font_t *font,
}
static hb_position_t
-pango_hb_font_get_glyph_h_advance (hb_font_t *font,
+pango2_hb_font_get_glyph_h_advance (hb_font_t *font,
void *font_data,
hb_codepoint_t glyph,
void *user_data G_GNUC_UNUSED)
{
- PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+ Pango2HbShapeContext *context = (Pango2HbShapeContext *) font_data;
- if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ if (glyph & PANGO2_GLYPH_UNKNOWN_FLAG)
{
- PangoRectangle logical;
+ Pango2Rectangle logical;
- pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
+ pango2_font_get_glyph_extents (context->font, glyph, NULL, &logical);
return logical.width;
}
@@ -189,18 +189,18 @@ pango_hb_font_get_glyph_h_advance (hb_font_t *font,
}
static hb_position_t
-pango_hb_font_get_glyph_v_advance (hb_font_t *font,
+pango2_hb_font_get_glyph_v_advance (hb_font_t *font,
void *font_data,
hb_codepoint_t glyph,
void *user_data G_GNUC_UNUSED)
{
- PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+ Pango2HbShapeContext *context = (Pango2HbShapeContext *) font_data;
- if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ if (glyph & PANGO2_GLYPH_UNKNOWN_FLAG)
{
- PangoRectangle logical;
+ Pango2Rectangle logical;
- pango_font_get_glyph_extents (context->font, glyph, NULL, &logical);
+ pango2_font_get_glyph_extents (context->font, glyph, NULL, &logical);
return logical.height;
}
@@ -208,19 +208,19 @@ pango_hb_font_get_glyph_v_advance (hb_font_t *font,
}
static hb_bool_t
-pango_hb_font_get_glyph_extents (hb_font_t *font,
+pango2_hb_font_get_glyph_extents (hb_font_t *font,
void *font_data,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents,
void *user_data G_GNUC_UNUSED)
{
- PangoHbShapeContext *context = (PangoHbShapeContext *) font_data;
+ Pango2HbShapeContext *context = (Pango2HbShapeContext *) font_data;
- if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
+ if (glyph & PANGO2_GLYPH_UNKNOWN_FLAG)
{
- PangoRectangle ink;
+ Pango2Rectangle ink;
- pango_font_get_glyph_extents (context->font, glyph, &ink, NULL);
+ pango2_font_get_glyph_extents (context->font, glyph, &ink, NULL);
extents->x_bearing = ink.x;
extents->y_bearing = ink.y;
@@ -234,22 +234,22 @@ pango_hb_font_get_glyph_extents (hb_font_t *font,
}
static hb_font_t *
-pango_font_get_hb_font_for_context (PangoFont *font,
- PangoHbShapeContext *context)
+pango2_font_get_hb_font_for_context (Pango2Font *font,
+ Pango2HbShapeContext *context)
{
hb_font_t *hb_font;
static hb_font_funcs_t *funcs;
- hb_font = pango_font_get_hb_font (font);
+ hb_font = pango2_font_get_hb_font (font);
if (G_UNLIKELY (!funcs))
{
funcs = hb_font_funcs_create ();
- hb_font_funcs_set_nominal_glyph_func (funcs, pango_hb_font_get_nominal_glyph, NULL, NULL);
- hb_font_funcs_set_glyph_h_advance_func (funcs, pango_hb_font_get_glyph_h_advance, NULL, NULL);
- hb_font_funcs_set_glyph_v_advance_func (funcs, pango_hb_font_get_glyph_v_advance, NULL, NULL);
- hb_font_funcs_set_glyph_extents_func (funcs, pango_hb_font_get_glyph_extents, NULL, NULL);
+ hb_font_funcs_set_nominal_glyph_func (funcs, pango2_hb_font_get_nominal_glyph, NULL, NULL);
+ hb_font_funcs_set_glyph_h_advance_func (funcs, pango2_hb_font_get_glyph_h_advance, NULL, NULL);
+ hb_font_funcs_set_glyph_v_advance_func (funcs, pango2_hb_font_get_glyph_v_advance, NULL, NULL);
+ hb_font_funcs_set_glyph_extents_func (funcs, pango2_hb_font_get_glyph_extents, NULL, NULL);
hb_font_funcs_make_immutable (funcs);
}
@@ -266,35 +266,35 @@ pango_font_get_hb_font_for_context (PangoFont *font,
/* }}} */
/* {{{ Utilities */
-static PangoShowFlags
-find_show_flags (const PangoAnalysis *analysis)
+static Pango2ShowFlags
+find_show_flags (const Pango2Analysis *analysis)
{
GSList *l;
- PangoShowFlags flags = 0;
+ Pango2ShowFlags flags = 0;
for (l = analysis->extra_attrs; l; l = l->next)
{
- PangoAttribute *attr = l->data;
+ Pango2Attribute *attr = l->data;
- if (attr->type == PANGO_ATTR_SHOW)
+ if (attr->type == PANGO2_ATTR_SHOW)
flags |= attr->int_value;
}
return flags;
}
-static PangoTextTransform
-find_text_transform (const PangoAnalysis *analysis)
+static Pango2TextTransform
+find_text_transform (const Pango2Analysis *analysis)
{
GSList *l;
- PangoTextTransform transform = PANGO_TEXT_TRANSFORM_NONE;
+ Pango2TextTransform transform = PANGO2_TEXT_TRANSFORM_NONE;
for (l = analysis->extra_attrs; l; l = l->next)
{
- PangoAttribute *attr = l->data;
+ Pango2Attribute *attr = l->data;
- if (attr->type == PANGO_ATTR_TEXT_TRANSFORM)
- transform = (PangoTextTransform) attr->int_value;
+ if (attr->type == PANGO2_ATTR_TEXT_TRANSFORM)
+ transform = (Pango2TextTransform) attr->int_value;
}
return transform;
@@ -342,17 +342,17 @@ glyph_has_color (hb_font_t *font,
/* }}} */
static void
-pango_hb_shape (const char *item_text,
+pango2_hb_shape (const char *item_text,
int item_length,
const char *paragraph_text,
int paragraph_length,
- const PangoAnalysis *analysis,
- PangoLogAttr *log_attrs,
+ const Pango2Analysis *analysis,
+ Pango2LogAttr *log_attrs,
int num_chars,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags)
+ Pango2GlyphString *glyphs,
+ Pango2ShapeFlags flags)
{
- PangoHbShapeContext context = { 0, };
+ Pango2HbShapeContext context = { 0, };
hb_buffer_flags_t hb_buffer_flags;
hb_font_t *hb_font;
hb_buffer_t *hb_buffer;
@@ -365,40 +365,40 @@ pango_hb_shape (const char *item_text,
unsigned int item_offset = item_text - paragraph_text;
hb_feature_t features[32];
unsigned int num_features = 0;
- PangoGlyphInfo *infos;
- PangoTextTransform transform;
+ Pango2GlyphInfo *infos;
+ Pango2TextTransform transform;
int hyphen_index;
g_return_if_fail (analysis != NULL);
g_return_if_fail (analysis->font != NULL);
context.show_flags = find_show_flags (analysis);
- hb_font = pango_font_get_hb_font_for_context (analysis->font, &context);
+ hb_font = pango2_font_get_hb_font_for_context (analysis->font, &context);
hb_buffer = acquire_buffer (&free_buffer);
transform = find_text_transform (analysis);
- hb_direction = PANGO_GRAVITY_IS_VERTICAL (analysis->gravity) ? HB_DIRECTION_TTB : HB_DIRECTION_LTR;
+ hb_direction = PANGO2_GRAVITY_IS_VERTICAL (analysis->gravity) ? HB_DIRECTION_TTB : HB_DIRECTION_LTR;
if (analysis->level % 2)
hb_direction = HB_DIRECTION_REVERSE (hb_direction);
- if (PANGO_GRAVITY_IS_IMPROPER (analysis->gravity))
+ if (PANGO2_GRAVITY_IS_IMPROPER (analysis->gravity))
hb_direction = HB_DIRECTION_REVERSE (hb_direction);
hb_buffer_flags = HB_BUFFER_FLAG_BOT | HB_BUFFER_FLAG_EOT;
- if (context.show_flags & PANGO_SHOW_IGNORABLES)
+ if (context.show_flags & PANGO2_SHOW_IGNORABLES)
hb_buffer_flags |= HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES;
/* setup buffer */
hb_buffer_set_direction (hb_buffer, hb_direction);
hb_buffer_set_script (hb_buffer, (hb_script_t) g_unicode_script_to_iso15924 (analysis->script));
- hb_buffer_set_language (hb_buffer, hb_language_from_string (pango_language_to_string (analysis->language), -1));
+ hb_buffer_set_language (hb_buffer, hb_language_from_string (pango2_language_to_string (analysis->language), -1));
hb_buffer_set_cluster_level (hb_buffer, HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
hb_buffer_set_flags (hb_buffer, hb_buffer_flags);
- hb_buffer_set_invisible_glyph (hb_buffer, PANGO_GLYPH_EMPTY);
+ hb_buffer_set_invisible_glyph (hb_buffer, PANGO2_GLYPH_EMPTY);
- if (analysis->flags & PANGO_ANALYSIS_FLAG_NEED_HYPHEN)
+ if (analysis->flags & PANGO2_ANALYSIS_FLAG_NEED_HYPHEN)
{
const char *p = paragraph_text + item_offset + item_length;
int last_char_len = p - g_utf8_prev_char (p);
@@ -412,7 +412,7 @@ pango_hb_shape (const char *item_text,
/* Add pre-context */
hb_buffer_add_utf8 (hb_buffer, paragraph_text, item_offset, item_offset, 0);
- if (transform == PANGO_TEXT_TRANSFORM_NONE)
+ if (transform == PANGO2_TEXT_TRANSFORM_NONE)
{
hb_buffer_add_utf8 (hb_buffer, paragraph_text, item_offset + item_length, item_offset, item_length);
}
@@ -434,22 +434,22 @@ pango_hb_shape (const char *item_text,
switch (transform)
{
- case PANGO_TEXT_TRANSFORM_LOWERCASE:
+ case PANGO2_TEXT_TRANSFORM_LOWERCASE:
if (g_unichar_isalnum (ch))
str = g_utf8_strdown (p, g_utf8_next_char (p) - p);
break;
- case PANGO_TEXT_TRANSFORM_UPPERCASE:
+ case PANGO2_TEXT_TRANSFORM_UPPERCASE:
if (g_unichar_isalnum (ch))
str = g_utf8_strup (p, g_utf8_next_char (p) - p);
break;
- case PANGO_TEXT_TRANSFORM_CAPITALIZE:
+ case PANGO2_TEXT_TRANSFORM_CAPITALIZE:
if (log_attrs[i].is_word_start)
ch = g_unichar_totitle (ch);
break;
- case PANGO_TEXT_TRANSFORM_NONE:
+ case PANGO2_TEXT_TRANSFORM_NONE:
default:
g_assert_not_reached ();
}
@@ -471,7 +471,7 @@ pango_hb_shape (const char *item_text,
/* Add post-context */
hb_buffer_add_utf8 (hb_buffer, paragraph_text, paragraph_length, item_offset + item_length, 0);
- if (analysis->flags & PANGO_ANALYSIS_FLAG_NEED_HYPHEN)
+ if (analysis->flags & PANGO2_ANALYSIS_FLAG_NEED_HYPHEN)
{
/* Insert either a Unicode or ASCII hyphen. We may
* want to look for script-specific hyphens here.
@@ -485,17 +485,17 @@ pango_hb_shape (const char *item_text,
hb_buffer_add (hb_buffer, '-', hyphen_index);
}
- pango_analysis_collect_features (analysis, features, G_N_ELEMENTS (features), &num_features);
+ pango2_analysis_collect_features (analysis, features, G_N_ELEMENTS (features), &num_features);
hb_shape (hb_font, hb_buffer, features, num_features);
- if (PANGO_GRAVITY_IS_IMPROPER (analysis->gravity))
+ if (PANGO2_GRAVITY_IS_IMPROPER (analysis->gravity))
hb_buffer_reverse (hb_buffer);
/* buffer output */
num_glyphs = hb_buffer_get_length (hb_buffer);
hb_glyph = hb_buffer_get_glyph_infos (hb_buffer, NULL);
- pango_glyph_string_set_size (glyphs, num_glyphs);
+ pango2_glyph_string_set_size (glyphs, num_glyphs);
infos = glyphs->glyphs;
last_cluster = -1;
@@ -510,7 +510,7 @@ pango_hb_shape (const char *item_text,
}
hb_position = hb_buffer_get_glyph_positions (hb_buffer, NULL);
- if (PANGO_GRAVITY_IS_VERTICAL (analysis->gravity))
+ if (PANGO2_GRAVITY_IS_VERTICAL (analysis->gravity))
for (i = 0; i < num_glyphs; i++)
{
/* 90 degrees rotation counter-clockwise. */
@@ -536,14 +536,14 @@ pango_hb_shape (const char *item_text,
/* {{{ User shaping */
static void
-pango_user_shape (const char *text,
+pango2_user_shape (const char *text,
unsigned int length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags)
+ const Pango2Analysis *analysis,
+ Pango2GlyphString *glyphs,
+ Pango2ShapeFlags flags)
{
- PangoFont *font = analysis->font;
- PangoUserFace *face = PANGO_USER_FACE (font->face);
+ Pango2Font *font = analysis->font;
+ Pango2UserFace *face = PANGO2_USER_FACE (font->face);
face->shape_func (face, font->size,
text, length,
@@ -560,36 +560,36 @@ pango_user_shape (const char *text,
static void
fallback_shape (const char *text,
unsigned int length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
+ const Pango2Analysis *analysis,
+ Pango2GlyphString *glyphs)
{
int n_chars;
const char *p;
int cluster = 0;
int i;
- n_chars = text ? pango_utf8_strlen (text, length) : 0;
+ n_chars = text ? pango2_utf8_strlen (text, length) : 0;
- pango_glyph_string_set_size (glyphs, n_chars);
+ pango2_glyph_string_set_size (glyphs, n_chars);
p = text;
for (i = 0; i < n_chars; i++)
{
gunichar wc;
- PangoGlyph glyph;
- PangoRectangle logical_rect;
+ Pango2Glyph glyph;
+ Pango2Rectangle logical_rect;
wc = g_utf8_get_char (p);
if (g_unichar_type (wc) != G_UNICODE_NON_SPACING_MARK)
cluster = p - text;
- if (pango_is_zero_width (wc))
- glyph = PANGO_GLYPH_EMPTY;
+ if (pango2_is_zero_width (wc))
+ glyph = PANGO2_GLYPH_EMPTY;
else
- glyph = PANGO_GET_UNKNOWN_GLYPH (wc);
+ glyph = PANGO2_GET_UNKNOWN_GLYPH (wc);
- pango_font_get_glyph_extents (analysis->font, glyph, NULL, &logical_rect);
+ pango2_font_get_glyph_extents (analysis->font, glyph, NULL, &logical_rect);
glyphs->glyphs[i].glyph = glyph;
@@ -603,22 +603,22 @@ fallback_shape (const char *text,
}
if (analysis->level & 1)
- pango_glyph_string_reverse_range (glyphs, 0, glyphs->num_glyphs);
+ pango2_glyph_string_reverse_range (glyphs, 0, glyphs->num_glyphs);
}
/* }}} */
/* {{{ Shaping implementation */
static void
-pango_shape_internal (const char *item_text,
+pango2_shape_internal (const char *item_text,
int item_length,
const char *paragraph_text,
int paragraph_length,
- const PangoAnalysis *analysis,
- PangoLogAttr *log_attrs,
+ const Pango2Analysis *analysis,
+ Pango2LogAttr *log_attrs,
int num_chars,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags)
+ Pango2GlyphString *glyphs,
+ Pango2ShapeFlags flags)
{
int i;
int last_cluster;
@@ -639,10 +639,10 @@ pango_shape_internal (const char *item_text,
g_return_if_fail (paragraph_text <= item_text);
g_return_if_fail (paragraph_text + paragraph_length >= item_text + item_length);
- if (PANGO_IS_USER_FONT (analysis->font))
- pango_user_shape (item_text, item_length, analysis, glyphs, flags);
+ if (PANGO2_IS_USER_FONT (analysis->font))
+ pango2_user_shape (item_text, item_length, analysis, glyphs, flags);
else if (analysis->font)
- pango_hb_shape (item_text, item_length,
+ pango2_hb_shape (item_text, item_length,
paragraph_text, paragraph_length,
analysis,
log_attrs, num_chars,
@@ -664,12 +664,12 @@ pango_shape_internal (const char *item_text,
if (!g_object_get_qdata (G_OBJECT (analysis->font), warned_quark))
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
char *font_name;
- desc = pango_font_describe (analysis->font);
- font_name = pango_font_description_to_string (desc);
- pango_font_description_free (desc);
+ desc = pango2_font_describe (analysis->font);
+ font_name = pango2_font_description_to_string (desc);
+ pango2_font_description_free (desc);
g_warning ("shaping failure, expect ugly output. font='%s', text='%.*s'",
font_name, item_length, item_text);
@@ -720,19 +720,19 @@ pango_shape_internal (const char *item_text,
g_warning ("Expected RTL run but got LTR. Fixing.");
/* *Fix* it so we don't crash later */
- pango_glyph_string_reverse_range (glyphs, 0, glyphs->num_glyphs);
+ pango2_glyph_string_reverse_range (glyphs, 0, glyphs->num_glyphs);
}
- if (flags & PANGO_SHAPE_ROUND_POSITIONS)
+ if (flags & PANGO2_SHAPE_ROUND_POSITIONS)
{
- if (analysis->font && pango_font_is_hinted (analysis->font))
+ if (analysis->font && pango2_font_is_hinted (analysis->font))
{
double x_scale_inv, y_scale_inv;
double x_scale, y_scale;
- pango_font_get_scale_factors (analysis->font, &x_scale_inv, &y_scale_inv);
+ pango2_font_get_scale_factors (analysis->font, &x_scale_inv, &y_scale_inv);
- if (PANGO_GRAVITY_IS_IMPROPER (analysis->gravity))
+ if (PANGO2_GRAVITY_IS_IMPROPER (analysis->gravity))
{
x_scale_inv = -x_scale_inv;
y_scale_inv = -y_scale_inv;
@@ -744,12 +744,12 @@ pango_shape_internal (const char *item_text,
if (x_scale == 1.0 && y_scale == 1.0)
{
for (i = 0; i < glyphs->num_glyphs; i++)
- glyphs->glyphs[i].geometry.width = PANGO_UNITS_ROUND (glyphs->glyphs[i].geometry.width);
+ glyphs->glyphs[i].geometry.width = PANGO2_UNITS_ROUND (glyphs->glyphs[i].geometry.width);
}
else
{
#if 0
- if (PANGO_GRAVITY_IS_VERTICAL (analysis->gravity))
+ if (PANGO2_GRAVITY_IS_VERTICAL (analysis->gravity))
{
/* XXX */
double tmp = x_scale;
@@ -757,7 +757,7 @@ pango_shape_internal (const char *item_text,
y_scale = -tmp;
}
#endif
- #define HINT(value, scale_inv, scale) (PANGO_UNITS_ROUND ((int) ((value) * scale)) * scale_inv)
+ #define HINT(value, scale_inv, scale) (PANGO2_UNITS_ROUND ((int) ((value) * scale)) * scale_inv)
#define HINT_X(value) HINT ((value), x_scale, x_scale_inv)
#define HINT_Y(value) HINT ((value), y_scale, y_scale_inv)
for (i = 0; i < glyphs->num_glyphs; i++)
@@ -776,11 +776,11 @@ pango_shape_internal (const char *item_text,
for (i = 0; i < glyphs->num_glyphs; i++)
{
glyphs->glyphs[i].geometry.width =
- PANGO_UNITS_ROUND (glyphs->glyphs[i].geometry.width);
+ PANGO2_UNITS_ROUND (glyphs->glyphs[i].geometry.width);
glyphs->glyphs[i].geometry.x_offset =
- PANGO_UNITS_ROUND (glyphs->glyphs[i].geometry.x_offset);
+ PANGO2_UNITS_ROUND (glyphs->glyphs[i].geometry.x_offset);
glyphs->glyphs[i].geometry.y_offset =
- PANGO_UNITS_ROUND (glyphs->glyphs[i].geometry.y_offset);
+ PANGO2_UNITS_ROUND (glyphs->glyphs[i].geometry.y_offset);
}
}
}
@@ -790,73 +790,73 @@ pango_shape_internal (const char *item_text,
/* {{{ Public API */
/**
- * pango_shape:
+ * pango2_shape:
* @item_text: valid UTF-8 text to shape
* @item_length: the length (in bytes) of @item_text.
* -1 means nul-terminated text.
* @paragraph_text: (nullable): text of the paragraph (see details).
* @paragraph_length: the length (in bytes) of @paragraph_text.
* -1 means nul-terminated text.
- * @analysis: `PangoAnalysis` structure from [func@Pango.itemize]
+ * @analysis: `Pango2Analysis` structure from [func@Pango2.itemize]
* @glyphs: glyph string in which to store results
* @flags: flags influencing the shaping process
*
* Convert the characters in @text into glyphs.
*
- * Given a segment of text and the corresponding `PangoAnalysis` structure
- * returned from [func@Pango.itemize], convert the characters into glyphs.
- * You may also pass in only a substring of the item from [func@Pango.itemize].
+ * Given a segment of text and the corresponding `Pango2Analysis` structure
+ * returned from [func@Pango2.itemize], convert the characters into glyphs.
+ * You may also pass in only a substring of the item from [func@Pango2.itemize].
*
* Note that the extra attributes in the @analyis that is returned from
- * [func@Pango.itemize] have indices that are relative to the entire paragraph,
+ * [func@Pango2.itemize] have indices that are relative to the entire paragraph,
* so you do not pass the full paragraph text as @paragraph_text, you need
* to subtract the item offset from their indices first.
*/
void
-pango_shape (const char *item_text,
+pango2_shape (const char *item_text,
int item_length,
const char *paragraph_text,
int paragraph_length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags)
+ const Pango2Analysis *analysis,
+ Pango2GlyphString *glyphs,
+ Pango2ShapeFlags flags)
{
- pango_shape_internal (item_text, item_length,
+ pango2_shape_internal (item_text, item_length,
paragraph_text, paragraph_length,
analysis, NULL, 0,
glyphs, flags);
}
/**
- * pango_shape_item:
- * @item: `PangoItem` to shape
+ * pango2_shape_item:
+ * @item: `Pango2Item` to shape
* @paragraph_text: (nullable): text of the paragraph (see details).
* @paragraph_length: the length (in bytes) of @paragraph_text.
* -1 means nul-terminated text.
- * @log_attrs: (nullable): array of `PangoLogAttr` for @item
+ * @log_attrs: (nullable): array of `Pango2LogAttr` for @item
* @glyphs: glyph string in which to store results
* @flags: flags influencing the shaping process
*
* Convert the characters in @item into glyphs.
*
- * This is similar to [func@Pango.shape], except it takes a `PangoItem`
+ * This is similar to [func@Pango2.shape], except it takes a `Pango2Item`
* instead of separate @item_text and @analysis arguments. It also takes
* @log_attrs, which may be used in implementing text transforms.
*
* Note that the extra attributes in the @analyis that is returned from
- * [func@Pango.itemize] have indices that are relative to the entire paragraph,
+ * [func@Pango2.itemize] have indices that are relative to the entire paragraph,
* so you do not pass the full paragraph text as @paragraph_text, you need to
- * subtract the item offset from their indices before calling [func@Pango.shape].
+ * subtract the item offset from their indices before calling [func@Pango2.shape].
*/
void
-pango_shape_item (PangoItem *item,
+pango2_shape_item (Pango2Item *item,
const char *paragraph_text,
int paragraph_length,
- PangoLogAttr *log_attrs,
- PangoGlyphString *glyphs,
- PangoShapeFlags flags)
+ Pango2LogAttr *log_attrs,
+ Pango2GlyphString *glyphs,
+ Pango2ShapeFlags flags)
{
- pango_shape_internal (paragraph_text + item->offset, item->length,
+ pango2_shape_internal (paragraph_text + item->offset, item->length,
paragraph_text, paragraph_length,
&item->analysis,
log_attrs, item->num_chars,
diff --git a/tests/dump-boundaries.c b/tests/dump-boundaries.c
index d9b64532..467e637b 100644
--- a/tests/dump-boundaries.c
+++ b/tests/dump-boundaries.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* dump-boundaries.c: Dump text boundaries for a file
*
* Copyright (C) 1999-2000 Red Hat Software
@@ -50,7 +50,7 @@ static void
dump_text (const char *text)
{
unsigned int len;
- PangoLogAttr *attrs;
+ Pango2LogAttr *attrs;
unsigned int i;
gunichar *ucs4;
@@ -58,12 +58,12 @@ dump_text (const char *text)
fail ("Invalid UTF-8 in file");
len = g_utf8_strlen (text, -1);
- attrs = g_new0 (PangoLogAttr, len + 1);
+ attrs = g_new0 (Pango2LogAttr, len + 1);
- pango_get_log_attrs (text,
+ pango2_get_log_attrs (text,
-1,
0,
- pango_language_from_string ("C"),
+ pango2_language_from_string ("C"),
attrs,
len + 1);
diff --git a/tests/markup-parse.c b/tests/markup-parse.c
index 3b63ac86..a8de714d 100644
--- a/tests/markup-parse.c
+++ b/tests/markup-parse.c
@@ -1,5 +1,5 @@
-/* Pango
- * markup-parse.c: Test Pango markup
+/* Pango2
+ * markup-parse.c: Test Pango2 markup
*
* Copyright (C) 2014 Red Hat, Inc
*
@@ -40,10 +40,10 @@ test_file (const char *filename, GString *string)
gsize length;
GError *error = NULL;
char *text;
- PangoAttrList *attrs;
- PangoAttrIterator *iter;
- PangoFontDescription *desc;
- PangoLanguage *lang;
+ Pango2AttrList *attrs;
+ Pango2AttrIterator *iter;
+ Pango2FontDescription *desc;
+ Pango2Language *lang;
gboolean ret;
char *str;
int start, end;
@@ -52,7 +52,7 @@ test_file (const char *filename, GString *string)
g_file_get_contents (filename, &contents, &length, &error);
g_assert_no_error (error);
- ret = pango_parse_markup (contents, length, '_', &attrs, &text, &accel, &error);
+ ret = pango2_parse_markup (contents, length, '_', &attrs, &text, &accel, &error);
if (ret)
{
@@ -61,18 +61,18 @@ test_file (const char *filename, GString *string)
g_string_append (string, "\n\n---\n\n");
print_attr_list (attrs, string);
g_string_append (string, "\n\n---\n\n");
- desc = pango_font_description_new ();
- iter = pango_attr_list_get_iterator (attrs);
+ desc = pango2_font_description_new ();
+ iter = pango2_attr_list_get_iterator (attrs);
do {
- pango_attr_iterator_range (iter, &start, &end);
- pango_attr_iterator_get_font (iter, desc, &lang, NULL);
- str = pango_font_description_to_string (desc);
+ pango2_attr_iterator_range (iter, &start, &end);
+ pango2_attr_iterator_get_font (iter, desc, &lang, NULL);
+ str = pango2_font_description_to_string (desc);
g_string_append_printf (string, "[%d:%d] %s %s\n", start, end, (char *)lang, str);
g_free (str);
- } while (pango_attr_iterator_next (iter));
- pango_attr_iterator_destroy (iter);
- pango_attr_list_unref (attrs);
- pango_font_description_free (desc);
+ } while (pango2_attr_iterator_next (iter));
+ pango2_attr_iterator_destroy (iter);
+ pango2_attr_list_unref (attrs);
+ pango2_font_description_free (desc);
g_free (text);
if (accel)
@@ -82,7 +82,7 @@ test_file (const char *filename, GString *string)
}
/* Check that all optional arguments can be NULL */
- ret = pango_parse_markup (contents, length, '_', NULL, NULL, NULL, NULL);
+ ret = pango2_parse_markup (contents, length, '_', NULL, NULL, NULL, NULL);
g_assert_true (ret);
}
else
@@ -147,10 +147,10 @@ test_file_incrementally (const char *filename, GString *string)
gsize length;
GError *error = NULL;
char *text;
- PangoAttrList *attrs;
- PangoAttrIterator *iter;
- PangoFontDescription *desc;
- PangoLanguage *lang;
+ Pango2AttrList *attrs;
+ Pango2AttrIterator *iter;
+ Pango2FontDescription *desc;
+ Pango2Language *lang;
gboolean ret;
char *str;
int start, end;
@@ -160,7 +160,7 @@ test_file_incrementally (const char *filename, GString *string)
g_file_get_contents (filename, &contents, &length, &error);
g_assert_no_error (error);
- ctx = pango_markup_parser_new ('_');
+ ctx = pango2_markup_parser_new ('_');
ret = TRUE;
for (int i = 0; i < length; i++)
@@ -174,25 +174,25 @@ test_file_incrementally (const char *filename, GString *string)
if (ret)
{
- pango_markup_parser_finish (ctx, &attrs, &text, &accel, &error);
+ pango2_markup_parser_finish (ctx, &attrs, &text, &accel, &error);
g_assert_no_error (error);
g_string_append (string, text);
g_string_append (string, "\n\n---\n\n");
print_attr_list (attrs, string);
g_string_append (string, "\n\n---\n\n");
- desc = pango_font_description_new ();
- iter = pango_attr_list_get_iterator (attrs);
+ desc = pango2_font_description_new ();
+ iter = pango2_attr_list_get_iterator (attrs);
do {
- pango_attr_iterator_range (iter, &start, &end);
- pango_attr_iterator_get_font (iter, desc, &lang, NULL);
- str = pango_font_description_to_string (desc);
+ pango2_attr_iterator_range (iter, &start, &end);
+ pango2_attr_iterator_get_font (iter, desc, &lang, NULL);
+ str = pango2_font_description_to_string (desc);
g_string_append_printf (string, "[%d:%d] %s %s\n", start, end, (char *)lang, str);
g_free (str);
- } while (pango_attr_iterator_next (iter));
- pango_attr_iterator_destroy (iter);
- pango_attr_list_unref (attrs);
- pango_font_description_free (desc);
+ } while (pango2_attr_iterator_next (iter));
+ pango2_attr_iterator_destroy (iter);
+ pango2_attr_list_unref (attrs);
+ pango2_font_description_free (desc);
g_free (text);
if (accel)
diff --git a/tests/test-bidi.c b/tests/test-bidi.c
index c7b412f6..db128279 100644
--- a/tests/test-bidi.c
+++ b/tests/test-bidi.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* test-bidi.c: Test bidi apis
*
* Copyright (C) 2021 Red Hat, Inc.
@@ -22,7 +22,7 @@
#include <locale.h>
#include <pango/pango.h>
-static PangoContext *context;
+static Pango2Context *context;
#if 0
static void
@@ -31,32 +31,32 @@ test_bidi_embedding_levels (void)
/* Examples taken from https://www.w3.org/International/articles/inline-bidi-markup/uba-basics */
struct {
const char *text;
- PangoDirection dir;
+ Pango2Direction dir;
const char *levels;
- PangoDirection out_dir;
+ Pango2Direction out_dir;
} tests[] = {
- { "bahrain مصر kuwait", PANGO_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\1\1\1\0\0\0\0\0\0\0", PANGO_DIRECTION_LTR },
- { "bahrain مصر kuwait", PANGO_DIRECTION_WEAK_LTR, "\0\0\0\0\0\0\0\0\1\1\1\0\0\0\0\0\0\0", PANGO_DIRECTION_LTR },
- { "bahrain مصر kuwait", PANGO_DIRECTION_RTL, "\2\2\2\2\2\2\2\1\1\1\1\1\2\2\2\2\2\2", PANGO_DIRECTION_RTL },
- { "bahrain مصر kuwait", PANGO_DIRECTION_WEAK_RTL, "\0\0\0\0\0\0\0\0\1\1\1\0\0\0\0\0\0\0", PANGO_DIRECTION_LTR },
- { "The title is مفتاح معايير الويب in Arabic.", PANGO_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\0\0\0\0\0\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\0\0\0\0\0\0\0\0\0\0", PANGO_DIRECTION_LTR },
- { "The title is مفتاح معايير الويب, in Arabic.", PANGO_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\0\0\0\0\0\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\0\0\0\0\0\0\0\0\0\0\0", PANGO_DIRECTION_LTR },
- { "The title is مفتاح معايير الويب⁧!⁩ in Arabic.", PANGO_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\0\0\0\0\0\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\1\0\0\0\0\0\0\0\0\0\0\0", PANGO_DIRECTION_LTR }, // FIXME
- { "one two ثلاثة 1234 خمسة", PANGO_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\1\1\1\1\1\1\2\2\2\2\1\1\1\1\1", PANGO_DIRECTION_LTR },
- { "one two ثلاثة ١٢٣٤ خمسة", PANGO_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\1\1\1\1\1\1\2\2\2\2\1\1\1\1\1", PANGO_DIRECTION_LTR },
- { "abאב12cd", PANGO_DIRECTION_LTR, "\0\0\1\1\2\2\0\0" },
- { "abאב‪xy‬cd", PANGO_DIRECTION_LTR, "\0\0\1\1\1\2\2\2\0\0" },
+ { "bahrain مصر kuwait", PANGO2_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\1\1\1\0\0\0\0\0\0\0", PANGO2_DIRECTION_LTR },
+ { "bahrain مصر kuwait", PANGO2_DIRECTION_WEAK_LTR, "\0\0\0\0\0\0\0\0\1\1\1\0\0\0\0\0\0\0", PANGO2_DIRECTION_LTR },
+ { "bahrain مصر kuwait", PANGO2_DIRECTION_RTL, "\2\2\2\2\2\2\2\1\1\1\1\1\2\2\2\2\2\2", PANGO2_DIRECTION_RTL },
+ { "bahrain مصر kuwait", PANGO2_DIRECTION_WEAK_RTL, "\0\0\0\0\0\0\0\0\1\1\1\0\0\0\0\0\0\0", PANGO2_DIRECTION_LTR },
+ { "The title is مفتاح معايير الويب in Arabic.", PANGO2_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\0\0\0\0\0\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\0\0\0\0\0\0\0\0\0\0", PANGO2_DIRECTION_LTR },
+ { "The title is مفتاح معايير الويب, in Arabic.", PANGO2_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\0\0\0\0\0\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\0\0\0\0\0\0\0\0\0\0\0", PANGO2_DIRECTION_LTR },
+ { "The title is مفتاح معايير الويب⁧!⁩ in Arabic.", PANGO2_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\0\0\0\0\0\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\1\0\0\0\0\0\0\0\0\0\0\0", PANGO2_DIRECTION_LTR }, // FIXME
+ { "one two ثلاثة 1234 خمسة", PANGO2_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\1\1\1\1\1\1\2\2\2\2\1\1\1\1\1", PANGO2_DIRECTION_LTR },
+ { "one two ثلاثة ١٢٣٤ خمسة", PANGO2_DIRECTION_LTR, "\0\0\0\0\0\0\0\0\1\1\1\1\1\1\2\2\2\2\1\1\1\1\1", PANGO2_DIRECTION_LTR },
+ { "abאב12cd", PANGO2_DIRECTION_LTR, "\0\0\1\1\2\2\0\0" },
+ { "abאב‪xy‬cd", PANGO2_DIRECTION_LTR, "\0\0\1\1\1\2\2\2\0\0" },
};
for (int i = 0; i < G_N_ELEMENTS (tests); i++)
{
const char *text = tests[i].text;
- PangoDirection dir = tests[i].dir;
+ Pango2Direction dir = tests[i].dir;
guint8 *levels;
gsize len;
- levels = pango_log2vis_get_embedding_levels (text, -1, &dir);
+ levels = pango2_log2vis_get_embedding_levels (text, -1, &dir);
len = g_utf8_strlen (text, -1);
@@ -74,8 +74,8 @@ test_bidi_embedding_levels (void)
}
#endif
-/* Some basic tests for pango_layout_move_cursor inside
- * a single PangoLine:
+/* Some basic tests for pango2_layout_move_cursor inside
+ * a single Pango2Line:
* - check that we actually move the cursor in the right direction
* - check that we get through the line with at most n steps
* - check that we don't skip legitimate cursor positions
@@ -90,10 +90,10 @@ test_move_cursor_line (void)
"aאב12b",
"pa­ra­graph", // soft hyphens
};
- PangoLayout *layout;
+ Pango2Layout *layout;
gboolean fail = FALSE;
- layout = pango_layout_new (context);
+ layout = pango2_layout_new (context);
for (int i = 0; i < G_N_ELEMENTS (tests); i++)
{
@@ -102,11 +102,11 @@ test_move_cursor_line (void)
int index;
int start_index;
gboolean trailing;
- PangoRectangle s_pos, old_s_pos;
- PangoRectangle w_pos, old_w_pos;
- PangoLines *lines;
- PangoLine *line;
- PangoLine *new_line;
+ Pango2Rectangle s_pos, old_s_pos;
+ Pango2Rectangle w_pos, old_w_pos;
+ Pango2Lines *lines;
+ Pango2Line *line;
+ Pango2Line *new_line;
struct {
int direction;
gboolean strong;
@@ -119,20 +119,20 @@ test_move_cursor_line (void)
int *strong_cursor;
int *weak_cursor;
gboolean *met_cursor;
- const PangoLogAttr *attrs;
+ const Pango2LogAttr *attrs;
int n_attrs;
int j;
const char *p;
- pango_layout_set_text (layout, tests[i], -1);
+ pango2_layout_set_text (layout, tests[i], -1);
- text = pango_layout_get_text (layout);
- lines = pango_layout_get_lines (layout);
- line = pango_lines_get_lines (lines)[0];
+ text = pango2_layout_get_text (layout);
+ lines = pango2_layout_get_lines (layout);
+ line = pango2_lines_get_lines (lines)[0];
n_chars = g_utf8_strlen (text, -1);
- attrs = pango_layout_get_log_attrs (layout, &n_attrs);
+ attrs = pango2_layout_get_log_attrs (layout, &n_attrs);
strong_cursor = g_new (int, n_attrs);
weak_cursor = g_new (int, n_attrs);
met_cursor = g_new (gboolean, n_attrs);
@@ -140,7 +140,7 @@ test_move_cursor_line (void)
{
if (attrs[j].is_cursor_position)
{
- pango_lines_get_cursor_pos (lines, NULL, p - text, &s_pos, &w_pos);
+ pango2_lines_get_cursor_pos (lines, NULL, p - text, &s_pos, &w_pos);
strong_cursor[j] = s_pos.x;
weak_cursor[j] = w_pos.x;
}
@@ -158,7 +158,7 @@ test_move_cursor_line (void)
params[j].direction > 0 ? "->" : "<-",
params[j].strong ? "strong" : "weak");
- if ((pango_line_get_resolved_direction (line) == PANGO_DIRECTION_LTR) == (params[j].direction > 0))
+ if ((pango2_line_get_resolved_direction (line) == PANGO2_DIRECTION_LTR) == (params[j].direction > 0))
start_index = 0;
else
start_index = strlen (text);
@@ -167,7 +167,7 @@ test_move_cursor_line (void)
memset (met_cursor, 0, sizeof (gboolean) * n_attrs);
- pango_lines_get_cursor_pos (lines, NULL, index, &s_pos, &w_pos);
+ pango2_lines_get_cursor_pos (lines, NULL, index, &s_pos, &w_pos);
for (int l = 0; l < n_attrs; l++)
{
if ((params[j].strong && strong_cursor[l] == s_pos.x) ||
@@ -181,7 +181,7 @@ test_move_cursor_line (void)
{
old_s_pos = s_pos;
old_w_pos = w_pos;
- pango_lines_move_cursor (lines, params[j].strong,
+ pango2_lines_move_cursor (lines, params[j].strong,
NULL,
index, 0,
params[j].direction,
@@ -197,7 +197,7 @@ test_move_cursor_line (void)
if (index == -1 || index == G_MAXINT)
break;
- pango_lines_get_cursor_pos (lines, NULL, index, &s_pos, &w_pos);
+ pango2_lines_get_cursor_pos (lines, NULL, index, &s_pos, &w_pos);
for (int l = 0; l < n_attrs; l++)
{
if ((params[j].strong && strong_cursor[l] == s_pos.x) ||
@@ -271,39 +271,39 @@ test_move_cursor_para (void)
{ "long word", 40 },
{ "זוהי השורה הראשונה" "\n" "זוהי השורה השנייה" "\n" "זוהי השורה השלישית" , 200 },
};
- PangoLayout *layout;
- PangoRectangle pos, old_pos;
+ Pango2Layout *layout;
+ Pango2Rectangle pos, old_pos;
int index;
int trailing;
const char *text;
- PangoLine *line;
- PangoLines *lines;
- PangoLine *new_line;
+ Pango2Line *line;
+ Pango2Lines *lines;
+ Pango2Line *new_line;
- layout = pango_layout_new (context);
+ layout = pango2_layout_new (context);
for (int i = 0; i < G_N_ELEMENTS (tests); i++)
{
- pango_layout_set_text (layout, tests[i].text, -1);
- text = pango_layout_get_text (layout);
+ pango2_layout_set_text (layout, tests[i].text, -1);
+ text = pango2_layout_get_text (layout);
if (tests[i].width > 0)
- pango_layout_set_width (layout, tests[i].width * PANGO_SCALE);
+ pango2_layout_set_width (layout, tests[i].width * PANGO2_SCALE);
else
- pango_layout_set_width (layout, -1);
+ pango2_layout_set_width (layout, -1);
index = 0;
- lines = pango_layout_get_lines (layout);
- pango_lines_get_cursor_pos (lines, NULL, index, &pos, NULL);
+ lines = pango2_layout_get_lines (layout);
+ pango2_lines_get_cursor_pos (lines, NULL, index, &pos, NULL);
while (index < G_MAXINT)
{
old_pos = pos;
- pango_lines_index_to_line (lines, index, &line, NULL, NULL, NULL);
+ pango2_lines_index_to_line (lines, index, &line, NULL, NULL, NULL);
if (line == NULL)
break;
- pango_lines_move_cursor(lines, TRUE,
+ pango2_lines_move_cursor(lines, TRUE,
NULL,
index, 0,
1,
@@ -321,7 +321,7 @@ test_move_cursor_para (void)
if (index >= strlen (tests[i].text) - 1)
continue;
- pango_lines_get_cursor_pos (lines, NULL, index, &pos, NULL);
+ pango2_lines_get_cursor_pos (lines, NULL, index, &pos, NULL);
// assert that we are either moving to the right
// or jumping to the next line
@@ -332,17 +332,17 @@ test_move_cursor_para (void)
/* and now backwards */
index = strlen (text);
- pango_lines_get_cursor_pos (lines, NULL, index, &pos, NULL);
+ pango2_lines_get_cursor_pos (lines, NULL, index, &pos, NULL);
while (index > -1)
{
old_pos = pos;
line = NULL;
- pango_lines_index_to_line (lines, index, &line, NULL, NULL, NULL);
+ pango2_lines_index_to_line (lines, index, &line, NULL, NULL, NULL);
g_assert_nonnull (line);
- pango_lines_move_cursor (lines, TRUE,
+ pango2_lines_move_cursor (lines, TRUE,
NULL,
index, 0,
-1,
@@ -357,7 +357,7 @@ test_move_cursor_para (void)
if (index == -1 || index == G_MAXINT)
break;
- pango_lines_get_cursor_pos (lines, NULL, index, &pos, NULL);
+ pango2_lines_get_cursor_pos (lines, NULL, index, &pos, NULL);
// assert that we are either moving to the left
// or jumping to the previous line
@@ -375,7 +375,7 @@ main (int argc, char *argv[])
{
setlocale (LC_ALL, "");
- context = pango_context_new ();
+ context = pango2_context_new ();
g_test_init (&argc, &argv, NULL);
diff --git a/tests/test-break.c b/tests/test-break.c
index cbec698b..23caba69 100644
--- a/tests/test-break.c
+++ b/tests/test-break.c
@@ -1,5 +1,5 @@
-/* Pango
- * test-break.c: Test Pango line breaking
+/* Pango2
+ * test-break.c: Test Pango2 line breaking
*
* Copyright (C) 2019 Red Hat, Inc
*
@@ -33,7 +33,7 @@
#include "validate-log-attrs.h"
-static PangoContext *context;
+static Pango2Context *context;
static gboolean opt_hex_chars;
@@ -43,7 +43,7 @@ test_file (const char *filename, GString *string)
char *contents;
gsize length;
GError *error = NULL;
- const PangoLogAttr *attrs;
+ const Pango2LogAttr *attrs;
int len;
char *p;
int i;
@@ -51,8 +51,8 @@ test_file (const char *filename, GString *string)
int m;
char *test;
char *text;
- PangoAttrList *attributes;
- PangoLayout *layout;
+ Pango2AttrList *attributes;
+ Pango2Layout *layout;
g_file_get_contents (filename, &contents, &length, &error);
g_assert_no_error (error);
@@ -66,15 +66,15 @@ test_file (const char *filename, GString *string)
length = strlen (test);
len = g_utf8_strlen (test, -1) + 1;
- pango_parse_markup (test, -1, 0, &attributes, &text, NULL, &error);
+ pango2_parse_markup (test, -1, 0, &attributes, &text, NULL, &error);
g_assert_no_error (error);
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, text, length);
- pango_layout_set_attributes (layout, attributes);
+ layout = pango2_layout_new (context);
+ pango2_layout_set_text (layout, text, length);
+ pango2_layout_set_attributes (layout, attributes);
#if 0
- if (pango_layout_get_unknown_glyphs_count (layout) > 0)
+ if (pango2_layout_get_unknown_glyphs_count (layout) > 0)
{
char *msg = g_strdup_printf ("Missing glyphs - skipping %s. Maybe fonts are missing?", filename);
if (g_test_initialized())
@@ -84,15 +84,15 @@ test_file (const char *filename, GString *string)
g_free (msg);
g_free (contents);
g_object_unref (layout);
- pango_attr_list_unref (attributes);
+ pango2_attr_list_unref (attributes);
g_free (text);
return FALSE;
}
#endif
- attrs = pango_layout_get_log_attrs (layout, &len);
+ attrs = pango2_layout_get_log_attrs (layout, &len);
- if (!pango_validate_log_attrs (text, length, attrs, len, &error))
+ if (!pango2_validate_log_attrs (text, length, attrs, len, &error))
{
g_warning ("%s: Log attrs invalid: %s", filename, error->message);
// g_assert_not_reached ();
@@ -119,7 +119,7 @@ test_file (const char *filename, GString *string)
for (i = 0, p = text; i < len; i++, p = g_utf8_next_char (p))
{
- PangoLogAttr log = attrs[i];
+ Pango2LogAttr log = attrs[i];
int b = 0;
int w = 0;
int o = 0;
@@ -279,7 +279,7 @@ test_file (const char *filename, GString *string)
g_object_unref (layout);
g_free (contents);
g_free (text);
- pango_attr_list_unref (attributes);
+ pango2_attr_list_unref (attributes);
return TRUE;
}
@@ -386,7 +386,7 @@ main (int argc, char *argv[])
g_option_context_free (option_context);
install_fonts ();
- context = pango_context_new ();
+ context = pango2_context_new ();
if (opt_legend)
{
diff --git a/tests/test-common.c b/tests/test-common.c
index d3afe032..84dfbef9 100644
--- a/tests/test-common.c
+++ b/tests/test-common.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* test-common.c: Common test code
*
* Copyright (C) 2014 Red Hat, Inc
@@ -169,44 +169,44 @@ file_has_prefix (const char *filename,
}
void
-print_attribute (PangoAttribute *attr, GString *string)
+print_attribute (Pango2Attribute *attr, GString *string)
{
- PangoAttrList *l = pango_attr_list_new ();
+ Pango2AttrList *l = pango2_attr_list_new ();
char *s;
- pango_attr_list_insert (l, pango_attribute_copy (attr));
- s = pango_attr_list_to_string (l);
+ pango2_attr_list_insert (l, pango2_attribute_copy (attr));
+ s = pango2_attr_list_to_string (l);
g_string_append (string, s);
g_free (s);
- pango_attr_list_unref (l);
+ pango2_attr_list_unref (l);
}
void
-print_attr_list (PangoAttrList *attrs, GString *string)
+print_attr_list (Pango2AttrList *attrs, GString *string)
{
- PangoAttrIterator *iter;
+ Pango2AttrIterator *iter;
if (!attrs)
return;
- iter = pango_attr_list_get_iterator (attrs);
+ iter = pango2_attr_list_get_iterator (attrs);
do {
int start, end;
GSList *list, *l;
- pango_attr_iterator_range (iter, &start, &end);
+ pango2_attr_iterator_range (iter, &start, &end);
g_string_append_printf (string, "range %d %d\n", start, end);
- list = pango_attr_iterator_get_attrs (iter);
+ list = pango2_attr_iterator_get_attrs (iter);
for (l = list; l; l = l->next)
{
- PangoAttribute *attr = l->data;
+ Pango2Attribute *attr = l->data;
print_attribute (attr, string);
g_string_append (string, "\n");
}
- g_slist_free_full (list, (GDestroyNotify)pango_attribute_destroy);
- } while (pango_attr_iterator_next (iter));
+ g_slist_free_full (list, (GDestroyNotify)pango2_attribute_destroy);
+ } while (pango2_attr_iterator_next (iter));
- pango_attr_iterator_destroy (iter);
+ pango2_attr_iterator_destroy (iter);
}
void
@@ -216,7 +216,7 @@ print_attributes (GSList *attrs, GString *string)
for (l = attrs; l; l = l->next)
{
- PangoAttribute *attr = l->data;
+ Pango2Attribute *attr = l->data;
print_attribute (attr, string);
g_string_append (string, "\n");
@@ -238,14 +238,14 @@ get_script_name (GUnicodeScript s)
}
static void
-add_file (PangoFontMap *map,
+add_file (Pango2FontMap *map,
const char *path,
const char *name)
{
char *fullname;
hb_blob_t *blob;
hb_face_t *hbface;
- PangoHbFace *face;
+ Pango2HbFace *face;
fullname = g_build_filename (path, name, NULL);
@@ -261,22 +261,22 @@ add_file (PangoFontMap *map,
if (hb_ot_var_get_axis_count (hbface) == 0)
{
/* Add the default instance */
- face = pango_hb_face_new_from_hb_face (hbface, -1, NULL, NULL);
- pango_font_map_add_face (map, PANGO_FONT_FACE (face));
+ face = pango2_hb_face_new_from_hb_face (hbface, -1, NULL, NULL);
+ pango2_font_map_add_face (map, PANGO2_FONT_FACE (face));
return;
}
/* Add the variable face */
- face = pango_hb_face_new_from_hb_face (hbface, -2, "Variable", NULL);
- pango_font_map_add_face (map, PANGO_FONT_FACE (face));
+ face = pango2_hb_face_new_from_hb_face (hbface, -2, "Variable", NULL);
+ pango2_font_map_add_face (map, PANGO2_FONT_FACE (face));
if (hb_ot_var_get_named_instance_count (hbface) > 0)
{
/* Add named instances */
for (int i = 0; i < hb_ot_var_get_named_instance_count (hbface); i++)
{
- face = pango_hb_face_new_from_hb_face (hbface, i, NULL, NULL);
- pango_font_map_add_face (map, PANGO_FONT_FACE (face));
+ face = pango2_hb_face_new_from_hb_face (hbface, i, NULL, NULL);
+ pango2_font_map_add_face (map, PANGO2_FONT_FACE (face));
}
}
@@ -284,7 +284,7 @@ add_file (PangoFontMap *map,
}
static void
-add_generic_family (PangoFontMap *map,
+add_generic_family (Pango2FontMap *map,
const char *path,
const char *name)
{
@@ -294,7 +294,7 @@ add_generic_family (PangoFontMap *map,
char *basename;
char **families;
GError *error = NULL;
- PangoGenericFamily *generic;
+ Pango2GenericFamily *generic;
g_assert (g_str_has_suffix (name, ".generic"));
@@ -308,28 +308,28 @@ add_generic_family (PangoFontMap *map,
basename = g_strdup (name);
basename[strlen (name) - strlen (".generic")] = '\0';
- generic = pango_generic_family_new (basename);
+ generic = pango2_generic_family_new (basename);
families = g_strsplit (contents, "\n", -1);
for (int i = 0; families[i]; i++)
{
const char *name = families[i];
- PangoFontFamily *family;
+ Pango2FontFamily *family;
if (name[0] == '\0')
continue;
- family = pango_font_map_get_family (map, name);
+ family = pango2_font_map_get_family (map, name);
if (!family)
{
g_warning ("no such family: %s", name);
continue;
}
- pango_generic_family_add_family (generic, family);
+ pango2_generic_family_add_family (generic, family);
}
- pango_font_map_add_family (map, PANGO_FONT_FAMILY (generic));
+ pango2_font_map_add_family (map, PANGO2_FONT_FAMILY (generic));
g_strfreev (families);
g_free (basename);
@@ -337,7 +337,7 @@ add_generic_family (PangoFontMap *map,
}
static void
-add_synthetic_faces (PangoFontMap *map,
+add_synthetic_faces (Pango2FontMap *map,
const char *path,
const char *name)
{
@@ -346,10 +346,10 @@ add_synthetic_faces (PangoFontMap *map,
GError *error = NULL;
gsize length;
char *basename;
- PangoFontFamily *family;
+ Pango2FontFamily *family;
gboolean make_italic;
- PangoMatrix italic_matrix = { 1, 0.2, 0, 1, 0, 0 };
- PangoHbFace *newface;
+ Pango2Matrix italic_matrix = { 1, 0.2, 0, 1, 0, 0 };
+ Pango2HbFace *newface;
GSList *newfaces, *l;
g_assert (g_str_has_suffix (name, ".synthetic"));
@@ -364,7 +364,7 @@ add_synthetic_faces (PangoFontMap *map,
basename = g_strdup (name);
basename[strlen (name) - strlen (".synthetic")] = '\0';
- family = pango_font_map_get_family (map, basename);
+ family = pango2_font_map_get_family (map, basename);
if (!family)
g_error ("Family %s not found", basename);
@@ -375,27 +375,27 @@ add_synthetic_faces (PangoFontMap *map,
for (int i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (family)); i++)
{
- PangoHbFace *face = g_list_model_get_item (G_LIST_MODEL (family), i);
+ Pango2HbFace *face = g_list_model_get_item (G_LIST_MODEL (family), i);
if (make_italic)
{
char *name;
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
- name = g_strconcat (pango_font_face_get_name (PANGO_FONT_FACE (face)),
+ name = g_strconcat (pango2_font_face_get_name (PANGO2_FONT_FACE (face)),
" Italic",
NULL);
- desc = pango_font_face_describe (PANGO_FONT_FACE (face));
- pango_font_description_set_style (desc, PANGO_STYLE_ITALIC);
- pango_font_description_unset_fields (desc, ~(PANGO_FONT_MASK_FAMILY|
- PANGO_FONT_MASK_STYLE|
- PANGO_FONT_MASK_STRETCH|
- PANGO_FONT_MASK_WEIGHT));
- newface = pango_hb_face_new_synthetic (face, &italic_matrix, FALSE, name, desc);
+ desc = pango2_font_face_describe (PANGO2_FONT_FACE (face));
+ pango2_font_description_set_style (desc, PANGO2_STYLE_ITALIC);
+ pango2_font_description_unset_fields (desc, ~(PANGO2_FONT_MASK_FAMILY|
+ PANGO2_FONT_MASK_STYLE|
+ PANGO2_FONT_MASK_STRETCH|
+ PANGO2_FONT_MASK_WEIGHT));
+ newface = pango2_hb_face_new_synthetic (face, &italic_matrix, FALSE, name, desc);
newfaces = g_slist_prepend (newfaces, newface);
g_free (name);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
}
g_object_unref (face);
@@ -405,7 +405,7 @@ add_synthetic_faces (PangoFontMap *map,
for (l = newfaces; l; l = l->next)
{
newface = l->data;
- pango_font_map_add_face (map, PANGO_FONT_FACE (newface));
+ pango2_font_map_add_face (map, PANGO2_FONT_FACE (newface));
}
g_slist_free (newfaces);
@@ -417,14 +417,14 @@ add_synthetic_faces (PangoFontMap *map,
void
install_fonts (void)
{
- PangoFontMap *map;
+ Pango2FontMap *map;
GDir *dir;
GError *error = NULL;
GPtrArray *generic;
GPtrArray *synthetic;
char *path = NULL;
- map = pango_font_map_new ();
+ map = pango2_font_map_new ();
path = g_build_filename (g_getenv ("G_TEST_SRCDIR"), "fonts", NULL);
@@ -469,7 +469,7 @@ install_fonts (void)
g_ptr_array_free (synthetic, TRUE);
- pango_font_map_set_default (map);
+ pango2_font_map_set_default (map);
g_object_unref (map);
g_dir_close (dir);
@@ -480,30 +480,30 @@ install_fonts (void)
void
dump_fonts (void)
{
- PangoFontMap *map;
+ Pango2FontMap *map;
- map = pango_font_map_get_default ();
+ map = pango2_font_map_get_default ();
for (int i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (map)); i++)
{
- PangoFontFamily *family = g_list_model_get_item (G_LIST_MODEL (map), i);
+ Pango2FontFamily *family = g_list_model_get_item (G_LIST_MODEL (map), i);
- if (PANGO_IS_GENERIC_FAMILY (family))
+ if (PANGO2_IS_GENERIC_FAMILY (family))
{
- g_print ("%s (generic)\n", pango_font_family_get_name (family));
+ g_print ("%s (generic)\n", pango2_font_family_get_name (family));
}
else
{
- g_print ("%s\n", pango_font_family_get_name (family));
+ g_print ("%s\n", pango2_font_family_get_name (family));
for (int j = 0; j < g_list_model_get_n_items (G_LIST_MODEL (family)); j++)
{
- PangoFontFace *face = g_list_model_get_item (G_LIST_MODEL (family), j);
+ Pango2FontFace *face = g_list_model_get_item (G_LIST_MODEL (family), j);
g_print ("\t%s %s%s\n",
- pango_font_family_get_name (family),
- pango_font_face_get_name (face),
- pango_font_face_is_variable (face) ? " (variable)" : "");
+ pango2_font_family_get_name (family),
+ pango2_font_face_get_name (face),
+ pango2_font_face_is_variable (face) ? " (variable)" : "");
g_object_unref (face);
}
diff --git a/tests/test-common.h b/tests/test-common.h
index 2141100d..2baa85b3 100644
--- a/tests/test-common.h
+++ b/tests/test-common.h
@@ -14,13 +14,13 @@ gboolean file_has_prefix (const char *file,
const char *str,
GError **error);
-void print_attribute (PangoAttribute *attr,
+void print_attribute (Pango2Attribute *attr,
GString *string);
void print_attributes (GSList *attrs,
GString *string);
-void print_attr_list (PangoAttrList *attrs,
+void print_attr_list (Pango2AttrList *attrs,
GString *string);
const char *get_script_name (GUnicodeScript s);
diff --git a/tests/test-ellipsize.c b/tests/test-ellipsize.c
index fcd5d049..a469cb63 100644
--- a/tests/test-ellipsize.c
+++ b/tests/test-ellipsize.c
@@ -1,5 +1,5 @@
-/* Pango
- * test-ellipsize.c: Test Pango harfbuzz apis
+/* Pango2
+ * test-ellipsize.c: Test Pango2 harfbuzz apis
*
* Copyright (C) 2019 Red Hat, Inc.
*
@@ -22,7 +22,7 @@
#include <pango/pango.h>
#include "test-common.h"
-static PangoContext *context;
+static Pango2Context *context;
/* Test that ellipsization does not change the height of a layout.
* See https://gitlab.gnome.org/GNOME/pango/issues/397
@@ -30,26 +30,26 @@ static PangoContext *context;
static void
test_ellipsize_height (void)
{
- PangoLayout *layout;
+ Pango2Layout *layout;
int height1, height2;
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
- layout = pango_layout_new (context);
+ layout = pango2_layout_new (context);
- desc = pango_font_description_from_string ("Fixed 7");
- //pango_layout_set_font_description (layout, desc);
- pango_font_description_free (desc);
+ desc = pango2_font_description_from_string ("Fixed 7");
+ //pango2_layout_set_font_description (layout, desc);
+ pango2_font_description_free (desc);
- pango_layout_set_text (layout, "some text that should be ellipsized", -1);
- g_assert_cmpint (pango_lines_get_line_count (pango_layout_get_lines (layout)), ==, 1);
- pango_lines_get_size (pango_layout_get_lines (layout), NULL, &height1);
+ pango2_layout_set_text (layout, "some text that should be ellipsized", -1);
+ g_assert_cmpint (pango2_lines_get_line_count (pango2_layout_get_lines (layout)), ==, 1);
+ pango2_lines_get_size (pango2_layout_get_lines (layout), NULL, &height1);
- pango_layout_set_width (layout, 100 * PANGO_SCALE);
- pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
+ pango2_layout_set_width (layout, 100 * PANGO2_SCALE);
+ pango2_layout_set_ellipsize (layout, PANGO2_ELLIPSIZE_END);
- g_assert_cmpint (pango_lines_get_line_count (pango_layout_get_lines (layout)), ==, 1);
- g_assert_true (pango_lines_is_ellipsized (pango_layout_get_lines (layout)));
- pango_lines_get_size (pango_layout_get_lines (layout), NULL, &height2);
+ g_assert_cmpint (pango2_lines_get_line_count (pango2_layout_get_lines (layout)), ==, 1);
+ g_assert_true (pango2_lines_is_ellipsized (pango2_layout_get_lines (layout)));
+ pango2_lines_get_size (pango2_layout_get_lines (layout), NULL, &height2);
g_assert_cmpint (height1, ==, height2);
@@ -61,18 +61,18 @@ test_ellipsize_height (void)
static void
test_ellipsize_crash (void)
{
- PangoLayout *layout;
+ Pango2Layout *layout;
- layout = pango_layout_new (context);
+ layout = pango2_layout_new (context);
- pango_layout_set_text (layout, "some text that should be ellipsized", -1);
- g_assert_cmpint (pango_lines_get_line_count (pango_layout_get_lines (layout)), ==, 1);
+ pango2_layout_set_text (layout, "some text that should be ellipsized", -1);
+ g_assert_cmpint (pango2_lines_get_line_count (pango2_layout_get_lines (layout)), ==, 1);
- pango_layout_set_width (layout, 100 * PANGO_SCALE);
- pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
+ pango2_layout_set_width (layout, 100 * PANGO2_SCALE);
+ pango2_layout_set_ellipsize (layout, PANGO2_ELLIPSIZE_END);
- g_assert_cmpint (pango_lines_get_line_count (pango_layout_get_lines (layout)), ==, 1);
- g_assert_true (pango_lines_is_ellipsized (pango_layout_get_lines (layout)));
+ g_assert_cmpint (pango2_lines_get_line_count (pango2_layout_get_lines (layout)), ==, 1);
+ g_assert_true (pango2_lines_is_ellipsized (pango2_layout_get_lines (layout)));
g_object_unref (layout);
}
@@ -83,21 +83,21 @@ test_ellipsize_crash (void)
static void
test_ellipsize_fully (void)
{
- PangoLayout *layout;
- PangoRectangle ink, logical;
- PangoRectangle ink2, logical2;
+ Pango2Layout *layout;
+ Pango2Rectangle ink, logical;
+ Pango2Rectangle ink2, logical2;
- layout = pango_layout_new (context);
+ layout = pango2_layout_new (context);
- pango_layout_set_text (layout, "…", -1);
- pango_lines_get_extents (pango_layout_get_lines (layout), &ink, &logical);
+ pango2_layout_set_text (layout, "…", -1);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), &ink, &logical);
- pango_layout_set_text (layout, "ellipsized", -1);
+ pango2_layout_set_text (layout, "ellipsized", -1);
- pango_layout_set_width (layout, 10 * PANGO_SCALE);
- pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
+ pango2_layout_set_width (layout, 10 * PANGO2_SCALE);
+ pango2_layout_set_ellipsize (layout, PANGO2_ELLIPSIZE_END);
- pango_lines_get_extents (pango_layout_get_lines (layout), &ink2, &logical2);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), &ink2, &logical2);
g_assert_cmpint (ink.width, ==, ink2.width);
g_assert_cmpint (logical.width, ==, logical2.width);
@@ -108,7 +108,7 @@ test_ellipsize_fully (void)
int
main (int argc, char *argv[])
{
- context = pango_context_new ();
+ context = pango2_context_new ();
g_test_init (&argc, &argv, NULL);
diff --git a/tests/test-font.c b/tests/test-font.c
index 9e1ad648..e37d0a63 100644
--- a/tests/test-font.c
+++ b/tests/test-font.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* test-font.c: Test fonts and font maps
*
* Copyright (C) 2014 Red Hat, Inc
@@ -30,162 +30,162 @@
#include "test-common.h"
-static PangoContext *context;
+static Pango2Context *context;
static void
test_parse (void)
{
- PangoFontDescription **descs;
- PangoFontDescription *desc;
-
- descs = g_new (PangoFontDescription *, 2);
-
- descs[0] = desc = pango_font_description_from_string ("Cantarell 14");
-
- g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarell");
- g_assert (!pango_font_description_get_size_is_absolute (desc));
- g_assert_cmpint (pango_font_description_get_size (desc), ==, 14 * PANGO_SCALE);
- g_assert_cmpint (pango_font_description_get_style (desc), ==, PANGO_STYLE_NORMAL);
- g_assert_cmpint (pango_font_description_get_variant (desc), ==, PANGO_VARIANT_NORMAL);
- g_assert_cmpint (pango_font_description_get_weight (desc), ==, PANGO_WEIGHT_NORMAL);
- g_assert_cmpint (pango_font_description_get_stretch (desc), ==, PANGO_STRETCH_NORMAL);
- g_assert_cmpint (pango_font_description_get_gravity (desc), ==, PANGO_GRAVITY_SOUTH);
- g_assert_cmpint (pango_font_description_get_set_fields (desc), ==, PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_STYLE | PANGO_FONT_MASK_VARIANT | PANGO_FONT_MASK_WEIGHT | PANGO_FONT_MASK_STRETCH | PANGO_FONT_MASK_SIZE);
-
- descs[1] = desc = pango_font_description_from_string ("Sans Bold Italic Condensed 22.5px");
-
- g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Sans");
- g_assert (pango_font_description_get_size_is_absolute (desc));
- g_assert_cmpint (pango_font_description_get_size (desc), ==, 225 * PANGO_SCALE / 10);
- g_assert_cmpint (pango_font_description_get_style (desc), ==, PANGO_STYLE_ITALIC);
- g_assert_cmpint (pango_font_description_get_variant (desc), ==, PANGO_VARIANT_NORMAL);
- g_assert_cmpint (pango_font_description_get_weight (desc), ==, PANGO_WEIGHT_BOLD);
- g_assert_cmpint (pango_font_description_get_stretch (desc), ==, PANGO_STRETCH_CONDENSED);
- g_assert_cmpint (pango_font_description_get_gravity (desc), ==, PANGO_GRAVITY_SOUTH); g_assert_cmpint (pango_font_description_get_set_fields (desc), ==, PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_STYLE | PANGO_FONT_MASK_VARIANT | PANGO_FONT_MASK_WEIGHT | PANGO_FONT_MASK_STRETCH | PANGO_FONT_MASK_SIZE);
-
- pango_font_description_free (descs[0]);
- pango_font_description_free (descs[1]);
+ Pango2FontDescription **descs;
+ Pango2FontDescription *desc;
+
+ descs = g_new (Pango2FontDescription *, 2);
+
+ descs[0] = desc = pango2_font_description_from_string ("Cantarell 14");
+
+ g_assert_cmpstr (pango2_font_description_get_family (desc), ==, "Cantarell");
+ g_assert (!pango2_font_description_get_size_is_absolute (desc));
+ g_assert_cmpint (pango2_font_description_get_size (desc), ==, 14 * PANGO2_SCALE);
+ g_assert_cmpint (pango2_font_description_get_style (desc), ==, PANGO2_STYLE_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_variant (desc), ==, PANGO2_VARIANT_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_weight (desc), ==, PANGO2_WEIGHT_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_stretch (desc), ==, PANGO2_STRETCH_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_gravity (desc), ==, PANGO2_GRAVITY_SOUTH);
+ g_assert_cmpint (pango2_font_description_get_set_fields (desc), ==, PANGO2_FONT_MASK_FAMILY | PANGO2_FONT_MASK_STYLE | PANGO2_FONT_MASK_VARIANT | PANGO2_FONT_MASK_WEIGHT | PANGO2_FONT_MASK_STRETCH | PANGO2_FONT_MASK_SIZE);
+
+ descs[1] = desc = pango2_font_description_from_string ("Sans Bold Italic Condensed 22.5px");
+
+ g_assert_cmpstr (pango2_font_description_get_family (desc), ==, "Sans");
+ g_assert (pango2_font_description_get_size_is_absolute (desc));
+ g_assert_cmpint (pango2_font_description_get_size (desc), ==, 225 * PANGO2_SCALE / 10);
+ g_assert_cmpint (pango2_font_description_get_style (desc), ==, PANGO2_STYLE_ITALIC);
+ g_assert_cmpint (pango2_font_description_get_variant (desc), ==, PANGO2_VARIANT_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_weight (desc), ==, PANGO2_WEIGHT_BOLD);
+ g_assert_cmpint (pango2_font_description_get_stretch (desc), ==, PANGO2_STRETCH_CONDENSED);
+ g_assert_cmpint (pango2_font_description_get_gravity (desc), ==, PANGO2_GRAVITY_SOUTH); g_assert_cmpint (pango2_font_description_get_set_fields (desc), ==, PANGO2_FONT_MASK_FAMILY | PANGO2_FONT_MASK_STYLE | PANGO2_FONT_MASK_VARIANT | PANGO2_FONT_MASK_WEIGHT | PANGO2_FONT_MASK_STRETCH | PANGO2_FONT_MASK_SIZE);
+
+ pango2_font_description_free (descs[0]);
+ pango2_font_description_free (descs[1]);
}
static void
test_roundtrip (void)
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
char *str;
- desc = pango_font_description_from_string ("Cantarell 14");
- str = pango_font_description_to_string (desc);
+ desc = pango2_font_description_from_string ("Cantarell 14");
+ str = pango2_font_description_to_string (desc);
g_assert_cmpstr (str, ==, "Cantarell 14");
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_free (str);
- desc = pango_font_description_from_string ("Sans Bold Italic Condensed 22.5px");
- str = pango_font_description_to_string (desc);
+ desc = pango2_font_description_from_string ("Sans Bold Italic Condensed 22.5px");
+ str = pango2_font_description_to_string (desc);
g_assert_cmpstr (str, ==, "Sans Bold Italic Condensed 22.5px");
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_free (str);
}
static void
test_variations (void)
{
- PangoFontDescription *desc1;
- PangoFontDescription *desc2;
+ Pango2FontDescription *desc1;
+ Pango2FontDescription *desc2;
char *str;
- desc1 = pango_font_description_from_string ("Cantarell 14");
+ desc1 = pango2_font_description_from_string ("Cantarell 14");
g_assert_nonnull (desc1);
- g_assert_cmpint ((pango_font_description_get_set_fields (desc1) & PANGO_FONT_MASK_VARIATIONS), ==, 0);
- g_assert_cmpstr (pango_font_description_get_family (desc1), ==, "Cantarell");
- g_assert_cmpint (pango_font_description_get_size (desc1), ==, 14 * PANGO_SCALE);
- g_assert_null (pango_font_description_get_variations (desc1));
+ g_assert_cmpint ((pango2_font_description_get_set_fields (desc1) & PANGO2_FONT_MASK_VARIATIONS), ==, 0);
+ g_assert_cmpstr (pango2_font_description_get_family (desc1), ==, "Cantarell");
+ g_assert_cmpint (pango2_font_description_get_size (desc1), ==, 14 * PANGO2_SCALE);
+ g_assert_null (pango2_font_description_get_variations (desc1));
- str = pango_font_description_to_string (desc1);
+ str = pango2_font_description_to_string (desc1);
g_assert_cmpstr (str, ==, "Cantarell 14");
g_free (str);
- desc2 = pango_font_description_from_string ("Cantarell 14 @wght=100,wdth=235");
+ desc2 = pango2_font_description_from_string ("Cantarell 14 @wght=100,wdth=235");
g_assert_nonnull (desc2);
- g_assert_cmpint ((pango_font_description_get_set_fields (desc2) & PANGO_FONT_MASK_VARIATIONS), ==, PANGO_FONT_MASK_VARIATIONS);
- g_assert_cmpstr (pango_font_description_get_family (desc2), ==, "Cantarell");
- g_assert_cmpint (pango_font_description_get_size (desc2), ==, 14 * PANGO_SCALE);
- g_assert_cmpstr (pango_font_description_get_variations (desc2), ==, "wght=100,wdth=235");
+ g_assert_cmpint ((pango2_font_description_get_set_fields (desc2) & PANGO2_FONT_MASK_VARIATIONS), ==, PANGO2_FONT_MASK_VARIATIONS);
+ g_assert_cmpstr (pango2_font_description_get_family (desc2), ==, "Cantarell");
+ g_assert_cmpint (pango2_font_description_get_size (desc2), ==, 14 * PANGO2_SCALE);
+ g_assert_cmpstr (pango2_font_description_get_variations (desc2), ==, "wght=100,wdth=235");
- str = pango_font_description_to_string (desc2);
+ str = pango2_font_description_to_string (desc2);
g_assert_cmpstr (str, ==, "Cantarell 14 @wght=100,wdth=235");
g_free (str);
- g_assert_false (pango_font_description_equal (desc1, desc2));
+ g_assert_false (pango2_font_description_equal (desc1, desc2));
- pango_font_description_set_variations (desc1, "wght=100,wdth=235");
- g_assert_cmpint ((pango_font_description_get_set_fields (desc1) & PANGO_FONT_MASK_VARIATIONS), ==, PANGO_FONT_MASK_VARIATIONS);
- g_assert_cmpstr (pango_font_description_get_variations (desc1), ==, "wght=100,wdth=235");
+ pango2_font_description_set_variations (desc1, "wght=100,wdth=235");
+ g_assert_cmpint ((pango2_font_description_get_set_fields (desc1) & PANGO2_FONT_MASK_VARIATIONS), ==, PANGO2_FONT_MASK_VARIATIONS);
+ g_assert_cmpstr (pango2_font_description_get_variations (desc1), ==, "wght=100,wdth=235");
- g_assert_true (pango_font_description_equal (desc1, desc2));
+ g_assert_true (pango2_font_description_equal (desc1, desc2));
- pango_font_description_free (desc1);
- pango_font_description_free (desc2);
+ pango2_font_description_free (desc1);
+ pango2_font_description_free (desc2);
}
static void
test_empty_variations (void)
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
char *str;
- desc = pango_font_description_from_string ("Cantarell 14");
+ desc = pango2_font_description_from_string ("Cantarell 14");
g_assert_nonnull (desc);
- g_assert_cmpint ((pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_VARIATIONS), ==, 0);
- g_assert_null (pango_font_description_get_variations (desc));
+ g_assert_cmpint ((pango2_font_description_get_set_fields (desc) & PANGO2_FONT_MASK_VARIATIONS), ==, 0);
+ g_assert_null (pango2_font_description_get_variations (desc));
- str = pango_font_description_to_string (desc);
+ str = pango2_font_description_to_string (desc);
g_assert_cmpstr (str, ==, "Cantarell 14");
g_free (str);
- pango_font_description_set_variations (desc, "");
- g_assert_cmpint ((pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_VARIATIONS), ==, PANGO_FONT_MASK_VARIATIONS);
- g_assert_cmpstr (pango_font_description_get_variations (desc), ==, "");
+ pango2_font_description_set_variations (desc, "");
+ g_assert_cmpint ((pango2_font_description_get_set_fields (desc) & PANGO2_FONT_MASK_VARIATIONS), ==, PANGO2_FONT_MASK_VARIATIONS);
+ g_assert_cmpstr (pango2_font_description_get_variations (desc), ==, "");
- str = pango_font_description_to_string (desc);
+ str = pango2_font_description_to_string (desc);
g_assert_cmpstr (str, ==, "Cantarell 14");
g_free (str);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
}
static void
test_metrics (void)
{
- PangoFontDescription *desc;
- PangoFontMetrics *metrics;
+ Pango2FontDescription *desc;
+ Pango2FontMetrics *metrics;
char *str;
- desc = pango_font_description_from_string ("Cantarell 11");
+ desc = pango2_font_description_from_string ("Cantarell 11");
- str = pango_font_description_to_string (desc);
+ str = pango2_font_description_to_string (desc);
- metrics = pango_context_get_metrics (context, desc, pango_language_get_default ());
+ metrics = pango2_context_get_metrics (context, desc, pango2_language_get_default ());
g_test_message ("%s metrics", str);
- g_test_message ("\tascent: %d", pango_font_metrics_get_ascent (metrics));
- g_test_message ("\tdescent: %d", pango_font_metrics_get_descent (metrics));
- g_test_message ("\theight: %d", pango_font_metrics_get_height (metrics));
+ g_test_message ("\tascent: %d", pango2_font_metrics_get_ascent (metrics));
+ g_test_message ("\tdescent: %d", pango2_font_metrics_get_descent (metrics));
+ g_test_message ("\theight: %d", pango2_font_metrics_get_height (metrics));
g_test_message ("\tchar width: %d",
- pango_font_metrics_get_approximate_char_width (metrics));
+ pango2_font_metrics_get_approximate_char_width (metrics));
g_test_message ("\tdigit width: %d",
- pango_font_metrics_get_approximate_digit_width (metrics));
+ pango2_font_metrics_get_approximate_digit_width (metrics));
g_test_message ("\tunderline position: %d",
- pango_font_metrics_get_underline_position (metrics));
+ pango2_font_metrics_get_underline_position (metrics));
g_test_message ("\tunderline thickness: %d",
- pango_font_metrics_get_underline_thickness (metrics));
+ pango2_font_metrics_get_underline_thickness (metrics));
g_test_message ("\tstrikethrough position: %d",
- pango_font_metrics_get_strikethrough_position (metrics));
+ pango2_font_metrics_get_strikethrough_position (metrics));
g_test_message ("\tstrikethrough thickness: %d",
- pango_font_metrics_get_strikethrough_thickness (metrics));
+ pango2_font_metrics_get_strikethrough_thickness (metrics));
- pango_font_metrics_free (metrics);
+ pango2_font_metrics_free (metrics);
g_free (str);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
}
static void
@@ -193,56 +193,56 @@ test_extents (void)
{
const char *str = "Composer";
GList *items;
- PangoItem *item;
- PangoGlyphString *glyphs;
- PangoRectangle ink, log;
- PangoContext *context;
- PangoFontDescription *desc;
- PangoDirection dir;
-
- context = pango_context_new ();
- desc = pango_font_description_from_string("Cantarell 11");
- pango_context_set_font_description (context, desc);
- pango_font_description_free (desc);
-
- dir = pango_context_get_base_dir (context);
- items = pango_itemize (context, dir, str, 0, strlen (str), NULL);
- glyphs = pango_glyph_string_new ();
+ Pango2Item *item;
+ Pango2GlyphString *glyphs;
+ Pango2Rectangle ink, log;
+ Pango2Context *context;
+ Pango2FontDescription *desc;
+ Pango2Direction dir;
+
+ context = pango2_context_new ();
+ desc = pango2_font_description_from_string("Cantarell 11");
+ pango2_context_set_font_description (context, desc);
+ pango2_font_description_free (desc);
+
+ dir = pango2_context_get_base_dir (context);
+ items = pango2_itemize (context, dir, str, 0, strlen (str), NULL);
+ glyphs = pango2_glyph_string_new ();
item = items->data;
- pango_shape (str, strlen (str), NULL, 0, &item->analysis, glyphs, PANGO_SHAPE_NONE);
- pango_glyph_string_extents (glyphs, item->analysis.font, &ink, &log);
+ pango2_shape (str, strlen (str), NULL, 0, &item->analysis, glyphs, PANGO2_SHAPE_NONE);
+ pango2_glyph_string_extents (glyphs, item->analysis.font, &ink, &log);
g_assert_cmpint (ink.width, >=, 0);
g_assert_cmpint (ink.height, >=, 0);
g_assert_cmpint (log.width, >=, 0);
g_assert_cmpint (log.height, >=, 0);
- pango_glyph_string_free (glyphs);
- g_list_free_full (items, (GDestroyNotify)pango_item_free);
+ pango2_glyph_string_free (glyphs);
+ g_list_free_full (items, (GDestroyNotify)pango2_item_free);
g_object_unref (context);
}
static void
test_fontmap_enumerate (void)
{
- PangoFontMap *fontmap;
- PangoContext *context;
- PangoFontFamily *family;
+ Pango2FontMap *fontmap;
+ Pango2Context *context;
+ Pango2FontFamily *family;
int i;
- PangoFontFace *face;
- PangoFontDescription *desc;
- PangoFont *font;
+ Pango2FontFace *face;
+ Pango2FontDescription *desc;
+ Pango2Font *font;
gboolean found_face;
- fontmap = pango_font_map_get_default ();
- context = pango_context_new_with_font_map (fontmap);
+ fontmap = pango2_font_map_get_default ();
+ context = pango2_context_new_with_font_map (fontmap);
g_assert_cmpint (g_list_model_get_n_items (G_LIST_MODEL (fontmap)), >, 0);
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (fontmap)); i++)
{
- PangoFontFamily *fam = g_list_model_get_item (G_LIST_MODEL (fontmap), i);
- family = pango_font_map_get_family (fontmap, pango_font_family_get_name (fam));
+ Pango2FontFamily *fam = g_list_model_get_item (G_LIST_MODEL (fontmap), i);
+ family = pango2_font_map_get_family (fontmap, pango2_font_family_get_name (fam));
g_assert_true (family == fam);
g_object_unref (fam);
}
@@ -253,22 +253,22 @@ test_fontmap_enumerate (void)
g_assert_cmpint (g_list_model_get_n_items (G_LIST_MODEL (family)), >, 0);
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (family)); i++)
{
- PangoFontFace *f = g_list_model_get_item (G_LIST_MODEL (family), i);
- face = pango_font_family_get_face (family, pango_font_face_get_name (f));
- g_assert_cmpstr (pango_font_face_get_name (face), ==, pango_font_face_get_name (f));
+ Pango2FontFace *f = g_list_model_get_item (G_LIST_MODEL (family), i);
+ face = pango2_font_family_get_face (family, pango2_font_face_get_name (f));
+ g_assert_cmpstr (pango2_font_face_get_name (face), ==, pango2_font_face_get_name (f));
g_object_unref (f);
}
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, pango_font_family_get_name (family));
- pango_font_description_set_size (desc, 10*PANGO_SCALE);
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, pango2_font_family_get_name (family));
+ pango2_font_description_set_size (desc, 10*PANGO2_SCALE);
- font = pango_font_map_load_font (fontmap, context, desc);
- face = pango_font_get_face (font);
+ font = pango2_font_map_load_font (fontmap, context, desc);
+ face = pango2_font_get_face (font);
found_face = FALSE;
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (family)); i++)
{
- PangoFontFace *f = g_list_model_get_item (G_LIST_MODEL (family), i);
+ Pango2FontFace *f = g_list_model_get_item (G_LIST_MODEL (family), i);
g_object_unref (f);
if (face == f)
{
@@ -279,108 +279,108 @@ test_fontmap_enumerate (void)
g_assert_true (found_face);
g_object_unref (font);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_object_unref (context);
}
static void
test_roundtrip_plain (void)
{
- PangoContext *context;
- PangoFontDescription *desc, *desc2, *desc3;
- PangoFont *font, *font2;
+ Pango2Context *context;
+ Pango2FontDescription *desc, *desc2, *desc3;
+ Pango2Font *font, *font2;
- desc = pango_font_description_from_string ("Cantarell 11");
+ desc = pango2_font_description_from_string ("Cantarell 11");
- context = pango_context_new ();
+ context = pango2_context_new ();
- font = pango_context_load_font (context, desc);
- desc2 = pango_font_describe (font);
+ font = pango2_context_load_font (context, desc);
+ desc2 = pango2_font_describe (font);
- font2 = pango_context_load_font (context, desc2);
- desc3 = pango_font_describe (font2);
+ font2 = pango2_context_load_font (context, desc2);
+ desc3 = pango2_font_describe (font2);
- g_assert_true (pango_font_description_equal (desc2, desc3));
+ g_assert_true (pango2_font_description_equal (desc2, desc3));
//g_assert_true (font == font2);
- pango_font_description_free (desc2);
+ pango2_font_description_free (desc2);
g_object_unref (font2);
- pango_font_description_free (desc3);
+ pango2_font_description_free (desc3);
g_object_unref (font);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_object_unref (context);
}
static void
test_roundtrip_small_caps (void)
{
- PangoContext *context;
- PangoFontDescription *desc, *desc2;
- PangoFont *font;
+ Pango2Context *context;
+ Pango2FontDescription *desc, *desc2;
+ Pango2Font *font;
const hb_feature_t *features;
guint num = 0;
- context = pango_context_new ();
+ context = pango2_context_new ();
- desc = pango_font_description_from_string ("Cantarell Small-Caps 11");
- g_assert_true (pango_font_description_get_variant (desc) == PANGO_VARIANT_SMALL_CAPS);
+ desc = pango2_font_description_from_string ("Cantarell Small-Caps 11");
+ g_assert_true (pango2_font_description_get_variant (desc) == PANGO2_VARIANT_SMALL_CAPS);
- font = pango_context_load_font (context, desc);
- desc2 = pango_font_describe (font);
+ font = pango2_context_load_font (context, desc);
+ desc2 = pango2_font_describe (font);
num = 0;
- features = pango_hb_font_get_features (PANGO_HB_FONT (font), &num);
+ features = pango2_hb_font_get_features (PANGO2_HB_FONT (font), &num);
g_assert_true (num == 1);
g_assert_true (features[0].tag == HB_TAG ('s', 'm', 'c', 'p'));
g_assert_true (features[0].value == 1);
- g_assert_true (pango_font_description_get_variant (desc2) == PANGO_VARIANT_SMALL_CAPS);
+ g_assert_true (pango2_font_description_get_variant (desc2) == PANGO2_VARIANT_SMALL_CAPS);
/* We need to unset faceid since desc doesn't have one */
- pango_font_description_unset_fields (desc2, PANGO_FONT_MASK_FACEID);
- g_assert_true (pango_font_description_equal (desc2, desc));
+ pango2_font_description_unset_fields (desc2, PANGO2_FONT_MASK_FACEID);
+ g_assert_true (pango2_font_description_equal (desc2, desc));
- pango_font_description_free (desc2);
+ pango2_font_description_free (desc2);
g_object_unref (font);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
- desc = pango_font_description_from_string ("Cantarell All-Small-Caps 11");
- g_assert_true (pango_font_description_get_variant (desc) == PANGO_VARIANT_ALL_SMALL_CAPS);
+ desc = pango2_font_description_from_string ("Cantarell All-Small-Caps 11");
+ g_assert_true (pango2_font_description_get_variant (desc) == PANGO2_VARIANT_ALL_SMALL_CAPS);
- font = pango_context_load_font (context, desc);
- desc2 = pango_font_describe (font);
+ font = pango2_context_load_font (context, desc);
+ desc2 = pango2_font_describe (font);
num = 0;
- features = pango_hb_font_get_features (PANGO_HB_FONT (font), &num);
+ features = pango2_hb_font_get_features (PANGO2_HB_FONT (font), &num);
g_assert_true (num == 2);
g_assert_true (features[0].tag == HB_TAG ('s', 'm', 'c', 'p'));
g_assert_true (features[0].value == 1);
g_assert_true (features[1].tag == HB_TAG ('c', '2', 's', 'c'));
g_assert_true (features[1].value == 1);
- g_assert_true (pango_font_description_get_variant (desc2) == PANGO_VARIANT_ALL_SMALL_CAPS);
- pango_font_description_unset_fields (desc2, PANGO_FONT_MASK_FACEID);
- g_assert_true (pango_font_description_equal (desc2, desc));
+ g_assert_true (pango2_font_description_get_variant (desc2) == PANGO2_VARIANT_ALL_SMALL_CAPS);
+ pango2_font_description_unset_fields (desc2, PANGO2_FONT_MASK_FACEID);
+ g_assert_true (pango2_font_description_equal (desc2, desc));
- pango_font_description_free (desc2);
+ pango2_font_description_free (desc2);
g_object_unref (font);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
- desc = pango_font_description_from_string ("Cantarell Unicase 11");
- g_assert_true (pango_font_description_get_variant (desc) == PANGO_VARIANT_UNICASE);
+ desc = pango2_font_description_from_string ("Cantarell Unicase 11");
+ g_assert_true (pango2_font_description_get_variant (desc) == PANGO2_VARIANT_UNICASE);
- font = pango_context_load_font (context, desc);
- desc2 = pango_font_describe (font);
+ font = pango2_context_load_font (context, desc);
+ desc2 = pango2_font_describe (font);
num = 0;
- features = pango_hb_font_get_features (PANGO_HB_FONT (font), &num);
+ features = pango2_hb_font_get_features (PANGO2_HB_FONT (font), &num);
g_assert_true (num == 1);
g_assert_true (features[0].tag == HB_TAG ('u', 'n', 'i', 'c'));
g_assert_true (features[0].value == 1);
- g_assert_true (pango_font_description_get_variant (desc2) == PANGO_VARIANT_UNICASE);
- pango_font_description_unset_fields (desc2, PANGO_FONT_MASK_FACEID);
- g_assert_true (pango_font_description_equal (desc2, desc));
+ g_assert_true (pango2_font_description_get_variant (desc2) == PANGO2_VARIANT_UNICASE);
+ pango2_font_description_unset_fields (desc2, PANGO2_FONT_MASK_FACEID);
+ g_assert_true (pango2_font_description_equal (desc2, desc));
- pango_font_description_free (desc2);
+ pango2_font_description_free (desc2);
g_object_unref (font);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_object_unref (context);
}
@@ -388,48 +388,48 @@ test_roundtrip_small_caps (void)
static void
test_roundtrip_emoji (void)
{
- PangoContext *context;
- PangoFontDescription *desc, *desc2;
- PangoFont *font;
+ Pango2Context *context;
+ Pango2FontDescription *desc, *desc2;
+ Pango2Font *font;
- context = pango_context_new ();
+ context = pango2_context_new ();
- /* This is how pango_itemize creates the emoji font desc */
- desc = pango_font_description_from_string ("DejaVu Sans Book 11");
- pango_font_description_set_family_static (desc, "emoji");
+ /* This is how pango2_itemize creates the emoji font desc */
+ desc = pango2_font_description_from_string ("DejaVu Sans Book 11");
+ pango2_font_description_set_family_static (desc, "emoji");
- font = pango_context_load_font (context, desc);
- desc2 = pango_font_describe (font);
+ font = pango2_context_load_font (context, desc);
+ desc2 = pango2_font_describe (font);
/* We can't expect the family name to match, since we go in with
* a generic family
* And we need to unset faceid, since desc doesn't have one.
*/
- pango_font_description_unset_fields (desc, PANGO_FONT_MASK_FAMILY);
- pango_font_description_unset_fields (desc2, PANGO_FONT_MASK_FAMILY|PANGO_FONT_MASK_FACEID);
- g_assert_true (pango_font_description_equal (desc2, desc));
+ pango2_font_description_unset_fields (desc, PANGO2_FONT_MASK_FAMILY);
+ pango2_font_description_unset_fields (desc2, PANGO2_FONT_MASK_FAMILY|PANGO2_FONT_MASK_FACEID);
+ g_assert_true (pango2_font_description_equal (desc2, desc));
- pango_font_description_free (desc2);
+ pango2_font_description_free (desc2);
g_object_unref (font);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_object_unref (context);
}
static void
test_fontmap_models (void)
{
- PangoFontMap *map = pango_font_map_get_default ();
+ Pango2FontMap *map = pango2_font_map_get_default ();
int n_families = 0;
- g_assert_true (g_list_model_get_item_type (G_LIST_MODEL (map)) == PANGO_TYPE_FONT_FAMILY);
+ g_assert_true (g_list_model_get_item_type (G_LIST_MODEL (map)) == PANGO2_TYPE_FONT_FAMILY);
for (guint i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (map)); i++)
{
GObject *obj = g_list_model_get_item (G_LIST_MODEL (map), i);
- g_assert_true (PANGO_IS_FONT_FAMILY (obj));
+ g_assert_true (PANGO2_IS_FONT_FAMILY (obj));
- g_assert_true (g_list_model_get_item_type (G_LIST_MODEL (obj)) == PANGO_TYPE_FONT_FACE);
+ g_assert_true (g_list_model_get_item_type (G_LIST_MODEL (obj)) == PANGO2_TYPE_FONT_FACE);
n_families++;
@@ -437,7 +437,7 @@ test_fontmap_models (void)
{
GObject *obj2 = g_list_model_get_item (G_LIST_MODEL (obj), j);
- g_assert_true (PANGO_IS_FONT_FACE (obj2));
+ g_assert_true (PANGO2_IS_FONT_FACE (obj2));
g_object_unref (obj2);
}
@@ -451,85 +451,85 @@ test_fontmap_models (void)
static void
test_glyph_extents (void)
{
- PangoRectangle ink, logical;
+ Pango2Rectangle ink, logical;
- pango_font_get_glyph_extents (NULL, 0, &ink, &logical);
+ pango2_font_get_glyph_extents (NULL, 0, &ink, &logical);
/* We are promised 'sane values', so lets check that
* we are between 1 and 100 pixels in both dimensions.
*/
- g_assert_cmpint (ink.height, >=, PANGO_SCALE);
- g_assert_cmpint (ink.height, <=, 100 * PANGO_SCALE);
- g_assert_cmpint (ink.width, >=, PANGO_SCALE);
- g_assert_cmpint (ink.width, <=, 100 * PANGO_SCALE);
- g_assert_cmpint (logical.height, >=, PANGO_SCALE);
- g_assert_cmpint (logical.height, <=, 100 * PANGO_SCALE);
- g_assert_cmpint (logical.width, >=, PANGO_SCALE);
- g_assert_cmpint (logical.width, <=, 100 * PANGO_SCALE);
+ g_assert_cmpint (ink.height, >=, PANGO2_SCALE);
+ g_assert_cmpint (ink.height, <=, 100 * PANGO2_SCALE);
+ g_assert_cmpint (ink.width, >=, PANGO2_SCALE);
+ g_assert_cmpint (ink.width, <=, 100 * PANGO2_SCALE);
+ g_assert_cmpint (logical.height, >=, PANGO2_SCALE);
+ g_assert_cmpint (logical.height, <=, 100 * PANGO2_SCALE);
+ g_assert_cmpint (logical.width, >=, PANGO2_SCALE);
+ g_assert_cmpint (logical.width, <=, 100 * PANGO2_SCALE);
}
static void
test_font_metrics (void)
{
- PangoFontMetrics *metrics;
+ Pango2FontMetrics *metrics;
- metrics = pango_font_get_metrics (NULL, NULL);
+ metrics = pango2_font_get_metrics (NULL, NULL);
- g_assert_cmpint (pango_font_metrics_get_approximate_char_width (metrics), ==, PANGO_SCALE * PANGO_UNKNOWN_GLYPH_WIDTH);
- g_assert_cmpint (pango_font_metrics_get_approximate_digit_width (metrics), ==, PANGO_SCALE * PANGO_UNKNOWN_GLYPH_WIDTH);
+ g_assert_cmpint (pango2_font_metrics_get_approximate_char_width (metrics), ==, PANGO2_SCALE * PANGO2_UNKNOWN_GLYPH_WIDTH);
+ g_assert_cmpint (pango2_font_metrics_get_approximate_digit_width (metrics), ==, PANGO2_SCALE * PANGO2_UNKNOWN_GLYPH_WIDTH);
- pango_font_metrics_free (metrics);
+ pango2_font_metrics_free (metrics);
}
static void
test_set_gravity (void)
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
- desc = pango_font_description_from_string ("Futura Medium Italic 14");
- pango_font_description_set_gravity (desc, PANGO_GRAVITY_SOUTH);
- g_assert_true (pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_GRAVITY);
+ desc = pango2_font_description_from_string ("Futura Medium Italic 14");
+ pango2_font_description_set_gravity (desc, PANGO2_GRAVITY_SOUTH);
+ g_assert_true (pango2_font_description_get_set_fields (desc) & PANGO2_FONT_MASK_GRAVITY);
- pango_font_description_set_gravity (desc, PANGO_GRAVITY_AUTO);
- g_assert_false (pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_GRAVITY);
+ pango2_font_description_set_gravity (desc, PANGO2_GRAVITY_AUTO);
+ g_assert_false (pango2_font_description_get_set_fields (desc) & PANGO2_FONT_MASK_GRAVITY);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
}
static void
test_faceid (void)
{
const char *test = "Cantarell Bold Italic 32 @faceid=Cantarell-Regular:0:-1:0,wght=600";
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
char *s;
- desc = pango_font_description_from_string (test);
- g_assert_cmpint (pango_font_description_get_set_fields (desc), ==, PANGO_FONT_MASK_FAMILY|
- PANGO_FONT_MASK_STYLE|
- PANGO_FONT_MASK_WEIGHT|
- PANGO_FONT_MASK_VARIANT|
- PANGO_FONT_MASK_STRETCH|
- PANGO_FONT_MASK_SIZE|
- PANGO_FONT_MASK_FACEID|
- PANGO_FONT_MASK_VARIATIONS);
- g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarell");
- g_assert_cmpint (pango_font_description_get_size (desc), ==, 32 * PANGO_SCALE);
- g_assert_cmpint (pango_font_description_get_style (desc), ==, PANGO_STYLE_ITALIC);
- g_assert_cmpint (pango_font_description_get_variant (desc), ==, PANGO_VARIANT_NORMAL);
- g_assert_cmpint (pango_font_description_get_weight (desc), ==, PANGO_WEIGHT_BOLD);
- g_assert_cmpint (pango_font_description_get_stretch (desc), ==, PANGO_STRETCH_NORMAL);
- g_assert_cmpstr (pango_font_description_get_faceid (desc), ==, "Cantarell-Regular:0:-1:0");
- g_assert_cmpstr (pango_font_description_get_variations (desc), ==, "wght=600");
-
- s = pango_font_description_to_string (desc);
+ desc = pango2_font_description_from_string (test);
+ g_assert_cmpint (pango2_font_description_get_set_fields (desc), ==, PANGO2_FONT_MASK_FAMILY|
+ PANGO2_FONT_MASK_STYLE|
+ PANGO2_FONT_MASK_WEIGHT|
+ PANGO2_FONT_MASK_VARIANT|
+ PANGO2_FONT_MASK_STRETCH|
+ PANGO2_FONT_MASK_SIZE|
+ PANGO2_FONT_MASK_FACEID|
+ PANGO2_FONT_MASK_VARIATIONS);
+ g_assert_cmpstr (pango2_font_description_get_family (desc), ==, "Cantarell");
+ g_assert_cmpint (pango2_font_description_get_size (desc), ==, 32 * PANGO2_SCALE);
+ g_assert_cmpint (pango2_font_description_get_style (desc), ==, PANGO2_STYLE_ITALIC);
+ g_assert_cmpint (pango2_font_description_get_variant (desc), ==, PANGO2_VARIANT_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_weight (desc), ==, PANGO2_WEIGHT_BOLD);
+ g_assert_cmpint (pango2_font_description_get_stretch (desc), ==, PANGO2_STRETCH_NORMAL);
+ g_assert_cmpstr (pango2_font_description_get_faceid (desc), ==, "Cantarell-Regular:0:-1:0");
+ g_assert_cmpstr (pango2_font_description_get_variations (desc), ==, "wght=600");
+
+ s = pango2_font_description_to_string (desc);
g_assert_cmpstr (s, ==, test);
g_free (s);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
}
static gboolean
-font_info_cb (PangoUserFace *face,
+font_info_cb (Pango2UserFace *face,
int size,
hb_font_extents_t *extents,
gpointer user_data)
@@ -542,7 +542,7 @@ font_info_cb (PangoUserFace *face,
}
static gboolean
-glyph_cb (PangoUserFace *face,
+glyph_cb (Pango2UserFace *face,
hb_codepoint_t unicode,
hb_codepoint_t *glyph,
gpointer user_data)
@@ -557,7 +557,7 @@ glyph_cb (PangoUserFace *face,
}
static gboolean
-glyph_info_cb (PangoUserFace *face,
+glyph_info_cb (Pango2UserFace *face,
int size,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents,
@@ -570,8 +570,8 @@ glyph_info_cb (PangoUserFace *face,
}
static gboolean
-count_fonts (PangoFontset *fontset,
- PangoFont *font,
+count_fonts (Pango2Fontset *fontset,
+ Pango2Font *font,
gpointer user_data)
{
int *count = user_data;
@@ -585,56 +585,56 @@ count_fonts (PangoFontset *fontset,
static void
test_fontmap_fallback (void)
{
- PangoFontMap *map;
- PangoUserFace *custom;
- PangoFontDescription *desc;
- PangoFontset *fontset;
- PangoFont *font;
+ Pango2FontMap *map;
+ Pango2UserFace *custom;
+ Pango2FontDescription *desc;
+ Pango2Fontset *fontset;
+ Pango2Font *font;
int count;
- map = pango_font_map_new ();
+ map = pango2_font_map_new ();
- desc = pango_font_description_from_string ("CustomFont");
- custom = pango_user_face_new (font_info_cb,
+ desc = pango2_font_description_from_string ("CustomFont");
+ custom = pango2_user_face_new (font_info_cb,
glyph_cb,
glyph_info_cb,
NULL,
NULL,
NULL, NULL,
"Regular", desc);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
- pango_font_map_add_face (map, PANGO_FONT_FACE (custom));
+ pango2_font_map_add_face (map, PANGO2_FONT_FACE (custom));
- desc = pango_font_description_from_string ("CustomFont 11");
- fontset = pango_font_map_load_fontset (map, context, desc, NULL);
+ desc = pango2_font_description_from_string ("CustomFont 11");
+ fontset = pango2_font_map_load_fontset (map, context, desc, NULL);
g_assert_nonnull (fontset);
- font = pango_fontset_get_font (fontset, 0x20);
+ font = pango2_fontset_get_font (fontset, 0x20);
g_assert_nonnull (font);
- g_assert_true (pango_font_get_face (font) == PANGO_FONT_FACE (custom));
+ g_assert_true (pango2_font_get_face (font) == PANGO2_FONT_FACE (custom));
g_object_unref (font);
count = 0;
- pango_fontset_foreach (fontset, count_fonts, &count);
+ pango2_fontset_foreach (fontset, count_fonts, &count);
g_assert_true (count == 1);
- pango_font_map_set_fallback (map, pango_font_map_get_default ());
+ pango2_font_map_set_fallback (map, pango2_font_map_get_default ());
- desc = pango_font_description_from_string ("CustomFont 11");
- fontset = pango_font_map_load_fontset (map, context, desc, NULL);
+ desc = pango2_font_description_from_string ("CustomFont 11");
+ fontset = pango2_font_map_load_fontset (map, context, desc, NULL);
g_assert_nonnull (fontset);
- font = pango_fontset_get_font (fontset, ' ');
+ font = pango2_fontset_get_font (fontset, ' ');
g_assert_nonnull (font);
- g_assert_true (pango_font_get_face (font) == PANGO_FONT_FACE (custom));
+ g_assert_true (pango2_font_get_face (font) == PANGO2_FONT_FACE (custom));
g_object_unref (font);
- font = pango_fontset_get_font (fontset, 'a');
+ font = pango2_fontset_get_font (fontset, 'a');
g_assert_nonnull (font);
count = 0;
- pango_fontset_foreach (fontset, count_fonts, &count);
+ pango2_fontset_foreach (fontset, count_fonts, &count);
g_assert_true (count > 1);
g_object_unref (map);
@@ -649,7 +649,7 @@ main (int argc, char *argv[])
install_fonts ();
- context = pango_context_new ();
+ context = pango2_context_new ();
g_test_add_func ("/pango/fontdescription/parse", test_parse);
g_test_add_func ("/pango/fontdescription/roundtrip", test_roundtrip);
diff --git a/tests/test-fontsets.c b/tests/test-fontsets.c
index 6701d647..339411c9 100644
--- a/tests/test-fontsets.c
+++ b/tests/test-fontsets.c
@@ -5,21 +5,21 @@
#include "test-common.h"
static gboolean
-append_one (PangoFontset *fonts,
- PangoFont *font,
+append_one (Pango2Fontset *fonts,
+ Pango2Font *font,
gpointer data)
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
GString *str = data;
char *s;
- desc = pango_font_describe (font);
- s = pango_font_description_to_string (desc);
+ desc = pango2_font_describe (font);
+ s = pango2_font_description_to_string (desc);
g_string_append_printf (str, "%s\n", s);
g_free (s);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
return FALSE;
}
@@ -28,9 +28,9 @@ static char *
list_fonts (const char *contents)
{
char *p, *s;
- PangoFontDescription *desc;
- PangoContext *context;
- PangoFontset *fonts;
+ Pango2FontDescription *desc;
+ Pango2Context *context;
+ Pango2Fontset *fonts;
GString *str;
p = strchr (contents, '\n');
@@ -39,19 +39,19 @@ list_fonts (const char *contents)
else
s = g_strdup (contents);
- desc = pango_font_description_from_string (s);
+ desc = pango2_font_description_from_string (s);
- context = pango_context_new ();
- fonts = pango_context_load_fontset (context, desc, pango_language_get_default ());
+ context = pango2_context_new ();
+ fonts = pango2_context_load_fontset (context, desc, pango2_language_get_default ());
str = g_string_new (s);
g_string_append (str, "\n\n");
- pango_fontset_foreach (fonts, append_one, str);
+ pango2_fontset_foreach (fonts, append_one, str);
g_object_unref (fonts);
g_object_unref (context);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_free (s);
diff --git a/tests/test-harfbuzz.c b/tests/test-harfbuzz.c
index 1e6c23a1..4d4fd7be 100644
--- a/tests/test-harfbuzz.c
+++ b/tests/test-harfbuzz.c
@@ -1,5 +1,5 @@
-/* Pango
- * test-harfbuzz.c: Test Pango harfbuzz apis
+/* Pango2
+ * test-harfbuzz.c: Test Pango2 harfbuzz apis
*
* Copyright (C) 2019 Red Hat, Inc.
*
@@ -24,15 +24,15 @@
#include "test-common.h"
/* Some basic checks that the hb_font_t returned
- * by pango_font_get_hb_font is functional
+ * by pango2_font_get_hb_font is functional
*/
static void
test_hb_font (void)
{
- PangoFontMap *map = pango_font_map_get_default ();
- PangoFontFamily *family;
- PangoFontFace *face;
- PangoFont *font;
+ Pango2FontMap *map = pango2_font_map_get_default ();
+ Pango2FontFamily *family;
+ Pango2FontFace *face;
+ Pango2Font *font;
hb_font_t *hb_font;
hb_bool_t res;
hb_codepoint_t glyph;
@@ -43,14 +43,14 @@ test_hb_font (void)
g_assert_true (g_list_model_get_n_items (G_LIST_MODEL (family)) > 0);
face = g_list_model_get_item (G_LIST_MODEL (family), 0);
- font = PANGO_FONT (pango_hb_font_new (PANGO_HB_FACE (face),
- 12 * PANGO_SCALE,
+ font = PANGO2_FONT (pango2_hb_font_new (PANGO2_HB_FACE (face),
+ 12 * PANGO2_SCALE,
NULL, 0,
NULL, 0,
- PANGO_GRAVITY_SOUTH,
+ PANGO2_GRAVITY_SOUTH,
96., NULL));
- hb_font = pango_font_get_hb_font (font);
+ hb_font = pango2_font_get_hb_font (font);
g_assert (hb_font != NULL);
diff --git a/tests/test-itemize.c b/tests/test-itemize.c
index 3276f5fc..d7b4074c 100644
--- a/tests/test-itemize.c
+++ b/tests/test-itemize.c
@@ -1,5 +1,5 @@
-/* Pango
- * test-break.c: Test Pango line breaking
+/* Pango2
+ * test-break.c: Test Pango2 line breaking
*
* Copyright (C) 2019 Red Hat, Inc
*
@@ -36,7 +36,7 @@
#include "pango/pango-item-private.h"
-static PangoContext *context;
+static Pango2Context *context;
static void
append_text (GString *s,
@@ -56,33 +56,33 @@ append_text (GString *s,
}
static gboolean
-affects_itemization (PangoAttribute *attr,
+affects_itemization (Pango2Attribute *attr,
gpointer data)
{
switch ((int)attr->type)
{
/* These affect font selection */
- case PANGO_ATTR_LANGUAGE:
- case PANGO_ATTR_FAMILY:
- case PANGO_ATTR_STYLE:
- case PANGO_ATTR_WEIGHT:
- case PANGO_ATTR_VARIANT:
- case PANGO_ATTR_STRETCH:
- case PANGO_ATTR_SIZE:
- case PANGO_ATTR_FONT_DESC:
- case PANGO_ATTR_SCALE:
- case PANGO_ATTR_FALLBACK:
- case PANGO_ATTR_ABSOLUTE_SIZE:
- case PANGO_ATTR_GRAVITY:
- case PANGO_ATTR_GRAVITY_HINT:
- case PANGO_ATTR_FONT_SCALE:
+ case PANGO2_ATTR_LANGUAGE:
+ case PANGO2_ATTR_FAMILY:
+ case PANGO2_ATTR_STYLE:
+ case PANGO2_ATTR_WEIGHT:
+ case PANGO2_ATTR_VARIANT:
+ case PANGO2_ATTR_STRETCH:
+ case PANGO2_ATTR_SIZE:
+ case PANGO2_ATTR_FONT_DESC:
+ case PANGO2_ATTR_SCALE:
+ case PANGO2_ATTR_FALLBACK:
+ case PANGO2_ATTR_ABSOLUTE_SIZE:
+ case PANGO2_ATTR_GRAVITY:
+ case PANGO2_ATTR_GRAVITY_HINT:
+ case PANGO2_ATTR_FONT_SCALE:
/* These are part of ItemProperties, so need to break runs */
- case PANGO_ATTR_LETTER_SPACING:
- case PANGO_ATTR_RISE:
- case PANGO_ATTR_BASELINE_SHIFT:
- case PANGO_ATTR_LINE_HEIGHT:
- case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT:
- case PANGO_ATTR_TEXT_TRANSFORM:
+ case PANGO2_ATTR_LETTER_SPACING:
+ case PANGO2_ATTR_RISE:
+ case PANGO2_ATTR_BASELINE_SHIFT:
+ case PANGO2_ATTR_LINE_HEIGHT:
+ case PANGO2_ATTR_ABSOLUTE_LINE_HEIGHT:
+ case PANGO2_ATTR_TEXT_TRANSFORM:
return TRUE;
default:
return FALSE;
@@ -93,9 +93,9 @@ affects_itemization (PangoAttribute *attr,
static int
compare_attr (gconstpointer p1, gconstpointer p2)
{
- const PangoAttribute *a1 = p1;
- const PangoAttribute *a2 = p2;
- if (pango_attribute_equal (a1, a2) &&
+ const Pango2Attribute *a1 = p1;
+ const Pango2Attribute *a2 = p2;
+ if (pango2_attribute_equal (a1, a2) &&
a1->start_index == a2->start_index &&
a1->end_index == a2->end_index)
return 0;
@@ -104,15 +104,15 @@ compare_attr (gconstpointer p1, gconstpointer p2)
}
void
-pango_item_apply_attrs (PangoItem *item,
- PangoAttrIterator *iter)
+pango2_item_apply_attrs (Pango2Item *item,
+ Pango2AttrIterator *iter)
{
int start, end;
GSList *attrs = NULL;
do
{
- pango_attr_iterator_range (iter, &start, &end);
+ pango2_attr_iterator_range (iter, &start, &end);
if (start >= item->offset + item->length)
break;
@@ -121,47 +121,47 @@ pango_item_apply_attrs (PangoItem *item,
{
GSList *list, *l;
- list = pango_attr_iterator_get_attrs (iter);
+ list = pango2_attr_iterator_get_attrs (iter);
for (l = list; l; l = l->next)
{
if (!g_slist_find_custom (attrs, l->data, compare_attr))
- attrs = g_slist_prepend (attrs, pango_attribute_copy (l->data));
+ attrs = g_slist_prepend (attrs, pango2_attribute_copy (l->data));
}
- g_slist_free_full (list, (GDestroyNotify)pango_attribute_destroy);
+ g_slist_free_full (list, (GDestroyNotify)pango2_attribute_destroy);
}
if (end >= item->offset + item->length)
break;
}
- while (pango_attr_iterator_next (iter));
+ while (pango2_attr_iterator_next (iter));
item->analysis.extra_attrs = g_slist_concat (item->analysis.extra_attrs, attrs);
}
static void
apply_attributes_to_items (GList *items,
- PangoAttrList *attrs)
+ Pango2AttrList *attrs)
{
GList *l;
- PangoAttrIterator *iter;
+ Pango2AttrIterator *iter;
if (!attrs)
return;
- iter = pango_attr_list_get_iterator (attrs);
+ iter = pango2_attr_list_get_iterator (attrs);
for (l = items; l; l = l->next)
{
- PangoItem *item = l->data;
- pango_item_apply_attrs (item, iter);
+ Pango2Item *item = l->data;
+ pango2_item_apply_attrs (item, iter);
}
- pango_attr_iterator_destroy (iter);
+ pango2_attr_iterator_destroy (iter);
}
static int
-get_item_char_offset (PangoItem *item)
+get_item_char_offset (Pango2Item *item)
{
return item->char_offset;
}
@@ -175,11 +175,11 @@ test_file (const char *filename, GString *string)
GString *s1, *s2, *s3, *s4, *s5, *s6, *s7;
char *test;
char *text;
- PangoAttrList *attrs;
- PangoAttrList *itemize_attrs;
+ Pango2AttrList *attrs;
+ Pango2AttrList *itemize_attrs;
GList *items, *l;
const char *sep = "";
- PangoDirection dir;
+ Pango2Direction dir;
g_file_get_contents (filename, &contents, &length, &error);
g_assert_no_error (error);
@@ -190,7 +190,7 @@ test_file (const char *filename, GString *string)
while (test[0] == '#')
test = strchr (test, '\n') + 1;
- pango_parse_markup (test, -1, 0, &attrs, &text, NULL, &error);
+ pango2_parse_markup (test, -1, 0, &attrs, &text, NULL, &error);
g_assert_no_error (error);
s1 = g_string_new ("Items: ");
@@ -205,25 +205,25 @@ test_file (const char *filename, GString *string)
if (text[length - 1] == '\n')
length--;
- itemize_attrs = pango_attr_list_filter (attrs, affects_itemization, NULL);
- dir = pango_context_get_base_dir (context);
- items = pango_itemize (context, dir, text, 0, length, itemize_attrs);
+ itemize_attrs = pango2_attr_list_filter (attrs, affects_itemization, NULL);
+ dir = pango2_context_get_base_dir (context);
+ items = pango2_itemize (context, dir, text, 0, length, itemize_attrs);
apply_attributes_to_items (items, attrs);
- pango_attr_list_unref (itemize_attrs);
+ pango2_attr_list_unref (itemize_attrs);
for (l = items; l; l = l->next)
{
- PangoItem *item = l->data;
- PangoFontDescription *desc;
+ Pango2Item *item = l->data;
+ Pango2FontDescription *desc;
char *font;
int m;
GSList *a;
- desc = pango_font_describe (item->analysis.font);
+ desc = pango2_font_describe (item->analysis.font);
/* Leave out faceid for now to avoid backend-dependent test output */
- pango_font_description_unset_fields (desc, PANGO_FONT_MASK_FACEID);
- font = pango_font_description_to_string (desc);
+ pango2_font_description_unset_fields (desc, PANGO2_FONT_MASK_FACEID);
+ font = pango2_font_description_to_string (desc);
if (l != items)
sep = "|";
@@ -232,20 +232,20 @@ test_file (const char *filename, GString *string)
g_string_append_printf (s2, "%s%s", sep, font);
g_string_append_printf (s3, "%s%s", sep, get_script_name (item->analysis.script));
- g_string_append_printf (s4, "%s%s", sep, pango_language_to_string (item->analysis.language));
+ g_string_append_printf (s4, "%s%s", sep, pango2_language_to_string (item->analysis.language));
g_string_append_printf (s5, "%s%d", sep, item->analysis.level);
g_string_append_printf (s6, "%s", sep);
g_string_append_printf (s7, "%s%d(%d)", sep, item->num_chars, get_item_char_offset (item));
for (a = item->analysis.extra_attrs; a; a = a->next)
{
- PangoAttribute *attr = a->data;
+ Pango2Attribute *attr = a->data;
if (a != item->analysis.extra_attrs)
g_string_append (s6, ",");
print_attribute (attr, s6);
}
g_free (font);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
m = MAX (MAX (MAX (s1->len, s2->len),
MAX (s3->len, s4->len)),
@@ -277,8 +277,8 @@ test_file (const char *filename, GString *string)
g_string_free (s6, TRUE);
g_string_free (s7, TRUE);
- g_list_free_full (items, (GDestroyNotify)pango_item_free);
- pango_attr_list_unref (attrs);
+ g_list_free_full (items, (GDestroyNotify)pango2_item_free);
+ pango2_attr_list_unref (attrs);
g_free (text);
g_free (contents);
}
@@ -308,7 +308,7 @@ test_itemize (gconstpointer d)
GString *dump;
char *diff;
gboolean found_cantarell;
- PangoFontMap *map;
+ Pango2FontMap *map;
char *old_locale = g_strdup (setlocale (LC_ALL, NULL));
setlocale (LC_ALL, "en_US.UTF-8");
@@ -322,12 +322,12 @@ test_itemize (gconstpointer d)
}
found_cantarell = FALSE;
- map = pango_context_get_font_map (context);
+ map = pango2_context_get_font_map (context);
for (int i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (map)); i++)
{
- PangoFontFamily *family = g_list_model_get_item (G_LIST_MODEL (map), i);
+ Pango2FontFamily *family = g_list_model_get_item (G_LIST_MODEL (map), i);
g_object_unref (family);
- if (strcmp (pango_font_family_get_name (family), "Cantarell") == 0)
+ if (strcmp (pango2_font_family_get_name (family), "Cantarell") == 0)
{
found_cantarell = TRUE;
break;
@@ -386,8 +386,8 @@ main (int argc, char *argv[])
install_fonts ();
- context = pango_context_new ();
- pango_context_set_language (context, pango_language_from_string ("en-us"));
+ context = pango2_context_new ();
+ pango2_context_set_language (context, pango2_language_from_string ("en-us"));
/* allow to easily generate expected output for new test cases */
if (argc > 1 && argv[1][0] != '-')
diff --git a/tests/test-layout.c b/tests/test-layout.c
index 53f2de46..868806df 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -1,5 +1,5 @@
-/* Pango
- * test-layout.c: Test Pango Layout
+/* Pango2
+ * test-layout.c: Test Pango2 Layout
*
* Copyright (C) 2014 Red Hat, Inc
*
@@ -42,8 +42,8 @@ test_layout (gconstpointer d)
char *contents;
gsize length;
GBytes *orig;
- PangoContext *context;
- PangoLayout *layout;
+ Pango2Context *context;
+ Pango2Layout *layout;
char *old_locale = g_strdup (setlocale (LC_ALL, NULL));
setlocale (LC_ALL, "en_US.UTF-8");
@@ -60,12 +60,12 @@ test_layout (gconstpointer d)
g_assert_no_error (error);
orig = g_bytes_new_take (contents, length);
- context = pango_context_new ();
- layout = pango_layout_deserialize (context, orig, PANGO_LAYOUT_DESERIALIZE_CONTEXT, &error);
+ context = pango2_context_new ();
+ layout = pango2_layout_deserialize (context, orig, PANGO2_LAYOUT_DESERIALIZE_CONTEXT, &error);
g_assert_no_error (error);
- bytes = pango_layout_serialize (layout, PANGO_LAYOUT_SERIALIZE_CONTEXT |
- PANGO_LAYOUT_SERIALIZE_OUTPUT);
+ bytes = pango2_layout_serialize (layout, PANGO2_LAYOUT_SERIALIZE_CONTEXT |
+ PANGO2_LAYOUT_SERIALIZE_OUTPUT);
g_object_unref (layout);
g_object_unref (context);
@@ -117,18 +117,18 @@ main (int argc, char *argv[])
GError *error = NULL;
GBytes *orig;
GBytes *bytes;
- PangoContext *context;
- PangoLayout *layout;
+ Pango2Context *context;
+ Pango2Layout *layout;
g_file_get_contents (argv[1], &contents, &length, &error);
g_assert_no_error (error);
orig = g_bytes_new_take (contents, length);
- context = pango_context_new ();
- layout = pango_layout_deserialize (context, orig, PANGO_LAYOUT_DESERIALIZE_CONTEXT, &error);
+ context = pango2_context_new ();
+ layout = pango2_layout_deserialize (context, orig, PANGO2_LAYOUT_DESERIALIZE_CONTEXT, &error);
g_assert_no_error (error);
- bytes = pango_layout_serialize (layout, PANGO_LAYOUT_SERIALIZE_CONTEXT |
- PANGO_LAYOUT_SERIALIZE_OUTPUT);
+ bytes = pango2_layout_serialize (layout, PANGO2_LAYOUT_SERIALIZE_CONTEXT |
+ PANGO2_LAYOUT_SERIALIZE_OUTPUT);
g_object_unref (layout);
g_object_unref (context);
diff --git a/tests/test-pangocairo-threads.c b/tests/test-pangocairo-threads.c
index 0daa950a..4db903c2 100644
--- a/tests/test-pangocairo-threads.c
+++ b/tests/test-pangocairo-threads.c
@@ -20,23 +20,23 @@ create_surface (void)
return cairo_image_surface_create (CAIRO_FORMAT_A8, WIDTH, HEIGHT);
}
-static PangoLayout *
+static Pango2Layout *
create_layout (cairo_t *cr)
{
- PangoContext *context;
- PangoLayout *layout;
+ Pango2Context *context;
+ Pango2Layout *layout;
- context = pango_cairo_create_context (cr);
- layout = pango_layout_new (context);
+ context = pango2_cairo_create_context (cr);
+ layout = pango2_layout_new (context);
g_object_unref (context);
- pango_layout_set_text (layout, text, -1);
- pango_layout_set_width (layout, WIDTH * PANGO_SCALE);
+ pango2_layout_set_text (layout, text, -1);
+ pango2_layout_set_width (layout, WIDTH * PANGO2_SCALE);
return layout;
}
static void
-draw (cairo_t *cr, PangoLayout *layout, unsigned int i)
+draw (cairo_t *cr, Pango2Layout *layout, unsigned int i)
{
cairo_set_source_rgba (cr, 1, 1, 1, 1);
cairo_paint (cr);
@@ -45,16 +45,16 @@ draw (cairo_t *cr, PangoLayout *layout, unsigned int i)
cairo_identity_matrix (cr);
cairo_scale (cr, (100 + i) / 100., (100 + i) / 100.);
- pango_cairo_update_context (cr, pango_layout_get_context (layout));
+ pango2_cairo_update_context (cr, pango2_layout_get_context (layout));
- pango_cairo_show_lines (cr, pango_layout_get_lines (layout));
+ pango2_cairo_show_lines (cr, pango2_layout_get_lines (layout));
}
static gpointer
thread_func (gpointer data)
{
cairo_surface_t *surface = data;
- PangoLayout *layout;
+ Pango2Layout *layout;
int i;
install_fonts ();
@@ -109,7 +109,7 @@ pangocairo_threads (void)
{
cairo_surface_t *ref_surface = create_surface ();
cairo_t *cr = cairo_create (ref_surface);
- PangoLayout *layout = create_layout (cr);
+ Pango2Layout *layout = create_layout (cr);
unsigned char *ref_data = cairo_image_surface_get_data (ref_surface);
unsigned int len = WIDTH * HEIGHT;
@@ -142,7 +142,7 @@ pangocairo_threads (void)
g_ptr_array_unref (surfaces);
- pango_font_map_set_default (NULL);
+ pango2_font_map_set_default (NULL);
}
diff --git a/tests/test-shape.c b/tests/test-shape.c
index 5c00f76e..8f0732f6 100644
--- a/tests/test-shape.c
+++ b/tests/test-shape.c
@@ -1,5 +1,5 @@
-/* Pango
- * test-shape.c: Test Pango shaping
+/* Pango2
+ * test-shape.c: Test Pango2 shaping
*
* Copyright (C) 2019 Red Hat, Inc
*
@@ -34,7 +34,7 @@
#include "test-common.h"
-static PangoContext *context;
+static Pango2Context *context;
gboolean opt_hex_chars;
@@ -60,31 +60,31 @@ append_text (GString *s,
}
static gboolean
-affects_itemization (PangoAttribute *attr,
+affects_itemization (Pango2Attribute *attr,
gpointer data)
{
switch ((int)attr->klass->type)
{
/* These affect font selection */
- case PANGO_ATTR_LANGUAGE:
- case PANGO_ATTR_FAMILY:
- case PANGO_ATTR_STYLE:
- case PANGO_ATTR_WEIGHT:
- case PANGO_ATTR_VARIANT:
- case PANGO_ATTR_STRETCH:
- case PANGO_ATTR_SIZE:
- case PANGO_ATTR_FONT_DESC:
- case PANGO_ATTR_SCALE:
- case PANGO_ATTR_FALLBACK:
- case PANGO_ATTR_ABSOLUTE_SIZE:
- case PANGO_ATTR_GRAVITY:
- case PANGO_ATTR_GRAVITY_HINT:
+ case PANGO2_ATTR_LANGUAGE:
+ case PANGO2_ATTR_FAMILY:
+ case PANGO2_ATTR_STYLE:
+ case PANGO2_ATTR_WEIGHT:
+ case PANGO2_ATTR_VARIANT:
+ case PANGO2_ATTR_STRETCH:
+ case PANGO2_ATTR_SIZE:
+ case PANGO2_ATTR_FONT_DESC:
+ case PANGO2_ATTR_SCALE:
+ case PANGO2_ATTR_FALLBACK:
+ case PANGO2_ATTR_ABSOLUTE_SIZE:
+ case PANGO2_ATTR_GRAVITY:
+ case PANGO2_ATTR_GRAVITY_HINT:
/* These are part of ItemProperties, so need to break runs */
- case PANGO_ATTR_SHAPE:
- case PANGO_ATTR_RISE:
- case PANGO_ATTR_UNDERLINE:
- case PANGO_ATTR_STRIKETHROUGH:
- case PANGO_ATTR_LETTER_SPACING:
+ case PANGO2_ATTR_SHAPE:
+ case PANGO2_ATTR_RISE:
+ case PANGO2_ATTR_UNDERLINE:
+ case PANGO2_ATTR_STRIKETHROUGH:
+ case PANGO2_ATTR_LETTER_SPACING:
return TRUE;
default:
return FALSE;
@@ -92,17 +92,17 @@ affects_itemization (PangoAttribute *attr,
}
static gboolean
-affects_break_or_shape (PangoAttribute *attr,
+affects_break_or_shape (Pango2Attribute *attr,
gpointer data)
{
switch ((int)attr->klass->type)
{
/* Affects breaks */
- case PANGO_ATTR_ALLOW_BREAKS:
+ case PANGO2_ATTR_ALLOW_BREAKS:
/* Affects shaping */
- case PANGO_ATTR_INSERT_HYPHENS:
- case PANGO_ATTR_FONT_FEATURES:
- case PANGO_ATTR_SHOW:
+ case PANGO2_ATTR_INSERT_HYPHENS:
+ case PANGO2_ATTR_FONT_FEATURES:
+ case PANGO2_ATTR_SHOW:
return TRUE;
default:
return FALSE;
@@ -111,23 +111,23 @@ affects_break_or_shape (PangoAttribute *attr,
static void
apply_attributes_to_items (GList *items,
- PangoAttrList *attrs)
+ Pango2AttrList *attrs)
{
GList *l;
- PangoAttrIterator *iter;
+ Pango2AttrIterator *iter;
if (!attrs)
return;
- iter = pango_attr_list_get_iterator (attrs);
+ iter = pango2_attr_list_get_iterator (attrs);
for (l = items; l; l = l->next)
{
- PangoItem *item = l->data;
- pango_item_apply_attrs (item, iter);
+ Pango2Item *item = l->data;
+ pango2_item_apply_attrs (item, iter);
}
- pango_attr_iterator_destroy (iter);
+ pango2_attr_iterator_destroy (iter);
}
static void
@@ -138,14 +138,14 @@ test_file (const char *filename, GString *string)
GError *error = NULL;
char *test;
char *text;
- PangoAttrList *attrs;
- PangoAttrList *itemize_attrs;
- PangoAttrList *shape_attrs;
+ Pango2AttrList *attrs;
+ Pango2AttrList *itemize_attrs;
+ Pango2AttrList *shape_attrs;
GList *items, *l;
GString *s1, *s2, *s3, *s4, *s5, *s6, *s7, *s8, *s9;
char *p1;
const char *sep = "";
- PangoDirection dir;
+ Pango2Direction dir;
if (!g_file_get_contents (filename, &contents, &length, &error))
{
@@ -160,7 +160,7 @@ test_file (const char *filename, GString *string)
while (test[0] == '#')
test = strchr (test, '\n') + 1;
- if (!pango_parse_markup (test, -1, 0, &attrs, &text, NULL, &error))
+ if (!pango2_parse_markup (test, -1, 0, &attrs, &text, NULL, &error))
{
fprintf (stderr, "%s\n", error->message);
g_error_free (error);
@@ -181,31 +181,31 @@ test_file (const char *filename, GString *string)
if (text[length - 1] == '\n')
length--;
- itemize_attrs = pango_attr_list_filter (attrs, affects_itemization, NULL);
- shape_attrs = pango_attr_list_filter (attrs, affects_break_or_shape, NULL);
+ itemize_attrs = pango2_attr_list_filter (attrs, affects_itemization, NULL);
+ shape_attrs = pango2_attr_list_filter (attrs, affects_break_or_shape, NULL);
- dir = pango_context_get_base_dir (context);
- items = pango_itemize (context, dir, text, 0, length, itemize_attrs);
+ dir = pango2_context_get_base_dir (context);
+ items = pango2_itemize (context, dir, text, 0, length, itemize_attrs);
apply_attributes_to_items (items, shape_attrs);
- pango_attr_list_unref (itemize_attrs);
- pango_attr_list_unref (shape_attrs);
+ pango2_attr_list_unref (itemize_attrs);
+ pango2_attr_list_unref (shape_attrs);
for (l = items; l; l = l->next)
{
- PangoItem *item = l->data;
- PangoGlyphString *glyphs;
+ Pango2Item *item = l->data;
+ Pango2GlyphString *glyphs;
gboolean rtl = item->analysis.level % 2;
- PangoGlyphItem glyph_item;
+ Pango2GlyphItem glyph_item;
int i;
- glyphs = pango_glyph_string_new ();
+ glyphs = pango2_glyph_string_new ();
/* FIXME: get log attrs */
- pango_shape_item (item, text, length, NULL, glyphs, 0);
+ pango2_shape_item (item, text, length, NULL, glyphs, 0);
glyph_item.item = item;
glyph_item.glyphs = glyphs;
- pango_glyph_item_apply_attrs (&glyph_item, text, attrs);
+ pango2_glyph_item_apply_attrs (&glyph_item, text, attrs);
g_string_append (s1, sep);
g_string_append (s2, sep);
@@ -224,7 +224,7 @@ test_file (const char *filename, GString *string)
for (i = 0; i < glyphs->num_glyphs; i++)
{
int len;
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
+ Pango2GlyphInfo *gi = &glyphs->glyphs[i];
if (gi->attr.is_cluster_start && i > 0)
@@ -257,15 +257,15 @@ test_file (const char *filename, GString *string)
p1 = text + item->offset + item->length;
}
append_text (s1, p, p1 - p);
- if (gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG)
- g_string_append_printf (s2, "(%d)", gi->glyph & ~PANGO_GLYPH_UNKNOWN_FLAG);
+ if (gi->glyph & PANGO2_GLYPH_UNKNOWN_FLAG)
+ g_string_append_printf (s2, "(%d)", gi->glyph & ~PANGO2_GLYPH_UNKNOWN_FLAG);
else
g_string_append_printf (s2, "[%d]", gi->glyph);
g_string_append_printf (s4, "%d ", gi->geometry.width);
g_string_append_printf (s7, "%d,%d ", gi->geometry.x_offset, gi->geometry.y_offset);
if (gi->attr.is_cluster_start)
g_string_append_printf (s3, "%d ", item->offset + glyphs->log_clusters[i]);
- switch (hb_ot_layout_get_glyph_class (hb_font_get_face (pango_font_get_hb_font (item->analysis.font)), gi->glyph))
+ switch (hb_ot_layout_get_glyph_class (hb_font_get_face (pango2_font_get_hb_font (item->analysis.font)), gi->glyph))
{
case HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED:
g_string_append (s8, "u");
@@ -308,7 +308,7 @@ test_file (const char *filename, GString *string)
g_string_append_printf (s9, "%*s", len - (int)g_utf8_strlen (s9->str, s9->len), "");
}
- pango_glyph_string_free (glyphs);
+ pango2_glyph_string_free (glyphs);
}
g_string_append_printf (string, "%s\n", test);
@@ -332,11 +332,11 @@ test_file (const char *filename, GString *string)
g_string_free (s8, TRUE);
g_string_free (s9, TRUE);
- g_list_free_full (items, (GDestroyNotify)pango_item_free);
+ g_list_free_full (items, (GDestroyNotify)pango2_item_free);
g_free (contents);
g_free (text);
- pango_attr_list_unref (attrs);
+ pango2_attr_list_unref (attrs);
}
static char *
@@ -412,7 +412,7 @@ main (int argc, char *argv[])
g_test_init (&argc, &argv, NULL);
- context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+ context = pango2_font_map_create_context (pango2_cairo_font_map_get_default ());
/* allow to easily generate expected output for new test cases */
if (argc > 1)
diff --git a/tests/testattributes.c b/tests/testattributes.c
index 6e07a087..13db3b97 100644
--- a/tests/testattributes.c
+++ b/tests/testattributes.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* testattributes.c: Test pango attributes
*
* Copyright (C) 2015 Red Hat, Inc.
@@ -23,74 +23,74 @@
#include <pango/pango-attr-private.h>
static void
-test_copy (PangoAttribute *attr)
+test_copy (Pango2Attribute *attr)
{
- PangoAttribute *a;
+ Pango2Attribute *a;
- a = pango_attribute_copy (attr);
- g_assert_true (pango_attribute_equal (attr, a));
- pango_attribute_destroy (a);
- pango_attribute_destroy (attr);
+ a = pango2_attribute_copy (attr);
+ g_assert_true (pango2_attribute_equal (attr, a));
+ pango2_attribute_destroy (a);
+ pango2_attribute_destroy (attr);
}
static void
test_attributes_basic (void)
{
- PangoFontDescription *desc;
-
- test_copy (pango_attr_language_new (pango_language_from_string ("ja-JP")));
- test_copy (pango_attr_family_new ("Times"));
- test_copy (pango_attr_size_new (1024));
- test_copy (pango_attr_size_new_absolute (1024));
- test_copy (pango_attr_style_new (PANGO_STYLE_ITALIC));
- test_copy (pango_attr_weight_new (PANGO_WEIGHT_ULTRALIGHT));
- test_copy (pango_attr_variant_new (PANGO_VARIANT_SMALL_CAPS));
- test_copy (pango_attr_stretch_new (PANGO_STRETCH_SEMI_EXPANDED));
- desc = pango_font_description_from_string ("Computer Modern 12");
- test_copy (pango_attr_font_desc_new (desc));
- pango_font_description_free (desc);
- test_copy (pango_attr_underline_new (PANGO_LINE_STYLE_SOLID));
- test_copy (pango_attr_underline_new (PANGO_LINE_STYLE_DOTTED));
- test_copy (pango_attr_underline_color_new (&(PangoColor){100, 200, 300}));
- test_copy (pango_attr_overline_new (PANGO_LINE_STYLE_SOLID));
- test_copy (pango_attr_overline_color_new (&(PangoColor){100, 200, 300}));
- test_copy (pango_attr_strikethrough_new (TRUE));
- test_copy (pango_attr_strikethrough_color_new (&(PangoColor){100, 200, 300}));
- test_copy (pango_attr_rise_new (256));
- test_copy (pango_attr_scale_new (2.56));
- test_copy (pango_attr_fallback_new (FALSE));
- test_copy (pango_attr_letter_spacing_new (1024));
- test_copy (pango_attr_gravity_new (PANGO_GRAVITY_SOUTH));
- test_copy (pango_attr_gravity_hint_new (PANGO_GRAVITY_HINT_STRONG));
- test_copy (pango_attr_font_features_new ("csc=1"));
- test_copy (pango_attr_allow_breaks_new (FALSE));
- test_copy (pango_attr_show_new (PANGO_SHOW_SPACES));
- test_copy (pango_attr_insert_hyphens_new (FALSE));
- test_copy (pango_attr_text_transform_new (PANGO_TEXT_TRANSFORM_UPPERCASE));
- test_copy (pango_attr_line_height_new (1.5));
- test_copy (pango_attr_line_height_new_absolute (3000));
- test_copy (pango_attr_word_new ());
- test_copy (pango_attr_sentence_new ());
+ Pango2FontDescription *desc;
+
+ test_copy (pango2_attr_language_new (pango2_language_from_string ("ja-JP")));
+ test_copy (pango2_attr_family_new ("Times"));
+ test_copy (pango2_attr_size_new (1024));
+ test_copy (pango2_attr_size_new_absolute (1024));
+ test_copy (pango2_attr_style_new (PANGO2_STYLE_ITALIC));
+ test_copy (pango2_attr_weight_new (PANGO2_WEIGHT_ULTRALIGHT));
+ test_copy (pango2_attr_variant_new (PANGO2_VARIANT_SMALL_CAPS));
+ test_copy (pango2_attr_stretch_new (PANGO2_STRETCH_SEMI_EXPANDED));
+ desc = pango2_font_description_from_string ("Computer Modern 12");
+ test_copy (pango2_attr_font_desc_new (desc));
+ pango2_font_description_free (desc);
+ test_copy (pango2_attr_underline_new (PANGO2_LINE_STYLE_SOLID));
+ test_copy (pango2_attr_underline_new (PANGO2_LINE_STYLE_DOTTED));
+ test_copy (pango2_attr_underline_color_new (&(Pango2Color){100, 200, 300}));
+ test_copy (pango2_attr_overline_new (PANGO2_LINE_STYLE_SOLID));
+ test_copy (pango2_attr_overline_color_new (&(Pango2Color){100, 200, 300}));
+ test_copy (pango2_attr_strikethrough_new (TRUE));
+ test_copy (pango2_attr_strikethrough_color_new (&(Pango2Color){100, 200, 300}));
+ test_copy (pango2_attr_rise_new (256));
+ test_copy (pango2_attr_scale_new (2.56));
+ test_copy (pango2_attr_fallback_new (FALSE));
+ test_copy (pango2_attr_letter_spacing_new (1024));
+ test_copy (pango2_attr_gravity_new (PANGO2_GRAVITY_SOUTH));
+ test_copy (pango2_attr_gravity_hint_new (PANGO2_GRAVITY_HINT_STRONG));
+ test_copy (pango2_attr_font_features_new ("csc=1"));
+ test_copy (pango2_attr_allow_breaks_new (FALSE));
+ test_copy (pango2_attr_show_new (PANGO2_SHOW_SPACES));
+ test_copy (pango2_attr_insert_hyphens_new (FALSE));
+ test_copy (pango2_attr_text_transform_new (PANGO2_TEXT_TRANSFORM_UPPERCASE));
+ test_copy (pango2_attr_line_height_new (1.5));
+ test_copy (pango2_attr_line_height_new_absolute (3000));
+ test_copy (pango2_attr_word_new ());
+ test_copy (pango2_attr_sentence_new ());
}
static void
test_attributes_equal (void)
{
- PangoAttribute *attr1, *attr2, *attr3;
+ Pango2Attribute *attr1, *attr2, *attr3;
- /* check that pango_attribute_equal compares values, but not ranges */
- attr1 = pango_attr_size_new (10);
- attr2 = pango_attr_size_new (20);
- attr3 = pango_attr_size_new (20);
+ /* check that pango2_attribute_equal compares values, but not ranges */
+ attr1 = pango2_attr_size_new (10);
+ attr2 = pango2_attr_size_new (20);
+ attr3 = pango2_attr_size_new (20);
attr3->start_index = 1;
attr3->end_index = 2;
- g_assert_true (!pango_attribute_equal (attr1, attr2));
- g_assert_true (pango_attribute_equal (attr2, attr3));
+ g_assert_true (!pango2_attribute_equal (attr1, attr2));
+ g_assert_true (pango2_attribute_equal (attr2, attr3));
- pango_attribute_destroy (attr1);
- pango_attribute_destroy (attr2);
- pango_attribute_destroy (attr3);
+ pango2_attribute_destroy (attr1);
+ pango2_attribute_destroy (attr2);
+ pango2_attribute_destroy (attr3);
}
static gpointer
@@ -120,135 +120,135 @@ my_attribute_data_serialize (gconstpointer data)
static void
test_attributes_register (void)
{
- PangoAttrType type;
- PangoAttribute *attr;
- PangoAttribute *attr2;
- PangoAttrList *list;
+ Pango2AttrType type;
+ Pango2Attribute *attr;
+ Pango2Attribute *attr2;
+ Pango2AttrList *list;
gboolean ret;
char *str;
- type = pango_attr_type_register ("my-attribute",
- PANGO_ATTR_VALUE_POINTER,
- PANGO_ATTR_AFFECTS_RENDERING,
- PANGO_ATTR_MERGE_OVERRIDES,
+ type = pango2_attr_type_register ("my-attribute",
+ PANGO2_ATTR_VALUE_POINTER,
+ PANGO2_ATTR_AFFECTS_RENDERING,
+ PANGO2_ATTR_MERGE_OVERRIDES,
copy_my_attribute_data,
destroy_my_attribute_data,
my_attribute_data_equal,
my_attribute_data_serialize);
- g_assert_cmpstr (pango_attr_type_get_name (type), ==, "my-attribute");
+ g_assert_cmpstr (pango2_attr_type_get_name (type), ==, "my-attribute");
- attr = pango_attribute_new (type, (gpointer)0x42);
+ attr = pango2_attribute_new (type, (gpointer)0x42);
- g_assert_true (pango_attribute_get_pointer (attr) == (gpointer)0x42);
+ g_assert_true (pango2_attribute_get_pointer (attr) == (gpointer)0x42);
- attr2 = pango_attribute_new (type, (gpointer)0x43);
+ attr2 = pango2_attribute_new (type, (gpointer)0x43);
- ret = pango_attribute_equal (attr, attr2);
+ ret = pango2_attribute_equal (attr, attr2);
g_assert_false (ret);
- list = pango_attr_list_new ();
- pango_attr_list_insert (list, attr2);
+ list = pango2_attr_list_new ();
+ pango2_attr_list_insert (list, attr2);
- str = pango_attr_list_to_string (list);
+ str = pango2_attr_list_to_string (list);
g_assert_cmpstr (str, ==, "0 4294967295 my-attribute 0x43");
g_free (str);
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
- pango_attribute_destroy (attr);
+ pango2_attribute_destroy (attr);
}
static void
assert_attributes (GSList *attrs,
const char *expected)
{
- PangoAttrList *list2;
+ Pango2AttrList *list2;
GSList *attrs2, *l, *l2;
- list2 = pango_attr_list_from_string (expected);
- attrs2 = pango_attr_list_get_attributes (list2);
+ list2 = pango2_attr_list_from_string (expected);
+ attrs2 = pango2_attr_list_get_attributes (list2);
if (g_slist_length (attrs) != g_slist_length (attrs2))
g_assert_not_reached ();
for (l = attrs, l2 = attrs2; l; l = l->next, l2 = l2->next)
{
- PangoAttribute *a = l->data;
- PangoAttribute *a2 = l2->data;
- if (!pango_attribute_equal (a, a2))
+ Pango2Attribute *a = l->data;
+ Pango2Attribute *a2 = l2->data;
+ if (!pango2_attribute_equal (a, a2))
g_assert_not_reached ();
}
- g_slist_free_full (attrs2, (GDestroyNotify)pango_attribute_destroy);
- pango_attr_list_unref (list2);
+ g_slist_free_full (attrs2, (GDestroyNotify)pango2_attribute_destroy);
+ pango2_attr_list_unref (list2);
}
static void
-assert_attr_list_order (PangoAttrList *list)
+assert_attr_list_order (Pango2AttrList *list)
{
GSList *attrs, *l;
guint start = 0;
- attrs = pango_attr_list_get_attributes (list);
+ attrs = pango2_attr_list_get_attributes (list);
for (l = attrs; l; l = l->next)
{
- PangoAttribute *attr = l->data;
+ Pango2Attribute *attr = l->data;
g_assert (start <= attr->start_index);
start = attr->start_index;
}
- g_slist_free_full (attrs, (GDestroyNotify) pango_attribute_destroy);
+ g_slist_free_full (attrs, (GDestroyNotify) pango2_attribute_destroy);
}
static void
-assert_attr_list (PangoAttrList *list,
+assert_attr_list (Pango2AttrList *list,
const char *expected)
{
- PangoAttrList *list2;
+ Pango2AttrList *list2;
assert_attr_list_order (list);
- list2 = pango_attr_list_from_string (expected);
- if (!pango_attr_list_equal (list, list2))
+ list2 = pango2_attr_list_from_string (expected);
+ if (!pango2_attr_list_equal (list, list2))
{
- char *s = pango_attr_list_to_string (list);
+ char *s = pango2_attr_list_to_string (list);
g_print ("-----\nattribute list mismatch\nexpected:\n%s\n-----\nreceived:\n%s\n-----\n",
expected, s);
g_free (s);
g_assert_not_reached ();
}
- pango_attr_list_unref (list2);
+ pango2_attr_list_unref (list2);
}
static void
-assert_attr_iterator (PangoAttrIterator *iter,
+assert_attr_iterator (Pango2AttrIterator *iter,
const char *expected)
{
GSList *attrs;
- attrs = pango_attr_iterator_get_attrs (iter);
+ attrs = pango2_attr_iterator_get_attrs (iter);
assert_attributes (attrs, expected);
- g_slist_free_full (attrs, (GDestroyNotify)pango_attribute_destroy);
+ g_slist_free_full (attrs, (GDestroyNotify)pango2_attribute_destroy);
}
-static PangoAttribute *
+static Pango2Attribute *
attribute_from_string (const char *str)
{
- PangoAttrList *list;
+ Pango2AttrList *list;
GSList *attrs;
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string (str);
- attrs = pango_attr_list_get_attributes (list);
+ list = pango2_attr_list_from_string (str);
+ attrs = pango2_attr_list_get_attributes (list);
g_assert_true (attrs->next == NULL);
attr = attrs->data;
g_slist_free (attrs);
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
return attr;
}
@@ -256,69 +256,69 @@ attribute_from_string (const char *str)
static void
test_list (void)
{
- PangoAttrList *list, *list2;
- PangoAttribute *attr;
+ Pango2AttrList *list, *list2;
+ Pango2Attribute *attr;
- list = pango_attr_list_new ();
+ list = pango2_attr_list_new ();
- attr = pango_attr_size_new (10);
- pango_attr_list_insert (list, attr);
- attr = pango_attr_size_new (20);
- pango_attr_list_insert (list, attr);
- attr = pango_attr_size_new (30);
- pango_attr_list_insert (list, attr);
+ attr = pango2_attr_size_new (10);
+ pango2_attr_list_insert (list, attr);
+ attr = pango2_attr_size_new (20);
+ pango2_attr_list_insert (list, attr);
+ attr = pango2_attr_size_new (30);
+ pango2_attr_list_insert (list, attr);
- list2 = pango_attr_list_from_string ("0 -1 size 10\n"
+ list2 = pango2_attr_list_from_string ("0 -1 size 10\n"
"0 -1 size 20\n"
"0 -1 size 30\n");
- g_assert_true (pango_attr_list_equal (list, list2));
- pango_attr_list_unref (list2);
+ g_assert_true (pango2_attr_list_equal (list, list2));
+ pango2_attr_list_unref (list2);
assert_attr_list (list, "0 -1 size 10\n"
"0 -1 size 20\n"
"0 -1 size 30");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
- list = pango_attr_list_new ();
+ list = pango2_attr_list_new ();
/* test that insertion respects start_index */
attr = attribute_from_string ("0 -1 size 10");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("10 20 size 20");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("0 -1 size 30");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string (" 10 40 size 40");
- pango_attr_list_insert_before (list, attr);
+ pango2_attr_list_insert_before (list, attr);
assert_attr_list (list, "0 -1 size 10\n"
"0 -1 size 30\n"
"10 40 size 40\n"
"10 20 size 20");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_change (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string (" 0 10 size 10\n"
+ list = pango2_attr_list_from_string (" 0 10 size 10\n"
" 0 30 weight 700\n"
" 20 30 size 20\n");
/* no-op */
attr = attribute_from_string ("10 10 variant small-caps");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 10 size 10\n"
"0 30 weight bold\n"
"20 30 size 20");
- /* simple insertion with pango_attr_list_change */
+ /* simple insertion with pango2_attr_list_change */
attr = attribute_from_string ("10 20 variant small-caps");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 10 size 10\n"
"0 30 weight bold\n"
@@ -327,7 +327,7 @@ test_list_change (void)
/* insertion with splitting */
attr = attribute_from_string ("15 20 weight light");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 10 size 10\n"
"0 15 weight bold\n"
@@ -338,7 +338,7 @@ test_list_change (void)
/* insertion with joining */
attr = attribute_from_string ("5 20 size 20");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 5 size 10\n"
"0 15 weight bold\n"
@@ -347,74 +347,74 @@ test_list_change (void)
"15 20 weight light\n"
"20 30 weight bold");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
/* See https://gitlab.gnome.org/GNOME/pango/-/issues/564 */
static void
test_list_change2 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 3 style italic\n"
+ list = pango2_attr_list_from_string ("0 3 style italic\n"
"3 4 style normal\n"
"4 18 style italic\n");
/* insertion with joining */
attr = attribute_from_string ("0 18 style normal");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 18 style normal");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_change3 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 3 style italic\n"
+ list = pango2_attr_list_from_string ("0 3 style italic\n"
"3 4 style normal\n"
"4 18 style italic\n");
/* insertion with joining */
attr = attribute_from_string ("1 1 style normal");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 3 style italic\n"
"3 4 style normal\n"
"4 18 style italic");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_change4 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_new ();
+ list = pango2_attr_list_new ();
/* insertion with joining */
attr = attribute_from_string ("0 10 style normal");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 10 style normal");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_change5 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 3 weight 800\n"
+ list = pango2_attr_list_from_string ("0 3 weight 800\n"
"2 4 style normal\n"
"10 20 style normal\n"
"15 18 fallback false\n");
@@ -423,8 +423,8 @@ test_list_change5 (void)
attr = attribute_from_string ("5 15 style italic");
g_assert (attr->start_index == 5);
g_assert (attr->end_index == 15);
- g_assert (attr->int_value == PANGO_STYLE_ITALIC);
- pango_attr_list_change (list, attr);
+ g_assert (attr->int_value == PANGO2_STYLE_ITALIC);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 3 weight ultrabold\n"
"2 4 style normal\n"
@@ -432,68 +432,68 @@ test_list_change5 (void)
"15 20 style normal\n"
"15 18 fallback false");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_change6 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 3 weight 800\n"
+ list = pango2_attr_list_from_string ("0 3 weight 800\n"
"2 4 style normal\n"
"10 20 style normal\n"
"15 18 fallback false\n");
/* insertion with joining */
attr = attribute_from_string ("3 10 style normal");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 3 weight ultrabold\n"
"2 20 style normal\n"
"15 18 fallback false");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_change7 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 3 weight 800\n"
+ list = pango2_attr_list_from_string ("0 3 weight 800\n"
"2 4 style normal\n"
"10 20 style normal\n"
"15 18 fallback false\n");
/* insertion with joining */
attr = attribute_from_string ("3 4 style normal");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 3 weight ultrabold\n"
"2 4 style normal\n"
"10 20 style normal\n"
"15 18 fallback false");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_change8 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 3 weight 800\n"
+ list = pango2_attr_list_from_string ("0 3 weight 800\n"
"2 4 style normal\n"
"10 20 style normal\n"
"15 18 fallback false\n");
/* insertion with joining */
attr = attribute_from_string ("3 11 style italic");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 3 weight ultrabold\n"
"2 3 style normal\n"
@@ -501,23 +501,23 @@ test_list_change8 (void)
"11 20 style normal\n"
"15 18 fallback false");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_change9 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 3 weight 800\n"
+ list = pango2_attr_list_from_string ("0 3 weight 800\n"
"2 4 style normal\n"
"10 20 style normal\n"
"15 18 fallback false\n");
/* insertion with joining */
attr = attribute_from_string ("2 3 style italic");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 3 weight ultrabold\n"
"2 3 style italic\n"
@@ -525,23 +525,23 @@ test_list_change9 (void)
"10 20 style normal\n"
"15 18 fallback false");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_change10 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 3 weight 800\n"
+ list = pango2_attr_list_from_string ("0 3 weight 800\n"
"2 4 style normal\n"
"10 20 style normal\n"
"15 18 fallback false\n");
/* insertion with joining */
attr = attribute_from_string ("3 4 style italic");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 3 weight ultrabold\n"
"2 3 style normal\n"
@@ -549,16 +549,16 @@ test_list_change10 (void)
"10 20 style normal\n"
"15 18 fallback false");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_change11 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 3 weight 800\n"
+ list = pango2_attr_list_from_string ("0 3 weight 800\n"
"2 4 style normal\n"
"3 5 fallback false\n"
"10 20 style italic\n"
@@ -567,7 +567,7 @@ test_list_change11 (void)
/* insertion with joining */
attr = attribute_from_string ("3 22 style italic");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 3 weight ultrabold\n"
"2 3 style normal\n"
@@ -575,16 +575,16 @@ test_list_change11 (void)
"3 5 fallback false\n"
"15 18 fallback false\n");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_change12 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 3 weight 800\n"
+ list = pango2_attr_list_from_string ("0 3 weight 800\n"
"2 4 style normal\n"
"3 5 fallback false\n"
"10 20 style normal\n"
@@ -594,7 +594,7 @@ test_list_change12 (void)
/* insertion with joining */
attr = attribute_from_string ("3 22 style italic");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 3 weight ultrabold\n"
"2 3 style normal\n"
@@ -604,39 +604,39 @@ test_list_change12 (void)
"21 22 fallback false\n"
"22 30 style oblique");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_splice (void)
{
- PangoAttrList *base;
- PangoAttrList *list;
- PangoAttrList *other;
+ Pango2AttrList *base;
+ Pango2AttrList *list;
+ Pango2AttrList *other;
- base = pango_attr_list_from_string ("0 -1 size 10\n"
+ base = pango2_attr_list_from_string ("0 -1 size 10\n"
"10 15 weight 700\n"
"20 30 variant 1\n");
/* splice in an empty list */
- list = pango_attr_list_copy (base);
- other = pango_attr_list_new ();
- pango_attr_list_splice (list, other, 11, 5);
+ list = pango2_attr_list_copy (base);
+ other = pango2_attr_list_new ();
+ pango2_attr_list_splice (list, other, 11, 5);
assert_attr_list (list, "0 -1 size 10\n"
"10 20 weight bold\n"
"25 35 variant small-caps\n");
- pango_attr_list_unref (list);
- pango_attr_list_unref (other);
+ pango2_attr_list_unref (list);
+ pango2_attr_list_unref (other);
/* splice in some attributes */
- list = pango_attr_list_copy (base);
+ list = pango2_attr_list_copy (base);
- other = pango_attr_list_from_string ("0 3 size 20\n"
+ other = pango2_attr_list_from_string ("0 3 size 20\n"
"2 4 stretch condensed\n");
- pango_attr_list_splice (list, other, 11, 5);
+ pango2_attr_list_splice (list, other, 11, 5);
assert_attr_list (list, "0 11 size 10\n"
"10 20 weight bold\n"
@@ -645,74 +645,74 @@ test_list_splice (void)
"14 -1 size 10\n"
"25 35 variant small-caps\n");
- pango_attr_list_unref (list);
- pango_attr_list_unref (other);
+ pango2_attr_list_unref (list);
+ pango2_attr_list_unref (other);
- pango_attr_list_unref (base);
+ pango2_attr_list_unref (base);
}
-/* Test that empty lists work in pango_attr_list_splice */
+/* Test that empty lists work in pango2_attr_list_splice */
static void
test_list_splice2 (void)
{
- PangoAttrList *list;
- PangoAttrList *other;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2AttrList *other;
+ Pango2Attribute *attr;
- list = pango_attr_list_new ();
- other = pango_attr_list_new ();
+ list = pango2_attr_list_new ();
+ other = pango2_attr_list_new ();
- pango_attr_list_splice (list, other, 11, 5);
+ pango2_attr_list_splice (list, other, 11, 5);
- g_assert_null (pango_attr_list_get_attributes (list));
+ g_assert_null (pango2_attr_list_get_attributes (list));
attr = attribute_from_string ("0 -1 size 10");
- pango_attr_list_insert (other, attr);
+ pango2_attr_list_insert (other, attr);
- pango_attr_list_splice (list, other, 11, 5);
+ pango2_attr_list_splice (list, other, 11, 5);
assert_attr_list (list, "11 16 size 10\n");
- pango_attr_list_unref (other);
- other = pango_attr_list_new ();
+ pango2_attr_list_unref (other);
+ other = pango2_attr_list_new ();
- pango_attr_list_splice (list, other, 11, 5);
+ pango2_attr_list_splice (list, other, 11, 5);
assert_attr_list (list, "11 21 size 10\n");
- pango_attr_list_unref (other);
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (other);
+ pango2_attr_list_unref (list);
}
-/* Test that attributes in other aren't leaking out in pango_attr_list_splice */
+/* Test that attributes in other aren't leaking out in pango2_attr_list_splice */
static void
test_list_splice3 (void)
{
- PangoAttrList *list;
- PangoAttrList *other;
+ Pango2AttrList *list;
+ Pango2AttrList *other;
- list = pango_attr_list_from_string ("10 30 variant 1\n");
- other = pango_attr_list_from_string ("0 -1 weight 700\n");
+ list = pango2_attr_list_from_string ("10 30 variant 1\n");
+ other = pango2_attr_list_from_string ("0 -1 weight 700\n");
- pango_attr_list_splice (list, other, 20, 5);
+ pango2_attr_list_splice (list, other, 20, 5);
assert_attr_list (list, "10 35 variant small-caps\n"
"20 25 weight bold\n");
- pango_attr_list_unref (other);
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (other);
+ pango2_attr_list_unref (list);
}
static gboolean
-never_true (PangoAttribute *attribute, gpointer user_data)
+never_true (Pango2Attribute *attribute, gpointer user_data)
{
return FALSE;
}
static gboolean
-just_weight (PangoAttribute *attribute, gpointer user_data)
+just_weight (Pango2Attribute *attribute, gpointer user_data)
{
- if (attribute->type == PANGO_ATTR_WEIGHT)
+ if (attribute->type == PANGO2_ATTR_WEIGHT)
return TRUE;
else
return FALSE;
@@ -721,369 +721,369 @@ just_weight (PangoAttribute *attribute, gpointer user_data)
static void
test_list_filter (void)
{
- PangoAttrList *list;
- PangoAttrList *out;
+ Pango2AttrList *list;
+ Pango2AttrList *out;
- list = pango_attr_list_from_string ("0 -1 size 10\n"
+ list = pango2_attr_list_from_string ("0 -1 size 10\n"
"10 20 stretch condensed\n"
"20 -1 weight 700\n");
- out = pango_attr_list_filter (list, never_true, NULL);
+ out = pango2_attr_list_filter (list, never_true, NULL);
g_assert_null (out);
- out = pango_attr_list_filter (list, just_weight, NULL);
+ out = pango2_attr_list_filter (list, just_weight, NULL);
g_assert_nonnull (out);
assert_attr_list (list, "0 -1 size 10\n"
"10 20 stretch condensed\n");
assert_attr_list (out, "20 -1 weight bold\n");
- pango_attr_list_unref (list);
- pango_attr_list_unref (out);
+ pango2_attr_list_unref (list);
+ pango2_attr_list_unref (out);
}
static void
test_iter (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
- PangoAttrIterator *iter;
- PangoAttrIterator *copy;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
+ Pango2AttrIterator *iter;
+ Pango2AttrIterator *copy;
int start, end;
/* Empty list */
- list = pango_attr_list_new ();
- iter = pango_attr_list_get_iterator (list);
+ list = pango2_attr_list_new ();
+ iter = pango2_attr_list_get_iterator (list);
- g_assert_false (pango_attr_iterator_next (iter));
- g_assert_null (pango_attr_iterator_get_attrs (iter));
- pango_attr_iterator_destroy (iter);
- pango_attr_list_unref (list);
+ g_assert_false (pango2_attr_iterator_next (iter));
+ g_assert_null (pango2_attr_iterator_get_attrs (iter));
+ pango2_attr_iterator_destroy (iter);
+ pango2_attr_list_unref (list);
- list = pango_attr_list_new ();
+ list = pango2_attr_list_new ();
attr = attribute_from_string ("0 -1 size 10");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("10 30 stretch condensed");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("20 -1 weight bold");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
- iter = pango_attr_list_get_iterator (list);
- copy = pango_attr_iterator_copy (iter);
- pango_attr_iterator_range (iter, &start, &end);
+ iter = pango2_attr_list_get_iterator (list);
+ copy = pango2_attr_iterator_copy (iter);
+ pango2_attr_iterator_range (iter, &start, &end);
g_assert_cmpint (start, ==, 0);
g_assert_cmpint (end, ==, 10);
- g_assert_true (pango_attr_iterator_next (iter));
- pango_attr_iterator_range (iter, &start, &end);
+ g_assert_true (pango2_attr_iterator_next (iter));
+ pango2_attr_iterator_range (iter, &start, &end);
g_assert_cmpint (start, ==, 10);
g_assert_cmpint (end, ==, 20);
- g_assert_true (pango_attr_iterator_next (iter));
- pango_attr_iterator_range (iter, &start, &end);
+ g_assert_true (pango2_attr_iterator_next (iter));
+ pango2_attr_iterator_range (iter, &start, &end);
g_assert_cmpint (start, ==, 20);
g_assert_cmpint (end, ==, 30);
- g_assert_true (pango_attr_iterator_next (iter));
- pango_attr_iterator_range (iter, &start, &end);
+ g_assert_true (pango2_attr_iterator_next (iter));
+ pango2_attr_iterator_range (iter, &start, &end);
g_assert_cmpint (start, ==, 30);
g_assert_cmpint (end, ==, G_MAXINT);
- g_assert_true (pango_attr_iterator_next (iter));
- pango_attr_iterator_range (iter, &start, &end);
+ g_assert_true (pango2_attr_iterator_next (iter));
+ pango2_attr_iterator_range (iter, &start, &end);
g_assert_cmpint (start, ==, G_MAXINT);
g_assert_cmpint (end, ==, G_MAXINT);
- g_assert_true (!pango_attr_iterator_next (iter));
+ g_assert_true (!pango2_attr_iterator_next (iter));
- pango_attr_iterator_destroy (iter);
+ pango2_attr_iterator_destroy (iter);
- pango_attr_iterator_range (copy, &start, &end);
+ pango2_attr_iterator_range (copy, &start, &end);
g_assert_cmpint (start, ==, 0);
g_assert_cmpint (end, ==, 10);
- pango_attr_iterator_destroy (copy);
+ pango2_attr_iterator_destroy (copy);
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_iter_get (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
- PangoAttrIterator *iter;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
+ Pango2AttrIterator *iter;
- list = pango_attr_list_new ();
- attr = pango_attr_size_new (10);
- pango_attr_list_insert (list, attr);
+ list = pango2_attr_list_new ();
+ attr = pango2_attr_size_new (10);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("10 30 stretch condensed");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("20 -1 weight bold");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
- iter = pango_attr_list_get_iterator (list);
- pango_attr_iterator_next (iter);
- attr = pango_attr_iterator_get (iter, PANGO_ATTR_SIZE);
+ iter = pango2_attr_list_get_iterator (list);
+ pango2_attr_iterator_next (iter);
+ attr = pango2_attr_iterator_get (iter, PANGO2_ATTR_SIZE);
g_assert_nonnull (attr);
g_assert_cmpuint (attr->start_index, ==, 0);
g_assert_cmpuint (attr->end_index, ==, G_MAXUINT);
- attr = pango_attr_iterator_get (iter, PANGO_ATTR_STRETCH);
+ attr = pango2_attr_iterator_get (iter, PANGO2_ATTR_STRETCH);
g_assert_nonnull (attr);
g_assert_cmpuint (attr->start_index, ==, 10);
g_assert_cmpuint (attr->end_index, ==, 30);
- attr = pango_attr_iterator_get (iter, PANGO_ATTR_WEIGHT);
+ attr = pango2_attr_iterator_get (iter, PANGO2_ATTR_WEIGHT);
g_assert_null (attr);
- attr = pango_attr_iterator_get (iter, PANGO_ATTR_GRAVITY);
+ attr = pango2_attr_iterator_get (iter, PANGO2_ATTR_GRAVITY);
g_assert_null (attr);
- pango_attr_iterator_destroy (iter);
- pango_attr_list_unref (list);
+ pango2_attr_iterator_destroy (iter);
+ pango2_attr_list_unref (list);
}
static void
test_iter_get_font (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
- PangoAttrIterator *iter;
- PangoFontDescription *desc;
- PangoFontDescription *desc2;
- PangoLanguage *lang;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
+ Pango2AttrIterator *iter;
+ Pango2FontDescription *desc;
+ Pango2FontDescription *desc2;
+ Pango2Language *lang;
GSList *attrs;
- list = pango_attr_list_new ();
- attr = pango_attr_size_new (10 * PANGO_SCALE);
- pango_attr_list_insert (list, attr);
+ list = pango2_attr_list_new ();
+ attr = pango2_attr_size_new (10 * PANGO2_SCALE);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("0 -1 family \"Times\"");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("10 30 stretch condensed");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("10 20 absolute-size 10240");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("10 20 language ja-JP");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("20 -1 rise 100");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("20 -1 fallback false");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
- iter = pango_attr_list_get_iterator (list);
- desc = pango_font_description_new ();
- pango_attr_iterator_get_font (iter, desc, &lang, &attrs);
- desc2 = pango_font_description_from_string ("Times 10");
- g_assert_true (pango_font_description_equal (desc, desc2));
+ iter = pango2_attr_list_get_iterator (list);
+ desc = pango2_font_description_new ();
+ pango2_attr_iterator_get_font (iter, desc, &lang, &attrs);
+ desc2 = pango2_font_description_from_string ("Times 10");
+ g_assert_true (pango2_font_description_equal (desc, desc2));
g_assert_null (lang);
g_assert_null (attrs);
- pango_font_description_free (desc);
- pango_font_description_free (desc2);
-
- pango_attr_iterator_next (iter);
- desc = pango_font_description_new ();
- pango_attr_iterator_get_font (iter, desc, &lang, &attrs);
- desc2 = pango_font_description_from_string ("Times Condensed 10px");
- g_assert_true (pango_font_description_equal (desc, desc2));
+ pango2_font_description_free (desc);
+ pango2_font_description_free (desc2);
+
+ pango2_attr_iterator_next (iter);
+ desc = pango2_font_description_new ();
+ pango2_attr_iterator_get_font (iter, desc, &lang, &attrs);
+ desc2 = pango2_font_description_from_string ("Times Condensed 10px");
+ g_assert_true (pango2_font_description_equal (desc, desc2));
g_assert_nonnull (lang);
- g_assert_cmpstr (pango_language_to_string (lang), ==, "ja-jp");
+ g_assert_cmpstr (pango2_language_to_string (lang), ==, "ja-jp");
g_assert_null (attrs);
- pango_font_description_free (desc);
- pango_font_description_free (desc2);
-
- pango_attr_iterator_next (iter);
- desc = pango_font_description_new ();
- pango_attr_iterator_get_font (iter, desc, &lang, &attrs);
- desc2 = pango_font_description_from_string ("Times Condensed 10");
- g_assert_true (pango_font_description_equal (desc, desc2));
+ pango2_font_description_free (desc);
+ pango2_font_description_free (desc2);
+
+ pango2_attr_iterator_next (iter);
+ desc = pango2_font_description_new ();
+ pango2_attr_iterator_get_font (iter, desc, &lang, &attrs);
+ desc2 = pango2_font_description_from_string ("Times Condensed 10");
+ g_assert_true (pango2_font_description_equal (desc, desc2));
g_assert_null (lang);
assert_attributes (attrs, "20 -1 rise 100\n"
"20 -1 fallback false\n");
- g_slist_free_full (attrs, (GDestroyNotify)pango_attribute_destroy);
+ g_slist_free_full (attrs, (GDestroyNotify)pango2_attribute_destroy);
- pango_font_description_free (desc);
- pango_font_description_free (desc2);
+ pango2_font_description_free (desc);
+ pango2_font_description_free (desc2);
- pango_attr_iterator_destroy (iter);
- pango_attr_list_unref (list);
+ pango2_attr_iterator_destroy (iter);
+ pango2_attr_list_unref (list);
}
static void
test_iter_get_attrs (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
- PangoAttrIterator *iter;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
+ Pango2AttrIterator *iter;
- list = pango_attr_list_new ();
- attr = pango_attr_size_new (10 * PANGO_SCALE);
- pango_attr_list_insert (list, attr);
+ list = pango2_attr_list_new ();
+ attr = pango2_attr_size_new (10 * PANGO2_SCALE);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("0 -1 family \"Times\"");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("10 30 stretch condensed");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("10 20 language ja-JP");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("20 -1 rise 100");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
attr = attribute_from_string ("20 -1 fallback false");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
- iter = pango_attr_list_get_iterator (list);
+ iter = pango2_attr_list_get_iterator (list);
assert_attr_iterator (iter, "0 -1 size 10240\n"
"0 -1 family \"Times\"\n");
- pango_attr_iterator_next (iter);
+ pango2_attr_iterator_next (iter);
assert_attr_iterator (iter, "0 -1 size 10240\n"
"0 -1 family \"Times\"\n"
"10 30 stretch condensed\n"
"10 20 language ja-jp\n");
- pango_attr_iterator_next (iter);
+ pango2_attr_iterator_next (iter);
assert_attr_iterator (iter, "0 -1 size 10240\n"
"0 -1 family \"Times\"\n"
"10 30 stretch condensed\n"
"20 -1 rise 100\n"
"20 -1 fallback false\n");
- pango_attr_iterator_next (iter);
+ pango2_attr_iterator_next (iter);
assert_attr_iterator (iter, "0 -1 size 10240\n"
"0 -1 family \"Times\"\n"
"20 -1 rise 100\n"
"20 -1 fallback false\n");
- pango_attr_iterator_next (iter);
- g_assert_null (pango_attr_iterator_get_attrs (iter));
+ pango2_attr_iterator_next (iter);
+ g_assert_null (pango2_attr_iterator_get_attrs (iter));
- pango_attr_iterator_destroy (iter);
- pango_attr_list_unref (list);
+ pango2_attr_iterator_destroy (iter);
+ pango2_attr_list_unref (list);
}
static void
test_list_update (void)
{
- PangoAttrList *list;
+ Pango2AttrList *list;
- list = pango_attr_list_from_string ("0 200 rise 100\n"
+ list = pango2_attr_list_from_string ("0 200 rise 100\n"
"5 15 family \"Times\"\n"
"10 11 size 10240\n"
"11 100 fallback false\n"
"30 60 stretch condensed\n");
- pango_attr_list_update (list, 8, 10, 20);
+ pango2_attr_list_update (list, 8, 10, 20);
assert_attr_list (list, "0 210 rise 100\n"
"5 8 family \"Times\"\n"
"28 110 fallback false\n"
"40 70 stretch condensed\n");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
-/* Test that empty lists work in pango_attr_list_update */
+/* Test that empty lists work in pango2_attr_list_update */
static void
test_list_update2 (void)
{
- PangoAttrList *list;
+ Pango2AttrList *list;
- list = pango_attr_list_new ();
- pango_attr_list_update (list, 8, 10, 20);
+ list = pango2_attr_list_new ();
+ pango2_attr_list_update (list, 8, 10, 20);
- g_assert_null (pango_attr_list_get_attributes (list));
+ g_assert_null (pango2_attr_list_get_attributes (list));
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
/* test overflow */
static void
test_list_update3 (void)
{
- PangoAttrList *list;
+ Pango2AttrList *list;
- list = pango_attr_list_from_string ("5 4294967285 family \"Times\"\n");
+ list = pango2_attr_list_from_string ("5 4294967285 family \"Times\"\n");
- pango_attr_list_update (list, 8, 10, 30);
+ pango2_attr_list_update (list, 8, 10, 30);
assert_attr_list (list, "5 -1 family \"Times\"\n");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_list_equal (void)
{
- PangoAttrList *list1, *list2;
- PangoAttribute *attr;
+ Pango2AttrList *list1, *list2;
+ Pango2Attribute *attr;
- list1 = pango_attr_list_new ();
- list2 = pango_attr_list_new ();
+ list1 = pango2_attr_list_new ();
+ list2 = pango2_attr_list_new ();
- g_assert_true (pango_attr_list_equal (NULL, NULL));
- g_assert_false (pango_attr_list_equal (list1, NULL));
- g_assert_false (pango_attr_list_equal (NULL, list1));
- g_assert_true (pango_attr_list_equal (list1, list1));
- g_assert_true (pango_attr_list_equal (list1, list2));
+ g_assert_true (pango2_attr_list_equal (NULL, NULL));
+ g_assert_false (pango2_attr_list_equal (list1, NULL));
+ g_assert_false (pango2_attr_list_equal (NULL, list1));
+ g_assert_true (pango2_attr_list_equal (list1, list1));
+ g_assert_true (pango2_attr_list_equal (list1, list2));
attr = attribute_from_string ("0 7 size 10240");
- pango_attr_list_insert (list1, pango_attribute_copy (attr));
- pango_attr_list_insert (list2, pango_attribute_copy (attr));
- pango_attribute_destroy (attr);
+ pango2_attr_list_insert (list1, pango2_attribute_copy (attr));
+ pango2_attr_list_insert (list2, pango2_attribute_copy (attr));
+ pango2_attribute_destroy (attr);
- g_assert_true (pango_attr_list_equal (list1, list2));
+ g_assert_true (pango2_attr_list_equal (list1, list2));
attr = attribute_from_string ("0 1 stretch condensed");
- pango_attr_list_insert (list1, pango_attribute_copy (attr));
- g_assert_true (!pango_attr_list_equal (list1, list2));
+ pango2_attr_list_insert (list1, pango2_attribute_copy (attr));
+ g_assert_true (!pango2_attr_list_equal (list1, list2));
- pango_attr_list_insert (list2, pango_attribute_copy (attr));
- g_assert_true (pango_attr_list_equal (list1, list2));
- pango_attribute_destroy (attr);
+ pango2_attr_list_insert (list2, pango2_attribute_copy (attr));
+ g_assert_true (pango2_attr_list_equal (list1, list2));
+ pango2_attribute_destroy (attr);
/* Same range as the first attribute */
attr = attribute_from_string ("0 7 size 30720");
- pango_attr_list_insert (list2, pango_attribute_copy (attr));
- g_assert_true (!pango_attr_list_equal (list1, list2));
- pango_attr_list_insert (list1, pango_attribute_copy (attr));
- g_assert_true (pango_attr_list_equal (list1, list2));
- pango_attribute_destroy (attr);
+ pango2_attr_list_insert (list2, pango2_attribute_copy (attr));
+ g_assert_true (!pango2_attr_list_equal (list1, list2));
+ pango2_attr_list_insert (list1, pango2_attribute_copy (attr));
+ g_assert_true (pango2_attr_list_equal (list1, list2));
+ pango2_attribute_destroy (attr);
- pango_attr_list_unref (list1);
- pango_attr_list_unref (list2);
+ pango2_attr_list_unref (list1);
+ pango2_attr_list_unref (list2);
/* Same range but different order */
{
- PangoAttrList *list1, *list2;
- PangoAttribute *attr1, *attr2;
+ Pango2AttrList *list1, *list2;
+ Pango2Attribute *attr1, *attr2;
- list1 = pango_attr_list_new ();
- list2 = pango_attr_list_new ();
+ list1 = pango2_attr_list_new ();
+ list2 = pango2_attr_list_new ();
- attr1 = pango_attr_size_new (10 * PANGO_SCALE);
- attr2 = pango_attr_stretch_new (PANGO_STRETCH_CONDENSED);
+ attr1 = pango2_attr_size_new (10 * PANGO2_SCALE);
+ attr2 = pango2_attr_stretch_new (PANGO2_STRETCH_CONDENSED);
- pango_attr_list_insert (list1, pango_attribute_copy (attr1));
- pango_attr_list_insert (list1, pango_attribute_copy (attr2));
+ pango2_attr_list_insert (list1, pango2_attribute_copy (attr1));
+ pango2_attr_list_insert (list1, pango2_attribute_copy (attr2));
- pango_attr_list_insert (list2, pango_attribute_copy (attr2));
- pango_attr_list_insert (list2, pango_attribute_copy (attr1));
+ pango2_attr_list_insert (list2, pango2_attribute_copy (attr2));
+ pango2_attr_list_insert (list2, pango2_attribute_copy (attr1));
- pango_attribute_destroy (attr1);
- pango_attribute_destroy (attr2);
+ pango2_attribute_destroy (attr1);
+ pango2_attribute_destroy (attr2);
- g_assert_true (pango_attr_list_equal (list1, list2));
- g_assert_true (pango_attr_list_equal (list2, list1));
+ g_assert_true (pango2_attr_list_equal (list1, list2));
+ g_assert_true (pango2_attr_list_equal (list2, list1));
- pango_attr_list_unref (list1);
- pango_attr_list_unref (list2);
+ pango2_attr_list_unref (list1);
+ pango2_attr_list_unref (list2);
}
}
static void
test_insert (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 200 rise 100\n"
+ list = pango2_attr_list_from_string ("0 200 rise 100\n"
"5 15 family \"Times\"\n"
"10 11 size 10240\n"
"11 100 fallback false\n"
"30 60 stretch condensed\n");
attr = attribute_from_string ("10 25 family \"Times\"");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 200 rise 100\n"
"5 25 family \"Times\"\n"
@@ -1092,7 +1092,7 @@ test_insert (void)
"30 60 stretch condensed\n");
attr = attribute_from_string ("11 25 family \"Futura\"");
- pango_attr_list_insert (list, attr);
+ pango2_attr_list_insert (list, attr);
assert_attr_list (list, "0 200 rise 100\n"
"5 25 family \"Times\"\n"
@@ -1101,16 +1101,16 @@ test_insert (void)
"11 25 family \"Futura\"\n"
"30 60 stretch condensed\n");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_insert2 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 200 rise 100\n"
+ list = pango2_attr_list_from_string ("0 200 rise 100\n"
"5 15 family \"Times\"\n"
"10 11 size 10240\n"
"11 100 fallback false\n"
@@ -1119,7 +1119,7 @@ test_insert2 (void)
"30 60 stretch condensed\n");
attr = attribute_from_string ("10 35 family \"Times\"");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 200 rise 100\n"
"5 35 family \"Times\"\n"
@@ -1128,14 +1128,14 @@ test_insert2 (void)
"35 40 family \"Futura\"\n"
"30 60 stretch condensed\n");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static gboolean
-attr_list_merge_filter (PangoAttribute *attribute,
+attr_list_merge_filter (Pango2Attribute *attribute,
gpointer list)
{
- pango_attr_list_change (list, pango_attribute_copy (attribute));
+ pango2_attr_list_change (list, pango2_attribute_copy (attribute));
return FALSE;
}
@@ -1143,20 +1143,20 @@ attr_list_merge_filter (PangoAttribute *attribute,
static void
test_merge (void)
{
- PangoAttrList *list;
- PangoAttrList *list2;
+ Pango2AttrList *list;
+ Pango2AttrList *list2;
- list = pango_attr_list_from_string ("0 200 rise 100\n"
+ list = pango2_attr_list_from_string ("0 200 rise 100\n"
"5 15 family \"Times\"\n"
"10 11 size 10240\n"
"11 100 fallback false\n"
"30 60 stretch condensed\n");
- list2 = pango_attr_list_from_string ("11 13 size 10240\n"
+ list2 = pango2_attr_list_from_string ("11 13 size 10240\n"
"13 15 size 11264\n"
"40 50 size 12288\n");
- pango_attr_list_filter (list2, attr_list_merge_filter, list);
+ pango2_attr_list_filter (list2, attr_list_merge_filter, list);
assert_attr_list (list, "0 200 rise 100\n"
"5 15 family \"Times\"\n"
@@ -1166,8 +1166,8 @@ test_merge (void)
"30 60 stretch condensed\n"
"40 50 size 12288\n");
- pango_attr_list_unref (list);
- pango_attr_list_unref (list2);
+ pango2_attr_list_unref (list);
+ pango2_attr_list_unref (list2);
}
/* reproduce what the links example in gtk4-demo does
@@ -1176,14 +1176,14 @@ test_merge (void)
static void
test_merge2 (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 10 underline 1\n"
+ list = pango2_attr_list_from_string ("0 10 underline 1\n"
"0 10 foreground #00000000ffff\n");
attr = attribute_from_string ("2 3 foreground #ffff00000000");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 10 underline solid\n"
"0 2 foreground #00000000ffff\n"
@@ -1191,7 +1191,7 @@ test_merge2 (void)
"3 10 foreground #00000000ffff");
attr = attribute_from_string ("3 4 foreground #0000ffff0000");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 10 underline solid\n"
"0 2 foreground #00000000ffff\n"
@@ -1200,7 +1200,7 @@ test_merge2 (void)
"4 10 foreground #00000000ffff");
attr = attribute_from_string ("4 5 foreground #00000000ffff");
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 10 underline solid\n"
"0 2 foreground #00000000ffff\n"
@@ -1208,7 +1208,7 @@ test_merge2 (void)
"3 4 foreground #0000ffff0000\n"
"4 10 foreground #00000000ffff");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
/* This only prints rise, size, scale, allow_breaks and line_break,
@@ -1216,30 +1216,30 @@ test_merge2 (void)
* function.
*/
static void
-print_tags_for_attributes (PangoAttrIterator *iter,
+print_tags_for_attributes (Pango2AttrIterator *iter,
GString *s)
{
- PangoAttribute *attr;
+ Pango2Attribute *attr;
- attr = pango_attr_iterator_get (iter, PANGO_ATTR_RISE);
+ attr = pango2_attr_iterator_get (iter, PANGO2_ATTR_RISE);
if (attr)
g_string_append_printf (s, "%d %d rise %d\n",
attr->start_index, attr->end_index,
attr->int_value);
- attr = pango_attr_iterator_get (iter, PANGO_ATTR_SIZE);
+ attr = pango2_attr_iterator_get (iter, PANGO2_ATTR_SIZE);
if (attr)
g_string_append_printf (s, "%d %d size %d\n",
attr->start_index, attr->end_index,
attr->int_value);
- attr = pango_attr_iterator_get (iter, PANGO_ATTR_SCALE);
+ attr = pango2_attr_iterator_get (iter, PANGO2_ATTR_SCALE);
if (attr)
g_string_append_printf (s, "%d %d scale %f\n",
attr->start_index, attr->end_index,
attr->double_value);
- attr = pango_attr_iterator_get (iter, PANGO_ATTR_ALLOW_BREAKS);
+ attr = pango2_attr_iterator_get (iter, PANGO2_ATTR_ALLOW_BREAKS);
if (attr)
g_string_append_printf (s, "%d %d allow_breaks %d\n",
attr->start_index, attr->end_index,
@@ -1250,30 +1250,30 @@ static void
test_iter_epsilon_zero (void)
{
const char *markup = "𝜀<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>";
- PangoAttrList *attributes;
- PangoAttrIterator *attr;
+ Pango2AttrList *attributes;
+ Pango2AttrIterator *attr;
char *text;
GError *error = NULL;
GString *s;
s = g_string_new ("");
- pango_parse_markup (markup, -1, 0, &attributes, &text, NULL, &error);
+ pango2_parse_markup (markup, -1, 0, &attributes, &text, NULL, &error);
g_assert_no_error (error);
g_assert_cmpstr (text, ==, "𝜀0 = 𝜔𝜔𝜔...");
- attr = pango_attr_list_get_iterator (attributes);
+ attr = pango2_attr_list_get_iterator (attributes);
do
{
int start, end;
- pango_attr_iterator_range (attr, &start, &end);
+ pango2_attr_iterator_range (attr, &start, &end);
g_string_append_printf (s, "range: [%d, %d]\n", start, end);
print_tags_for_attributes (attr, s);
}
- while (pango_attr_iterator_next (attr));
+ while (pango2_attr_iterator_next (attr));
g_assert_cmpstr (s->str, ==,
"range: [0, 4]\n"
@@ -1299,8 +1299,8 @@ test_iter_epsilon_zero (void)
"range: [23, 2147483647]\n");
g_free (text);
- pango_attr_list_unref (attributes);
- pango_attr_iterator_destroy (attr);
+ pango2_attr_list_unref (attributes);
+ pango2_attr_iterator_destroy (attr);
g_string_free (s, TRUE);
}
@@ -1308,63 +1308,63 @@ test_iter_epsilon_zero (void)
static void
test_gnumeric_splice (void)
{
- PangoAttrList *list, *list2;
+ Pango2AttrList *list, *list2;
- list = pango_attr_list_from_string ("0 -1 font-desc \"Sans 10\"\n");
- list2 = pango_attr_list_from_string ("1 2 weight bold\n");
+ list = pango2_attr_list_from_string ("0 -1 font-desc \"Sans 10\"\n");
+ list2 = pango2_attr_list_from_string ("1 2 weight bold\n");
- pango_attr_list_splice (list, list2, 0, 0);
+ pango2_attr_list_splice (list, list2, 0, 0);
assert_attr_list (list, "0 4294967295 font-desc \"Sans 10\"\n"
"1 2 weight bold\n");
- pango_attr_list_unref (list);
- pango_attr_list_unref (list2);
+ pango2_attr_list_unref (list);
+ pango2_attr_list_unref (list2);
}
static void
test_change_order (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("1 -1 font-features \"tnum=1\"\n"
+ list = pango2_attr_list_from_string ("1 -1 font-features \"tnum=1\"\n"
"0 20 font-desc \"sans-serif\"\n"
"0 9 size 102400\n");
- attr = pango_attr_font_features_new ("tnum=2");
+ attr = pango2_attr_font_features_new ("tnum=2");
attr->end_index = 9;
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 9 font-features \"tnum=2\"\n"
"0 20 font-desc \"sans-serif\"\n"
"0 9 size 102400\n"
"9 4294967295 font-features \"tnum=1\"\n");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
test_pitivi_crash (void)
{
- PangoAttrList *list;
- PangoAttribute *attr;
+ Pango2AttrList *list;
+ Pango2Attribute *attr;
- list = pango_attr_list_from_string ("0 8 font-features \"tnum=1\"\n"
+ list = pango2_attr_list_from_string ("0 8 font-features \"tnum=1\"\n"
"0 20 font-desc \"sans-serif\"\n"
"0 9 size 102400\n");
- attr = pango_attr_font_features_new ("tnum=2");
+ attr = pango2_attr_font_features_new ("tnum=2");
attr->end_index = 9;
- pango_attr_list_change (list, attr);
+ pango2_attr_list_change (list, attr);
assert_attr_list (list, "0 9 font-features \"tnum=2\"\n"
"0 20 font-desc \"sans-serif\"\n"
"0 9 size 102400\n");
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
int
diff --git a/tests/testboundaries.c b/tests/testboundaries.c
index 7e9a8fc4..1deaa65d 100644
--- a/tests/testboundaries.c
+++ b/tests/testboundaries.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* testboundaries.c: Test text boundary algorithms
*
* Copyright (C) 1999-2000 Red Hat Software
@@ -52,14 +52,14 @@ typedef void (* CharForeachFunc) (gunichar wc,
GUnicodeType type,
GUnicodeType prev_type,
GUnicodeType next_type,
- PangoLogAttr *attr,
- PangoLogAttr *prev_attr,
- PangoLogAttr *next_attr,
+ Pango2LogAttr *attr,
+ Pango2LogAttr *prev_attr,
+ Pango2LogAttr *next_attr,
gpointer data);
static void
log_attr_foreach (const char *text,
- PangoLogAttr *attrs,
+ Pango2LogAttr *attrs,
CharForeachFunc func,
gpointer data)
{
@@ -136,9 +136,9 @@ check_line_char (gunichar wc,
GUnicodeType type,
GUnicodeType prev_type,
GUnicodeType next_type,
- PangoLogAttr *attr,
- PangoLogAttr *prev_attr,
- PangoLogAttr *next_attr,
+ Pango2LogAttr *attr,
+ Pango2LogAttr *prev_attr,
+ Pango2LogAttr *next_attr,
gpointer data)
{
GUnicodeBreakType break_type;
@@ -212,14 +212,14 @@ check_line_char (gunichar wc,
static void
check_line_invariants (const char *text,
- PangoLogAttr *attrs)
+ Pango2LogAttr *attrs)
{
log_attr_foreach (text, attrs, check_line_char, NULL);
}
static void
check_word_invariants (const char *text,
- PangoLogAttr *attrs)
+ Pango2LogAttr *attrs)
{
@@ -227,7 +227,7 @@ check_word_invariants (const char *text,
static void
check_sentence_invariants (const char *text,
- PangoLogAttr *attrs)
+ Pango2LogAttr *attrs)
{
@@ -235,7 +235,7 @@ check_sentence_invariants (const char *text,
static void
check_grapheme_invariants (const char *text,
- PangoLogAttr *attrs)
+ Pango2LogAttr *attrs)
{
@@ -243,10 +243,10 @@ check_grapheme_invariants (const char *text,
#if 0
static void print_sentences (const char *text,
- PangoLogAttr *attrs);
+ Pango2LogAttr *attrs);
static void
print_sentences (const char *text,
- PangoLogAttr *attrs)
+ Pango2LogAttr *attrs)
{
const char *p;
const char *last;
@@ -275,14 +275,14 @@ static void
check_invariants (const char *text)
{
int len;
- PangoLogAttr *attrs;
+ Pango2LogAttr *attrs;
g_assert_true (g_utf8_validate (text, -1, NULL));
len = g_utf8_strlen (text, -1);
- attrs = g_new0 (PangoLogAttr, len + 1);
+ attrs = g_new0 (Pango2LogAttr, len + 1);
- pango_get_log_attrs (text, -1, NULL, 0, pango_language_from_string ("C"), attrs, len + 1);
+ pango2_get_log_attrs (text, -1, NULL, 0, pango2_language_from_string ("C"), attrs, len + 1);
check_line_invariants (text, attrs);
check_sentence_invariants (text, attrs);
diff --git a/tests/testboundaries_ucd.c b/tests/testboundaries_ucd.c
index 58681776..64fa66ff 100644
--- a/tests/testboundaries_ucd.c
+++ b/tests/testboundaries_ucd.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* testboundaries_ucd.c: Test text boundary algorithms with test data from
* Unicode Character Database.
*
@@ -27,10 +27,10 @@
static gboolean failed = FALSE;
-/* PangoLogAttr has to be the same size as guint or this hack breaks */
+/* Pango2LogAttr has to be the same size as guint or this hack breaks */
typedef union
{
- PangoLogAttr attr;
+ Pango2LogAttr attr;
guint bits;
}
AttrBits;
@@ -72,7 +72,7 @@ static gboolean
parse_line (char *line,
AttrBits bits,
char **str_return,
- PangoLogAttr **attr_return,
+ Pango2LogAttr **attr_return,
int *num_attrs)
{
GString *gs;
@@ -82,7 +82,7 @@ parse_line (char *line,
AttrBits temp_attr;
*num_attrs = count_attrs (line);
- *attr_return = g_new (PangoLogAttr, *num_attrs);
+ *attr_return = g_new (Pango2LogAttr, *num_attrs);
p = line;
i = 0;
@@ -152,8 +152,8 @@ parse_line (char *line,
}
static gboolean
-attrs_equal (PangoLogAttr *attrs1,
- PangoLogAttr *attrs2,
+attrs_equal (Pango2LogAttr *attrs1,
+ Pango2LogAttr *attrs2,
int len,
AttrBits bits)
{
@@ -181,7 +181,7 @@ attrs_equal (PangoLogAttr *attrs1,
static char *
make_test_string (char *string,
- PangoLogAttr *attrs,
+ Pango2LogAttr *attrs,
AttrBits bits)
{
GString *gs = g_string_new (NULL);
@@ -224,7 +224,7 @@ do_test (const char *filename,
gsize length, terminator_pos;
GError *error;
char *string;
- PangoLogAttr *expected_attrs;
+ Pango2LogAttr *expected_attrs;
int num_attrs;
int i;
@@ -273,8 +273,8 @@ do_test (const char *filename,
if (num_attrs > 0)
{
- PangoLogAttr *attrs = g_new0 (PangoLogAttr, num_attrs);
- pango_get_log_attrs (string, -1, NULL, 0, pango_language_from_string ("C"), attrs, num_attrs);
+ Pango2LogAttr *attrs = g_new0 (Pango2LogAttr, num_attrs);
+ pango2_get_log_attrs (string, -1, NULL, 0, pango2_language_from_string ("C"), attrs, num_attrs);
if (! attrs_equal (attrs, expected_attrs, num_attrs, bits))
{
diff --git a/tests/testcolor.c b/tests/testcolor.c
index 7877a6c0..125d1023 100644
--- a/tests/testcolor.c
+++ b/tests/testcolor.c
@@ -1,5 +1,5 @@
-/* Pango
- * test-color.c: Test program for pango_color_parse()
+/* Pango2
+ * test-color.c: Test program for pango2_color_parse()
*
* Copyright (C) 2002 Matthias Clasen
*
@@ -34,10 +34,10 @@ typedef struct _ColorSpec {
static void
test_one_color (ColorSpec *spec)
{
- PangoColor color;
+ Pango2Color color;
gboolean accepted;
- accepted = pango_color_parse (&color, spec->spec);
+ accepted = pango2_color_parse (&color, spec->spec);
if (!spec->valid)
{
@@ -98,26 +98,26 @@ test_color (void)
static void
test_color_copy (void)
{
- PangoColor orig = { 0, 200, 5000, 666 };
- PangoColor *copy;
+ Pango2Color orig = { 0, 200, 5000, 666 };
+ Pango2Color *copy;
- copy = pango_color_copy (&orig);
+ copy = pango2_color_copy (&orig);
g_assert_cmpint (orig.red, ==, copy->red);
g_assert_cmpint (orig.green, ==, copy->green);
g_assert_cmpint (orig.blue, ==, copy->blue);
g_assert_cmpint (orig.alpha, ==, copy->alpha);
- pango_color_free (copy);
+ pango2_color_free (copy);
}
static void
test_color_serialize (void)
{
- PangoColor orig = { 0, 200, 5000, 666 };
+ Pango2Color orig = { 0, 200, 5000, 666 };
char *string;
- string = pango_color_to_string (&orig);
+ string = pango2_color_to_string (&orig);
g_assert_cmpstr (string, ==, "#000000c81388029a");
diff --git a/tests/testcontext.c b/tests/testcontext.c
index 9c9dcaef..59517e57 100644
--- a/tests/testcontext.c
+++ b/tests/testcontext.c
@@ -1,5 +1,5 @@
-/* Pango
- * testcontext.c: Test program for PangoContext
+/* Pango2
+ * testcontext.c: Test program for Pango2Context
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -25,15 +25,15 @@
static void
test_set_language (void)
{
- PangoContext *context;
+ Pango2Context *context;
- context = pango_context_new ();
+ context = pango2_context_new ();
- pango_context_set_language (context, pango_language_from_string ("de-de"));
- g_assert_true (pango_context_get_language (context) == pango_language_from_string ("de-de"));
+ pango2_context_set_language (context, pango2_language_from_string ("de-de"));
+ g_assert_true (pango2_context_get_language (context) == pango2_language_from_string ("de-de"));
- pango_context_set_language (context, NULL);
- g_assert_null (pango_context_get_language (context));
+ pango2_context_set_language (context, NULL);
+ g_assert_null (pango2_context_get_language (context));
g_object_unref (context);
}
@@ -41,15 +41,15 @@ test_set_language (void)
static void
test_set_base_dir (void)
{
- PangoContext *context;
+ Pango2Context *context;
- context = pango_context_new ();
+ context = pango2_context_new ();
- pango_context_set_base_dir (context, PANGO_DIRECTION_RTL);
- g_assert_true (pango_context_get_base_dir (context) == PANGO_DIRECTION_RTL);
+ pango2_context_set_base_dir (context, PANGO2_DIRECTION_RTL);
+ g_assert_true (pango2_context_get_base_dir (context) == PANGO2_DIRECTION_RTL);
- pango_context_set_base_dir (context, PANGO_DIRECTION_WEAK_LTR);
- g_assert_true (pango_context_get_base_dir (context) == PANGO_DIRECTION_WEAK_LTR);
+ pango2_context_set_base_dir (context, PANGO2_DIRECTION_WEAK_LTR);
+ g_assert_true (pango2_context_get_base_dir (context) == PANGO2_DIRECTION_WEAK_LTR);
g_object_unref (context);
}
@@ -57,17 +57,17 @@ test_set_base_dir (void)
static void
test_set_base_gravity (void)
{
- PangoContext *context;
+ Pango2Context *context;
- context = pango_context_new ();
+ context = pango2_context_new ();
- pango_context_set_base_gravity (context, PANGO_GRAVITY_SOUTH);
- g_assert_true (pango_context_get_base_gravity (context) == PANGO_GRAVITY_SOUTH);
- g_assert_true (pango_context_get_gravity (context) == PANGO_GRAVITY_SOUTH);
+ pango2_context_set_base_gravity (context, PANGO2_GRAVITY_SOUTH);
+ g_assert_true (pango2_context_get_base_gravity (context) == PANGO2_GRAVITY_SOUTH);
+ g_assert_true (pango2_context_get_gravity (context) == PANGO2_GRAVITY_SOUTH);
- pango_context_set_base_gravity (context, PANGO_GRAVITY_AUTO);
- g_assert_true (pango_context_get_base_gravity (context) == PANGO_GRAVITY_AUTO);
- g_assert_true (pango_context_get_gravity (context) == PANGO_GRAVITY_SOUTH);
+ pango2_context_set_base_gravity (context, PANGO2_GRAVITY_AUTO);
+ g_assert_true (pango2_context_get_base_gravity (context) == PANGO2_GRAVITY_AUTO);
+ g_assert_true (pango2_context_get_gravity (context) == PANGO2_GRAVITY_SOUTH);
g_object_unref (context);
}
@@ -75,15 +75,15 @@ test_set_base_gravity (void)
static void
test_set_gravity_hint (void)
{
- PangoContext *context;
+ Pango2Context *context;
- context = pango_context_new ();
+ context = pango2_context_new ();
- pango_context_set_gravity_hint (context, PANGO_GRAVITY_HINT_NATURAL);
- g_assert_true (pango_context_get_gravity_hint (context) == PANGO_GRAVITY_HINT_NATURAL);
+ pango2_context_set_gravity_hint (context, PANGO2_GRAVITY_HINT_NATURAL);
+ g_assert_true (pango2_context_get_gravity_hint (context) == PANGO2_GRAVITY_HINT_NATURAL);
- pango_context_set_gravity_hint (context, PANGO_GRAVITY_HINT_STRONG);
- g_assert_true (pango_context_get_gravity_hint (context) == PANGO_GRAVITY_HINT_STRONG);
+ pango2_context_set_gravity_hint (context, PANGO2_GRAVITY_HINT_STRONG);
+ g_assert_true (pango2_context_get_gravity_hint (context) == PANGO2_GRAVITY_HINT_STRONG);
g_object_unref (context);
}
@@ -91,15 +91,15 @@ test_set_gravity_hint (void)
static void
test_set_round_glyph_positions (void)
{
- PangoContext *context;
+ Pango2Context *context;
- context = pango_context_new ();
+ context = pango2_context_new ();
- pango_context_set_round_glyph_positions (context, TRUE);
- g_assert_true (pango_context_get_round_glyph_positions (context));
+ pango2_context_set_round_glyph_positions (context, TRUE);
+ g_assert_true (pango2_context_get_round_glyph_positions (context));
- pango_context_set_round_glyph_positions (context, FALSE);
- g_assert_false (pango_context_get_round_glyph_positions (context));
+ pango2_context_set_round_glyph_positions (context, FALSE);
+ g_assert_false (pango2_context_get_round_glyph_positions (context));
g_object_unref (context);
}
diff --git a/tests/testhbfont.c b/tests/testhbfont.c
index 35f86234..9f6e76ce 100644
--- a/tests/testhbfont.c
+++ b/tests/testhbfont.c
@@ -1,5 +1,5 @@
-/* Pango
- * testhbfont.c: Test program for PangoHbFont etc
+/* Pango2
+ * testhbfont.c: Test program for Pango2HbFont etc
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -28,33 +28,33 @@
/* Verify that the variable and monospace properties work as expected
- * for PangoHbFamily
+ * for Pango2HbFamily
*/
static void
test_hbfont_monospace (void)
{
- PangoFontMap *map;
- PangoFontFamily *family;
+ Pango2FontMap *map;
+ Pango2FontFamily *family;
char *path;
- map = pango_font_map_new ();
+ map = pango2_font_map_new ();
path = g_test_build_filename (G_TEST_DIST, "fonts", "Cantarell-VF.otf", NULL);
- pango_font_map_add_file (map, path);
+ pango2_font_map_add_file (map, path);
- family = pango_font_map_get_family (PANGO_FONT_MAP (map), "Cantarell");
+ family = pango2_font_map_get_family (PANGO2_FONT_MAP (map), "Cantarell");
g_assert_nonnull (family);
- pango_font_map_add_face (map, PANGO_FONT_FACE (pango_hb_face_new_from_file (path, 0, -2, NULL, NULL)));
+ pango2_font_map_add_face (map, PANGO2_FONT_FACE (pango2_hb_face_new_from_file (path, 0, -2, NULL, NULL)));
g_free (path);
path = g_test_build_filename (G_TEST_DIST, "fonts", "DejaVuSansMono.ttf", NULL);
- pango_font_map_add_file (map, path);
+ pango2_font_map_add_file (map, path);
g_free (path);
- family = pango_font_map_get_family (PANGO_FONT_MAP (map), "DejaVu Sans Mono");
+ family = pango2_font_map_get_family (PANGO2_FONT_MAP (map), "DejaVu Sans Mono");
g_assert_nonnull (family);
@@ -62,190 +62,190 @@ test_hbfont_monospace (void)
}
/* Verify that a description -> face -> description roundtrip works for
- * PangoHbFaces created with pango_hb_face_new_synthetic or pango_hb_face_new_instance
+ * Pango2HbFaces created with pango2_hb_face_new_synthetic or pango2_hb_face_new_instance
*/
static void
test_hbface_roundtrip (void)
{
char *path;
- PangoHbFace *face;
- PangoHbFace *face2;
- PangoFontDescription *desc;
- const int NO_FACEID = ~PANGO_FONT_MASK_FACEID;
+ Pango2HbFace *face;
+ Pango2HbFace *face2;
+ Pango2FontDescription *desc;
+ const int NO_FACEID = ~PANGO2_FONT_MASK_FACEID;
hb_variation_t v;
path = g_test_build_filename (G_TEST_DIST, "fonts", "Cantarell-VF.otf", NULL);
- face = pango_hb_face_new_from_file (path, 0, -1, NULL, NULL);
- g_assert_true (PANGO_IS_HB_FACE (face));
- g_assert_cmpstr (pango_font_face_get_name (PANGO_FONT_FACE (face)), ==, "Regular");
- desc = pango_font_face_describe (PANGO_FONT_FACE (face));
- g_assert_cmpint (pango_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO_FONT_MASK_FAMILY |
- PANGO_FONT_MASK_STYLE |
- PANGO_FONT_MASK_VARIANT |
- PANGO_FONT_MASK_WEIGHT |
- PANGO_FONT_MASK_STRETCH);
- g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarell");
- g_assert_cmpint (pango_font_description_get_style (desc), ==, PANGO_STYLE_NORMAL);
- g_assert_cmpint (pango_font_description_get_weight (desc), ==, PANGO_WEIGHT_NORMAL);
- g_assert_cmpint (pango_font_description_get_stretch (desc), ==, PANGO_STRETCH_NORMAL);
- pango_font_description_free (desc);
-
- desc = pango_font_description_new ();
- pango_font_description_set_style (desc, PANGO_STYLE_OBLIQUE);
- face2 = pango_hb_face_new_synthetic (face, &(PangoMatrix){ 1, 0.2, 0, 1, 0, 0 }, FALSE, NULL, desc);
- pango_font_description_free (desc);
-
- g_assert_true (PANGO_IS_HB_FACE (face2));
- g_assert_cmpstr (pango_font_face_get_name (PANGO_FONT_FACE (face2)), ==, "Oblique");
- desc = pango_font_face_describe (PANGO_FONT_FACE (face2));
- g_assert_cmpint (pango_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO_FONT_MASK_FAMILY |
- PANGO_FONT_MASK_STYLE |
- PANGO_FONT_MASK_VARIANT |
- PANGO_FONT_MASK_WEIGHT |
- PANGO_FONT_MASK_STRETCH);
- g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarell");
- g_assert_cmpint (pango_font_description_get_style (desc), ==, PANGO_STYLE_OBLIQUE);
- g_assert_cmpint (pango_font_description_get_weight (desc), ==, PANGO_WEIGHT_NORMAL);
- g_assert_cmpint (pango_font_description_get_stretch (desc), ==, PANGO_STRETCH_NORMAL);
- pango_font_description_free (desc);
+ face = pango2_hb_face_new_from_file (path, 0, -1, NULL, NULL);
+ g_assert_true (PANGO2_IS_HB_FACE (face));
+ g_assert_cmpstr (pango2_font_face_get_name (PANGO2_FONT_FACE (face)), ==, "Regular");
+ desc = pango2_font_face_describe (PANGO2_FONT_FACE (face));
+ g_assert_cmpint (pango2_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO2_FONT_MASK_FAMILY |
+ PANGO2_FONT_MASK_STYLE |
+ PANGO2_FONT_MASK_VARIANT |
+ PANGO2_FONT_MASK_WEIGHT |
+ PANGO2_FONT_MASK_STRETCH);
+ g_assert_cmpstr (pango2_font_description_get_family (desc), ==, "Cantarell");
+ g_assert_cmpint (pango2_font_description_get_style (desc), ==, PANGO2_STYLE_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_weight (desc), ==, PANGO2_WEIGHT_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_stretch (desc), ==, PANGO2_STRETCH_NORMAL);
+ pango2_font_description_free (desc);
+
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_style (desc, PANGO2_STYLE_OBLIQUE);
+ face2 = pango2_hb_face_new_synthetic (face, &(Pango2Matrix){ 1, 0.2, 0, 1, 0, 0 }, FALSE, NULL, desc);
+ pango2_font_description_free (desc);
+
+ g_assert_true (PANGO2_IS_HB_FACE (face2));
+ g_assert_cmpstr (pango2_font_face_get_name (PANGO2_FONT_FACE (face2)), ==, "Oblique");
+ desc = pango2_font_face_describe (PANGO2_FONT_FACE (face2));
+ g_assert_cmpint (pango2_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO2_FONT_MASK_FAMILY |
+ PANGO2_FONT_MASK_STYLE |
+ PANGO2_FONT_MASK_VARIANT |
+ PANGO2_FONT_MASK_WEIGHT |
+ PANGO2_FONT_MASK_STRETCH);
+ g_assert_cmpstr (pango2_font_description_get_family (desc), ==, "Cantarell");
+ g_assert_cmpint (pango2_font_description_get_style (desc), ==, PANGO2_STYLE_OBLIQUE);
+ g_assert_cmpint (pango2_font_description_get_weight (desc), ==, PANGO2_WEIGHT_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_stretch (desc), ==, PANGO2_STRETCH_NORMAL);
+ pango2_font_description_free (desc);
g_object_unref (face2);
- desc = pango_font_description_new ();
- pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
- face2 = pango_hb_face_new_synthetic (face, NULL, TRUE, NULL, desc);
- pango_font_description_free (desc);
-
- g_assert_true (PANGO_IS_HB_FACE (face2));
- g_assert_cmpstr (pango_font_face_get_name (PANGO_FONT_FACE (face2)), ==, "Bold");
- desc = pango_font_face_describe (PANGO_FONT_FACE (face2));
- g_assert_cmpint (pango_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO_FONT_MASK_FAMILY |
- PANGO_FONT_MASK_STYLE |
- PANGO_FONT_MASK_VARIANT |
- PANGO_FONT_MASK_WEIGHT |
- PANGO_FONT_MASK_STRETCH);
- g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarell");
- g_assert_cmpint (pango_font_description_get_style (desc), ==, PANGO_STYLE_NORMAL);
- g_assert_cmpint (pango_font_description_get_weight (desc), ==, PANGO_WEIGHT_BOLD);
- g_assert_cmpint (pango_font_description_get_stretch (desc), ==, PANGO_STRETCH_NORMAL);
- pango_font_description_free (desc);
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_weight (desc, PANGO2_WEIGHT_BOLD);
+ face2 = pango2_hb_face_new_synthetic (face, NULL, TRUE, NULL, desc);
+ pango2_font_description_free (desc);
+
+ g_assert_true (PANGO2_IS_HB_FACE (face2));
+ g_assert_cmpstr (pango2_font_face_get_name (PANGO2_FONT_FACE (face2)), ==, "Bold");
+ desc = pango2_font_face_describe (PANGO2_FONT_FACE (face2));
+ g_assert_cmpint (pango2_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO2_FONT_MASK_FAMILY |
+ PANGO2_FONT_MASK_STYLE |
+ PANGO2_FONT_MASK_VARIANT |
+ PANGO2_FONT_MASK_WEIGHT |
+ PANGO2_FONT_MASK_STRETCH);
+ g_assert_cmpstr (pango2_font_description_get_family (desc), ==, "Cantarell");
+ g_assert_cmpint (pango2_font_description_get_style (desc), ==, PANGO2_STYLE_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_weight (desc), ==, PANGO2_WEIGHT_BOLD);
+ g_assert_cmpint (pango2_font_description_get_stretch (desc), ==, PANGO2_STRETCH_NORMAL);
+ pango2_font_description_free (desc);
g_object_unref (face2);
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, "Cantarellagain");
- face2 = pango_hb_face_new_synthetic (face, NULL, FALSE, NULL, desc);
- pango_font_description_free (desc);
-
- g_assert_true (PANGO_IS_HB_FACE (face2));
- g_assert_cmpstr (pango_font_face_get_name (PANGO_FONT_FACE (face2)), ==, "Regular");
- desc = pango_font_face_describe (PANGO_FONT_FACE (face2));
- g_assert_cmpint (pango_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO_FONT_MASK_FAMILY |
- PANGO_FONT_MASK_STYLE |
- PANGO_FONT_MASK_VARIANT |
- PANGO_FONT_MASK_WEIGHT |
- PANGO_FONT_MASK_STRETCH);
- g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarellagain");
- g_assert_cmpint (pango_font_description_get_style (desc), ==, PANGO_STYLE_NORMAL);
- g_assert_cmpint (pango_font_description_get_weight (desc), ==, PANGO_WEIGHT_NORMAL);
- g_assert_cmpint (pango_font_description_get_stretch (desc), ==, PANGO_STRETCH_NORMAL);
- pango_font_description_free (desc);
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, "Cantarellagain");
+ face2 = pango2_hb_face_new_synthetic (face, NULL, FALSE, NULL, desc);
+ pango2_font_description_free (desc);
+
+ g_assert_true (PANGO2_IS_HB_FACE (face2));
+ g_assert_cmpstr (pango2_font_face_get_name (PANGO2_FONT_FACE (face2)), ==, "Regular");
+ desc = pango2_font_face_describe (PANGO2_FONT_FACE (face2));
+ g_assert_cmpint (pango2_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO2_FONT_MASK_FAMILY |
+ PANGO2_FONT_MASK_STYLE |
+ PANGO2_FONT_MASK_VARIANT |
+ PANGO2_FONT_MASK_WEIGHT |
+ PANGO2_FONT_MASK_STRETCH);
+ g_assert_cmpstr (pango2_font_description_get_family (desc), ==, "Cantarellagain");
+ g_assert_cmpint (pango2_font_description_get_style (desc), ==, PANGO2_STYLE_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_weight (desc), ==, PANGO2_WEIGHT_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_stretch (desc), ==, PANGO2_STRETCH_NORMAL);
+ pango2_font_description_free (desc);
g_object_unref (face2);
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, "Cat");
- pango_font_description_set_weight (desc, PANGO_WEIGHT_ULTRABOLD);
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, "Cat");
+ pango2_font_description_set_weight (desc, PANGO2_WEIGHT_ULTRABOLD);
v.tag = HB_OT_TAG_VAR_AXIS_WEIGHT;
v.value = 768.;
- face2 = pango_hb_face_new_instance (face, &v, 1, "Fat", desc);
- pango_font_description_free (desc);
-
- g_assert_true (PANGO_IS_HB_FACE (face2));
- g_assert_cmpstr (pango_font_face_get_name (PANGO_FONT_FACE (face2)), ==, "Fat");
- desc = pango_font_face_describe (PANGO_FONT_FACE (face2));
- g_assert_cmpint (pango_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO_FONT_MASK_FAMILY |
- PANGO_FONT_MASK_STYLE |
- PANGO_FONT_MASK_WEIGHT |
- PANGO_FONT_MASK_VARIANT |
- PANGO_FONT_MASK_VARIATIONS |
- PANGO_FONT_MASK_STRETCH);
- g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cat");
- g_assert_cmpint (pango_font_description_get_style (desc), ==, PANGO_STYLE_NORMAL);
- g_assert_cmpint (pango_font_description_get_weight (desc), ==, PANGO_WEIGHT_ULTRABOLD);
- g_assert_cmpint (pango_font_description_get_stretch (desc), ==, PANGO_STRETCH_NORMAL);
- g_assert_cmpstr (pango_font_description_get_variations (desc), ==, "wght=768");
- pango_font_description_free (desc);
+ face2 = pango2_hb_face_new_instance (face, &v, 1, "Fat", desc);
+ pango2_font_description_free (desc);
+
+ g_assert_true (PANGO2_IS_HB_FACE (face2));
+ g_assert_cmpstr (pango2_font_face_get_name (PANGO2_FONT_FACE (face2)), ==, "Fat");
+ desc = pango2_font_face_describe (PANGO2_FONT_FACE (face2));
+ g_assert_cmpint (pango2_font_description_get_set_fields (desc) & NO_FACEID, ==, PANGO2_FONT_MASK_FAMILY |
+ PANGO2_FONT_MASK_STYLE |
+ PANGO2_FONT_MASK_WEIGHT |
+ PANGO2_FONT_MASK_VARIANT |
+ PANGO2_FONT_MASK_VARIATIONS |
+ PANGO2_FONT_MASK_STRETCH);
+ g_assert_cmpstr (pango2_font_description_get_family (desc), ==, "Cat");
+ g_assert_cmpint (pango2_font_description_get_style (desc), ==, PANGO2_STYLE_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_weight (desc), ==, PANGO2_WEIGHT_ULTRABOLD);
+ g_assert_cmpint (pango2_font_description_get_stretch (desc), ==, PANGO2_STRETCH_NORMAL);
+ g_assert_cmpstr (pango2_font_description_get_variations (desc), ==, "wght=768");
+ pango2_font_description_free (desc);
g_object_unref (face2);
g_object_unref (face);
g_free (path);
}
-/* Verify that face -> font -> description works as expected for PangoHbFont */
+/* Verify that face -> font -> description works as expected for Pango2HbFont */
static void
test_hbfont_roundtrip (void)
{
char *path;
- PangoHbFace *face;
- PangoHbFont *font;
- PangoFontDescription *desc;
+ Pango2HbFace *face;
+ Pango2HbFont *font;
+ Pango2FontDescription *desc;
unsigned int n_features;
path = g_test_build_filename (G_TEST_DIST, "fonts", "Cantarell-VF.otf", NULL);
- face = pango_hb_face_new_from_file (path, 0, -1, NULL, NULL);
- g_assert_true (PANGO_IS_HB_FACE (face));
+ face = pango2_hb_face_new_from_file (path, 0, -1, NULL, NULL);
+ g_assert_true (PANGO2_IS_HB_FACE (face));
- font = pango_hb_font_new (face, 11 * PANGO_SCALE, NULL, 0, NULL, 0, PANGO_GRAVITY_AUTO, 96., NULL);
- g_assert_true (PANGO_IS_HB_FONT (font));
- g_assert_true (pango_font_get_face (PANGO_FONT (font)) == PANGO_FONT_FACE (face));
- pango_hb_font_get_features (PANGO_HB_FONT (font), &n_features);
+ font = pango2_hb_font_new (face, 11 * PANGO2_SCALE, NULL, 0, NULL, 0, PANGO2_GRAVITY_AUTO, 96., NULL);
+ g_assert_true (PANGO2_IS_HB_FONT (font));
+ g_assert_true (pango2_font_get_face (PANGO2_FONT (font)) == PANGO2_FONT_FACE (face));
+ pango2_hb_font_get_features (PANGO2_HB_FONT (font), &n_features);
g_assert_cmpint (n_features, ==, 0);
- desc = pango_font_describe (PANGO_FONT (font));
- g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarell");
- g_assert_cmpint (pango_font_description_get_style (desc), ==, PANGO_STYLE_NORMAL);
- g_assert_cmpint (pango_font_description_get_weight (desc), ==, PANGO_WEIGHT_NORMAL);
- g_assert_cmpint (pango_font_description_get_stretch (desc), ==, PANGO_STRETCH_NORMAL);
- g_assert_cmpint (pango_font_description_get_size (desc), ==, 11 * PANGO_SCALE);
- pango_font_description_free (desc);
+ desc = pango2_font_describe (PANGO2_FONT (font));
+ g_assert_cmpstr (pango2_font_description_get_family (desc), ==, "Cantarell");
+ g_assert_cmpint (pango2_font_description_get_style (desc), ==, PANGO2_STYLE_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_weight (desc), ==, PANGO2_WEIGHT_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_stretch (desc), ==, PANGO2_STRETCH_NORMAL);
+ g_assert_cmpint (pango2_font_description_get_size (desc), ==, 11 * PANGO2_SCALE);
+ pango2_font_description_free (desc);
g_object_unref (font);
g_object_unref (face);
g_free (path);
}
-/* Verify that pango_font_describe and pango_font_describe_with_absolute_size
- * work as expected with PangoHbFont
+/* Verify that pango2_font_describe and pango2_font_describe_with_absolute_size
+ * work as expected with Pango2HbFont
*/
static void
test_hbfont_describe (void)
{
char *path;
- PangoHbFace *face;
- PangoHbFont *font;
- PangoFontDescription *desc;
+ Pango2HbFace *face;
+ Pango2HbFont *font;
+ Pango2FontDescription *desc;
path = g_test_build_filename (G_TEST_DIST, "fonts", "Cantarell-VF.otf", NULL);
- face = pango_hb_face_new_from_file (path, 0, -1, NULL, NULL);
- g_assert_true (PANGO_IS_HB_FACE (face));
+ face = pango2_hb_face_new_from_file (path, 0, -1, NULL, NULL);
+ g_assert_true (PANGO2_IS_HB_FACE (face));
- font = pango_hb_font_new (face, 11 * PANGO_SCALE, NULL, 0, NULL, 0, PANGO_GRAVITY_AUTO, 96., NULL);
- g_assert_true (PANGO_IS_HB_FONT (font));
+ font = pango2_hb_font_new (face, 11 * PANGO2_SCALE, NULL, 0, NULL, 0, PANGO2_GRAVITY_AUTO, 96., NULL);
+ g_assert_true (PANGO2_IS_HB_FONT (font));
- desc = pango_font_describe (PANGO_FONT (font));
- g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarell");
- g_assert_cmpint (pango_font_description_get_size (desc), ==, 11 * PANGO_SCALE);
- g_assert_true (!pango_font_description_get_size_is_absolute (desc));
- pango_font_description_free (desc);
+ desc = pango2_font_describe (PANGO2_FONT (font));
+ g_assert_cmpstr (pango2_font_description_get_family (desc), ==, "Cantarell");
+ g_assert_cmpint (pango2_font_description_get_size (desc), ==, 11 * PANGO2_SCALE);
+ g_assert_true (!pango2_font_description_get_size_is_absolute (desc));
+ pango2_font_description_free (desc);
- desc = pango_font_describe_with_absolute_size (PANGO_FONT (font));
- g_assert_cmpstr (pango_font_description_get_family (desc), ==, "Cantarell");
- g_assert_cmpint (pango_font_description_get_size (desc), ==, 11 * PANGO_SCALE * 96./72.);
- g_assert_true (pango_font_description_get_size_is_absolute (desc));
- pango_font_description_free (desc);
+ desc = pango2_font_describe_with_absolute_size (PANGO2_FONT (font));
+ g_assert_cmpstr (pango2_font_description_get_family (desc), ==, "Cantarell");
+ g_assert_cmpint (pango2_font_description_get_size (desc), ==, 11 * PANGO2_SCALE * 96./72.);
+ g_assert_true (pango2_font_description_get_size_is_absolute (desc));
+ pango2_font_description_free (desc);
g_object_unref (font);
g_object_unref (face);
@@ -257,65 +257,65 @@ static void
test_hbfont_describe_variation (void)
{
char *path;
- PangoHbFace *face, *face2;
- PangoHbFont *font;
- PangoFontDescription *desc;
+ Pango2HbFace *face, *face2;
+ Pango2HbFont *font;
+ Pango2FontDescription *desc;
hb_variation_t v;
path = g_test_build_filename (G_TEST_DIST, "fonts", "Cantarell-VF.otf", NULL);
- face = pango_hb_face_new_from_file (path, 0, -1, NULL, NULL);
- g_assert_true (PANGO_IS_HB_FACE (face));
+ face = pango2_hb_face_new_from_file (path, 0, -1, NULL, NULL);
+ g_assert_true (PANGO2_IS_HB_FACE (face));
- font = pango_hb_font_new (face, 11 * PANGO_SCALE, NULL, 0, NULL, 0, PANGO_GRAVITY_AUTO, 96., NULL);
- g_assert_true (PANGO_IS_HB_FONT (font));
+ font = pango2_hb_font_new (face, 11 * PANGO2_SCALE, NULL, 0, NULL, 0, PANGO2_GRAVITY_AUTO, 96., NULL);
+ g_assert_true (PANGO2_IS_HB_FONT (font));
- desc = pango_font_describe (PANGO_FONT (font));
- g_assert_true ((pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_VARIATIONS) == 0);
- pango_font_description_free (desc);
+ desc = pango2_font_describe (PANGO2_FONT (font));
+ g_assert_true ((pango2_font_description_get_set_fields (desc) & PANGO2_FONT_MASK_VARIATIONS) == 0);
+ pango2_font_description_free (desc);
g_object_unref (font);
v.tag = HB_OT_TAG_VAR_AXIS_WEIGHT;
v.value = 768.;
- font = pango_hb_font_new (face, 11 * PANGO_SCALE, NULL, 0, &v, 1, PANGO_GRAVITY_AUTO, 96., NULL);
+ font = pango2_hb_font_new (face, 11 * PANGO2_SCALE, NULL, 0, &v, 1, PANGO2_GRAVITY_AUTO, 96., NULL);
- desc = pango_font_describe (PANGO_FONT (font));
- g_assert_true ((pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_VARIATIONS) != 0);
- g_assert_cmpstr (pango_font_description_get_variations (desc), ==, "wght=768");
- pango_font_description_free (desc);
+ desc = pango2_font_describe (PANGO2_FONT (font));
+ g_assert_true ((pango2_font_description_get_set_fields (desc) & PANGO2_FONT_MASK_VARIATIONS) != 0);
+ g_assert_cmpstr (pango2_font_description_get_variations (desc), ==, "wght=768");
+ pango2_font_description_free (desc);
g_object_unref (font);
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, "Cantarellagain");
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, "Cantarellagain");
v.tag = HB_OT_TAG_VAR_AXIS_WEIGHT;
v.value = 512.;
- face2 = pango_hb_face_new_instance (face, &v, 1, "Medium", desc);
- g_assert_true (PANGO_IS_HB_FACE (face));
- pango_font_description_free (desc);
-
- desc = pango_font_face_describe (PANGO_FONT_FACE (face2));
- g_assert_true ((pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_VARIATIONS) != 0);
- g_assert_cmpstr (pango_font_description_get_variations (desc), ==, "wght=512");
- pango_font_description_free (desc);
-
- font = pango_hb_font_new (face2, 11 * PANGO_SCALE, NULL, 0, NULL, 0, PANGO_GRAVITY_AUTO, 96., NULL);
- g_assert_true (PANGO_IS_HB_FONT (font));
-
- desc = pango_font_describe (PANGO_FONT (font));
- g_assert_true ((pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_VARIATIONS) != 0);
- g_assert_cmpstr (pango_font_description_get_variations (desc), ==, "wght=512");
- pango_font_description_free (desc);
+ face2 = pango2_hb_face_new_instance (face, &v, 1, "Medium", desc);
+ g_assert_true (PANGO2_IS_HB_FACE (face));
+ pango2_font_description_free (desc);
+
+ desc = pango2_font_face_describe (PANGO2_FONT_FACE (face2));
+ g_assert_true ((pango2_font_description_get_set_fields (desc) & PANGO2_FONT_MASK_VARIATIONS) != 0);
+ g_assert_cmpstr (pango2_font_description_get_variations (desc), ==, "wght=512");
+ pango2_font_description_free (desc);
+
+ font = pango2_hb_font_new (face2, 11 * PANGO2_SCALE, NULL, 0, NULL, 0, PANGO2_GRAVITY_AUTO, 96., NULL);
+ g_assert_true (PANGO2_IS_HB_FONT (font));
+
+ desc = pango2_font_describe (PANGO2_FONT (font));
+ g_assert_true ((pango2_font_description_get_set_fields (desc) & PANGO2_FONT_MASK_VARIATIONS) != 0);
+ g_assert_cmpstr (pango2_font_description_get_variations (desc), ==, "wght=512");
+ pango2_font_description_free (desc);
g_object_unref (font);
v.tag = HB_OT_TAG_VAR_AXIS_WEIGHT;
v.value = 768.;
- font = pango_hb_font_new (face2, 11 * PANGO_SCALE, NULL, 0, &v, 1, PANGO_GRAVITY_AUTO, 96., NULL);
+ font = pango2_hb_font_new (face2, 11 * PANGO2_SCALE, NULL, 0, &v, 1, PANGO2_GRAVITY_AUTO, 96., NULL);
- desc = pango_font_describe (PANGO_FONT (font));
- g_assert_true ((pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_VARIATIONS) != 0);
- g_assert_cmpstr (pango_font_description_get_variations (desc), ==, "wght=768");
- pango_font_description_free (desc);
+ desc = pango2_font_describe (PANGO2_FONT (font));
+ g_assert_true ((pango2_font_description_get_set_fields (desc) & PANGO2_FONT_MASK_VARIATIONS) != 0);
+ g_assert_cmpstr (pango2_font_description_get_variations (desc), ==, "wght=768");
+ pango2_font_description_free (desc);
g_object_unref (font);
g_object_unref (face2);
@@ -330,34 +330,34 @@ static void
test_hbfont_faceid (void)
{
char *path;
- PangoHbFace *face, *face2, *face3;
- PangoFontDescription *desc, *desc2, *desc3;
+ Pango2HbFace *face, *face2, *face3;
+ Pango2FontDescription *desc, *desc2, *desc3;
path = g_test_build_filename (G_TEST_DIST, "fonts", "Cantarell-VF.otf", NULL);
- face = pango_hb_face_new_from_file (path, 0, -1, NULL, NULL);
- face2 = pango_hb_face_new_from_file (path, 0, 2, NULL, NULL);
- desc = pango_font_description_new ();
- pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
- face3 = pango_hb_face_new_synthetic (face, NULL, TRUE, NULL, desc);
- pango_font_description_free (desc);
+ face = pango2_hb_face_new_from_file (path, 0, -1, NULL, NULL);
+ face2 = pango2_hb_face_new_from_file (path, 0, 2, NULL, NULL);
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_weight (desc, PANGO2_WEIGHT_BOLD);
+ face3 = pango2_hb_face_new_synthetic (face, NULL, TRUE, NULL, desc);
+ pango2_font_description_free (desc);
- desc = pango_font_face_describe (PANGO_FONT_FACE (face));
- g_assert_true (pango_font_description_get_set_fields (desc) & PANGO_FONT_MASK_FACEID);
+ desc = pango2_font_face_describe (PANGO2_FONT_FACE (face));
+ g_assert_true (pango2_font_description_get_set_fields (desc) & PANGO2_FONT_MASK_FACEID);
- desc2 = pango_font_face_describe (PANGO_FONT_FACE (face2));
- g_assert_true (pango_font_description_get_set_fields (desc2) & PANGO_FONT_MASK_FACEID);
+ desc2 = pango2_font_face_describe (PANGO2_FONT_FACE (face2));
+ g_assert_true (pango2_font_description_get_set_fields (desc2) & PANGO2_FONT_MASK_FACEID);
- desc3 = pango_font_face_describe (PANGO_FONT_FACE (face3));
- g_assert_true (pango_font_description_get_set_fields (desc3) & PANGO_FONT_MASK_FACEID);
+ desc3 = pango2_font_face_describe (PANGO2_FONT_FACE (face3));
+ g_assert_true (pango2_font_description_get_set_fields (desc3) & PANGO2_FONT_MASK_FACEID);
- g_assert_cmpstr (pango_font_description_get_faceid (desc), !=, pango_font_description_get_faceid (desc2));
- g_assert_cmpstr (pango_font_description_get_faceid (desc), !=, pango_font_description_get_faceid (desc3));
- g_assert_cmpstr (pango_font_description_get_faceid (desc2), !=, pango_font_description_get_faceid (desc3));
+ g_assert_cmpstr (pango2_font_description_get_faceid (desc), !=, pango2_font_description_get_faceid (desc2));
+ g_assert_cmpstr (pango2_font_description_get_faceid (desc), !=, pango2_font_description_get_faceid (desc3));
+ g_assert_cmpstr (pango2_font_description_get_faceid (desc2), !=, pango2_font_description_get_faceid (desc3));
- pango_font_description_free (desc);
- pango_font_description_free (desc2);
- pango_font_description_free (desc3);
+ pango2_font_description_free (desc);
+ pango2_font_description_free (desc2);
+ pango2_font_description_free (desc3);
g_object_unref (face);
g_object_unref (face2);
@@ -370,59 +370,59 @@ test_hbfont_faceid (void)
static void
test_hbfont_load (void)
{
- PangoFontMap *map;
- PangoContext *context;
+ Pango2FontMap *map;
+ Pango2Context *context;
char *path;
- PangoFontDescription *desc;
- PangoHbFace *face_fat, *face_wild;
+ Pango2FontDescription *desc;
+ Pango2HbFace *face_fat, *face_wild;
char *s;
- PangoFont *font;
+ Pango2Font *font;
/* Make a Cat family, with the two faces Fat and Wild */
- map = pango_font_map_new ();
- context = pango_context_new_with_font_map (PANGO_FONT_MAP (map));
+ map = pango2_font_map_new ();
+ context = pango2_context_new_with_font_map (PANGO2_FONT_MAP (map));
path = g_test_build_filename (G_TEST_DIST, "fonts", "Cantarell-VF.otf", NULL);
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, "Cat");
- face_fat = pango_hb_face_new_from_file (path, 0, -1, "Fat", desc);
- pango_font_description_free (desc);
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, "Cat");
+ face_fat = pango2_hb_face_new_from_file (path, 0, -1, "Fat", desc);
+ pango2_font_description_free (desc);
g_free (path);
- pango_font_map_add_face (map, PANGO_FONT_FACE (face_fat));
+ pango2_font_map_add_face (map, PANGO2_FONT_FACE (face_fat));
path = g_test_build_filename (G_TEST_DIST, "fonts", "DejaVuSans.ttf", NULL);
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, "Cat");
- face_wild = pango_hb_face_new_from_file (path, 0, -1, "Wild", desc);
- pango_font_description_free (desc);
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, "Cat");
+ face_wild = pango2_hb_face_new_from_file (path, 0, -1, "Wild", desc);
+ pango2_font_description_free (desc);
- pango_font_map_add_face (map, PANGO_FONT_FACE (face_wild));
+ pango2_font_map_add_face (map, PANGO2_FONT_FACE (face_wild));
- desc = pango_font_face_describe (PANGO_FONT_FACE (face_wild));
- pango_font_description_set_size (desc, 12 * PANGO_SCALE);
+ desc = pango2_font_face_describe (PANGO2_FONT_FACE (face_wild));
+ pango2_font_description_set_size (desc, 12 * PANGO2_SCALE);
- s = pango_font_description_to_string (desc);
+ s = pango2_font_description_to_string (desc);
g_assert_cmpstr (s, ==, "Cat 12 @faceid=hb:DejaVuSans:0:-1:0:1:1:0");
g_free (s);
/* loading with faceid set works as expected */
- font = pango_font_map_load_font (PANGO_FONT_MAP (map), context, desc);
- g_assert_true (pango_font_get_face (font) == PANGO_FONT_FACE (face_wild));
+ font = pango2_font_map_load_font (PANGO2_FONT_MAP (map), context, desc);
+ g_assert_true (pango2_font_get_face (font) == PANGO2_FONT_FACE (face_wild));
g_object_unref (font);
- pango_font_description_unset_fields (desc, PANGO_FONT_MASK_FACEID);
+ pango2_font_description_unset_fields (desc, PANGO2_FONT_MASK_FACEID);
/* ...and without doesn't */
- s = pango_font_description_to_string (desc);
+ s = pango2_font_description_to_string (desc);
g_assert_cmpstr (s, ==, "Cat 12");
g_free (s);
- font = pango_font_map_load_font (PANGO_FONT_MAP (map), context, desc);
- g_assert_true (pango_font_get_face (font) == PANGO_FONT_FACE (face_fat));
+ font = pango2_font_map_load_font (PANGO2_FONT_MAP (map), context, desc);
+ g_assert_true (pango2_font_get_face (font) == PANGO2_FONT_FACE (face_fat));
g_object_unref (font);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_object_unref (context);
g_object_unref (map);
@@ -432,73 +432,73 @@ test_hbfont_load (void)
static void
test_hbfont_load_variation (void)
{
- PangoFontMap *map;
- PangoContext *context;
+ Pango2FontMap *map;
+ Pango2Context *context;
char *path;
- PangoFontDescription *desc;
- PangoHbFace *face_fat, *face_wild;
+ Pango2FontDescription *desc;
+ Pango2HbFace *face_fat, *face_wild;
char *s;
- PangoFont *font;
+ Pango2Font *font;
hb_variation_t v;
hb_font_t *hb_font;
const float *coords;
unsigned int length;
/* Make a Cat family, with the two faces Fat and Wild */
- map = pango_font_map_new ();
- context = pango_context_new_with_font_map (PANGO_FONT_MAP (map));
+ map = pango2_font_map_new ();
+ context = pango2_context_new_with_font_map (PANGO2_FONT_MAP (map));
path = g_test_build_filename (G_TEST_DIST, "fonts", "Cantarell-VF.otf", NULL);
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, "Cat");
- face_fat = pango_hb_face_new_from_file (path, 0, -1, "Fat", desc);
- pango_font_description_free (desc);
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, "Cat");
+ face_fat = pango2_hb_face_new_from_file (path, 0, -1, "Fat", desc);
+ pango2_font_description_free (desc);
g_free (path);
- pango_font_map_add_face (map, PANGO_FONT_FACE (face_fat));
+ pango2_font_map_add_face (map, PANGO2_FONT_FACE (face_fat));
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, "Cat");
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, "Cat");
v.tag = HB_OT_TAG_VAR_AXIS_WEIGHT;
v.value = 624.;
- face_wild = pango_hb_face_new_instance (face_fat, &v, 1, "Wild", desc);
- pango_font_description_free (desc);
+ face_wild = pango2_hb_face_new_instance (face_fat, &v, 1, "Wild", desc);
+ pango2_font_description_free (desc);
- pango_font_map_add_face (map, PANGO_FONT_FACE (face_wild));
+ pango2_font_map_add_face (map, PANGO2_FONT_FACE (face_wild));
- desc = pango_font_face_describe (PANGO_FONT_FACE (face_wild));
+ desc = pango2_font_face_describe (PANGO2_FONT_FACE (face_wild));
- g_assert_cmpstr (pango_font_description_get_variations (desc), ==, "wght=624");
+ g_assert_cmpstr (pango2_font_description_get_variations (desc), ==, "wght=624");
- pango_font_description_set_size (desc, 12 * PANGO_SCALE);
+ pango2_font_description_set_size (desc, 12 * PANGO2_SCALE);
- s = pango_font_description_to_string (desc);
+ s = pango2_font_description_to_string (desc);
g_assert_cmpstr (s, ==, "Cat 12 @faceid=hb:Cantarell-Regular:0:-1:0:1:1:0:wght_624,wght=624");
g_free (s);
- font = pango_font_map_load_font (PANGO_FONT_MAP (map), context, desc);
- g_assert_true (pango_font_get_face (font) == PANGO_FONT_FACE (face_wild));
+ font = pango2_font_map_load_font (PANGO2_FONT_MAP (map), context, desc);
+ g_assert_true (pango2_font_get_face (font) == PANGO2_FONT_FACE (face_wild));
- hb_font = pango_font_get_hb_font (font);
+ hb_font = pango2_font_get_hb_font (font);
coords = hb_font_get_var_coords_design (hb_font, &length);
g_assert_cmpint (length, ==, 1);
g_assert_cmphex (coords[0], ==, 624.);
g_object_unref (font);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_object_unref (context);
g_object_unref (map);
}
-/* Verify that pango_fontmap_load_fontset produces a non-empty result
+/* Verify that pango2_fontmap_load_fontset produces a non-empty result
* even if the language isn't covered - our itemization code relies
* on this.
*/
static gboolean
-get_font (PangoFontset *fontset,
- PangoFont *font,
+get_font (Pango2Fontset *fontset,
+ Pango2Font *font,
gpointer data)
{
gboolean *found = data;
@@ -511,28 +511,28 @@ get_font (PangoFontset *fontset,
static void
test_fontmap_language (void)
{
- PangoFontMap *map;
- PangoContext *context;
- PangoFontDescription *desc;
- PangoFontset *fonts;
+ Pango2FontMap *map;
+ Pango2Context *context;
+ Pango2FontDescription *desc;
+ Pango2Fontset *fonts;
gboolean found;
- map = PANGO_FONT_MAP (pango_font_map_new_default ());
- context = pango_context_new_with_font_map (map);
- desc = pango_font_description_from_string ("serif 11");
+ map = PANGO2_FONT_MAP (pango2_font_map_new_default ());
+ context = pango2_context_new_with_font_map (map);
+ desc = pango2_font_description_from_string ("serif 11");
/* zz isn't assigned, so there should not be any fonts claiming to support
* this language. We are expecting to get a nonempty fontset regardless.
*/
- fonts = pango_font_map_load_fontset (map, context, desc, pango_language_from_string ("zz"));
- g_assert_true (PANGO_IS_FONTSET (fonts));
+ fonts = pango2_font_map_load_fontset (map, context, desc, pango2_language_from_string ("zz"));
+ g_assert_true (PANGO2_IS_FONTSET (fonts));
found = FALSE;
- pango_fontset_foreach (fonts, get_font, &found);
+ pango2_fontset_foreach (fonts, get_font, &found);
g_assert_true (found);
g_object_unref (fonts);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
}
int
diff --git a/tests/testiter.c b/tests/testiter.c
index f38e10d7..b180f66f 100644
--- a/tests/testiter.c
+++ b/tests/testiter.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* testiter.c: Test pangolayoutiter.c
*
* Copyright (C) 2005 Amit Aronovitch
@@ -45,7 +45,7 @@ verbose (const char *format, ...)
#endif
}
-#define LAYOUT_WIDTH (80 * PANGO_SCALE)
+#define LAYOUT_WIDTH (80 * PANGO2_SCALE)
/* Note: The test expects that any newline sequence is of length 1
* use \n (not \r\n) in the test texts.
@@ -77,21 +77,21 @@ const char *test_texts[] =
* - GlyphString's index_to_x positions match those returned by the Iter
*/
static void
-iter_char_test (PangoLayout *layout)
+iter_char_test (Pango2Layout *layout)
{
- PangoRectangle extents, run_extents;
- PangoLineIter *iter;
- PangoRun *run;
+ Pango2Rectangle extents, run_extents;
+ Pango2LineIter *iter;
+ Pango2Run *run;
int num_chars;
int i, index, offset;
int leading_x, trailing_x, x0, x1;
gboolean iter_next_ok, rtl;
const char *text, *ptr;
- text = pango_layout_get_text (layout);
+ text = pango2_layout_get_text (layout);
num_chars = g_utf8_strlen (text, -1);
- iter = pango_lines_get_iter (pango_layout_get_lines (layout));
+ iter = pango2_lines_get_iter (pango2_layout_get_lines (layout));
iter_next_ok = TRUE;
for (i = 0 ; i < num_chars; ++i)
@@ -99,54 +99,54 @@ iter_char_test (PangoLayout *layout)
char *char_str;
g_assert (iter_next_ok);
- index = pango_line_iter_get_index (iter);
+ index = pango2_line_iter_get_index (iter);
ptr = text + index;
char_str = g_strndup (ptr, g_utf8_next_char (ptr) - ptr);
verbose ("i=%d (visual), index = %d '%s':\n",
i, index, char_str);
g_free (char_str);
- pango_line_iter_get_char_extents (iter, &extents);
+ pango2_line_iter_get_char_extents (iter, &extents);
verbose (" char extents: x=%d,y=%d w=%d,h=%d\n",
extents.x, extents.y,
extents.width, extents.height);
- run = pango_line_iter_get_run (iter);
+ run = pango2_line_iter_get_run (iter);
if (run)
{
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
char *str;
- PangoItem *item;
- const PangoAnalysis *analysis;
- PangoGlyphString *glyphs;
+ Pango2Item *item;
+ const Pango2Analysis *analysis;
+ Pango2GlyphString *glyphs;
int length;
- item = pango_run_get_item (run);
- analysis = pango_item_get_analysis (item);
- glyphs = pango_run_get_glyphs (run);
+ item = pango2_run_get_item (run);
+ analysis = pango2_item_get_analysis (item);
+ glyphs = pango2_run_get_glyphs (run);
/* Get needed data for the GlyphString */
- pango_line_iter_get_run_extents (iter, NULL, &run_extents);
- offset = pango_item_get_byte_offset (item);
- length = pango_item_get_byte_length (item);
+ pango2_line_iter_get_run_extents (iter, NULL, &run_extents);
+ offset = pango2_item_get_byte_offset (item);
+ length = pango2_item_get_byte_length (item);
- rtl = pango_analysis_get_bidi_level (analysis) % 2;
- desc = pango_font_describe (pango_analysis_get_font (analysis));
- str = pango_font_description_to_string (desc);
+ rtl = pango2_analysis_get_bidi_level (analysis) % 2;
+ desc = pango2_font_describe (pango2_analysis_get_font (analysis));
+ str = pango2_font_description_to_string (desc);
verbose (" (current run: font=%s,offset=%d,x=%d,len=%d,rtl=%d)\n",
str, offset, run_extents.x, length, rtl);
g_free (str);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
/* Calculate expected x result using index_to_x */
- pango_glyph_string_index_to_x (glyphs,
+ pango2_glyph_string_index_to_x (glyphs,
(char *)(text + offset), length,
- pango_item_get_analysis (item),
+ pango2_item_get_analysis (item),
index - offset, FALSE, &leading_x);
- pango_glyph_string_index_to_x (glyphs,
+ pango2_glyph_string_index_to_x (glyphs,
(char *)(text + offset), length,
- pango_item_get_analysis (item),
+ pango2_item_get_analysis (item),
index - offset, TRUE, &trailing_x);
x0 = run_extents.x + MIN (leading_x, trailing_x);
@@ -163,7 +163,7 @@ iter_char_test (PangoLayout *layout)
/* We're on a line terminator */
}
- iter_next_ok = pango_line_iter_next_char (iter);
+ iter_next_ok = pango2_line_iter_next_char (iter);
verbose ("more to go? %d\n", iter_next_ok);
}
@@ -171,34 +171,34 @@ iter_char_test (PangoLayout *layout)
* input string */
g_assert (!iter_next_ok);
- pango_line_iter_free (iter);
+ pango2_line_iter_free (iter);
}
static void
-iter_cluster_test (PangoLayout *layout)
+iter_cluster_test (Pango2Layout *layout)
{
- PangoRectangle extents;
- PangoLineIter *iter;
+ Pango2Rectangle extents;
+ Pango2LineIter *iter;
int index;
gboolean iter_next_ok;
- PangoLine *last_line = NULL;
+ Pango2Line *last_line = NULL;
int expected_next_x = 0;
- iter = pango_lines_get_iter (pango_layout_get_lines (layout));
+ iter = pango2_lines_get_iter (pango2_layout_get_lines (layout));
iter_next_ok = TRUE;
while (iter_next_ok)
{
- PangoLine *line = pango_line_iter_get_line (iter);
+ Pango2Line *line = pango2_line_iter_get_line (iter);
/* Every cluster is part of a run */
- g_assert (pango_line_iter_get_run (iter));
+ g_assert (pango2_line_iter_get_run (iter));
- index = pango_line_iter_get_index (iter);
+ index = pango2_line_iter_get_index (iter);
- pango_line_iter_get_cluster_extents (iter, NULL, &extents);
+ pango2_line_iter_get_cluster_extents (iter, NULL, &extents);
- iter_next_ok = pango_line_iter_next_cluster (iter);
+ iter_next_ok = pango2_line_iter_next_cluster (iter);
verbose ("index = %d:\n", index);
verbose (" cluster extents: x=%d,y=%d w=%d,h=%d\n",
@@ -220,23 +220,23 @@ iter_cluster_test (PangoLayout *layout)
g_assert (!iter_next_ok);
- pango_line_iter_free (iter);
+ pango2_line_iter_free (iter);
}
static void
test_line_iter (void)
{
const char **ptext;
- PangoContext *context;
- PangoFontDescription *font_desc;
- PangoLayout *layout;
+ Pango2Context *context;
+ Pango2FontDescription *font_desc;
+ Pango2Layout *layout;
- context = pango_context_new ();
- font_desc = pango_font_description_from_string ("cantarell 11");
- pango_context_set_font_description (context, font_desc);
+ context = pango2_context_new ();
+ font_desc = pango2_font_description_from_string ("cantarell 11");
+ pango2_context_set_font_description (context, font_desc);
- layout = pango_layout_new (context);
- pango_layout_set_width (layout, LAYOUT_WIDTH);
+ layout = pango2_layout_new (context);
+ pango2_layout_set_width (layout, LAYOUT_WIDTH);
for (ptext = test_texts; *ptext != NULL; ++ptext)
{
@@ -245,14 +245,14 @@ test_line_iter (void)
verbose ( "len=%ld, bytes=%ld\n",
(long)g_utf8_strlen (*ptext, -1), (long)strlen (*ptext));
- pango_layout_set_text (layout, *ptext, -1);
+ pango2_layout_set_text (layout, *ptext, -1);
iter_char_test (layout);
iter_cluster_test (layout);
}
g_object_unref (layout);
g_object_unref (context);
- pango_font_description_free (font_desc);
+ pango2_font_description_free (font_desc);
}
int
diff --git a/tests/testlanguage.c b/tests/testlanguage.c
index 35844d46..1a6f238a 100644
--- a/tests/testlanguage.c
+++ b/tests/testlanguage.c
@@ -1,5 +1,5 @@
-/* Pango
- * testlanguage.c: Test program for PangoLanguage
+/* Pango2
+ * testlanguage.c: Test program for Pango2Language
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -25,11 +25,11 @@
static void
test_language_to_string (void)
{
- PangoLanguage *lang;
+ Pango2Language *lang;
- lang = pango_language_from_string ("ja-jp");
- g_assert_cmpstr (pango_language_to_string (lang), ==, "ja-jp");
- g_assert_cmpstr ((pango_language_to_string) (lang), ==, "ja-jp");
+ lang = pango2_language_from_string ("ja-jp");
+ g_assert_cmpstr (pango2_language_to_string (lang), ==, "ja-jp");
+ g_assert_cmpstr ((pango2_language_to_string) (lang), ==, "ja-jp");
}
static void
@@ -37,15 +37,15 @@ test_language_env (void)
{
if (g_test_subprocess ())
{
- PangoLanguage **preferred;
+ Pango2Language **preferred;
- g_setenv ("PANGO_LANGUAGE", "de:ja", TRUE);
+ g_setenv ("PANGO2_LANGUAGE", "de:ja", TRUE);
g_setenv ("LANGUAGE", "fr", TRUE);
- preferred = pango_language_get_preferred ();
+ preferred = pango2_language_get_preferred ();
g_assert_nonnull (preferred);
- g_assert_true (preferred[0] == pango_language_from_string ("de"));
- g_assert_true (preferred[1] == pango_language_from_string ("ja"));
+ g_assert_true (preferred[0] == pango2_language_from_string ("de"));
+ g_assert_true (preferred[1] == pango2_language_from_string ("ja"));
g_assert_null (preferred[2]);
return;
diff --git a/tests/testmatrix.c b/tests/testmatrix.c
index aa309193..0549764c 100644
--- a/tests/testmatrix.c
+++ b/tests/testmatrix.c
@@ -1,5 +1,5 @@
-/* Pango
- * testmatrix.c: Test program for PangoMatrix
+/* Pango2
+ * testmatrix.c: Test program for Pango2Matrix
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -34,11 +34,11 @@
static void
test_matrix_translate (void)
{
- PangoMatrix m = PANGO_MATRIX_INIT;
- PangoMatrix m2 = PANGO_MATRIX_INIT;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
+ Pango2Matrix m2 = PANGO2_MATRIX_INIT;
- pango_matrix_translate (&m, 10, 10);
- pango_matrix_translate (&m, -10, -10);
+ pango2_matrix_translate (&m, 10, 10);
+ pango2_matrix_translate (&m, -10, -10);
g_assert_true (matrix_equal (&m, &m2));
}
@@ -46,13 +46,13 @@ test_matrix_translate (void)
static void
test_matrix_rotate (void)
{
- PangoMatrix m = PANGO_MATRIX_INIT;
- PangoMatrix m2 = PANGO_MATRIX_INIT;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
+ Pango2Matrix m2 = PANGO2_MATRIX_INIT;
- pango_matrix_rotate (&m, 90);
- pango_matrix_rotate (&m, 90);
- pango_matrix_rotate (&m, 90);
- pango_matrix_rotate (&m, 90);
+ pango2_matrix_rotate (&m, 90);
+ pango2_matrix_rotate (&m, 90);
+ pango2_matrix_rotate (&m, 90);
+ pango2_matrix_rotate (&m, 90);
g_assert_true (matrix_equal (&m, &m2));
}
@@ -60,10 +60,10 @@ test_matrix_rotate (void)
static void
test_matrix_scale(void)
{
- PangoMatrix m = PANGO_MATRIX_INIT;
- PangoMatrix m2 = PANGO_MATRIX_INIT;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
+ Pango2Matrix m2 = PANGO2_MATRIX_INIT;
- pango_matrix_scale (&m, 4, 5);
+ pango2_matrix_scale (&m, 4, 5);
m2.xx = 4;
m2.yy = 5;
@@ -73,35 +73,35 @@ test_matrix_scale(void)
static void
test_matrix_concat (void)
{
- PangoMatrix m = PANGO_MATRIX_INIT;
- PangoMatrix id = PANGO_MATRIX_INIT;
- PangoMatrix *m2;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
+ Pango2Matrix id = PANGO2_MATRIX_INIT;
+ Pango2Matrix *m2;
- pango_matrix_rotate (&m, 120);
- m2 = pango_matrix_copy (&m);
- pango_matrix_concat (m2, &m);
- pango_matrix_concat (m2, &m);
+ pango2_matrix_rotate (&m, 120);
+ m2 = pango2_matrix_copy (&m);
+ pango2_matrix_concat (m2, &m);
+ pango2_matrix_concat (m2, &m);
g_assert_true (matrix_equal (&id, m2));
- pango_matrix_free (m2);
+ pango2_matrix_free (m2);
}
static void
test_matrix_font_scale (void)
{
- PangoMatrix m = PANGO_MATRIX_INIT;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
double x, y;
- pango_matrix_scale (&m, 2, 3);
+ pango2_matrix_scale (&m, 2, 3);
- pango_matrix_get_font_scale_factors (&m, &x, &y);
+ pango2_matrix_get_font_scale_factors (&m, &x, &y);
g_assert_cmpfloat (x, ==, 2);
g_assert_cmpfloat (y, ==, 3);
- g_assert_cmpfloat (pango_matrix_get_font_scale_factor (&m), ==, 3);
+ g_assert_cmpfloat (pango2_matrix_get_font_scale_factor (&m), ==, 3);
- pango_matrix_rotate (&m, 90);
- pango_matrix_get_font_scale_factors (&m, &x, &y);
+ pango2_matrix_rotate (&m, 90);
+ pango2_matrix_get_font_scale_factors (&m, &x, &y);
g_assert_cmpfloat (x, ==, 3);
g_assert_cmpfloat (y, ==, 2);
}
@@ -109,17 +109,17 @@ test_matrix_font_scale (void)
static void
test_matrix_transform_point (void)
{
- PangoMatrix m = PANGO_MATRIX_INIT;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
double x, y;
- pango_matrix_translate (&m, 1, 1);
- pango_matrix_scale (&m, 2, 4);
- pango_matrix_rotate (&m, -90);
+ pango2_matrix_translate (&m, 1, 1);
+ pango2_matrix_scale (&m, 2, 4);
+ pango2_matrix_rotate (&m, -90);
x = 1;
y = 0;
- pango_matrix_transform_point (&m, &x, &y);
+ pango2_matrix_transform_point (&m, &x, &y);
g_assert_cmpfloat_with_epsilon (x, 1, 0.001);
g_assert_cmpfloat_with_epsilon (y, 5, 0.001);
@@ -128,17 +128,17 @@ test_matrix_transform_point (void)
static void
test_matrix_transform_distance (void)
{
- PangoMatrix m = PANGO_MATRIX_INIT;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
double x, y;
- pango_matrix_translate (&m, 1, 1);
- pango_matrix_scale (&m, 2, 4);
- pango_matrix_rotate (&m, -90);
+ pango2_matrix_translate (&m, 1, 1);
+ pango2_matrix_scale (&m, 2, 4);
+ pango2_matrix_rotate (&m, -90);
x = 1;
y = 0;
- pango_matrix_transform_distance (&m, &x, &y);
+ pango2_matrix_transform_distance (&m, &x, &y);
g_assert_cmpfloat_with_epsilon (x, 0, 0.001);
g_assert_cmpfloat_with_epsilon (y, 4, 0.001);
@@ -147,38 +147,38 @@ test_matrix_transform_distance (void)
static void
test_matrix_transform_rect (void)
{
- PangoMatrix m = PANGO_MATRIX_INIT;
- PangoRectangle rect;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
+ Pango2Rectangle rect;
- pango_matrix_rotate (&m, 45);
+ pango2_matrix_rotate (&m, 45);
rect.x = 0;
rect.y = 0;
- rect.width = 1 * PANGO_SCALE;
- rect.height = 1 * PANGO_SCALE;
+ rect.width = 1 * PANGO2_SCALE;
+ rect.height = 1 * PANGO2_SCALE;
- pango_matrix_transform_rectangle (&m, &rect);
+ pango2_matrix_transform_rectangle (&m, &rect);
g_assert_cmpfloat_with_epsilon (rect.x, 0, 0.5);
- g_assert_cmpfloat_with_epsilon (rect.y, - G_SQRT2 / 2 * PANGO_SCALE, 0.5);
- g_assert_cmpfloat_with_epsilon (rect.width, G_SQRT2 * PANGO_SCALE, 0.5);
- g_assert_cmpfloat_with_epsilon (rect.height, G_SQRT2 * PANGO_SCALE, 0.5);
+ g_assert_cmpfloat_with_epsilon (rect.y, - G_SQRT2 / 2 * PANGO2_SCALE, 0.5);
+ g_assert_cmpfloat_with_epsilon (rect.width, G_SQRT2 * PANGO2_SCALE, 0.5);
+ g_assert_cmpfloat_with_epsilon (rect.height, G_SQRT2 * PANGO2_SCALE, 0.5);
}
static void
test_matrix_transform_pixel_rect (void)
{
- PangoMatrix m = PANGO_MATRIX_INIT;
- PangoRectangle rect;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
+ Pango2Rectangle rect;
- pango_matrix_rotate (&m, 45);
+ pango2_matrix_rotate (&m, 45);
rect.x = 0;
rect.y = 0;
rect.width = 1;
rect.height = 1;
- pango_matrix_transform_pixel_rectangle (&m, &rect);
+ pango2_matrix_transform_pixel_rectangle (&m, &rect);
g_assert_cmpfloat_with_epsilon (rect.x, 0, 0.1);
g_assert_cmpfloat_with_epsilon (rect.y, -1, 0.1);
@@ -187,68 +187,68 @@ test_matrix_transform_pixel_rect (void)
}
static void
-pango_matrix_postrotate (PangoMatrix *m,
+pango2_matrix_postrotate (Pango2Matrix *m,
double angle)
{
- PangoMatrix rot = (PangoMatrix) PANGO_MATRIX_INIT;
+ Pango2Matrix rot = (Pango2Matrix) PANGO2_MATRIX_INIT;
- pango_matrix_rotate (&rot, angle);
- pango_matrix_concat (&rot, m);
+ pango2_matrix_rotate (&rot, angle);
+ pango2_matrix_concat (&rot, m);
*m = rot;
}
static void
test_matrix_slant_ratio (void)
{
- PangoMatrix m = (PangoMatrix) { 1, 0.2, 0, 1, 0, 0 };
- PangoMatrix m2 = (PangoMatrix) { 1, 0.4, 0, 1, 0, 0 };
- PangoMatrix m3 = (PangoMatrix) { 1, 0.3, 0, 2, 0, 0 };
+ Pango2Matrix m = (Pango2Matrix) { 1, 0.2, 0, 1, 0, 0 };
+ Pango2Matrix m2 = (Pango2Matrix) { 1, 0.4, 0, 1, 0, 0 };
+ Pango2Matrix m3 = (Pango2Matrix) { 1, 0.3, 0, 2, 0, 0 };
double a;
double sx, sy;
double r;
- a = pango_matrix_get_rotation (&m);
+ a = pango2_matrix_get_rotation (&m);
g_assert_cmpfloat_with_epsilon (a, 0, 0.001);
- pango_matrix_get_font_scale_factors (&m, &sx, &sy);
+ pango2_matrix_get_font_scale_factors (&m, &sx, &sy);
g_assert_cmpfloat_with_epsilon (sx, 1, 0.001);
g_assert_cmpfloat_with_epsilon (sy, 1, 0.001);
- r = pango_matrix_get_slant_ratio (&m);
+ r = pango2_matrix_get_slant_ratio (&m);
g_assert_cmpfloat_with_epsilon (r, 0.2, 0.001);
- pango_matrix_postrotate (&m, 45);
+ pango2_matrix_postrotate (&m, 45);
- a = pango_matrix_get_rotation (&m);
+ a = pango2_matrix_get_rotation (&m);
g_assert_cmpfloat_with_epsilon (a, 45, 0.001);
- pango_matrix_postrotate (&m, -a);
+ pango2_matrix_postrotate (&m, -a);
- pango_matrix_get_font_scale_factors (&m, &sx, &sy);
+ pango2_matrix_get_font_scale_factors (&m, &sx, &sy);
g_assert_cmpfloat_with_epsilon (sx, 1, 0.001);
g_assert_cmpfloat_with_epsilon (sy, 1, 0.001);
- r = pango_matrix_get_slant_ratio (&m);
+ r = pango2_matrix_get_slant_ratio (&m);
g_assert_cmpfloat_with_epsilon (r, 0.2, 0.001);
- pango_matrix_scale (&m, 2, 3);
+ pango2_matrix_scale (&m, 2, 3);
- a = pango_matrix_get_rotation (&m);
+ a = pango2_matrix_get_rotation (&m);
g_assert_cmpfloat_with_epsilon (a, 0, 0.001);
- pango_matrix_get_font_scale_factors (&m, &sx, &sy);
+ pango2_matrix_get_font_scale_factors (&m, &sx, &sy);
g_assert_cmpfloat_with_epsilon (sx, 2, 0.001);
g_assert_cmpfloat_with_epsilon (sy, 3, 0.001);
- pango_matrix_scale (&m, 1/sx, 1/sy);
+ pango2_matrix_scale (&m, 1/sx, 1/sy);
- r = pango_matrix_get_slant_ratio (&m);
+ r = pango2_matrix_get_slant_ratio (&m);
g_assert_cmpfloat_with_epsilon (r, 0.2, 0.001);
- r = pango_matrix_get_slant_ratio (&m2);
+ r = pango2_matrix_get_slant_ratio (&m2);
g_assert_cmpfloat_with_epsilon (r, 0.4, 0.001);
- r = pango_matrix_get_slant_ratio (&m3);
+ r = pango2_matrix_get_slant_ratio (&m3);
g_assert_cmpfloat_with_epsilon (r, 0.15, 0.001);
}
diff --git a/tests/testmisc.c b/tests/testmisc.c
index f1749c35..32efb932 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* testmisc.c: Test program for miscellaneous things
*
* Copyright (C) 2020 Matthias Clasen
@@ -29,10 +29,10 @@
static void
test_itemize_empty_crash (void)
{
- PangoContext *context;
+ Pango2Context *context;
- context = pango_context_new ();
- pango_itemize (context, PANGO_DIRECTION_LTR, "", 0, 1, NULL);
+ context = pango2_context_new ();
+ pango2_itemize (context, PANGO2_DIRECTION_LTR, "", 0, 1, NULL);
g_object_unref (context);
}
@@ -40,31 +40,31 @@ test_itemize_empty_crash (void)
static void
test_itemize_utf8 (void)
{
- PangoContext *context;
+ Pango2Context *context;
GList *result = NULL;
- context = pango_context_new ();
- result = pango_itemize (context, PANGO_DIRECTION_LTR, "\xc3\xa1\na", 3, 1, NULL);
+ context = pango2_context_new ();
+ result = pango2_itemize (context, PANGO2_DIRECTION_LTR, "\xc3\xa1\na", 3, 1, NULL);
g_assert (result != NULL);
- g_list_free_full (result, (GDestroyNotify)pango_item_free);
+ g_list_free_full (result, (GDestroyNotify)pango2_item_free);
g_object_unref (context);
}
-/* Test that pango_layout_set_text (layout, "short", 200)
+/* Test that pango2_layout_set_text (layout, "short", 200)
* does not lead to a crash. (pidgin does this)
*/
static void
test_short_string_crash (void)
{
- PangoContext *context;
- PangoLayout *layout;
- PangoRectangle ext;
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2Rectangle ext;
- context = pango_context_new ();
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, "short text", 200);
- pango_lines_get_extents (pango_layout_get_lines (layout), &ext, &ext);
+ context = pango2_context_new ();
+ layout = pango2_layout_new (context);
+ pango2_layout_set_text (layout, "short text", 200);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), &ext, &ext);
g_object_unref (layout);
g_object_unref (context);
@@ -73,12 +73,12 @@ test_short_string_crash (void)
static void
test_language_emoji_crash (void)
{
- PangoLanguage *lang;
+ Pango2Language *lang;
const GUnicodeScript *scripts;
int num;
- lang = pango_language_from_string ("und-zsye");
- scripts = pango_language_get_scripts (lang, &num);
+ lang = pango2_language_from_string ("und-zsye");
+ scripts = pango2_language_get_scripts (lang, &num);
g_assert (num >= 0);
g_assert (scripts == NULL || num > 0);
@@ -87,16 +87,16 @@ test_language_emoji_crash (void)
static void
test_line_height (void)
{
- PangoContext *context;
- PangoLayout *layout;
- PangoLine *line;
- PangoRectangle ext;
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2Line *line;
+ Pango2Rectangle ext;
- context = pango_context_new ();
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, "one\ttwo", -1);
- line = pango_lines_get_lines (pango_layout_get_lines (layout))[0];
- pango_line_get_extents (line, NULL, &ext);
+ context = pango2_context_new ();
+ layout = pango2_layout_new (context);
+ pango2_layout_set_text (layout, "one\ttwo", -1);
+ line = pango2_lines_get_lines (pango2_layout_get_lines (layout))[0];
+ pango2_line_get_extents (line, NULL, &ext);
g_assert_cmpint (ext.height, >, 0);
@@ -107,24 +107,24 @@ test_line_height (void)
static void
test_line_height2 (void)
{
- PangoContext *context;
- PangoLayout *layout;
- PangoLine *line;
- PangoRectangle ext1, ext2;
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2Line *line;
+ Pango2Rectangle ext1, ext2;
- context = pango_context_new ();
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, "one", -1);
+ context = pango2_context_new ();
+ layout = pango2_layout_new (context);
+ pango2_layout_set_text (layout, "one", -1);
- line = pango_lines_get_lines (pango_layout_get_lines (layout))[0];
+ line = pango2_lines_get_lines (pango2_layout_get_lines (layout))[0];
g_assert_nonnull (line);
- pango_line_get_extents (line, NULL, &ext1);
+ pango2_line_get_extents (line, NULL, &ext1);
- pango_layout_set_text (layout, "", -1);
+ pango2_layout_set_text (layout, "", -1);
- line = pango_lines_get_lines (pango_layout_get_lines (layout))[0];
+ line = pango2_lines_get_lines (pango2_layout_get_lines (layout))[0];
g_assert_nonnull (line);
- pango_line_get_extents (line, NULL, &ext2);
+ pango2_line_get_extents (line, NULL, &ext2);
g_assert_cmpint (ext1.height, ==, ext2.height);
@@ -135,30 +135,30 @@ test_line_height2 (void)
static void
test_line_height3 (void)
{
- PangoContext *context;
- PangoLayout *layout;
- PangoLine *line;
- PangoAttrList *attrs;
- PangoRectangle ext1;
- PangoRectangle ext2;
-
- context = pango_context_new ();
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, "one", -1);
- attrs = pango_attr_list_new ();
- pango_attr_list_insert (attrs, pango_attr_line_height_new (2.0));
- pango_layout_set_attributes (layout, attrs);
- pango_attr_list_unref (attrs);
-
- line = pango_lines_get_lines (pango_layout_get_lines (layout))[0];
- g_assert_cmpint (pango_lines_get_line_count (pango_layout_get_lines (layout)), ==, 1);
- pango_line_get_extents (line, NULL, &ext1);
-
- pango_layout_set_text (layout, "", -1);
-
- g_assert_cmpint (pango_lines_get_line_count (pango_layout_get_lines (layout)), ==, 1);
- line = pango_lines_get_lines (pango_layout_get_lines (layout))[0];
- pango_line_get_extents (line, NULL, &ext2);
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2Line *line;
+ Pango2AttrList *attrs;
+ Pango2Rectangle ext1;
+ Pango2Rectangle ext2;
+
+ context = pango2_context_new ();
+ layout = pango2_layout_new (context);
+ pango2_layout_set_text (layout, "one", -1);
+ attrs = pango2_attr_list_new ();
+ pango2_attr_list_insert (attrs, pango2_attr_line_height_new (2.0));
+ pango2_layout_set_attributes (layout, attrs);
+ pango2_attr_list_unref (attrs);
+
+ line = pango2_lines_get_lines (pango2_layout_get_lines (layout))[0];
+ g_assert_cmpint (pango2_lines_get_line_count (pango2_layout_get_lines (layout)), ==, 1);
+ pango2_line_get_extents (line, NULL, &ext1);
+
+ pango2_layout_set_text (layout, "", -1);
+
+ g_assert_cmpint (pango2_lines_get_line_count (pango2_layout_get_lines (layout)), ==, 1);
+ line = pango2_lines_get_lines (pango2_layout_get_lines (layout))[0];
+ pango2_line_get_extents (line, NULL, &ext2);
g_assert_cmpint (ext1.height, ==, ext2.height);
@@ -169,24 +169,24 @@ test_line_height3 (void)
static void
test_run_height (void)
{
- PangoContext *context;
- PangoLayout *layout;
- PangoLineIter *iter;
- PangoRectangle logical1, logical2;
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2LineIter *iter;
+ Pango2Rectangle logical1, logical2;
- context = pango_context_new ();
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, "one", -1);
+ context = pango2_context_new ();
+ layout = pango2_layout_new (context);
+ pango2_layout_set_text (layout, "one", -1);
- iter = pango_lines_get_iter (pango_layout_get_lines (layout));
- pango_line_iter_get_run_extents (iter, NULL, &logical1);
- pango_line_iter_free (iter);
+ iter = pango2_lines_get_iter (pango2_layout_get_lines (layout));
+ pango2_line_iter_get_run_extents (iter, NULL, &logical1);
+ pango2_line_iter_free (iter);
- pango_layout_set_text (layout, "", -1);
+ pango2_layout_set_text (layout, "", -1);
- iter = pango_lines_get_iter (pango_layout_get_lines (layout));
- pango_line_iter_get_run_extents (iter, NULL, &logical2);
- pango_line_iter_free (iter);
+ iter = pango2_lines_get_iter (pango2_layout_get_lines (layout));
+ pango2_line_iter_get_run_extents (iter, NULL, &logical2);
+ pango2_line_iter_free (iter);
g_assert_cmpint (logical1.height, ==, logical2.height);
@@ -197,19 +197,19 @@ test_run_height (void)
static void
test_cursor_height (void)
{
- PangoContext *context;
- PangoLayout *layout;
- PangoRectangle strong;
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2Rectangle strong;
- context = pango_context_new ();
- layout = pango_layout_new (context);
+ context = pango2_context_new ();
+ layout = pango2_layout_new (context);
- pango_layout_set_text (layout, "one\ttwo", -1);
- pango_lines_get_cursor_pos (pango_layout_get_lines (layout), NULL, 0, &strong, NULL);
+ pango2_layout_set_text (layout, "one\ttwo", -1);
+ pango2_lines_get_cursor_pos (pango2_layout_get_lines (layout), NULL, 0, &strong, NULL);
g_assert_cmpint (strong.height, >, 0);
- pango_layout_set_text (layout, "", -1);
- pango_lines_get_cursor_pos (pango_layout_get_lines (layout), NULL, 0, &strong, NULL);
+ pango2_layout_set_text (layout, "", -1);
+ pango2_lines_get_cursor_pos (pango2_layout_get_lines (layout), NULL, 0, &strong, NULL);
g_assert_cmpint (strong.height, >, 0);
g_object_unref (layout);
@@ -219,39 +219,39 @@ test_cursor_height (void)
static void
test_attr_list_update (void)
{
- PangoAttribute *weight_attr;
- PangoAttribute *fg_attr;
- PangoAttrList *list;
+ Pango2Attribute *weight_attr;
+ Pango2Attribute *fg_attr;
+ Pango2AttrList *list;
guint start, end;
- weight_attr = pango_attr_weight_new (700);
- pango_attribute_set_range (weight_attr, 4, 6);
+ weight_attr = pango2_attr_weight_new (700);
+ pango2_attribute_set_range (weight_attr, 4, 6);
- fg_attr = pango_attr_foreground_new (&(PangoColor){0, 0, 65535});
- pango_attribute_set_range (fg_attr, PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING, PANGO_ATTR_INDEX_TO_TEXT_END);
+ fg_attr = pango2_attr_foreground_new (&(Pango2Color){0, 0, 65535});
+ pango2_attribute_set_range (fg_attr, PANGO2_ATTR_INDEX_FROM_TEXT_BEGINNING, PANGO2_ATTR_INDEX_TO_TEXT_END);
- list = pango_attr_list_new();
- pango_attr_list_insert (list, weight_attr);
- pango_attr_list_insert (list, fg_attr);
+ list = pango2_attr_list_new();
+ pango2_attr_list_insert (list, weight_attr);
+ pango2_attr_list_insert (list, fg_attr);
- pango_attribute_get_range (weight_attr, &start, &end);
+ pango2_attribute_get_range (weight_attr, &start, &end);
g_assert_cmpuint (start, ==, 4);
g_assert_cmpuint (end, ==, 6);
- pango_attribute_get_range (fg_attr, &start, &end);
- g_assert_cmpuint (start, ==, PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING);
- g_assert_cmpuint (end, ==, PANGO_ATTR_INDEX_TO_TEXT_END);
+ pango2_attribute_get_range (fg_attr, &start, &end);
+ g_assert_cmpuint (start, ==, PANGO2_ATTR_INDEX_FROM_TEXT_BEGINNING);
+ g_assert_cmpuint (end, ==, PANGO2_ATTR_INDEX_TO_TEXT_END);
// Delete 1 byte at position 2
- pango_attr_list_update (list, 2, 1, 0);
+ pango2_attr_list_update (list, 2, 1, 0);
- pango_attribute_get_range (weight_attr, &start, &end);
+ pango2_attribute_get_range (weight_attr, &start, &end);
g_assert_cmpuint (start, ==, 3);
g_assert_cmpuint (end, ==, 5);
- pango_attribute_get_range (fg_attr, &start, &end);
- g_assert_cmpuint (start, ==, PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING);
- g_assert_cmpuint (end, ==, PANGO_ATTR_INDEX_TO_TEXT_END);
+ pango2_attribute_get_range (fg_attr, &start, &end);
+ g_assert_cmpuint (start, ==, PANGO2_ATTR_INDEX_FROM_TEXT_BEGINNING);
+ g_assert_cmpuint (end, ==, PANGO2_ATTR_INDEX_TO_TEXT_END);
- pango_attr_list_unref (list);
+ pango2_attr_list_unref (list);
}
static void
@@ -259,59 +259,59 @@ test_version_info (void)
{
char *str;
- g_assert_null (pango_version_check (1, 0, 0));
- g_assert_null (pango_version_check (PANGO_VERSION_MAJOR, PANGO_VERSION_MINOR, PANGO_VERSION_MICRO));
- g_assert_nonnull (pango_version_check (2, 0, 0));
+ g_assert_null (pango2_version_check (1, 0, 0));
+ g_assert_null (pango2_version_check (PANGO2_VERSION_MAJOR, PANGO2_VERSION_MINOR, PANGO2_VERSION_MICRO));
+ g_assert_nonnull (pango2_version_check (2, 0, 0));
- str = g_strdup_printf ("%d.%d.%d", PANGO_VERSION_MAJOR, PANGO_VERSION_MINOR, PANGO_VERSION_MICRO);
- g_assert_cmpstr (str, ==, pango_version_string ());
+ str = g_strdup_printf ("%d.%d.%d", PANGO2_VERSION_MAJOR, PANGO2_VERSION_MINOR, PANGO2_VERSION_MICRO);
+ g_assert_cmpstr (str, ==, pango2_version_string ());
g_free (str);
}
static void
test_is_zero_width (void)
{
- g_assert_true (pango_is_zero_width (0x00ad));
- g_assert_true (pango_is_zero_width (0x034f));
- g_assert_false (pango_is_zero_width ('a'));
- g_assert_false (pango_is_zero_width ('c'));
-
- g_assert_true (pango_is_zero_width (0x2066));
- g_assert_true (pango_is_zero_width (0x2067));
- g_assert_true (pango_is_zero_width (0x2068));
- g_assert_true (pango_is_zero_width (0x2069));
-
- g_assert_true (pango_is_zero_width (0x202a));
- g_assert_true (pango_is_zero_width (0x202b));
- g_assert_true (pango_is_zero_width (0x202c));
- g_assert_true (pango_is_zero_width (0x202d));
- g_assert_true (pango_is_zero_width (0x202e));
+ g_assert_true (pango2_is_zero_width (0x00ad));
+ g_assert_true (pango2_is_zero_width (0x034f));
+ g_assert_false (pango2_is_zero_width ('a'));
+ g_assert_false (pango2_is_zero_width ('c'));
+
+ g_assert_true (pango2_is_zero_width (0x2066));
+ g_assert_true (pango2_is_zero_width (0x2067));
+ g_assert_true (pango2_is_zero_width (0x2068));
+ g_assert_true (pango2_is_zero_width (0x2069));
+
+ g_assert_true (pango2_is_zero_width (0x202a));
+ g_assert_true (pango2_is_zero_width (0x202b));
+ g_assert_true (pango2_is_zero_width (0x202c));
+ g_assert_true (pango2_is_zero_width (0x202d));
+ g_assert_true (pango2_is_zero_width (0x202e));
}
static void
test_gravity_to_rotation (void)
{
- g_assert_true (pango_gravity_to_rotation (PANGO_GRAVITY_SOUTH) == 0);
- g_assert_true (pango_gravity_to_rotation (PANGO_GRAVITY_NORTH) == G_PI);
- g_assert_true (pango_gravity_to_rotation (PANGO_GRAVITY_EAST) == -G_PI_2);
- g_assert_true (pango_gravity_to_rotation (PANGO_GRAVITY_WEST) == G_PI_2);
+ g_assert_true (pango2_gravity_to_rotation (PANGO2_GRAVITY_SOUTH) == 0);
+ g_assert_true (pango2_gravity_to_rotation (PANGO2_GRAVITY_NORTH) == G_PI);
+ g_assert_true (pango2_gravity_to_rotation (PANGO2_GRAVITY_EAST) == -G_PI_2);
+ g_assert_true (pango2_gravity_to_rotation (PANGO2_GRAVITY_WEST) == G_PI_2);
}
static void
test_gravity_from_matrix (void)
{
- PangoMatrix m = PANGO_MATRIX_INIT;
+ Pango2Matrix m = PANGO2_MATRIX_INIT;
- g_assert_true (pango_gravity_get_for_matrix (&m) == PANGO_GRAVITY_SOUTH);
+ g_assert_true (pango2_gravity_get_for_matrix (&m) == PANGO2_GRAVITY_SOUTH);
- pango_matrix_rotate (&m, 90);
- g_assert_true (pango_gravity_get_for_matrix (&m) == PANGO_GRAVITY_WEST);
+ pango2_matrix_rotate (&m, 90);
+ g_assert_true (pango2_gravity_get_for_matrix (&m) == PANGO2_GRAVITY_WEST);
- pango_matrix_rotate (&m, 90);
- g_assert_true (pango_gravity_get_for_matrix (&m) == PANGO_GRAVITY_NORTH);
+ pango2_matrix_rotate (&m, 90);
+ g_assert_true (pango2_gravity_get_for_matrix (&m) == PANGO2_GRAVITY_NORTH);
- pango_matrix_rotate (&m, 90);
- g_assert_true (pango_gravity_get_for_matrix (&m) == PANGO_GRAVITY_EAST);
+ pango2_matrix_rotate (&m, 90);
+ g_assert_true (pango2_gravity_get_for_matrix (&m) == PANGO2_GRAVITY_EAST);
}
static void
@@ -319,63 +319,63 @@ test_gravity_for_script (void)
{
struct {
GUnicodeScript script;
- PangoGravity gravity;
- PangoGravity gravity_natural;
- PangoGravity gravity_line;
+ Pango2Gravity gravity;
+ Pango2Gravity gravity_natural;
+ Pango2Gravity gravity_line;
} tests[] = {
- { G_UNICODE_SCRIPT_ARABIC, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_NORTH },
- { G_UNICODE_SCRIPT_BOPOMOFO, PANGO_GRAVITY_EAST, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH },
- { G_UNICODE_SCRIPT_LATIN, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH },
- { G_UNICODE_SCRIPT_HANGUL, PANGO_GRAVITY_EAST, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH },
- { G_UNICODE_SCRIPT_MONGOLIAN, PANGO_GRAVITY_WEST, PANGO_GRAVITY_SOUTH },
- { G_UNICODE_SCRIPT_OGHAM, PANGO_GRAVITY_WEST, PANGO_GRAVITY_NORTH, PANGO_GRAVITY_SOUTH },
- { G_UNICODE_SCRIPT_TIBETAN, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH, PANGO_GRAVITY_SOUTH },
+ { G_UNICODE_SCRIPT_ARABIC, PANGO2_GRAVITY_SOUTH, PANGO2_GRAVITY_SOUTH, PANGO2_GRAVITY_NORTH },
+ { G_UNICODE_SCRIPT_BOPOMOFO, PANGO2_GRAVITY_EAST, PANGO2_GRAVITY_SOUTH, PANGO2_GRAVITY_SOUTH },
+ { G_UNICODE_SCRIPT_LATIN, PANGO2_GRAVITY_SOUTH, PANGO2_GRAVITY_SOUTH, PANGO2_GRAVITY_SOUTH },
+ { G_UNICODE_SCRIPT_HANGUL, PANGO2_GRAVITY_EAST, PANGO2_GRAVITY_SOUTH, PANGO2_GRAVITY_SOUTH },
+ { G_UNICODE_SCRIPT_MONGOLIAN, PANGO2_GRAVITY_WEST, PANGO2_GRAVITY_SOUTH },
+ { G_UNICODE_SCRIPT_OGHAM, PANGO2_GRAVITY_WEST, PANGO2_GRAVITY_NORTH, PANGO2_GRAVITY_SOUTH },
+ { G_UNICODE_SCRIPT_TIBETAN, PANGO2_GRAVITY_SOUTH, PANGO2_GRAVITY_SOUTH, PANGO2_GRAVITY_SOUTH },
};
for (int i = 0; i < G_N_ELEMENTS (tests); i++)
{
- g_assert_true (pango_gravity_get_for_script (tests[i].script, PANGO_GRAVITY_AUTO, PANGO_GRAVITY_HINT_STRONG) == tests[i].gravity);
+ g_assert_true (pango2_gravity_get_for_script (tests[i].script, PANGO2_GRAVITY_AUTO, PANGO2_GRAVITY_HINT_STRONG) == tests[i].gravity);
- g_assert_true (pango_gravity_get_for_script_and_width (tests[i].script, FALSE, PANGO_GRAVITY_EAST, PANGO_GRAVITY_HINT_NATURAL) == tests[i].gravity_natural);
- g_assert_true (pango_gravity_get_for_script_and_width (tests[i].script, FALSE, PANGO_GRAVITY_EAST, PANGO_GRAVITY_HINT_STRONG) == PANGO_GRAVITY_EAST);
- g_assert_true (pango_gravity_get_for_script_and_width (tests[i].script, FALSE, PANGO_GRAVITY_EAST, PANGO_GRAVITY_HINT_LINE) == tests[i].gravity_line);
+ g_assert_true (pango2_gravity_get_for_script_and_width (tests[i].script, FALSE, PANGO2_GRAVITY_EAST, PANGO2_GRAVITY_HINT_NATURAL) == tests[i].gravity_natural);
+ g_assert_true (pango2_gravity_get_for_script_and_width (tests[i].script, FALSE, PANGO2_GRAVITY_EAST, PANGO2_GRAVITY_HINT_STRONG) == PANGO2_GRAVITY_EAST);
+ g_assert_true (pango2_gravity_get_for_script_and_width (tests[i].script, FALSE, PANGO2_GRAVITY_EAST, PANGO2_GRAVITY_HINT_LINE) == tests[i].gravity_line);
}
}
static void
test_fallback_shape (void)
{
- PangoContext *context;
+ Pango2Context *context;
const char *text;
GList *items, *l;
- PangoDirection dir;
+ Pango2Direction dir;
- context = pango_context_new ();
- dir = pango_context_get_base_dir (context);
+ context = pango2_context_new ();
+ dir = pango2_context_get_base_dir (context);
text = "Some text to sha​pe ﺄﻧﺍ ﻕﺍﺩﺭ ﻊﻟﻯ ﺄﻜﻟ ﺎﻟﺰﺟﺎﺟ ﻭ ﻩﺫﺍ ﻻ ﻱﺆﻠﻤﻨﻳ";
- items = pango_itemize (context, dir, text, 0, strlen (text), NULL);
+ items = pango2_itemize (context, dir, text, 0, strlen (text), NULL);
for (l = items; l; l = l->next)
{
- PangoItem *item = l->data;
- PangoGlyphString *glyphs;
+ Pango2Item *item = l->data;
+ Pango2GlyphString *glyphs;
/* We want to test fallback shaping, which happens when we don't have a font */
g_clear_object (&item->analysis.font);
- glyphs = pango_glyph_string_new ();
- pango_shape (text + item->offset, item->length, NULL, 0, &item->analysis, glyphs, PANGO_SHAPE_NONE);
+ glyphs = pango2_glyph_string_new ();
+ pango2_shape (text + item->offset, item->length, NULL, 0, &item->analysis, glyphs, PANGO2_SHAPE_NONE);
for (int i = 0; i < glyphs->num_glyphs; i++)
{
- PangoGlyph glyph = glyphs->glyphs[i].glyph;
- g_assert_true (glyph == PANGO_GLYPH_EMPTY || (glyph & PANGO_GLYPH_UNKNOWN_FLAG));
+ Pango2Glyph glyph = glyphs->glyphs[i].glyph;
+ g_assert_true (glyph == PANGO2_GLYPH_EMPTY || (glyph & PANGO2_GLYPH_UNKNOWN_FLAG));
}
- pango_glyph_string_free (glyphs);
+ pango2_glyph_string_free (glyphs);
}
- g_list_free_full (items, (GDestroyNotify)pango_item_free);
+ g_list_free_full (items, (GDestroyNotify)pango2_item_free);
g_object_unref (context);
}
@@ -384,23 +384,23 @@ test_fallback_shape (void)
static void
test_get_cursor_crash (void)
{
- PangoContext *context;
- PangoLayout *layout;
+ Pango2Context *context;
+ Pango2Layout *layout;
int i;
const char *string = "foo\n\rbar\r\nbaz\n\nqux\n\n..";
- context = pango_context_new ();
+ context = pango2_context_new ();
- layout = pango_layout_new (context);
+ layout = pango2_layout_new (context);
- pango_layout_set_text (layout, string, -1);
+ pango2_layout_set_text (layout, string, -1);
for (i = 0; string[i]; i++)
{
- PangoRectangle rectA, rectB;
+ Pango2Rectangle rectA, rectB;
- pango_lines_get_cursor_pos (pango_layout_get_lines (layout), NULL, i, &rectA, &rectB);
+ pango2_lines_get_cursor_pos (pango2_layout_get_lines (layout), NULL, i, &rectA, &rectB);
g_assert_cmpint (rectA.x, ==, rectB.x);
}
@@ -416,28 +416,28 @@ static void
test_get_cursor (void)
{
const char *text = "abאב";
- PangoContext *context;
- PangoLayout *layout;
- PangoRectangle strong, weak;
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2Rectangle strong, weak;
- context = pango_context_new ();
+ context = pango2_context_new ();
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, text, -1);
+ layout = pango2_layout_new (context);
+ pango2_layout_set_text (layout, text, -1);
- pango_lines_get_cursor_pos (pango_layout_get_lines (layout), NULL, 0, &strong, &weak);
+ pango2_lines_get_cursor_pos (pango2_layout_get_lines (layout), NULL, 0, &strong, &weak);
g_assert_cmpint (strong.x, ==, weak.x);
- pango_lines_get_cursor_pos (pango_layout_get_lines (layout), NULL, 1, &strong, &weak);
+ pango2_lines_get_cursor_pos (pango2_layout_get_lines (layout), NULL, 1, &strong, &weak);
g_assert_cmpint (strong.x, ==, weak.x);
- pango_lines_get_cursor_pos (pango_layout_get_lines (layout), NULL, 2, &strong, &weak);
+ pango2_lines_get_cursor_pos (pango2_layout_get_lines (layout), NULL, 2, &strong, &weak);
g_assert_cmpint (strong.x, !=, weak.x);
- pango_lines_get_cursor_pos (pango_layout_get_lines (layout), NULL, 4, &strong, &weak);
+ pango2_lines_get_cursor_pos (pango2_layout_get_lines (layout), NULL, 4, &strong, &weak);
g_assert_cmpint (strong.x, ==, weak.x);
- pango_lines_get_cursor_pos (pango_layout_get_lines (layout), NULL, 6, &strong, &weak);
+ pango2_lines_get_cursor_pos (pango2_layout_get_lines (layout), NULL, 6, &strong, &weak);
g_assert_cmpint (strong.x, !=, weak.x);
g_object_unref (layout);
@@ -447,40 +447,40 @@ test_get_cursor (void)
static void
test_index_to_x (void)
{
- PangoContext *context;
+ Pango2Context *context;
const char *tests[] = {
"ac­ual­ly", // soft hyphen
"ac​ual​ly", // zero-width space
};
- context = pango_context_new ();
+ context = pango2_context_new ();
for (int i = 0; i < G_N_ELEMENTS (tests); i++)
{
- PangoLayout *layout;
+ Pango2Layout *layout;
const char *text;
const char *p;
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, tests[i], -1);
- text = pango_layout_get_text (layout);
+ layout = pango2_layout_new (context);
+ pango2_layout_set_text (layout, tests[i], -1);
+ text = pango2_layout_get_text (layout);
for (p = text; *p; p = g_utf8_next_char (p))
{
int index = p - text;
- PangoLine *line;
+ Pango2Line *line;
int x;
int index2, trailing;
gunichar ch;
ch = g_utf8_get_char (p);
- pango_lines_index_to_line (pango_layout_get_lines (layout), index, &line, NULL, NULL, NULL);
+ pango2_lines_index_to_line (pango2_layout_get_lines (layout), index, &line, NULL, NULL, NULL);
g_assert_nonnull (line);
- pango_line_index_to_x (line, index, 0, &x);
- pango_line_x_to_index (line, x, &index2, &trailing);
- if (!pango_is_zero_width (ch))
+ pango2_line_index_to_x (line, index, 0, &x);
+ pango2_line_x_to_index (line, x, &index2, &trailing);
+ if (!pango2_is_zero_width (ch))
g_assert_cmpint (index, ==, index2);
}
@@ -491,8 +491,8 @@ test_index_to_x (void)
}
static gboolean
-pango_rectangle_contains (const PangoRectangle *r1,
- const PangoRectangle *r2)
+pango2_rectangle_contains (const Pango2Rectangle *r1,
+ const Pango2Rectangle *r2)
{
return r2->x >= r1->x &&
r2->y >= r1->y &&
@@ -503,13 +503,13 @@ pango_rectangle_contains (const PangoRectangle *r1,
static void
test_extents (void)
{
- PangoContext *context;
+ Pango2Context *context;
struct {
const char *text;
int width;
} tests[] = {
#if 0
- { "Some long text that has multiple lines that are wrapped by Pango.", 60 },
+ { "Some long text that has multiple lines that are wrapped by Pango2.", 60 },
{ "This paragraph should ac­tual­ly have multiple lines, unlike all the other wannabe äöü pa­ra­graph tests in this ugh test-case. Grow some lines!\n", 188 },
{ "你好 Hello שלום Γειά σας", 60 },
#endif
@@ -522,69 +522,69 @@ test_extents (void)
{ "pa­ra­graph", -1 }, // soft hyphens
};
- context = pango_context_new ();
+ context = pango2_context_new ();
for (int i = 0; i < G_N_ELEMENTS (tests); i++)
{
- PangoLayout *layout;
- PangoLines *lines;
- PangoLineIter *iter;
- PangoRectangle layout_extents;
- PangoRectangle line_extents;
- PangoRectangle run_extents;
- PangoRectangle cluster_extents;
- PangoRectangle char_extents;
- PangoRectangle pos;
- PangoRectangle strong, weak;
+ Pango2Layout *layout;
+ Pango2Lines *lines;
+ Pango2LineIter *iter;
+ Pango2Rectangle layout_extents;
+ Pango2Rectangle line_extents;
+ Pango2Rectangle run_extents;
+ Pango2Rectangle cluster_extents;
+ Pango2Rectangle char_extents;
+ Pango2Rectangle pos;
+ Pango2Rectangle strong, weak;
int index;
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, tests[i].text, -1);
- pango_layout_set_width (layout, tests[i].width > 0 ? tests[i].width * PANGO_SCALE : tests[i].width);
+ layout = pango2_layout_new (context);
+ pango2_layout_set_text (layout, tests[i].text, -1);
+ pango2_layout_set_width (layout, tests[i].width > 0 ? tests[i].width * PANGO2_SCALE : tests[i].width);
- lines = pango_layout_get_lines (layout);
- pango_lines_get_extents (lines, NULL, &layout_extents);
+ lines = pango2_layout_get_lines (layout);
+ pango2_lines_get_extents (lines, NULL, &layout_extents);
- iter = pango_lines_get_iter (lines);
+ iter = pango2_lines_get_iter (lines);
do
{
- PangoLeadingTrim trim = PANGO_LEADING_TRIM_NONE;
- PangoLine *line;
-
- line = pango_line_iter_get_line (iter);
- if (pango_line_is_paragraph_start (line))
- trim |= PANGO_LEADING_TRIM_START;
- if (pango_line_is_paragraph_end (line))
- trim |= PANGO_LEADING_TRIM_END;
-
- pango_line_iter_get_trimmed_line_extents (iter, trim, &line_extents);
-
- pango_line_iter_get_run_extents (iter, NULL, &run_extents);
- pango_line_iter_get_cluster_extents (iter, NULL, &cluster_extents);
- pango_line_iter_get_char_extents (iter, &char_extents);
- index = pango_line_iter_get_index (iter);
- pango_lines_index_to_pos (lines, NULL, index, &pos);
+ Pango2LeadingTrim trim = PANGO2_LEADING_TRIM_NONE;
+ Pango2Line *line;
+
+ line = pango2_line_iter_get_line (iter);
+ if (pango2_line_is_paragraph_start (line))
+ trim |= PANGO2_LEADING_TRIM_START;
+ if (pango2_line_is_paragraph_end (line))
+ trim |= PANGO2_LEADING_TRIM_END;
+
+ pango2_line_iter_get_trimmed_line_extents (iter, trim, &line_extents);
+
+ pango2_line_iter_get_run_extents (iter, NULL, &run_extents);
+ pango2_line_iter_get_cluster_extents (iter, NULL, &cluster_extents);
+ pango2_line_iter_get_char_extents (iter, &char_extents);
+ index = pango2_line_iter_get_index (iter);
+ pango2_lines_index_to_pos (lines, NULL, index, &pos);
if (pos.width < 0)
{
pos.x += pos.width;
pos.width = - pos.width;
}
- pango_lines_get_cursor_pos (lines, NULL, index, &strong, &weak);
+ pango2_lines_get_cursor_pos (lines, NULL, index, &strong, &weak);
- g_assert_true (pango_rectangle_contains (&layout_extents, &line_extents));
- g_assert_true (pango_rectangle_contains (&line_extents, &run_extents));
- g_assert_true (pango_rectangle_contains (&run_extents, &cluster_extents));
- g_assert_true (pango_rectangle_contains (&cluster_extents, &char_extents));
+ g_assert_true (pango2_rectangle_contains (&layout_extents, &line_extents));
+ g_assert_true (pango2_rectangle_contains (&line_extents, &run_extents));
+ g_assert_true (pango2_rectangle_contains (&run_extents, &cluster_extents));
+ g_assert_true (pango2_rectangle_contains (&cluster_extents, &char_extents));
- g_assert_true (pango_rectangle_contains (&run_extents, &pos));
- g_assert_true (pango_rectangle_contains (&run_extents, &pos));
- g_assert_true (pango_rectangle_contains (&line_extents, &strong));
- g_assert_true (pango_rectangle_contains (&line_extents, &weak));
+ g_assert_true (pango2_rectangle_contains (&run_extents, &pos));
+ g_assert_true (pango2_rectangle_contains (&run_extents, &pos));
+ g_assert_true (pango2_rectangle_contains (&line_extents, &strong));
+ g_assert_true (pango2_rectangle_contains (&line_extents, &weak));
}
- while (pango_line_iter_next_char (iter));
+ while (pango2_line_iter_next_char (iter));
- pango_line_iter_free (iter);
+ pango2_line_iter_free (iter);
g_object_unref (layout);
}
@@ -594,42 +594,42 @@ test_extents (void)
static void
test_empty_line_height (void)
{
- PangoContext *context;
- PangoLayout *layout;
- PangoFontDescription *description;
- PangoRectangle ext1, ext2, ext3;
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2FontDescription *description;
+ Pango2Rectangle ext1, ext2, ext3;
cairo_font_options_t *options;
int hint;
int size;
- context = pango_context_new ();
- description = pango_font_description_new ();
+ context = pango2_context_new ();
+ description = pango2_font_description_new ();
for (size = 10; size <= 20; size++)
{
- pango_font_description_set_size (description, size);
+ pango2_font_description_set_size (description, size);
for (hint = CAIRO_HINT_METRICS_OFF; hint <= CAIRO_HINT_METRICS_ON; hint++)
{
options = cairo_font_options_create ();
cairo_font_options_set_hint_metrics (options, hint);
- pango_cairo_context_set_font_options (context, options);
+ pango2_cairo_context_set_font_options (context, options);
cairo_font_options_destroy (options);
- layout = pango_layout_new (context);
- pango_layout_set_font_description (layout, description);
+ layout = pango2_layout_new (context);
+ pango2_layout_set_font_description (layout, description);
- pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext1);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), NULL, &ext1);
- pango_layout_set_text (layout, "a", 1);
+ pango2_layout_set_text (layout, "a", 1);
- pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext2);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), NULL, &ext2);
g_assert_cmpint (ext1.height, ==, ext2.height);
- pango_layout_set_text (layout, "Pg", 1);
+ pango2_layout_set_text (layout, "Pg", 1);
- pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext3);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), NULL, &ext3);
g_assert_cmpint (ext2.height, ==, ext3.height);
@@ -637,97 +637,97 @@ test_empty_line_height (void)
}
}
- pango_font_description_free (description);
+ pango2_font_description_free (description);
g_object_unref (context);
}
static void
test_gravity_metrics (void)
{
- PangoFontMap *map;
- PangoContext *context;
- PangoFontDescription *desc;
- PangoFont *font;
- PangoGlyph glyph;
- PangoGravity gravity;
- PangoRectangle ink[4];
- PangoRectangle log[4];
+ Pango2FontMap *map;
+ Pango2Context *context;
+ Pango2FontDescription *desc;
+ Pango2Font *font;
+ Pango2Glyph glyph;
+ Pango2Gravity gravity;
+ Pango2Rectangle ink[4];
+ Pango2Rectangle log[4];
- map = pango_font_map_get_default ();
- context = pango_context_new_with_font_map (map);
+ map = pango2_font_map_get_default ();
+ context = pango2_context_new_with_font_map (map);
- desc = pango_font_description_from_string ("Cantarell 64");
+ desc = pango2_font_description_from_string ("Cantarell 64");
glyph = 1; /* A */
- for (gravity = PANGO_GRAVITY_SOUTH; gravity <= PANGO_GRAVITY_WEST; gravity++)
+ for (gravity = PANGO2_GRAVITY_SOUTH; gravity <= PANGO2_GRAVITY_WEST; gravity++)
{
- pango_font_description_set_gravity (desc, gravity);
- font = pango_font_map_load_font (map, context, desc);
- pango_font_get_glyph_extents (font, glyph, &ink[gravity], &log[gravity]);
+ pango2_font_description_set_gravity (desc, gravity);
+ font = pango2_font_map_load_font (map, context, desc);
+ pango2_font_get_glyph_extents (font, glyph, &ink[gravity], &log[gravity]);
g_object_unref (font);
}
- g_assert_cmpint (ink[PANGO_GRAVITY_EAST].width, ==, ink[PANGO_GRAVITY_SOUTH].height);
- g_assert_cmpint (ink[PANGO_GRAVITY_EAST].height, ==, ink[PANGO_GRAVITY_SOUTH].width);
- g_assert_cmpint (ink[PANGO_GRAVITY_NORTH].width, ==, ink[PANGO_GRAVITY_SOUTH].width);
- g_assert_cmpint (ink[PANGO_GRAVITY_NORTH].height, ==, ink[PANGO_GRAVITY_SOUTH].height);
- g_assert_cmpint (ink[PANGO_GRAVITY_WEST].width, ==, ink[PANGO_GRAVITY_SOUTH].height);
- g_assert_cmpint (ink[PANGO_GRAVITY_WEST].height, ==, ink[PANGO_GRAVITY_SOUTH].width);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_EAST].width, ==, ink[PANGO2_GRAVITY_SOUTH].height);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_EAST].height, ==, ink[PANGO2_GRAVITY_SOUTH].width);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_NORTH].width, ==, ink[PANGO2_GRAVITY_SOUTH].width);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_NORTH].height, ==, ink[PANGO2_GRAVITY_SOUTH].height);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_WEST].width, ==, ink[PANGO2_GRAVITY_SOUTH].height);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_WEST].height, ==, ink[PANGO2_GRAVITY_SOUTH].width);
- g_assert_cmpint (log[PANGO_GRAVITY_SOUTH].width, ==, - log[PANGO_GRAVITY_NORTH].width);
- g_assert_cmpint (log[PANGO_GRAVITY_EAST].width, ==, - log[PANGO_GRAVITY_WEST].width);
+ g_assert_cmpint (log[PANGO2_GRAVITY_SOUTH].width, ==, - log[PANGO2_GRAVITY_NORTH].width);
+ g_assert_cmpint (log[PANGO2_GRAVITY_EAST].width, ==, - log[PANGO2_GRAVITY_WEST].width);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_object_unref (context);
}
static void
test_gravity_metrics2 (void)
{
- PangoFontMap *map;
- PangoContext *context;
- PangoFontDescription *desc;
- PangoFont *font;
- PangoGlyph glyph;
- PangoGravity gravity;
- PangoRectangle ink[4];
- PangoRectangle log[4];
+ Pango2FontMap *map;
+ Pango2Context *context;
+ Pango2FontDescription *desc;
+ Pango2Font *font;
+ Pango2Glyph glyph;
+ Pango2Gravity gravity;
+ Pango2Rectangle ink[4];
+ Pango2Rectangle log[4];
char *path;
- map = pango_font_map_new ();
+ map = pango2_font_map_new ();
path = g_test_build_filename (G_TEST_DIST, "fonts", "Cantarell-VF.otf", NULL);
- pango_font_map_add_file (map, path);
+ pango2_font_map_add_file (map, path);
g_free (path);
- context = pango_context_new_with_font_map (PANGO_FONT_MAP (map));
+ context = pango2_context_new_with_font_map (PANGO2_FONT_MAP (map));
- desc = pango_font_description_from_string ("Cantarell 64");
+ desc = pango2_font_description_from_string ("Cantarell 64");
glyph = 1; /* A */
- for (gravity = PANGO_GRAVITY_SOUTH; gravity <= PANGO_GRAVITY_WEST; gravity++)
+ for (gravity = PANGO2_GRAVITY_SOUTH; gravity <= PANGO2_GRAVITY_WEST; gravity++)
{
- pango_font_description_set_gravity (desc, gravity);
- font = pango_font_map_load_font (PANGO_FONT_MAP (map), context, desc);
- pango_font_get_glyph_extents (font, glyph, &ink[gravity], &log[gravity]);
+ pango2_font_description_set_gravity (desc, gravity);
+ font = pango2_font_map_load_font (PANGO2_FONT_MAP (map), context, desc);
+ pango2_font_get_glyph_extents (font, glyph, &ink[gravity], &log[gravity]);
g_object_unref (font);
}
- g_assert_cmpint (ink[PANGO_GRAVITY_EAST].width, ==, ink[PANGO_GRAVITY_SOUTH].height);
- g_assert_cmpint (ink[PANGO_GRAVITY_EAST].height, ==, ink[PANGO_GRAVITY_SOUTH].width);
- g_assert_cmpint (ink[PANGO_GRAVITY_NORTH].width, ==, ink[PANGO_GRAVITY_SOUTH].width);
- g_assert_cmpint (ink[PANGO_GRAVITY_NORTH].height, ==, ink[PANGO_GRAVITY_SOUTH].height);
- g_assert_cmpint (ink[PANGO_GRAVITY_WEST].width, ==, ink[PANGO_GRAVITY_SOUTH].height);
- g_assert_cmpint (ink[PANGO_GRAVITY_WEST].height, ==, ink[PANGO_GRAVITY_SOUTH].width);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_EAST].width, ==, ink[PANGO2_GRAVITY_SOUTH].height);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_EAST].height, ==, ink[PANGO2_GRAVITY_SOUTH].width);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_NORTH].width, ==, ink[PANGO2_GRAVITY_SOUTH].width);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_NORTH].height, ==, ink[PANGO2_GRAVITY_SOUTH].height);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_WEST].width, ==, ink[PANGO2_GRAVITY_SOUTH].height);
+ g_assert_cmpint (ink[PANGO2_GRAVITY_WEST].height, ==, ink[PANGO2_GRAVITY_SOUTH].width);
/* Seems that harfbuzz has some off-by-one differences in advance width
* when fonts differ by a scale of -1.
*/
- g_assert_cmpint (log[PANGO_GRAVITY_SOUTH].width + log[PANGO_GRAVITY_NORTH].width, <=, 1);
- g_assert_cmpint (log[PANGO_GRAVITY_EAST].width, ==, log[PANGO_GRAVITY_WEST].width);
+ g_assert_cmpint (log[PANGO2_GRAVITY_SOUTH].width + log[PANGO2_GRAVITY_NORTH].width, <=, 1);
+ g_assert_cmpint (log[PANGO2_GRAVITY_EAST].width, ==, log[PANGO2_GRAVITY_WEST].width);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_object_unref (context);
g_object_unref (map);
}
@@ -735,34 +735,34 @@ test_gravity_metrics2 (void)
static void
test_transform_rectangle (void)
{
- PangoMatrix matrix = PANGO_MATRIX_INIT;
- PangoRectangle rect;
- PangoRectangle rect2;
+ Pango2Matrix matrix = PANGO2_MATRIX_INIT;
+ Pango2Rectangle rect;
+ Pango2Rectangle rect2;
- rect = rect2 = (PangoRectangle) { 10 * PANGO_SCALE, 20 * PANGO_SCALE, 30 * PANGO_SCALE, 40 * PANGO_SCALE };
- pango_matrix_transform_rectangle (&matrix, &rect2);
+ rect = rect2 = (Pango2Rectangle) { 10 * PANGO2_SCALE, 20 * PANGO2_SCALE, 30 * PANGO2_SCALE, 40 * PANGO2_SCALE };
+ pango2_matrix_transform_rectangle (&matrix, &rect2);
g_assert_cmpint (rect2.x, ==, rect.x);
g_assert_cmpint (rect2.y, ==, rect.y);
g_assert_cmpint (rect2.width, ==, rect.width);
g_assert_cmpint (rect2.height, ==, rect.height);
- matrix = (PangoMatrix) PANGO_MATRIX_INIT;
- pango_matrix_translate (&matrix, 10, 20);
+ matrix = (Pango2Matrix) PANGO2_MATRIX_INIT;
+ pango2_matrix_translate (&matrix, 10, 20);
- pango_matrix_transform_rectangle (&matrix, &rect2);
+ pango2_matrix_transform_rectangle (&matrix, &rect2);
- g_assert_cmpint (rect2.x, ==, rect.x + 10 * PANGO_SCALE);
- g_assert_cmpint (rect2.y, ==, rect.y + 20 * PANGO_SCALE);
+ g_assert_cmpint (rect2.x, ==, rect.x + 10 * PANGO2_SCALE);
+ g_assert_cmpint (rect2.y, ==, rect.y + 20 * PANGO2_SCALE);
g_assert_cmpint (rect2.width, ==, rect.width);
g_assert_cmpint (rect2.height, ==, rect.height);
rect2 = rect;
- matrix = (PangoMatrix) PANGO_MATRIX_INIT;
- pango_matrix_rotate (&matrix, -90);
+ matrix = (Pango2Matrix) PANGO2_MATRIX_INIT;
+ pango2_matrix_rotate (&matrix, -90);
- pango_matrix_transform_rectangle (&matrix, &rect2);
+ pango2_matrix_transform_rectangle (&matrix, &rect2);
g_assert_cmpint (rect2.x, ==, - (rect.y + rect.height));
g_assert_cmpint (rect2.y, ==, rect.x);
@@ -773,20 +773,20 @@ test_transform_rectangle (void)
static void
test_wrap_char (void)
{
- PangoContext *context;
- PangoLayout *layout;
- PangoRectangle ext, ext1;
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2Rectangle ext, ext1;
- context = pango_context_new ();
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, "Rows can have suffix widgets", -1);
- pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
+ context = pango2_context_new ();
+ layout = pango2_layout_new (context);
+ pango2_layout_set_text (layout, "Rows can have suffix widgets", -1);
+ pango2_layout_set_wrap (layout, PANGO2_WRAP_WORD_CHAR);
- pango_layout_set_width (layout, 0);
- pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+ pango2_layout_set_width (layout, 0);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), NULL, &ext);
- pango_layout_set_width (layout, ext.width);
- pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext1);
+ pango2_layout_set_width (layout, ext.width);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), NULL, &ext1);
g_assert_cmpint (ext.width, ==, ext1.width);
g_assert_cmpint (ext.height, >=, ext1.height);
@@ -799,21 +799,21 @@ test_wrap_char (void)
static void
test_small_caps_crash (void)
{
- PangoContext *context;
- PangoLayout *layout;
- PangoFontDescription *desc;
- PangoRectangle ext;
+ Pango2Context *context;
+ Pango2Layout *layout;
+ Pango2FontDescription *desc;
+ Pango2Rectangle ext;
- context = pango_context_new ();
- layout = pango_layout_new (context);
- desc = pango_font_description_from_string ("Cantarell Small-Caps 11");
- pango_layout_set_font_description (layout, desc);
+ context = pango2_context_new ();
+ layout = pango2_layout_new (context);
+ desc = pango2_font_description_from_string ("Cantarell Small-Caps 11");
+ pango2_layout_set_font_description (layout, desc);
- pango_layout_set_text (layout, "Pere Ràfols Soler\nEqualiser, LV2\nAudio: 1, 1\nMidi: 0, 0\nControls: 53, 2\nCV: 0, 0", -1);
+ pango2_layout_set_text (layout, "Pere Ràfols Soler\nEqualiser, LV2\nAudio: 1, 1\nMidi: 0, 0\nControls: 53, 2\nCV: 0, 0", -1);
- pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &ext);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), NULL, &ext);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_object_unref (layout);
g_object_unref (context);
}
diff --git a/tests/testrandom.c b/tests/testrandom.c
index 02469587..8d7b19c4 100644
--- a/tests/testrandom.c
+++ b/tests/testrandom.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
* testmisc.c: Test program for miscellaneous things
*
* Copyright (C) 2021 Benjamin Otte
@@ -33,24 +33,24 @@ static char **rtl_words;
static gsize n_rtl_words;
static const char *
-random_word (PangoDirection dir)
+random_word (Pango2Direction dir)
{
switch (dir)
{
- case PANGO_DIRECTION_LTR:
+ case PANGO2_DIRECTION_LTR:
return ltr_words[g_test_rand_int_range (0, n_ltr_words)];
- case PANGO_DIRECTION_RTL:
+ case PANGO2_DIRECTION_RTL:
return rtl_words[g_test_rand_int_range (0, n_rtl_words)];
- case PANGO_DIRECTION_WEAK_LTR:
- case PANGO_DIRECTION_WEAK_RTL:
- case PANGO_DIRECTION_NEUTRAL:
+ case PANGO2_DIRECTION_WEAK_LTR:
+ case PANGO2_DIRECTION_WEAK_RTL:
+ case PANGO2_DIRECTION_NEUTRAL:
default:
- return random_word (g_test_rand_bit () ? PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL);
+ return random_word (g_test_rand_bit () ? PANGO2_DIRECTION_LTR : PANGO2_DIRECTION_RTL);
}
}
static char *
-create_random_sentence (PangoDirection dir)
+create_random_sentence (Pango2Direction dir)
{
GString *string = g_string_new (NULL);
gsize i, n_words;
@@ -90,38 +90,38 @@ compare_size (gconstpointer a,
}
static void
-layout_check_size (PangoLayout *layout,
+layout_check_size (Pango2Layout *layout,
int width,
Size *out_size)
{
out_size->set_width = width;
- pango_layout_set_width (layout, width);
- pango_lines_get_size (pango_layout_get_lines (layout), &out_size->width, &out_size->height);
+ pango2_layout_set_width (layout, width);
+ pango2_lines_get_size (pango2_layout_get_lines (layout), &out_size->width, &out_size->height);
}
static void
test_wrap_char (gconstpointer data)
{
- PangoDirection dir = GPOINTER_TO_UINT (data);
- PangoFontDescription *desc;
- PangoContext *context;
- PangoLayout *layout;
+ Pango2Direction dir = GPOINTER_TO_UINT (data);
+ Pango2FontDescription *desc;
+ Pango2Context *context;
+ Pango2Layout *layout;
char *sentence;
Size min, max;
Size sizes[100];
gsize i, j;
- context = pango_context_new ();
- desc = pango_font_description_from_string ("Sans 10");
- layout = pango_layout_new (context);
- pango_layout_set_font_description (layout, desc);
- pango_font_description_free (desc);
- pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
+ context = pango2_context_new ();
+ desc = pango2_font_description_from_string ("Sans 10");
+ layout = pango2_layout_new (context);
+ pango2_layout_set_font_description (layout, desc);
+ pango2_font_description_free (desc);
+ pango2_layout_set_wrap (layout, PANGO2_WRAP_WORD_CHAR);
for (j = 0; j < N_SENTENCES; j++)
{
sentence = create_random_sentence (dir);
- pango_layout_set_text (layout, sentence, -1);
+ pango2_layout_set_text (layout, sentence, -1);
g_test_message ("%s", sentence);
g_free (sentence);
@@ -172,29 +172,29 @@ test_wrap_char (gconstpointer data)
static void
test_wrap_char_min_width (gconstpointer data)
{
- PangoDirection dir = GPOINTER_TO_UINT (data);
- PangoFontDescription *desc;
- PangoContext *context;
- PangoLayout *test_layout, *ref_layout;
+ Pango2Direction dir = GPOINTER_TO_UINT (data);
+ Pango2FontDescription *desc;
+ Pango2Context *context;
+ Pango2Layout *test_layout, *ref_layout;
char *sentence, *s;
GString *ref_string;
gsize j;
int test_width, ref_width;
- context = pango_context_new ();
- desc = pango_font_description_from_string ("Sans 10");
- ref_layout = pango_layout_new (context);
- pango_layout_set_font_description (ref_layout, desc);
- test_layout = pango_layout_new (context);
- pango_layout_set_font_description (test_layout, desc);
- pango_layout_set_wrap (test_layout, PANGO_WRAP_WORD_CHAR);
- pango_layout_set_width (test_layout, 0);
- pango_font_description_free (desc);
+ context = pango2_context_new ();
+ desc = pango2_font_description_from_string ("Sans 10");
+ ref_layout = pango2_layout_new (context);
+ pango2_layout_set_font_description (ref_layout, desc);
+ test_layout = pango2_layout_new (context);
+ pango2_layout_set_font_description (test_layout, desc);
+ pango2_layout_set_wrap (test_layout, PANGO2_WRAP_WORD_CHAR);
+ pango2_layout_set_width (test_layout, 0);
+ pango2_font_description_free (desc);
for (j = 0; j < N_SENTENCES; j++)
{
sentence = create_random_sentence (dir);
- pango_layout_set_text (test_layout, sentence, -1);
+ pango2_layout_set_text (test_layout, sentence, -1);
g_test_message ("%s", sentence);
ref_string = g_string_new ("");
for (s = sentence; *s; s = g_utf8_next_char (s))
@@ -203,12 +203,12 @@ test_wrap_char_min_width (gconstpointer data)
g_string_append_unichar (ref_string, g_test_rand_bit () ? 0x2010 : '-');
g_string_append_c (ref_string, '\n');
}
- pango_layout_set_text (ref_layout, ref_string->str, ref_string->len);
+ pango2_layout_set_text (ref_layout, ref_string->str, ref_string->len);
g_string_free (ref_string, TRUE);
g_free (sentence);
- pango_lines_get_size (pango_layout_get_lines (test_layout), &test_width, NULL);
- pango_lines_get_size (pango_layout_get_lines (ref_layout), &ref_width, NULL);
+ pango2_lines_get_size (pango2_layout_get_lines (test_layout), &test_width, NULL);
+ pango2_lines_get_size (pango2_layout_get_lines (ref_layout), &ref_width, NULL);
g_assert_cmpint (test_width, <=, ref_width);
}
@@ -303,12 +303,12 @@ main (int argc, char *argv[])
rtl_words = init_rtl_words ();
n_rtl_words = g_strv_length (rtl_words);
- g_test_add_data_func ("/layout/ltr/wrap-char", GUINT_TO_POINTER (PANGO_DIRECTION_LTR), test_wrap_char);
- g_test_add_data_func ("/layout/rtl/wrap-char", GUINT_TO_POINTER (PANGO_DIRECTION_RTL), test_wrap_char);
- g_test_add_data_func ("/layout/any/wrap-char", GUINT_TO_POINTER (PANGO_DIRECTION_NEUTRAL), test_wrap_char);
- g_test_add_data_func ("/layout/ltr/wrap-char-min-width", GUINT_TO_POINTER (PANGO_DIRECTION_LTR), test_wrap_char_min_width);
- g_test_add_data_func ("/layout/rtl/wrap-char-min-width", GUINT_TO_POINTER (PANGO_DIRECTION_RTL), test_wrap_char_min_width);
- g_test_add_data_func ("/layout/any/wrap-char-min-width", GUINT_TO_POINTER (PANGO_DIRECTION_NEUTRAL), test_wrap_char_min_width);
+ g_test_add_data_func ("/layout/ltr/wrap-char", GUINT_TO_POINTER (PANGO2_DIRECTION_LTR), test_wrap_char);
+ g_test_add_data_func ("/layout/rtl/wrap-char", GUINT_TO_POINTER (PANGO2_DIRECTION_RTL), test_wrap_char);
+ g_test_add_data_func ("/layout/any/wrap-char", GUINT_TO_POINTER (PANGO2_DIRECTION_NEUTRAL), test_wrap_char);
+ g_test_add_data_func ("/layout/ltr/wrap-char-min-width", GUINT_TO_POINTER (PANGO2_DIRECTION_LTR), test_wrap_char_min_width);
+ g_test_add_data_func ("/layout/rtl/wrap-char-min-width", GUINT_TO_POINTER (PANGO2_DIRECTION_RTL), test_wrap_char_min_width);
+ g_test_add_data_func ("/layout/any/wrap-char-min-width", GUINT_TO_POINTER (PANGO2_DIRECTION_NEUTRAL), test_wrap_char_min_width);
result = g_test_run ();
diff --git a/tests/testscript.c b/tests/testscript.c
index 026e6a25..435c9d4e 100644
--- a/tests/testscript.c
+++ b/tests/testscript.c
@@ -1,6 +1,6 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
-/* Pango
- * testscript.c: Test cases for PangoScriptIter
+/* Pango2
+ * testscript.c: Test cases for Pango2ScriptIter
*
* Copyright (C) 2002 Red Hat Software
*
@@ -142,8 +142,8 @@ test_script_iter (void)
{ "\\U00010400\\U00010401\\U00010402\\U00010403", NULL, G_UNICODE_SCRIPT_DESERET }
};
- PangoScriptIter *iter;
- PangoScriptIter *iter2;
+ Pango2ScriptIter *iter;
+ Pango2ScriptIter *iter2;
GString *all = g_string_new (FALSE);
char *pos;
const char *start;
@@ -157,9 +157,9 @@ test_script_iter (void)
g_string_append (all, test_data[i].run_text);
}
- iter = pango_script_iter_new (all->str, -1);
+ iter = pango2_script_iter_new (all->str, -1);
- iter2 = g_boxed_copy (pango_script_iter_get_type (), iter);
+ iter2 = g_boxed_copy (pango2_script_iter_get_type (), iter);
g_test_message ("Total length: %" G_GSIZE_FORMAT "\n", all->len);
@@ -169,7 +169,7 @@ test_script_iter (void)
char *next_pos = pos + strlen (test_data[i].run_text);
gboolean result;
- pango_script_iter_get_range (iter, &start, &end, &script);
+ pango2_script_iter_get_range (iter, &start, &end, &script);
g_test_message ("Range: %d-%d: %d\n",
(int) (start - all->str),
@@ -180,34 +180,34 @@ test_script_iter (void)
g_assert_true (end == next_pos);
g_assert_true (script == test_data[i].run_code);
- result = pango_script_iter_next (iter);
+ result = pango2_script_iter_next (iter);
g_assert_true (result == (i != G_N_ELEMENTS (test_data) - 1));
pos = next_pos;
}
/* Check that copying the iter worked */
- pango_script_iter_get_range (iter2, &start, &end, &script);
+ pango2_script_iter_get_range (iter2, &start, &end, &script);
g_assert_true (start == all->str);
g_assert_true (end == all->str + strlen (test_data[0].run_text));
g_assert_true (script == test_data[0].run_code);
- pango_script_iter_free (iter2);
+ pango2_script_iter_free (iter2);
- pango_script_iter_free (iter);
+ pango2_script_iter_free (iter);
/*
* Test an empty string.
*/
- iter = pango_script_iter_new (all->str, 0);
+ iter = pango2_script_iter_new (all->str, 0);
- pango_script_iter_get_range (iter, &start, &end, &script);
+ pango2_script_iter_get_range (iter, &start, &end, &script);
g_assert_true (start == all->str);
g_assert_true (end == all->str);
g_assert_true (script == G_UNICODE_SCRIPT_COMMON);
- g_assert_true (!pango_script_iter_next (iter));
+ g_assert_true (!pango2_script_iter_next (iter));
- pango_script_iter_free (iter);
+ pango2_script_iter_free (iter);
/* Cleanup */
diff --git a/tests/testserialize.c b/tests/testserialize.c
index 4317da42..60333d1f 100644
--- a/tests/testserialize.c
+++ b/tests/testserialize.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -59,22 +59,22 @@ test_serialize_attr_list (void)
for (int i = 0; i < G_N_ELEMENTS (valid); i++)
{
- PangoAttrList *attrs;
+ Pango2AttrList *attrs;
char *str;
- attrs = pango_attr_list_from_string (valid[i]);
+ attrs = pango2_attr_list_from_string (valid[i]);
g_assert_nonnull (attrs);
- str = pango_attr_list_to_string (attrs);
+ str = pango2_attr_list_to_string (attrs);
g_assert_cmpstr (str, ==, roundtripped[i]);
g_free (str);
- pango_attr_list_unref (attrs);
+ pango2_attr_list_unref (attrs);
}
for (int i = 0; i < G_N_ELEMENTS (invalid); i++)
{
- PangoAttrList *attrs;
+ Pango2AttrList *attrs;
- attrs = pango_attr_list_from_string (invalid[i]);
+ attrs = pango2_attr_list_from_string (invalid[i]);
g_assert_null (attrs);
}
}
@@ -110,22 +110,22 @@ test_serialize_tab_array (void)
for (int i = 0; i < G_N_ELEMENTS (valid); i++)
{
- PangoTabArray *tabs;
+ Pango2TabArray *tabs;
char *str;
- tabs = pango_tab_array_from_string (valid[i]);
+ tabs = pango2_tab_array_from_string (valid[i]);
g_assert_nonnull (tabs);
- str = pango_tab_array_to_string (tabs);
+ str = pango2_tab_array_to_string (tabs);
g_assert_cmpstr (str, ==, roundtripped[i]);
g_free (str);
- pango_tab_array_free (tabs);
+ pango2_tab_array_free (tabs);
}
for (int i = 0; i < G_N_ELEMENTS (invalid); i++)
{
- PangoTabArray *tabs;
+ Pango2TabArray *tabs;
- tabs = pango_tab_array_from_string (invalid[i]);
+ tabs = pango2_tab_array_from_string (invalid[i]);
g_assert_null (tabs);
}
}
@@ -133,10 +133,10 @@ test_serialize_tab_array (void)
static void
test_serialize_font (void)
{
- PangoContext *context;
- PangoFontDescription *desc;
- PangoFont *font;
- PangoFont *font2;
+ Pango2Context *context;
+ Pango2FontDescription *desc;
+ Pango2Font *font;
+ Pango2Font *font2;
GBytes *bytes;
GBytes *bytes2;
GError *error = NULL;
@@ -157,11 +157,11 @@ test_serialize_font (void)
" ]\n"
"}";
- context = pango_context_new ();
- desc = pango_font_description_from_string ("Cantarell Italic 20 @wght=600");
- font = pango_context_load_font (context, desc);
+ context = pango2_context_new ();
+ desc = pango2_font_description_from_string ("Cantarell Italic 20 @wght=600");
+ font = pango2_context_load_font (context, desc);
- bytes = pango_font_serialize (font);
+ bytes = pango2_font_serialize (font);
if (strcmp (g_bytes_get_data (bytes, NULL), expected) != 0)
{
g_print ("expected\n%s\n", expected);
@@ -169,16 +169,16 @@ test_serialize_font (void)
}
g_assert_cmpstr (g_bytes_get_data (bytes, NULL), ==, expected);
- font2 = pango_font_deserialize (context, bytes, &error);
+ font2 = pango2_font_deserialize (context, bytes, &error);
g_assert_no_error (error);
g_assert_nonnull (font2);
- bytes2 = pango_font_serialize (font2);
+ bytes2 = pango2_font_serialize (font2);
g_assert_true (g_bytes_equal (bytes2, bytes));
g_object_unref (font);
g_object_unref (font2);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_bytes_unref (bytes);
g_bytes_unref (bytes2);
@@ -193,28 +193,28 @@ test_serialize_layout_minimal (void)
" \"text\" : \"Almost nothing\"\n"
"}\n";
- PangoContext *context;
+ Pango2Context *context;
GBytes *bytes;
- PangoLayout *layout;
+ Pango2Layout *layout;
GError *error = NULL;
GBytes *out_bytes;
const char *str;
- context = pango_context_new ();
+ context = pango2_context_new ();
bytes = g_bytes_new_static (test, strlen (test) + 1);
- layout = pango_layout_deserialize (context, bytes, PANGO_LAYOUT_DESERIALIZE_DEFAULT, &error);
+ layout = pango2_layout_deserialize (context, bytes, PANGO2_LAYOUT_DESERIALIZE_DEFAULT, &error);
g_assert_no_error (error);
- g_assert_true (PANGO_IS_LAYOUT (layout));
- g_assert_cmpstr (pango_layout_get_text (layout), ==, "Almost nothing");
- g_assert_null (pango_layout_get_attributes (layout));
- g_assert_null (pango_layout_get_tabs (layout));
- g_assert_null (pango_layout_get_font_description (layout));
- g_assert_cmpint (pango_layout_get_alignment (layout), ==, PANGO_ALIGN_NATURAL);
- g_assert_cmpint (pango_layout_get_width (layout), ==, -1);
-
- out_bytes = pango_layout_serialize (layout, PANGO_LAYOUT_SERIALIZE_DEFAULT);
+ g_assert_true (PANGO2_IS_LAYOUT (layout));
+ g_assert_cmpstr (pango2_layout_get_text (layout), ==, "Almost nothing");
+ g_assert_null (pango2_layout_get_attributes (layout));
+ g_assert_null (pango2_layout_get_tabs (layout));
+ g_assert_null (pango2_layout_get_font_description (layout));
+ g_assert_cmpint (pango2_layout_get_alignment (layout), ==, PANGO2_ALIGN_NATURAL);
+ g_assert_cmpint (pango2_layout_get_width (layout), ==, -1);
+
+ out_bytes = pango2_layout_serialize (layout, PANGO2_LAYOUT_SERIALIZE_DEFAULT);
str = g_bytes_get_data (out_bytes, NULL);
g_assert_cmpstr (str, ==, test);
@@ -276,31 +276,31 @@ test_serialize_layout_valid (void)
" \"line-height\" : 1.5\n"
"}\n";
- PangoContext *context;
+ Pango2Context *context;
GBytes *bytes;
- PangoLayout *layout;
+ Pango2Layout *layout;
GError *error = NULL;
GBytes *out_bytes;
char *s;
- context = pango_context_new ();
+ context = pango2_context_new ();
bytes = g_bytes_new_static (test, strlen (test) + 1);
- layout = pango_layout_deserialize (context, bytes, PANGO_LAYOUT_DESERIALIZE_DEFAULT, &error);
+ layout = pango2_layout_deserialize (context, bytes, PANGO2_LAYOUT_DESERIALIZE_DEFAULT, &error);
g_assert_no_error (error);
- g_assert_true (PANGO_IS_LAYOUT (layout));
- g_assert_cmpstr (pango_layout_get_text (layout), ==, "Some fun with layouts!");
- g_assert_nonnull (pango_layout_get_attributes (layout));
- g_assert_nonnull (pango_layout_get_tabs (layout));
- s = pango_font_description_to_string (pango_layout_get_font_description (layout));
+ g_assert_true (PANGO2_IS_LAYOUT (layout));
+ g_assert_cmpstr (pango2_layout_get_text (layout), ==, "Some fun with layouts!");
+ g_assert_nonnull (pango2_layout_get_attributes (layout));
+ g_assert_nonnull (pango2_layout_get_tabs (layout));
+ s = pango2_font_description_to_string (pango2_layout_get_font_description (layout));
g_assert_cmpstr (s, ==, "Sans Bold 32");
g_free (s);
- g_assert_cmpint (pango_layout_get_alignment (layout), ==, PANGO_ALIGN_CENTER);
- g_assert_cmpint (pango_layout_get_width (layout), ==, 350000);
- g_assert_cmpfloat_with_epsilon (pango_layout_get_line_height (layout), 1.5, 0.0001);
+ g_assert_cmpint (pango2_layout_get_alignment (layout), ==, PANGO2_ALIGN_CENTER);
+ g_assert_cmpint (pango2_layout_get_width (layout), ==, 350000);
+ g_assert_cmpfloat_with_epsilon (pango2_layout_get_line_height (layout), 1.5, 0.0001);
- out_bytes = pango_layout_serialize (layout, PANGO_LAYOUT_SERIALIZE_DEFAULT);
+ out_bytes = pango2_layout_serialize (layout, PANGO2_LAYOUT_SERIALIZE_DEFAULT);
if (strcmp (g_bytes_get_data (out_bytes, NULL), g_bytes_get_data (bytes, NULL)) != 0)
{
@@ -331,23 +331,23 @@ test_serialize_layout_context (void)
" \"text\" : \"Some fun with layouts!\"\n"
"}\n";
- PangoContext *context;
+ Pango2Context *context;
GBytes *bytes;
- PangoLayout *layout;
+ Pango2Layout *layout;
GError *error = NULL;
- context = pango_context_new ();
+ context = pango2_context_new ();
bytes = g_bytes_new_static (test, strlen (test) + 1);
- layout = pango_layout_deserialize (context, bytes, PANGO_LAYOUT_DESERIALIZE_CONTEXT, &error);
+ layout = pango2_layout_deserialize (context, bytes, PANGO2_LAYOUT_DESERIALIZE_CONTEXT, &error);
g_assert_no_error (error);
- g_assert_true (PANGO_IS_LAYOUT (layout));
- g_assert_cmpstr (pango_layout_get_text (layout), ==, "Some fun with layouts!");
+ g_assert_true (PANGO2_IS_LAYOUT (layout));
+ g_assert_cmpstr (pango2_layout_get_text (layout), ==, "Some fun with layouts!");
- g_assert_cmpint (pango_context_get_base_gravity (context), ==, PANGO_GRAVITY_EAST);
- g_assert_true (pango_context_get_language (context) == pango_language_from_string ("de-de"));
- g_assert_false (pango_context_get_round_glyph_positions (context));
+ g_assert_cmpint (pango2_context_get_base_gravity (context), ==, PANGO2_GRAVITY_EAST);
+ g_assert_true (pango2_context_get_language (context) == pango2_language_from_string ("de-de"));
+ g_assert_false (pango2_context_get_round_glyph_positions (context));
g_object_unref (layout);
g_bytes_unref (bytes);
@@ -369,7 +369,7 @@ test_serialize_layout_invalid (void)
" }\n"
" ]\n"
"}\n",
- PANGO_LAYOUT_DESERIALIZE_MISSING_VALUE
+ PANGO2_LAYOUT_DESERIALIZE_MISSING_VALUE
},
{
"{\n"
@@ -379,7 +379,7 @@ test_serialize_layout_invalid (void)
" }\n"
" ]\n"
"}\n",
- PANGO_LAYOUT_DESERIALIZE_MISSING_VALUE
+ PANGO2_LAYOUT_DESERIALIZE_MISSING_VALUE
},
{
"{\n"
@@ -390,13 +390,13 @@ test_serialize_layout_invalid (void)
" }\n"
" ]\n"
"}\n",
- PANGO_LAYOUT_DESERIALIZE_INVALID_VALUE
+ PANGO2_LAYOUT_DESERIALIZE_INVALID_VALUE
},
{
"{\n"
" \"alignment\" : \"nonsense\"\n"
"}\n",
- PANGO_LAYOUT_DESERIALIZE_INVALID_VALUE
+ PANGO2_LAYOUT_DESERIALIZE_INVALID_VALUE
},
{
"{\n"
@@ -408,21 +408,21 @@ test_serialize_layout_invalid (void)
}
};
- PangoContext *context;
+ Pango2Context *context;
- context = pango_context_new ();
+ context = pango2_context_new ();
for (int i = 0; i < G_N_ELEMENTS (test); i++)
{
GBytes *bytes;
- PangoLayout *layout;
+ Pango2Layout *layout;
GError *error = NULL;
bytes = g_bytes_new_static (test[i].json, strlen (test[i].json) + 1);
- layout = pango_layout_deserialize (context, bytes, PANGO_LAYOUT_DESERIALIZE_DEFAULT, &error);
+ layout = pango2_layout_deserialize (context, bytes, PANGO2_LAYOUT_DESERIALIZE_DEFAULT, &error);
g_assert_null (layout);
if (test[i].expected_error)
- g_assert_error (error, PANGO_LAYOUT_DESERIALIZE_ERROR, test[i].expected_error);
+ g_assert_error (error, PANGO2_LAYOUT_DESERIALIZE_ERROR, test[i].expected_error);
else
g_assert_nonnull (error);
g_bytes_unref (bytes);
diff --git a/tests/testtabs.c b/tests/testtabs.c
index fb16cf7f..873c2427 100644
--- a/tests/testtabs.c
+++ b/tests/testtabs.c
@@ -1,5 +1,5 @@
-/* Pango
- * testtabs.c: Test program for PangoTabArray
+/* Pango2
+ * testtabs.c: Test program for Pango2TabArray
*
* Copyright (C) 2021 Matthias Clasen
*
@@ -25,75 +25,75 @@
static void
test_tabs_basic (void)
{
- PangoTabArray *tabs;
- PangoTabAlign align;
+ Pango2TabArray *tabs;
+ Pango2TabAlign align;
int location;
- tabs = pango_tab_array_new (1, TRUE);
+ tabs = pango2_tab_array_new (1, TRUE);
- g_assert_true (pango_tab_array_get_positions_in_pixels (tabs));
- g_assert_true (pango_tab_array_get_size (tabs) == 1);
+ g_assert_true (pango2_tab_array_get_positions_in_pixels (tabs));
+ g_assert_true (pango2_tab_array_get_size (tabs) == 1);
- pango_tab_array_set_tab (tabs, 0, PANGO_TAB_LEFT, 10);
- pango_tab_array_get_tab (tabs, 0, &align, &location);
- g_assert_true (align == PANGO_TAB_LEFT);
+ pango2_tab_array_set_tab (tabs, 0, PANGO2_TAB_LEFT, 10);
+ pango2_tab_array_get_tab (tabs, 0, &align, &location);
+ g_assert_true (align == PANGO2_TAB_LEFT);
g_assert_true (location == 10);
- pango_tab_array_free (tabs);
+ pango2_tab_array_free (tabs);
}
static void
test_tabs_copy (void)
{
- PangoTabArray *tabs, *tabs2;
- PangoTabAlign *alignments;
+ Pango2TabArray *tabs, *tabs2;
+ Pango2TabAlign *alignments;
int *locations;
- tabs = pango_tab_array_new_with_positions (2, TRUE,
- PANGO_TAB_LEFT, 10,
- PANGO_TAB_LEFT, 20);
+ tabs = pango2_tab_array_new_with_positions (2, TRUE,
+ PANGO2_TAB_LEFT, 10,
+ PANGO2_TAB_LEFT, 20);
- tabs2 = pango_tab_array_copy (tabs);
- pango_tab_array_get_tabs (tabs2, &alignments, &locations);
- g_assert_true (alignments[0] == PANGO_TAB_LEFT);
- g_assert_true (alignments[1] == PANGO_TAB_LEFT);
+ tabs2 = pango2_tab_array_copy (tabs);
+ pango2_tab_array_get_tabs (tabs2, &alignments, &locations);
+ g_assert_true (alignments[0] == PANGO2_TAB_LEFT);
+ g_assert_true (alignments[1] == PANGO2_TAB_LEFT);
g_assert_true (locations[0] == 10);
g_assert_true (locations[1] == 20);
g_free (alignments);
g_free (locations);
- pango_tab_array_free (tabs);
- pango_tab_array_free (tabs2);
+ pango2_tab_array_free (tabs);
+ pango2_tab_array_free (tabs2);
}
static void
test_tabs_resize (void)
{
- PangoTabArray *tabs;
- PangoTabAlign *alignments;
+ Pango2TabArray *tabs;
+ Pango2TabAlign *alignments;
int *locations;
- tabs = pango_tab_array_new (1, TRUE);
+ tabs = pango2_tab_array_new (1, TRUE);
- pango_tab_array_set_tab (tabs, 0, PANGO_TAB_LEFT, 10);
+ pango2_tab_array_set_tab (tabs, 0, PANGO2_TAB_LEFT, 10);
- g_assert_cmpint (pango_tab_array_get_size (tabs), ==, 1);
+ g_assert_cmpint (pango2_tab_array_get_size (tabs), ==, 1);
- pango_tab_array_resize (tabs, 2);
- g_assert_cmpint (pango_tab_array_get_size (tabs), ==, 2);
+ pango2_tab_array_resize (tabs, 2);
+ g_assert_cmpint (pango2_tab_array_get_size (tabs), ==, 2);
- pango_tab_array_set_tab (tabs, 1, PANGO_TAB_RIGHT, 20);
- pango_tab_array_set_tab (tabs, 2, PANGO_TAB_CENTER, 30);
- pango_tab_array_set_tab (tabs, 3, PANGO_TAB_DECIMAL, 40);
+ pango2_tab_array_set_tab (tabs, 1, PANGO2_TAB_RIGHT, 20);
+ pango2_tab_array_set_tab (tabs, 2, PANGO2_TAB_CENTER, 30);
+ pango2_tab_array_set_tab (tabs, 3, PANGO2_TAB_DECIMAL, 40);
- g_assert_cmpint (pango_tab_array_get_size (tabs), ==, 4);
+ g_assert_cmpint (pango2_tab_array_get_size (tabs), ==, 4);
- pango_tab_array_get_tabs (tabs, &alignments, &locations);
- g_assert_cmpint (alignments[0], ==, PANGO_TAB_LEFT);
- g_assert_cmpint (alignments[1], ==, PANGO_TAB_RIGHT);
- g_assert_cmpint (alignments[2], ==, PANGO_TAB_CENTER);
- g_assert_cmpint (alignments[3], ==, PANGO_TAB_DECIMAL);
+ pango2_tab_array_get_tabs (tabs, &alignments, &locations);
+ g_assert_cmpint (alignments[0], ==, PANGO2_TAB_LEFT);
+ g_assert_cmpint (alignments[1], ==, PANGO2_TAB_RIGHT);
+ g_assert_cmpint (alignments[2], ==, PANGO2_TAB_CENTER);
+ g_assert_cmpint (alignments[3], ==, PANGO2_TAB_DECIMAL);
g_assert_cmpint (locations[0], ==, 10);
g_assert_cmpint (locations[1], ==, 20);
g_assert_cmpint (locations[2], ==, 30);
@@ -102,7 +102,7 @@ test_tabs_resize (void)
g_free (alignments);
g_free (locations);
- pango_tab_array_free (tabs);
+ pango2_tab_array_free (tabs);
}
int
diff --git a/tests/validate-log-attrs.c b/tests/validate-log-attrs.c
index 8b8fe7f4..16c9817f 100644
--- a/tests/validate-log-attrs.c
+++ b/tests/validate-log-attrs.c
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 1999 Red Hat Software
*
@@ -26,7 +26,7 @@
/* {{{ Validation */
-G_DEFINE_QUARK(pango-validate-error-quark, pango_validate_error)
+G_DEFINE_QUARK(pango-validate-error-quark, pango2_validate_error)
typedef gboolean (* CharForeachFunc) (int pos,
gunichar wc,
@@ -35,16 +35,16 @@ typedef gboolean (* CharForeachFunc) (int pos,
GUnicodeType type,
GUnicodeType prev_type,
GUnicodeType next_type,
- const PangoLogAttr *attr,
- const PangoLogAttr *prev_attr,
- const PangoLogAttr *next_attr,
+ const Pango2LogAttr *attr,
+ const Pango2LogAttr *prev_attr,
+ const Pango2LogAttr *next_attr,
gboolean *after_zws,
GError **error);
static gboolean
log_attr_foreach (const char *text,
int length,
- const PangoLogAttr *attrs,
+ const Pango2LogAttr *attrs,
int attrs_len,
CharForeachFunc func,
GError **error)
@@ -114,9 +114,9 @@ check_line_char (int pos,
GUnicodeType type,
GUnicodeType prev_type,
GUnicodeType next_type,
- const PangoLogAttr *attr,
- const PangoLogAttr *prev_attr,
- const PangoLogAttr *next_attr,
+ const Pango2LogAttr *attr,
+ const Pango2LogAttr *prev_attr,
+ const Pango2LogAttr *next_attr,
gboolean *after_zws,
GError **error)
{
@@ -141,7 +141,7 @@ check_line_char (int pos,
if (attr->is_line_break)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Do not break between \\r and \\n (LB5)", wc, pos);
return FALSE;
}
@@ -152,7 +152,7 @@ check_line_char (int pos,
if (attr->is_line_break)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Do not break before first char (LB2)", wc, pos);
return FALSE;
}
@@ -163,7 +163,7 @@ check_line_char (int pos,
if (!next_attr->is_line_break)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Always break after the last char (LB3)", wc, pos);
return FALSE;
}
@@ -174,7 +174,7 @@ check_line_char (int pos,
if (!attr->is_mandatory_break)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Always break after hard line breaks (LB4)", wc, pos);
return FALSE;
}
@@ -187,7 +187,7 @@ check_line_char (int pos,
if (!attr->is_mandatory_break)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Always break after CR, LF and NL (LB5)", wc, pos);
return FALSE;
}
@@ -201,7 +201,7 @@ check_line_char (int pos,
if (attr->is_line_break)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Do not break before hard line beaks (LB6)", wc, pos);
return FALSE;
}
@@ -215,7 +215,7 @@ check_line_char (int pos,
!(next_wc && g_unichar_break_type (next_wc) == G_UNICODE_BREAK_COMBINING_MARK))
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Can't break before a space unless mandatory precedes or combining mark follows (LB7)", wc, pos);
return FALSE;
}
@@ -228,7 +228,7 @@ check_line_char (int pos,
if (!attr->is_line_break)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Break before a char following ZWS, even if spaces intervene (LB8)", wc, pos);
return FALSE;
}
@@ -239,7 +239,7 @@ check_line_char (int pos,
if (attr->is_line_break)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Do not break after ZWJ (LB8a)", wc, pos);
return FALSE;
}
@@ -253,7 +253,7 @@ check_line_char (int pos,
if (attr->is_line_break)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Do not break before or after WJ (LB11)", wc, pos);
return FALSE;
}
@@ -262,7 +262,7 @@ check_line_char (int pos,
if (prev_break_type == G_UNICODE_BREAK_NON_BREAKING_GLUE)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Do not break after GL (LB12)", wc, pos);
return FALSE;
}
@@ -272,7 +272,7 @@ check_line_char (int pos,
if (attr->is_mandatory_break && !attr->is_line_break)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_BREAK,
"char %#x %d: Mandatory breaks must also be marked as regular breaks", wc, pos);
return FALSE;
}
@@ -283,7 +283,7 @@ check_line_char (int pos,
static gboolean
check_line_invariants (const char *text,
int length,
- const PangoLogAttr *attrs,
+ const Pango2LogAttr *attrs,
int attrs_len,
GError **error)
{
@@ -295,7 +295,7 @@ check_line_invariants (const char *text,
static gboolean
check_grapheme_invariants (const char *text,
int length,
- const PangoLogAttr *attrs,
+ const Pango2LogAttr *attrs,
int attrs_len,
GError **error)
{
@@ -305,7 +305,7 @@ check_grapheme_invariants (const char *text,
static gboolean
check_word_invariants (const char *text,
int length,
- const PangoLogAttr *attrs,
+ const Pango2LogAttr *attrs,
int attrs_len,
GError **error)
{
@@ -331,7 +331,7 @@ check_word_invariants (const char *text,
if (attrs[i].is_word_end)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_WORD,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_WORD,
"char %d: Unexpected word end", i);
return FALSE;
}
@@ -349,7 +349,7 @@ check_word_invariants (const char *text,
if (attrs[i].is_word_start)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_WORD,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_WORD,
"char %d: Unexpected word start", i);
return FALSE;
}
@@ -363,7 +363,7 @@ check_word_invariants (const char *text,
if (attrs[i].is_word_boundary && !attrs[i].is_cursor_position)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_SENTENCE,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_SENTENCE,
"char %d: Word ends inside a grapheme", i);
return FALSE;
}
@@ -375,7 +375,7 @@ check_word_invariants (const char *text,
static gboolean
check_sentence_invariants (const char *text,
int length,
- const PangoLogAttr *attrs,
+ const Pango2LogAttr *attrs,
int attrs_len,
GError **error)
{
@@ -401,7 +401,7 @@ check_sentence_invariants (const char *text,
if (attrs[i].is_sentence_end)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_SENTENCE,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_SENTENCE,
"char %d: Unexpected sentence end", i);
return FALSE;
}
@@ -419,7 +419,7 @@ check_sentence_invariants (const char *text,
if (attrs[i].is_sentence_start)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_SENTENCE,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_SENTENCE,
"char %d: Unexpected sentence start", i);
return FALSE;
}
@@ -436,7 +436,7 @@ check_sentence_invariants (const char *text,
static gboolean
check_space_invariants (const char *text,
int length,
- const PangoLogAttr *log_attrs,
+ const Pango2LogAttr *log_attrs,
int attrs_len,
GError **error)
{
@@ -445,7 +445,7 @@ check_space_invariants (const char *text,
if (log_attrs[i].is_expandable_space && !log_attrs[i].is_white)
{
g_set_error (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_SPACE,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_SPACE,
"char %d: Expandable space must be space", i);
return FALSE;
}
@@ -458,15 +458,15 @@ check_space_invariants (const char *text,
/* {{{ Public API */
/*
- * pango_validate_log_attrs:
+ * pango2_validate_log_attrs:
* @text: text to which @log_attrs belong
* @length: length of @text
- * @log_attrs: `PangoLogAttr` array to validate
+ * @log_attrs: `Pango2LogAttr` array to validate
* @attrs_len: length of @log_attrs
*
* Apply sanity checks to @log_attrs.
*
- * This function checks some conditions that Pango
+ * This function checks some conditions that Pango2
* relies on. It is not guaranteed to be an exhaustive
* validity test. Currentlty, it checks that
*
@@ -488,9 +488,9 @@ check_space_invariants (const char *text,
* Returns: %TRUE if @log_attrs are valid
*/
gboolean
-pango_validate_log_attrs (const char *text,
+pango2_validate_log_attrs (const char *text,
int length,
- const PangoLogAttr *log_attrs,
+ const Pango2LogAttr *log_attrs,
int attrs_len,
GError **error)
{
@@ -500,7 +500,7 @@ pango_validate_log_attrs (const char *text,
if (attrs_len != n_chars + 1)
{
g_set_error_literal (error,
- PANGO_VALIDATE_ERROR, PANGO_VALIDATE_ERROR_FAILED,
+ PANGO2_VALIDATE_ERROR, PANGO2_VALIDATE_ERROR_FAILED,
"Array has wrong length");
return FALSE;
}
diff --git a/tests/validate-log-attrs.h b/tests/validate-log-attrs.h
index 22b9ae63..dcdf0b09 100644
--- a/tests/validate-log-attrs.h
+++ b/tests/validate-log-attrs.h
@@ -1,4 +1,4 @@
-/* Pango
+/* Pango2
*
* Copyright (C) 1999 Red Hat Software
*
@@ -27,23 +27,23 @@ G_BEGIN_DECLS
#include <pango/pango-item.h>
-#define PANGO_VALIDATE_ERROR (pango_validate_error_quark ())
+#define PANGO2_VALIDATE_ERROR (pango2_validate_error_quark ())
typedef enum
{
- PANGO_VALIDATE_ERROR_FAILED,
- PANGO_VALIDATE_ERROR_BREAK,
- PANGO_VALIDATE_ERROR_GRAPHEME,
- PANGO_VALIDATE_ERROR_WORD,
- PANGO_VALIDATE_ERROR_SENTENCE,
- PANGO_VALIDATE_ERROR_SPACE
-} PangoValidateError;
+ PANGO2_VALIDATE_ERROR_FAILED,
+ PANGO2_VALIDATE_ERROR_BREAK,
+ PANGO2_VALIDATE_ERROR_GRAPHEME,
+ PANGO2_VALIDATE_ERROR_WORD,
+ PANGO2_VALIDATE_ERROR_SENTENCE,
+ PANGO2_VALIDATE_ERROR_SPACE
+} Pango2ValidateError;
-GQuark pango_validate_error_quark (void);
+GQuark pango2_validate_error_quark (void);
-gboolean pango_validate_log_attrs (const char *text,
+gboolean pango2_validate_log_attrs (const char *text,
int length,
- const PangoLogAttr *log_attrs,
+ const Pango2LogAttr *log_attrs,
int attrs_len,
GError **error);
diff --git a/tools/gen-script-for-lang.c b/tools/gen-script-for-lang.c
index 2fb0cbc7..f4e83adb 100644
--- a/tools/gen-script-for-lang.c
+++ b/tools/gen-script-for-lang.c
@@ -40,7 +40,7 @@ typedef struct {
} ScriptInfo;
typedef struct {
- PangoLanguage *lang;
+ Pango2Language *lang;
ScriptInfo scripts[MAX_SCRIPTS];
} LangInfo;
@@ -97,7 +97,7 @@ script_for_char (gunichar ch,
}
if (j == MAX_SCRIPTS)
- fail ("More than %d scripts found for %s. Increase MAX_SCRIPTS.\n", MAX_SCRIPTS, pango_language_to_string (info->lang));
+ fail ("More than %d scripts found for %s. Increase MAX_SCRIPTS.\n", MAX_SCRIPTS, pango2_language_to_string (info->lang));
info->scripts[j].freq++;
}
@@ -145,7 +145,7 @@ do_lang (GArray *script_array,
LangInfo info;
int j;
- info.lang = pango_language_from_string ((const char *)lang);
+ info.lang = pango2_language_from_string ((const char *)lang);
for (j = 0; j < MAX_SCRIPTS; j++)
{
@@ -195,8 +195,8 @@ compare_lang (gconstpointer a,
const LangInfo *info_a = a;
const LangInfo *info_b = b;
- return strcmp (pango_language_to_string (info_a->lang),
- pango_language_to_string (info_b->lang));
+ return strcmp (pango2_language_to_string (info_a->lang),
+ pango2_language_to_string (info_b->lang));
}
int main (void)
@@ -238,7 +238,7 @@ int main (void)
LangInfo *info = &g_array_index (script_array, LangInfo, i);
max_lang_len = MAX (max_lang_len,
- (int)strlen (pango_language_to_string (info->lang)));
+ (int)strlen (pango2_language_to_string (info->lang)));
g_qsort_with_data (info->scripts,
G_N_ELEMENTS (info->scripts),
@@ -284,8 +284,8 @@ int main (void)
LangInfo *info = &g_array_index (script_array, LangInfo, i);
g_print (" { \"%s\", %*s{ ",
- pango_language_to_string (info->lang),
- (int)(max_lang_len - strlen (pango_language_to_string (info->lang))), "");
+ pango2_language_to_string (info->lang),
+ (int)(max_lang_len - strlen (pango2_language_to_string (info->lang))), "");
for (j = 0; j < MAX_SCRIPTS; j++)
{
if (!info->scripts[j].freq)
diff --git a/utils/pango-list.c b/utils/pango-list.c
index b8ad1793..3023bce8 100644
--- a/utils/pango-list.c
+++ b/utils/pango-list.c
@@ -112,8 +112,8 @@ main (int argc,
{ NULL, }
};
GOptionContext *context;
- PangoContext *ctx;
- PangoFontMap *fontmap;
+ Pango2Context *ctx;
+ Pango2FontMap *fontmap;
int i, j;
int width;
GError *error = NULL;
@@ -143,16 +143,16 @@ main (int argc,
exit (0);
}
- fontmap = pango_font_map_get_default ();
- ctx = pango_context_new ();
+ fontmap = pango2_font_map_get_default ();
+ ctx = pango2_context_new ();
if (opt_verbose)
g_print ("Using %s\n\n", G_OBJECT_TYPE_NAME (fontmap));
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (fontmap)); i++)
{
- PangoFontFamily *family = g_list_model_get_item (G_LIST_MODEL (fontmap), i);
- const char *family_name = pango_font_family_get_name (family);
+ Pango2FontFamily *family = g_list_model_get_item (G_LIST_MODEL (fontmap), i);
+ const char *family_name = pango2_font_family_get_name (family);
g_object_unref (family);
@@ -160,7 +160,7 @@ main (int argc,
if (opt_verbose)
{
- if (PANGO_IS_GENERIC_FAMILY (family))
+ if (PANGO2_IS_GENERIC_FAMILY (family))
g_print ("(generic)");
g_print (" (%d faces)", g_list_model_get_n_items (G_LIST_MODEL (family)));
@@ -174,9 +174,9 @@ main (int argc,
width = 0;
for (j = 0; j < g_list_model_get_n_items (G_LIST_MODEL (family)); j++)
{
- PangoFontFace *face = g_list_model_get_item (G_LIST_MODEL (family), j);
- const char *face_name = pango_font_face_get_name (face);
- gboolean is_synth = pango_font_face_is_synthesized (face);
+ Pango2FontFace *face = g_list_model_get_item (G_LIST_MODEL (family), j);
+ const char *face_name = pango2_font_face_get_name (face);
+ gboolean is_synth = pango2_font_face_is_synthesized (face);
const char *synth_str = is_synth ? "*" : "";
const char *variable_str = "";
width = MAX (width, strlen (synth_str) + strlen (variable_str) + strlen (face_name));
@@ -185,61 +185,61 @@ main (int argc,
for (j = 0; j < g_list_model_get_n_items (G_LIST_MODEL (family)); j++)
{
- PangoFontFace *face = g_list_model_get_item (G_LIST_MODEL (family), j);
- const char *face_name = pango_font_face_get_name (face);
- gboolean is_synth = pango_font_face_is_synthesized (face);
+ Pango2FontFace *face = g_list_model_get_item (G_LIST_MODEL (family), j);
+ const char *face_name = pango2_font_face_get_name (face);
+ gboolean is_synth = pango2_font_face_is_synthesized (face);
const char *synth_str = is_synth ? "*" : "";
- gboolean is_variable = pango_font_face_is_variable (face);
+ gboolean is_variable = pango2_font_face_is_variable (face);
const char *variable_str = is_variable ? "@" : "";
- PangoFontDescription *desc;
+ Pango2FontDescription *desc;
char *desc_str;
- desc = pango_font_face_describe (face);
- desc_str = pango_font_description_to_string (desc);
+ desc = pango2_font_face_describe (face);
+ desc_str = pango2_font_description_to_string (desc);
g_print (" %s%s%s: %*s%s\n", synth_str, variable_str, face_name,
width - (int)strlen (face_name) - (int)strlen (synth_str) - (int)strlen (variable_str), "", desc_str);
- pango_font_description_set_absolute_size (desc, 10 * PANGO_SCALE);
+ pango2_font_description_set_absolute_size (desc, 10 * PANGO2_SCALE);
if (opt_metrics)
{
- PangoFontMetrics *metrics;
+ Pango2FontMetrics *metrics;
- metrics = pango_context_get_metrics (ctx, desc, pango_language_from_string ("en-us"));
+ metrics = pango2_context_get_metrics (ctx, desc, pango2_language_from_string ("en-us"));
g_print (" (a %d d %d h %d cw %d dw %d u %d %d s %d %d)\n",
- pango_font_metrics_get_ascent (metrics),
- pango_font_metrics_get_descent (metrics),
- pango_font_metrics_get_height (metrics),
- pango_font_metrics_get_approximate_char_width (metrics),
- pango_font_metrics_get_approximate_digit_width (metrics),
- pango_font_metrics_get_underline_position (metrics),
- pango_font_metrics_get_underline_thickness (metrics),
- pango_font_metrics_get_strikethrough_position (metrics),
- pango_font_metrics_get_strikethrough_thickness (metrics));
- pango_font_metrics_free (metrics);
+ pango2_font_metrics_get_ascent (metrics),
+ pango2_font_metrics_get_descent (metrics),
+ pango2_font_metrics_get_height (metrics),
+ pango2_font_metrics_get_approximate_char_width (metrics),
+ pango2_font_metrics_get_approximate_digit_width (metrics),
+ pango2_font_metrics_get_underline_position (metrics),
+ pango2_font_metrics_get_underline_thickness (metrics),
+ pango2_font_metrics_get_strikethrough_position (metrics),
+ pango2_font_metrics_get_strikethrough_thickness (metrics));
+ pango2_font_metrics_free (metrics);
}
if (opt_variations)
{
- PangoFont *font;
+ Pango2Font *font;
hb_font_t *hb_font;
int instance_id = -1;
/* set variations here, to make the fontmap prefer the variable family
* over a non-variable one.
*/
- pango_font_description_set_variations (desc, "@");
+ pango2_font_description_set_variations (desc, "@");
- font = pango_context_load_font (ctx, desc);
- hb_font = pango_font_get_hb_font (font);
- if (PANGO_IS_HB_FONT (font))
+ font = pango2_context_load_font (ctx, desc);
+ hb_font = pango2_font_get_hb_font (font);
+ if (PANGO2_IS_HB_FONT (font))
{
- PangoHbFace *hbface = (PangoHbFace *)face;
+ Pango2HbFace *hbface = (Pango2HbFace *)face;
instance_id = hbface->instance_id;
}
- if (pango_font_face_is_variable (face))
+ if (pango2_font_face_is_variable (face))
{
if (instance_id >= 0)
g_print (" Instance %d\n", instance_id);
@@ -270,9 +270,9 @@ main (int argc,
if (opt_verbose)
{
- if (PANGO_IS_HB_FACE (face))
+ if (PANGO2_IS_HB_FACE (face))
{
- PangoHbFace *hbface = (PangoHbFace *)face;
+ Pango2HbFace *hbface = (Pango2HbFace *)face;
if (hbface->file)
g_print (" %d %s\n", hbface->index, hbface->file);
@@ -280,7 +280,7 @@ main (int argc,
}
g_free (desc_str);
- pango_font_description_free (desc);
+ pango2_font_description_free (desc);
g_object_unref (face);
}
}
diff --git a/utils/pango-segmentation.c b/utils/pango-segmentation.c
index dc34db84..d99852ff 100644
--- a/utils/pango-segmentation.c
+++ b/utils/pango-segmentation.c
@@ -1,5 +1,5 @@
-/* Pango
- * pango-segmentation.c: Test Pango line breaking
+/* Pango2
+ * pango-segmentation.c: Test Pango2 line breaking
*
* Copyright (C) 2021 Red Hat, Inc
*
@@ -59,36 +59,36 @@ show_segmentation (const char *input,
BreakKind kind)
{
GString *string;
- PangoContext *context;
+ Pango2Context *context;
gsize length;
GError *error = NULL;
- const PangoLogAttr *attrs;
+ const Pango2LogAttr *attrs;
int len;
char *p;
int i;
char *text;
- PangoAttrList *attributes;
- PangoLayout *layout;
+ Pango2AttrList *attributes;
+ Pango2Layout *layout;
- context = pango_context_new ();
+ context = pango2_context_new ();
string = g_string_new ("");
length = strlen (input);
len = g_utf8_strlen (input, -1) + 1;
- pango_parse_markup (input, -1, 0, &attributes, &text, NULL, &error);
+ pango2_parse_markup (input, -1, 0, &attributes, &text, NULL, &error);
g_assert_no_error (error);
- layout = pango_layout_new (context);
- pango_layout_set_text (layout, text, length);
- pango_layout_set_attributes (layout, attributes);
+ layout = pango2_layout_new (context);
+ pango2_layout_set_text (layout, text, length);
+ pango2_layout_set_attributes (layout, attributes);
- attrs = pango_layout_get_log_attrs (layout, &len);
+ attrs = pango2_layout_get_log_attrs (layout, &len);
for (i = 0, p = text; i < len; i++, p = g_utf8_next_char (p))
{
- PangoLogAttr log = attrs[i];
+ Pango2LogAttr log = attrs[i];
gboolean is_break = FALSE;
switch (kind)
@@ -128,7 +128,7 @@ show_segmentation (const char *input,
g_object_unref (layout);
g_free (text);
- pango_attr_list_unref (attributes);
+ pango2_attr_list_unref (attributes);
g_print ("%s\n", string->str);
@@ -160,7 +160,7 @@ main (int argc, char *argv[])
context = g_option_context_new ("[FILE]");
g_option_context_add_main_entries (context, entries, NULL);
g_option_context_set_description (context,
- "Show text segmentation as determined by Pango.");
+ "Show text segmentation as determined by Pango2.");
if (!g_option_context_parse (context, &argc, &argv, &error))
{
g_printerr ("%s\n", error->message);
diff --git a/utils/pango-view.c b/utils/pango-view.c
index 457a7a9a..75b995ed 100644
--- a/utils/pango-view.c
+++ b/utils/pango-view.c
@@ -1,10 +1,10 @@
#include "config.h"
#include "viewer.h"
-extern const PangoViewer pangocairo_viewer;
-extern const PangoViewer pangox_viewer;
+extern const Pango2Viewer pangocairo_viewer;
+extern const Pango2Viewer pangox_viewer;
-const PangoViewer *viewers[] = {
+const Pango2Viewer *viewers[] = {
#ifdef HAVE_CAIRO
&pangocairo_viewer,
#endif
diff --git a/utils/userfont.c b/utils/userfont.c
index a3491e0e..6d064c49 100644
--- a/utils/userfont.c
+++ b/utils/userfont.c
@@ -59,7 +59,7 @@ static const test_scaled_font_glyph_t glyphs [] = {
};
static gboolean
-glyph_cb (PangoUserFace *face,
+glyph_cb (Pango2UserFace *face,
hb_codepoint_t unicode,
hb_codepoint_t *glyph,
gpointer user_data)
@@ -79,7 +79,7 @@ glyph_cb (PangoUserFace *face,
}
static gboolean
-glyph_info_cb (PangoUserFace *face,
+glyph_info_cb (Pango2UserFace *face,
int size,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents,
@@ -103,7 +103,7 @@ glyph_info_cb (PangoUserFace *face,
}
static gboolean
-font_info_cb (PangoUserFace *face,
+font_info_cb (Pango2UserFace *face,
int size,
hb_font_extents_t *extents,
gpointer user_data)
@@ -116,7 +116,7 @@ font_info_cb (PangoUserFace *face,
}
static gboolean
-render_cb (PangoUserFace *face,
+render_cb (Pango2UserFace *face,
int size,
hb_codepoint_t glyph,
gpointer user_data,
@@ -163,20 +163,20 @@ render_cb (PangoUserFace *face,
}
void
-add_userfont (PangoFontMap *fontmap)
+add_userfont (Pango2FontMap *fontmap)
{
- PangoFontDescription *desc;
- PangoUserFace *face;
+ Pango2FontDescription *desc;
+ Pango2UserFace *face;
- desc = pango_font_description_new ();
- pango_font_description_set_family (desc, "Userfont");
- face = pango_user_face_new (font_info_cb,
+ desc = pango2_font_description_new ();
+ pango2_font_description_set_family (desc, "Userfont");
+ face = pango2_user_face_new (font_info_cb,
glyph_cb,
glyph_info_cb,
NULL,
render_cb,
(gpointer) glyphs, NULL,
"Black", desc);
- pango_font_map_add_face (fontmap, PANGO_FONT_FACE (face));
- pango_font_description_free (desc);
+ pango2_font_map_add_face (fontmap, PANGO2_FONT_FACE (face));
+ pango2_font_description_free (desc);
}
diff --git a/utils/userfont.h b/utils/userfont.h
index f4d4f8be..b1918bb6 100644
--- a/utils/userfont.h
+++ b/utils/userfont.h
@@ -1 +1 @@
-void add_userfont (PangoFontMap *map);
+void add_userfont (Pango2FontMap *map);
diff --git a/utils/viewer-cairo.c b/utils/viewer-cairo.c
index f25d7766..49667da0 100644
--- a/utils/viewer-cairo.c
+++ b/utils/viewer-cairo.c
@@ -89,7 +89,7 @@ cairo_view_iface_create_surface (gpointer instance,
static gpointer
-cairo_image_view_create (const PangoViewer *klass G_GNUC_UNUSED)
+cairo_image_view_create (const Pango2Viewer *klass G_GNUC_UNUSED)
{
return NULL;
}
@@ -125,7 +125,7 @@ cairo_image_view_destroy_surface (gpointer instance,
cairo_surface_destroy (surface);
}
-const PangoViewer cairo_image_viewer = {
+const Pango2Viewer cairo_image_viewer = {
"CairoImage",
NULL,
NULL,
@@ -209,7 +209,7 @@ typedef struct
} CairoVectorViewer;
static gpointer
-cairo_vector_view_create (const PangoViewer *klass G_GNUC_UNUSED)
+cairo_vector_view_create (const Pango2Viewer *klass G_GNUC_UNUSED)
{
const char *extension = NULL;
CairoVectorFileCreateFunc constructor = NULL;
@@ -297,7 +297,7 @@ cairo_vector_view_destroy_surface (gpointer instance,
cairo_surface_destroy (surface);
}
-const PangoViewer cairo_vector_viewer = {
+const Pango2Viewer cairo_vector_viewer = {
"CairoFile",
NULL,
NULL,
diff --git a/utils/viewer-cairo.h b/utils/viewer-cairo.h
index e843664f..1999c910 100644
--- a/utils/viewer-cairo.h
+++ b/utils/viewer-cairo.h
@@ -29,7 +29,7 @@ typedef struct _CairoViewerIface CairoViewerIface;
struct _CairoViewerIface
{
- const PangoViewer *backend_class;
+ const Pango2Viewer *backend_class;
cairo_surface_t * (*create_surface) (gpointer instance,
gpointer surface,
diff --git a/utils/viewer-main.c b/utils/viewer-main.c
index 4544a84d..23d0b940 100644
--- a/utils/viewer-main.c
+++ b/utils/viewer-main.c
@@ -40,9 +40,9 @@ int
main (int argc,
char **argv)
{
- const PangoViewer *view;
+ const Pango2Viewer *view;
gpointer instance;
- PangoContext *context;
+ Pango2Context *context;
int run;
int width, height;
gpointer surface;
diff --git a/utils/viewer-pangocairo.c b/utils/viewer-pangocairo.c
index 2bf2e0d6..bd6ca9a5 100644
--- a/utils/viewer-pangocairo.c
+++ b/utils/viewer-pangocairo.c
@@ -1,4 +1,4 @@
-/* viewer-pangocairo.c: PangoCairo viewer backend.
+/* viewer-pangocairo.c: Pango2Cairo viewer backend.
*
* Copyright (C) 1999,2004,2005 Red Hat, Inc.
* Copyright (C) 2001 Sun Microsystems
@@ -41,13 +41,13 @@ typedef struct
gpointer backend;
- PangoFontMap *fontmap;
+ Pango2FontMap *fontmap;
cairo_font_options_t *font_options;
gboolean subpixel_positions;
} CairoViewer;
static gpointer
-pangocairo_view_create (const PangoViewer *klass G_GNUC_UNUSED)
+pangocairo_view_create (const Pango2Viewer *klass G_GNUC_UNUSED)
{
CairoViewer *instance;
@@ -57,40 +57,40 @@ pangocairo_view_create (const PangoViewer *klass G_GNUC_UNUSED)
if (opt_font_file != NULL)
{
- PangoFontFace *first = NULL;
+ Pango2FontFace *first = NULL;
- instance->fontmap = pango_font_map_new ();
+ instance->fontmap = pango2_font_map_new ();
for (int i = 0; opt_font_file[i]; i++)
{
- PangoFontFace *face;
+ Pango2FontFace *face;
- face = PANGO_FONT_FACE (pango_hb_face_new_from_file (opt_font_file[i],
+ face = PANGO2_FONT_FACE (pango2_hb_face_new_from_file (opt_font_file[i],
0, -1,
NULL, NULL));
- pango_font_map_add_face (instance->fontmap, face);
+ pango2_font_map_add_face (instance->fontmap, face);
if (!first)
first = face;
}
- /* We always need monospace, or Pango will complain */
- if (!pango_font_map_get_family (instance->fontmap, "monospace"))
+ /* We always need monospace, or Pango2 will complain */
+ if (!pango2_font_map_get_family (instance->fontmap, "monospace"))
{
- PangoGenericFamily *family;
+ Pango2GenericFamily *family;
- family = pango_generic_family_new ("monospace");
- pango_generic_family_add_family (family, pango_font_face_get_family (first));
- pango_font_map_add_family (instance->fontmap, PANGO_FONT_FAMILY (family));
+ family = pango2_generic_family_new ("monospace");
+ pango2_generic_family_add_family (family, pango2_font_face_get_family (first));
+ pango2_font_map_add_family (instance->fontmap, PANGO2_FONT_FAMILY (family));
}
}
else
{
- instance->fontmap = pango_font_map_new_default ();
+ instance->fontmap = pango2_font_map_new_default ();
}
- pango_font_map_set_resolution (PANGO_FONT_MAP (instance->fontmap), opt_dpi);
+ pango2_font_map_set_resolution (PANGO2_FONT_MAP (instance->fontmap), opt_dpi);
if (opt_userfont)
add_userfont (instance->fontmap);
@@ -137,15 +137,15 @@ pangocairo_view_destroy (gpointer instance)
g_slice_free (CairoViewer, c);
}
-static PangoContext *
+static Pango2Context *
pangocairo_view_get_context (gpointer instance)
{
CairoViewer *c = (CairoViewer *) instance;
- PangoContext *context;
+ Pango2Context *context;
- context = pango_context_new_with_font_map (c->fontmap);
- pango_cairo_context_set_font_options (context, c->font_options);
- pango_context_set_round_glyph_positions (context, !c->subpixel_positions);
+ context = pango2_context_new_with_font_map (c->fontmap);
+ pango2_cairo_context_set_font_options (context, c->font_options);
+ pango2_context_set_round_glyph_positions (context, !c->subpixel_positions);
return context;
}
@@ -231,7 +231,7 @@ static const char *annotate_arg_help =
"\t\t\t\t\t\t run, cluster, char, glyph, caret, slope\n";
static void
-render_callback (PangoLayout *layout,
+render_callback (Pango2Layout *layout,
int x,
int y,
gpointer context,
@@ -246,27 +246,27 @@ render_callback (PangoLayout *layout,
if (annotate != 0)
{
cairo_pattern_t *pattern;
- PangoRectangle ink, logical;
+ Pango2Rectangle ink, logical;
double lw = cairo_get_line_width (cr);
- PangoLineIter *iter;
+ Pango2LineIter *iter;
- pango_lines_get_extents (pango_layout_get_lines (layout), &ink, &logical);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), &ink, &logical);
if (annotate & ANNOTATE_GRAVITY_ROOF)
{
/* draw resolved gravity "roof" in blue */
cairo_save (cr);
cairo_translate (cr,
- (double)logical.x / PANGO_SCALE,
- (double)logical.y / PANGO_SCALE);
+ (double)logical.x / PANGO2_SCALE,
+ (double)logical.y / PANGO2_SCALE);
cairo_scale (cr,
- (double)logical.width / PANGO_SCALE * 0.5,
- (double)logical.height / PANGO_SCALE * 0.5);
+ (double)logical.width / PANGO2_SCALE * 0.5,
+ (double)logical.height / PANGO2_SCALE * 0.5);
cairo_translate (cr, 1.0, 1.0);
cairo_rotate (cr,
- pango_gravity_to_rotation (
- pango_context_get_gravity (
- pango_layout_get_context (layout))));
+ pango2_gravity_to_rotation (
+ pango2_context_get_gravity (
+ pango2_layout_get_context (layout))));
cairo_move_to (cr, -1.0, -1.0);
cairo_rel_line_to (cr, +1.0, -0.2); /* / */
cairo_rel_line_to (cr, +1.0, +0.2); /* \ */
@@ -293,11 +293,11 @@ render_callback (PangoLayout *layout,
/* draw block progression arrow in green */
cairo_save (cr);
cairo_translate (cr,
- (double)logical.x / PANGO_SCALE,
- (double)logical.y / PANGO_SCALE);
+ (double)logical.x / PANGO2_SCALE,
+ (double)logical.y / PANGO2_SCALE);
cairo_scale (cr,
- (double)logical.width / PANGO_SCALE * 0.5,
- (double)logical.height / PANGO_SCALE * 0.5);
+ (double)logical.width / PANGO2_SCALE * 0.5,
+ (double)logical.height / PANGO2_SCALE * 0.5);
cairo_translate (cr, 1.0, 1.0);
cairo_move_to (cr, -0.4, -0.7);
cairo_rel_line_to (cr, +0.8, 0.0); /* -- */
@@ -325,18 +325,18 @@ render_callback (PangoLayout *layout,
/* draw baselines with line direction arrow in orange */
cairo_save (cr);
cairo_set_source_rgba (cr, 1.0, 0.5, 0.0, 0.5);
- iter = pango_layout_get_iter (layout);
+ iter = pango2_layout_get_iter (layout);
do
{
- PangoLine *line = pango_line_iter_get_line (iter);
- double width = (double)logical.width / PANGO_SCALE;
+ Pango2Line *line = pango2_line_iter_get_line (iter);
+ double width = (double)logical.width / PANGO2_SCALE;
- y = pango_line_iter_get_line_baseline (iter);
+ y = pango2_line_iter_get_line_baseline (iter);
cairo_save (cr);
cairo_translate (cr,
- (double)logical.x / PANGO_SCALE + width * 0.5,
- (double)y / PANGO_SCALE);
- if (pango_line_get_resolved_direction (line))
+ (double)logical.x / PANGO2_SCALE + width * 0.5,
+ (double)y / PANGO2_SCALE);
+ if (pango2_line_get_resolved_direction (line))
cairo_scale (cr, -1, 1);
cairo_move_to (cr, -width * .5, -lw*0.2);
cairo_rel_line_to (cr, +width * .9, -lw*0.3);
@@ -349,8 +349,8 @@ render_callback (PangoLayout *layout,
cairo_fill (cr);
cairo_restore (cr);
}
- while (pango_line_iter_next_line (iter));
- pango_line_iter_free (iter);
+ while (pango2_line_iter_next_line (iter));
+ pango2_line_iter_free (iter);
cairo_restore (cr);
}
@@ -362,13 +362,13 @@ render_callback (PangoLayout *layout,
cairo_save (cr);
cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 0.5);
- iter = pango_layout_get_iter (layout);
+ iter = pango2_layout_get_iter (layout);
do
{
- PangoRun *run;
- PangoItem *item;
- const PangoAnalysis *analysis;
- PangoRectangle rect;
+ Pango2Run *run;
+ Pango2Item *item;
+ const Pango2Analysis *analysis;
+ Pango2Rectangle rect;
hb_font_t *hb_font;
hb_ot_layout_baseline_tag_t baselines[] = {
HB_OT_LAYOUT_BASELINE_TAG_ROMAN,
@@ -384,35 +384,35 @@ render_callback (PangoLayout *layout,
hb_tag_t script, lang;
hb_position_t coord;
- run = pango_line_iter_get_run (iter);
+ run = pango2_line_iter_get_run (iter);
if (!run)
{
baseline_tag = 0;
continue;
}
- item = pango_run_get_item (run);
- analysis = pango_item_get_analysis (item);
+ item = pango2_run_get_item (run);
+ analysis = pango2_item_get_analysis (item);
if (baseline_tag == 0)
{
- hb_script_t script = (hb_script_t) g_unicode_script_to_iso15924 (pango_analysis_get_script (analysis));
+ hb_script_t script = (hb_script_t) g_unicode_script_to_iso15924 (pango2_analysis_get_script (analysis));
- if (pango_analysis_get_flags (analysis) & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
+ if (pango2_analysis_get_flags (analysis) & PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE)
baseline_tag = HB_OT_LAYOUT_BASELINE_TAG_IDEO_EMBOX_CENTRAL;
else
baseline_tag = hb_ot_layout_get_horizontal_baseline_tag_for_script (script);
}
- y = pango_line_iter_get_run_baseline (iter);
- pango_line_iter_get_run_extents (iter, NULL, &rect);
+ y = pango2_line_iter_get_run_baseline (iter);
+ pango2_line_iter_get_run_extents (iter, NULL, &rect);
- hb_font = pango_font_get_hb_font (pango_analysis_get_font (analysis));
- if (pango_analysis_get_flags (analysis) & PANGO_ANALYSIS_FLAG_CENTERED_BASELINE)
+ hb_font = pango2_font_get_hb_font (pango2_analysis_get_font (analysis));
+ if (pango2_analysis_get_flags (analysis) & PANGO2_ANALYSIS_FLAG_CENTERED_BASELINE)
dir = HB_DIRECTION_TTB;
else
dir = HB_DIRECTION_LTR;
- script = (hb_script_t) g_unicode_script_to_iso15924 (pango_analysis_get_script (analysis));
+ script = (hb_script_t) g_unicode_script_to_iso15924 (pango2_analysis_get_script (analysis));
lang = HB_TAG_NONE;
for (int i = 0; i < G_N_ELEMENTS (baselines); i++)
@@ -454,21 +454,21 @@ render_callback (PangoLayout *layout,
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
}
cairo_move_to (cr,
- (double)rect.x / PANGO_SCALE,
- (double)(y - coord) / PANGO_SCALE);
- cairo_rel_line_to (cr, (double)rect.width / PANGO_SCALE, 0);
+ (double)rect.x / PANGO2_SCALE,
+ (double)(y - coord) / PANGO2_SCALE);
+ cairo_rel_line_to (cr, (double)rect.width / PANGO2_SCALE, 0);
cairo_stroke (cr);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_move_to (cr,
- (double)rect.x / PANGO_SCALE - 5,
- (double)(y - coord) / PANGO_SCALE - 5);
+ (double)rect.x / PANGO2_SCALE - 5,
+ (double)(y - coord) / PANGO2_SCALE - 5);
cairo_show_text (cr, buf);
cairo_restore (cr);
}
}
- while (pango_line_iter_next_run (iter));
- pango_line_iter_free (iter);
+ while (pango2_line_iter_next_run (iter));
+ pango2_line_iter_free (iter);
cairo_restore (cr);
}
#endif
@@ -480,10 +480,10 @@ render_callback (PangoLayout *layout,
cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 0.5);
cairo_rectangle (cr,
- (double)logical.x / PANGO_SCALE - lw / 2,
- (double)logical.y / PANGO_SCALE - lw / 2,
- (double)logical.width / PANGO_SCALE + lw,
- (double)logical.height / PANGO_SCALE + lw);
+ (double)logical.x / PANGO2_SCALE - lw / 2,
+ (double)logical.y / PANGO2_SCALE - lw / 2,
+ (double)logical.width / PANGO2_SCALE + lw,
+ (double)logical.height / PANGO2_SCALE + lw);
cairo_stroke (cr);
cairo_restore (cr);
@@ -491,10 +491,10 @@ render_callback (PangoLayout *layout,
cairo_save (cr);
cairo_set_source_rgba (cr, 0.0, 1.0, 0.0, 0.5);
cairo_rectangle (cr,
- (double)ink.x / PANGO_SCALE - lw / 2,
- (double)ink.y / PANGO_SCALE - lw / 2,
- (double)ink.width / PANGO_SCALE + lw,
- (double)ink.height / PANGO_SCALE + lw);
+ (double)ink.x / PANGO2_SCALE - lw / 2,
+ (double)ink.y / PANGO2_SCALE - lw / 2,
+ (double)ink.width / PANGO2_SCALE + lw,
+ (double)ink.height / PANGO2_SCALE + lw);
cairo_stroke (cr);
cairo_restore (cr);
}
@@ -505,21 +505,21 @@ render_callback (PangoLayout *layout,
cairo_save (cr);
cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 0.5);
- iter = pango_layout_get_iter (layout);
+ iter = pango2_layout_get_iter (layout);
do
{
- PangoRectangle rect;
+ Pango2Rectangle rect;
- pango_line_iter_get_line_extents (iter, NULL, &rect);
+ pango2_line_iter_get_line_extents (iter, NULL, &rect);
cairo_rectangle (cr,
- (double)rect.x / PANGO_SCALE - lw / 2,
- (double)rect.y / PANGO_SCALE - lw / 2,
- (double)rect.width / PANGO_SCALE + lw,
- (double)rect.height / PANGO_SCALE + lw);
+ (double)rect.x / PANGO2_SCALE - lw / 2,
+ (double)rect.y / PANGO2_SCALE - lw / 2,
+ (double)rect.width / PANGO2_SCALE + lw,
+ (double)rect.height / PANGO2_SCALE + lw);
cairo_stroke (cr);
}
- while (pango_line_iter_next_line (iter));
- pango_line_iter_free (iter);
+ while (pango2_line_iter_next_line (iter));
+ pango2_line_iter_free (iter);
cairo_restore (cr);
}
@@ -529,26 +529,26 @@ render_callback (PangoLayout *layout,
cairo_save (cr);
cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 0.5);
- iter = pango_layout_get_iter (layout);
+ iter = pango2_layout_get_iter (layout);
do
{
- PangoRun *run;
- PangoRectangle rect;
+ Pango2Run *run;
+ Pango2Rectangle rect;
- run = pango_line_iter_get_run (iter);
+ run = pango2_line_iter_get_run (iter);
if (!run)
continue;
- pango_line_iter_get_run_extents (iter, NULL, &rect);
+ pango2_line_iter_get_run_extents (iter, NULL, &rect);
cairo_rectangle (cr,
- (double)rect.x / PANGO_SCALE - lw / 2,
- (double)rect.y / PANGO_SCALE - lw / 2,
- (double)rect.width / PANGO_SCALE + lw,
- (double)rect.height / PANGO_SCALE + lw);
+ (double)rect.x / PANGO2_SCALE - lw / 2,
+ (double)rect.y / PANGO2_SCALE - lw / 2,
+ (double)rect.width / PANGO2_SCALE + lw,
+ (double)rect.height / PANGO2_SCALE + lw);
cairo_stroke (cr);
}
- while (pango_line_iter_next_run (iter));
- pango_line_iter_free (iter);
+ while (pango2_line_iter_next_run (iter));
+ pango2_line_iter_free (iter);
cairo_restore (cr);
}
@@ -558,21 +558,21 @@ render_callback (PangoLayout *layout,
cairo_save (cr);
cairo_set_source_rgba (cr, 1.0, 0.0, 1.0, 0.5);
- iter = pango_layout_get_iter (layout);
+ iter = pango2_layout_get_iter (layout);
do
{
- PangoRectangle rect;
+ Pango2Rectangle rect;
- pango_line_iter_get_cluster_extents (iter, NULL, &rect);
+ pango2_line_iter_get_cluster_extents (iter, NULL, &rect);
cairo_rectangle (cr,
- (double)rect.x / PANGO_SCALE - lw / 2,
- (double)rect.y / PANGO_SCALE - lw / 2,
- (double)rect.width / PANGO_SCALE + lw,
- (double)rect.height / PANGO_SCALE + lw);
+ (double)rect.x / PANGO2_SCALE - lw / 2,
+ (double)rect.y / PANGO2_SCALE - lw / 2,
+ (double)rect.width / PANGO2_SCALE + lw,
+ (double)rect.height / PANGO2_SCALE + lw);
cairo_stroke (cr);
}
- while (pango_line_iter_next_cluster (iter));
- pango_line_iter_free (iter);
+ while (pango2_line_iter_next_cluster (iter));
+ pango2_line_iter_free (iter);
cairo_restore (cr);
}
@@ -582,21 +582,21 @@ render_callback (PangoLayout *layout,
cairo_save (cr);
cairo_set_source_rgba (cr, 1.0, 0.5, 0.0, 0.5);
- iter = pango_layout_get_iter (layout);
+ iter = pango2_layout_get_iter (layout);
do
{
- PangoRectangle rect;
+ Pango2Rectangle rect;
- pango_line_iter_get_char_extents (iter, &rect);
+ pango2_line_iter_get_char_extents (iter, &rect);
cairo_rectangle (cr,
- (double)rect.x / PANGO_SCALE - lw / 2,
- (double)rect.y / PANGO_SCALE - lw / 2,
- (double)rect.width / PANGO_SCALE + lw,
- (double)rect.height / PANGO_SCALE + lw);
+ (double)rect.x / PANGO2_SCALE - lw / 2,
+ (double)rect.y / PANGO2_SCALE - lw / 2,
+ (double)rect.width / PANGO2_SCALE + lw,
+ (double)rect.height / PANGO2_SCALE + lw);
cairo_stroke (cr);
}
- while (pango_line_iter_next_cluster (iter));
- pango_line_iter_free (iter);
+ while (pango2_line_iter_next_cluster (iter));
+ pango2_line_iter_free (iter);
cairo_restore (cr);
}
@@ -606,34 +606,34 @@ render_callback (PangoLayout *layout,
cairo_save (cr);
cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 0.5);
- iter = pango_layout_get_iter (layout);
+ iter = pango2_layout_get_iter (layout);
do
{
- PangoRun *run;
- PangoItem *item;
- const PangoAnalysis *analysis;
- PangoGlyphString *glyphs;
- PangoRectangle rect;
+ Pango2Run *run;
+ Pango2Item *item;
+ const Pango2Analysis *analysis;
+ Pango2GlyphString *glyphs;
+ Pango2Rectangle rect;
int x_pos, y_pos;
- run = pango_line_iter_get_run (iter);
+ run = pango2_line_iter_get_run (iter);
if (!run)
continue;
- item = pango_run_get_item (run);
- analysis = pango_item_get_analysis (item);
- glyphs = pango_run_get_glyphs (run);
+ item = pango2_run_get_item (run);
+ analysis = pango2_item_get_analysis (item);
+ glyphs = pango2_run_get_glyphs (run);
- pango_line_iter_get_run_extents (iter, NULL, &rect);
+ pango2_line_iter_get_run_extents (iter, NULL, &rect);
x_pos = rect.x;
- y_pos = pango_line_iter_get_run_baseline (iter);
+ y_pos = pango2_line_iter_get_run_baseline (iter);
for (int i = 0; i < glyphs->num_glyphs; i++)
{
- PangoRectangle extents;
+ Pango2Rectangle extents;
- pango_font_get_glyph_extents (pango_analysis_get_font (analysis),
+ pango2_font_get_glyph_extents (pango2_analysis_get_font (analysis),
glyphs->glyphs[i].glyph,
&extents, NULL);
@@ -643,29 +643,29 @@ render_callback (PangoLayout *layout,
rect.height = extents.height;
cairo_rectangle (cr,
- (double)rect.x / PANGO_SCALE - lw / 2,
- (double)rect.y / PANGO_SCALE - lw / 2,
- (double)rect.width / PANGO_SCALE + lw,
- (double)rect.height / PANGO_SCALE + lw);
+ (double)rect.x / PANGO2_SCALE - lw / 2,
+ (double)rect.y / PANGO2_SCALE - lw / 2,
+ (double)rect.width / PANGO2_SCALE + lw,
+ (double)rect.height / PANGO2_SCALE + lw);
cairo_stroke (cr);
cairo_arc (cr,
- (double) (x_pos + glyphs->glyphs[i].geometry.x_offset) / PANGO_SCALE,
- (double) (y_pos + glyphs->glyphs[i].geometry.y_offset) / PANGO_SCALE,
+ (double) (x_pos + glyphs->glyphs[i].geometry.x_offset) / PANGO2_SCALE,
+ (double) (y_pos + glyphs->glyphs[i].geometry.y_offset) / PANGO2_SCALE,
3.0, 0, 2*G_PI);
cairo_fill (cr);
x_pos += glyphs->glyphs[i].geometry.width;
}
}
- while (pango_line_iter_next_run (iter));
- pango_line_iter_free (iter);
+ while (pango2_line_iter_next_run (iter));
+ pango2_line_iter_free (iter);
cairo_restore (cr);
}
if (annotate & ANNOTATE_CARET_POSITIONS)
{
- const PangoLogAttr *attrs;
+ const Pango2LogAttr *attrs;
int n_attrs;
int offset;
int num = 0;
@@ -674,64 +674,64 @@ render_callback (PangoLayout *layout,
cairo_save (cr);
cairo_set_source_rgba (cr, 1.0, 0.0, 1.0, 0.5);
- attrs = pango_layout_get_log_attrs (layout, &n_attrs);
+ attrs = pango2_layout_get_log_attrs (layout, &n_attrs);
- iter = pango_layout_get_iter (layout);
+ iter = pango2_layout_get_iter (layout);
do
{
- PangoRectangle rect;
- PangoRun *run;
- PangoItem *item;
- PangoGlyphString *glyphs;
+ Pango2Rectangle rect;
+ Pango2Run *run;
+ Pango2Item *item;
+ Pango2GlyphString *glyphs;
const char *text, *start, *p;
int x, y;
gboolean trailing;
- pango_line_iter_get_run_extents (iter, NULL, &rect);
- run = pango_line_iter_get_run (iter);
+ pango2_line_iter_get_run_extents (iter, NULL, &rect);
+ run = pango2_line_iter_get_run (iter);
if (!run)
continue;
- item = pango_run_get_item (run);
- glyphs = pango_run_get_glyphs (run);
+ item = pango2_run_get_item (run);
+ glyphs = pango2_run_get_glyphs (run);
- text = pango_layout_get_text (layout);
- start = text + pango_item_get_char_offset (item);
+ text = pango2_layout_get_text (layout);
+ start = text + pango2_item_get_char_offset (item);
offset = g_utf8_strlen (text, start - text);
- y = pango_line_iter_get_run_baseline (iter);
+ y = pango2_line_iter_get_run_baseline (iter);
trailing = FALSE;
p = start;
- for (int i = 0; i <= pango_item_get_char_length (item); i++)
+ for (int i = 0; i <= pango2_item_get_char_length (item); i++)
{
if (attrs[offset + i].is_cursor_position)
{
- pango_glyph_string_index_to_x_full (glyphs,
- text + pango_item_get_byte_offset (item),
- pango_item_get_byte_length (item),
- pango_item_get_analysis (item),
- (PangoLogAttr *)attrs + offset,
+ pango2_glyph_string_index_to_x_full (glyphs,
+ text + pango2_item_get_byte_offset (item),
+ pango2_item_get_byte_length (item),
+ pango2_item_get_analysis (item),
+ (Pango2LogAttr *)attrs + offset,
p - start,
trailing,
&x);
x += rect.x;
cairo_set_source_rgba (cr, 1.0, 0.0, 1.0, 0.5);
- cairo_arc (cr, x / PANGO_SCALE, y / PANGO_SCALE, 3.0, 0, 2*G_PI);
+ cairo_arc (cr, x / PANGO2_SCALE, y / PANGO2_SCALE, 3.0, 0, 2*G_PI);
cairo_close_path (cr);
cairo_fill (cr);
char *s = g_strdup_printf ("%d", num);
cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_move_to (cr, x / PANGO_SCALE - 5, y / PANGO_SCALE + 15);
+ cairo_move_to (cr, x / PANGO2_SCALE - 5, y / PANGO2_SCALE + 15);
cairo_show_text (cr, s);
g_free (s);
}
- if (i < pango_item_get_char_length (item))
+ if (i < pango2_item_get_char_length (item))
{
num++;
p = g_utf8_next_char (p);
@@ -741,16 +741,16 @@ render_callback (PangoLayout *layout,
}
}
- while (pango_line_iter_next_run (iter));
- pango_line_iter_free (iter);
+ while (pango2_line_iter_next_run (iter));
+ pango2_line_iter_free (iter);
cairo_restore (cr);
}
if (annotate & ANNOTATE_CARET_SLOPE)
{
- const char *text = pango_layout_get_text (layout);
+ const char *text = pango2_layout_get_text (layout);
int length = g_utf8_strlen (text, -1);
- const PangoLogAttr *attrs;
+ const Pango2LogAttr *attrs;
int n_attrs;
const char *p;
int i;
@@ -759,23 +759,23 @@ render_callback (PangoLayout *layout,
cairo_save (cr);
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.5);
- attrs = pango_layout_get_log_attrs (layout, &n_attrs);
+ attrs = pango2_layout_get_log_attrs (layout, &n_attrs);
for (i = 0, p = text; i <= length; i++, p = g_utf8_next_char (p))
{
- PangoRectangle rect;
+ Pango2Rectangle rect;
if (!attrs[i].is_cursor_position)
continue;
- pango_lines_get_caret_pos (pango_layout_get_lines (layout), NULL, p - text, &rect, NULL);
+ pango2_lines_get_caret_pos (pango2_layout_get_lines (layout), NULL, p - text, &rect, NULL);
cairo_move_to (cr,
- (double)rect.x / PANGO_SCALE + (double)rect.width / PANGO_SCALE - lw / 2,
- (double)rect.y / PANGO_SCALE - lw / 2);
+ (double)rect.x / PANGO2_SCALE + (double)rect.width / PANGO2_SCALE - lw / 2,
+ (double)rect.y / PANGO2_SCALE - lw / 2);
cairo_line_to (cr,
- (double)rect.x / PANGO_SCALE - lw / 2,
- (double)rect.y / PANGO_SCALE + (double)rect.height / PANGO_SCALE - lw / 2);
+ (double)rect.x / PANGO2_SCALE - lw / 2,
+ (double)rect.y / PANGO2_SCALE + (double)rect.height / PANGO2_SCALE - lw / 2);
cairo_stroke (cr);
}
@@ -784,7 +784,7 @@ render_callback (PangoLayout *layout,
}
cairo_move_to (cr, 0, 0);
- pango_cairo_show_layout (cr, layout);
+ pango2_cairo_show_layout (cr, layout);
cairo_restore (cr);
@@ -792,8 +792,8 @@ render_callback (PangoLayout *layout,
}
static void
-transform_callback (PangoContext *context,
- PangoMatrix *matrix,
+transform_callback (Pango2Context *context,
+ Pango2Matrix *matrix,
gpointer cr_context,
gpointer state G_GNUC_UNUSED)
{
@@ -816,13 +816,13 @@ transform_callback (PangoContext *context,
cairo_set_matrix (cr, &cairo_matrix);
- pango_cairo_update_context (cr, context);
+ pango2_cairo_update_context (cr, context);
}
static void
pangocairo_view_render (gpointer instance,
gpointer surface,
- PangoContext *context,
+ Pango2Context *context,
int *width,
int *height,
gpointer state)
@@ -966,7 +966,7 @@ parse_annotate_arg (const char *option_name,
}
static GOptionGroup *
-pangocairo_view_get_option_group (const PangoViewer *klass G_GNUC_UNUSED)
+pangocairo_view_get_option_group (const Pango2Viewer *klass G_GNUC_UNUSED)
{
GOptionEntry entries[] =
{
@@ -990,8 +990,8 @@ pangocairo_view_get_option_group (const PangoViewer *klass G_GNUC_UNUSED)
return group;
}
-const PangoViewer pangocairo_viewer = {
- "PangoCairo",
+const Pango2Viewer pangocairo_viewer = {
+ "Pango2Cairo",
"cairo",
#ifdef HAVE_CAIRO_PNG
"png",
diff --git a/utils/viewer-pangoxft.c b/utils/viewer-pangoxft.c
index 95a4545e..08aadb7e 100644
--- a/utils/viewer-pangoxft.c
+++ b/utils/viewer-pangoxft.c
@@ -1,4 +1,4 @@
-/* viewer-pangoxft.c: PangoXft viewer backend.
+/* viewer-pangoxft.c: Pango2Xft viewer backend.
*
* Copyright (C) 1999,2004,2005 Red Hat, Inc.
* Copyright (C) 2001 Sun Microsystems
@@ -43,7 +43,7 @@ default_substitute (FcPattern *pattern,
}
static gpointer
-pangoxft_view_create (const PangoViewer *klass)
+pangoxft_view_create (const Pango2Viewer *klass)
{
XViewer *instance;
@@ -51,7 +51,7 @@ pangoxft_view_create (const PangoViewer *klass)
XftInit (NULL);
- pango_fc_font_map_set_default_substitute (PANGO_FC_FONT_MAP (pango_xft_get_font_map (instance->display, instance->screen)),
+ pango2_fc_font_map_set_default_substitute (PANGO2_FC_FONT_MAP (pango2_xft_get_font_map (instance->display, instance->screen)),
default_substitute, NULL, NULL);
return instance;
@@ -62,17 +62,17 @@ pangoxft_view_destroy (gpointer instance)
{
XViewer *x = (XViewer *)instance;
- pango_xft_shutdown_display (x->display, x->screen);
+ pango2_xft_shutdown_display (x->display, x->screen);
x_view_destroy (instance);
}
-static PangoContext *
+static Pango2Context *
pangoxft_view_get_context (gpointer instance)
{
XViewer *x = (XViewer *) instance;
- return pango_font_map_create_context (pango_xft_get_font_map (x->display, x->screen));
+ return pango2_font_map_create_context (pango2_xft_get_font_map (x->display, x->screen));
}
typedef struct
@@ -82,7 +82,7 @@ typedef struct
} MyXftContext;
static void
-render_callback (PangoLayout *layout,
+render_callback (Pango2Layout *layout,
int x,
int y,
gpointer context,
@@ -90,16 +90,16 @@ render_callback (PangoLayout *layout,
{
MyXftContext *xft_context = (MyXftContext *) context;
- pango_xft_render_layout (xft_context->draw,
+ pango2_xft_render_layout (xft_context->draw,
&xft_context->color,
layout,
- x * PANGO_SCALE, y * PANGO_SCALE);
+ x * PANGO2_SCALE, y * PANGO2_SCALE);
}
static void
pangoxft_view_render (gpointer instance,
gpointer surface,
- PangoContext *context,
+ Pango2Context *context,
int *width,
int *height,
gpointer state)
@@ -137,8 +137,8 @@ pangoxft_view_render (gpointer instance,
XftDrawDestroy (draw);
}
-const PangoViewer pangoxft_viewer = {
- "PangoXft",
+const Pango2Viewer pangoxft_viewer = {
+ "Pango2Xft",
"xft",
NULL,
pangoxft_view_create,
diff --git a/utils/viewer-render.c b/utils/viewer-render.c
index 6c05b1d1..1cb9b4f3 100644
--- a/utils/viewer-render.c
+++ b/utils/viewer-render.c
@@ -35,7 +35,7 @@
gboolean opt_display = TRUE;
int opt_dpi = 96;
gboolean opt_pixels = FALSE;
-gboolean opt_pango_units = FALSE;
+gboolean opt_pango2_units = FALSE;
const char *opt_font = "";
gboolean opt_header = FALSE;
const char *opt_output = NULL;
@@ -55,25 +55,25 @@ int opt_indent = 0;
int opt_spacing = 0;
double opt_line_spacing = -1.0;
int opt_runs = 1;
-PangoAlignment opt_align = PANGO_ALIGN_LEFT;
-PangoEllipsizeMode opt_ellipsize = PANGO_ELLIPSIZE_NONE;
-PangoGravity opt_gravity = PANGO_GRAVITY_SOUTH;
-PangoGravityHint opt_gravity_hint = PANGO_GRAVITY_HINT_NATURAL;
+Pango2Alignment opt_align = PANGO2_ALIGN_LEFT;
+Pango2EllipsizeMode opt_ellipsize = PANGO2_ELLIPSIZE_NONE;
+Pango2Gravity opt_gravity = PANGO2_GRAVITY_SOUTH;
+Pango2GravityHint opt_gravity_hint = PANGO2_GRAVITY_HINT_NATURAL;
HintMode opt_hinting = HINT_DEFAULT;
HintMetrics opt_hint_metrics = HINT_METRICS_DEFAULT;
SubpixelOrder opt_subpixel_order = SUBPIXEL_DEFAULT;
Antialias opt_antialias = ANTIALIAS_DEFAULT;
gboolean opt_subpixel_positions = FALSE;
-PangoWrapMode opt_wrap = PANGO_WRAP_WORD_CHAR;
+Pango2WrapMode opt_wrap = PANGO2_WRAP_WORD_CHAR;
gboolean opt_wrap_set = FALSE;
static const char *opt_pangorc = NULL; /* Unused */
-const PangoViewer *opt_viewer = NULL;
+const Pango2Viewer *opt_viewer = NULL;
const char *opt_language = NULL;
gboolean opt_single_par = FALSE;
-PangoColor opt_fg_color = {0, 0, 0};
+Pango2Color opt_fg_color = {0, 0, 0};
guint16 opt_fg_alpha = 65535;
gboolean opt_bg_set = FALSE;
-PangoColor opt_bg_color = {65535, 65535, 65535};
+Pango2Color opt_bg_color = {65535, 65535, 65535};
guint16 opt_bg_alpha = 65535;
gboolean opt_serialized = FALSE;
const char *opt_serialized_output;
@@ -95,14 +95,14 @@ fail (const char *format, ...)
exit (1);
}
-static PangoLayout *
-make_layout(PangoContext *context,
+static Pango2Layout *
+make_layout(Pango2Context *context,
const char *text,
double size)
{
- static PangoFontDescription *font_description;
- PangoAlignment align;
- PangoLayout *layout;
+ static Pango2FontDescription *font_description;
+ Pango2Alignment align;
+ Pango2Layout *layout;
if (opt_serialized)
{
@@ -114,85 +114,85 @@ make_layout(PangoContext *context,
if (!g_file_get_contents (file_arg, &data, &len, &error))
fail ("%s\n", error->message);
bytes = g_bytes_new_take (data, len);
- layout = pango_layout_deserialize (context, bytes, PANGO_LAYOUT_DESERIALIZE_CONTEXT, &error);
+ layout = pango2_layout_deserialize (context, bytes, PANGO2_LAYOUT_DESERIALIZE_CONTEXT, &error);
if (!layout)
fail ("%s\n", error->message);
g_bytes_unref (bytes);
goto out;
}
- layout = pango_layout_new (context);
+ layout = pango2_layout_new (context);
if (opt_markup)
- pango_layout_set_markup (layout, text, -1);
+ pango2_layout_set_markup (layout, text, -1);
else
- pango_layout_set_text (layout, text, -1);
+ pango2_layout_set_text (layout, text, -1);
- pango_layout_set_auto_dir (layout, opt_auto_dir);
- pango_layout_set_ellipsize (layout, opt_ellipsize);
- pango_layout_set_single_paragraph (layout, opt_single_par);
- pango_layout_set_wrap (layout, opt_wrap);
+ pango2_layout_set_auto_dir (layout, opt_auto_dir);
+ pango2_layout_set_ellipsize (layout, opt_ellipsize);
+ pango2_layout_set_single_paragraph (layout, opt_single_par);
+ pango2_layout_set_wrap (layout, opt_wrap);
- font_description = pango_font_description_from_string (opt_font);
+ font_description = pango2_font_description_from_string (opt_font);
if (size > 0)
- pango_font_description_set_size (font_description, size * PANGO_SCALE);
+ pango2_font_description_set_size (font_description, size * PANGO2_SCALE);
if (opt_width >= 0)
{
- if (opt_pango_units)
- pango_layout_set_width (layout, opt_width);
+ if (opt_pango2_units)
+ pango2_layout_set_width (layout, opt_width);
else
- pango_layout_set_width (layout, (opt_width * opt_dpi * PANGO_SCALE + 36) / 72);
+ pango2_layout_set_width (layout, (opt_width * opt_dpi * PANGO2_SCALE + 36) / 72);
}
if (opt_height >= 0)
{
- if (opt_pango_units)
- pango_layout_set_width (layout, opt_height);
+ if (opt_pango2_units)
+ pango2_layout_set_width (layout, opt_height);
else
- pango_layout_set_height (layout, (opt_height * opt_dpi * PANGO_SCALE + 36) / 72);
+ pango2_layout_set_height (layout, (opt_height * opt_dpi * PANGO2_SCALE + 36) / 72);
}
else
- pango_layout_set_height (layout, opt_height);
+ pango2_layout_set_height (layout, opt_height);
if (opt_indent != 0)
{
- if (opt_pango_units)
- pango_layout_set_indent (layout, opt_indent);
+ if (opt_pango2_units)
+ pango2_layout_set_indent (layout, opt_indent);
else
- pango_layout_set_indent (layout, (opt_indent * opt_dpi * PANGO_SCALE + 36) / 72);
+ pango2_layout_set_indent (layout, (opt_indent * opt_dpi * PANGO2_SCALE + 36) / 72);
}
if (opt_spacing != 0)
{
- if (opt_pango_units)
- pango_layout_set_spacing (layout, opt_spacing);
+ if (opt_pango2_units)
+ pango2_layout_set_spacing (layout, opt_spacing);
else
- pango_layout_set_spacing (layout, (opt_spacing * opt_dpi * PANGO_SCALE + 36) / 72);
- pango_layout_set_line_height (layout, 0.0);
+ pango2_layout_set_spacing (layout, (opt_spacing * opt_dpi * PANGO2_SCALE + 36) / 72);
+ pango2_layout_set_line_height (layout, 0.0);
}
if (opt_line_spacing >= 0.0)
- pango_layout_set_line_height (layout, (float)opt_line_spacing);
+ pango2_layout_set_line_height (layout, (float)opt_line_spacing);
align = opt_align;
- if (align != PANGO_ALIGN_CENTER &&
- pango_context_get_base_dir (context) != PANGO_DIRECTION_LTR) {
+ if (align != PANGO2_ALIGN_CENTER &&
+ pango2_context_get_base_dir (context) != PANGO2_DIRECTION_LTR) {
/* pango reverses left and right if base dir ir rtl. so we should
* reverse to cancel that. unfortunately it also does that for
* rtl paragraphs, so we cannot really get left/right. all we get
* is default/other-side. */
- align = PANGO_ALIGN_LEFT + PANGO_ALIGN_RIGHT - align;
+ align = PANGO2_ALIGN_LEFT + PANGO2_ALIGN_RIGHT - align;
}
- pango_layout_set_alignment (layout, align);
+ pango2_layout_set_alignment (layout, align);
- pango_layout_set_font_description (layout, font_description);
+ pango2_layout_set_font_description (layout, font_description);
- pango_font_description_free (font_description);
+ pango2_font_description_free (font_description);
out:
if (opt_serialized_output)
{
- if (!pango_layout_write_to_file (layout, opt_serialized_output))
+ if (!pango2_layout_write_to_file (layout, opt_serialized_output))
fail ("Failed to serialize\n");
}
@@ -202,23 +202,23 @@ out:
char *
get_options_string (void)
{
- PangoFontDescription *font_description = pango_font_description_from_string (opt_font);
+ Pango2FontDescription *font_description = pango2_font_description_from_string (opt_font);
char *font_name;
char *result;
if (opt_waterfall)
- pango_font_description_unset_fields (font_description, PANGO_FONT_MASK_SIZE);
+ pango2_font_description_unset_fields (font_description, PANGO2_FONT_MASK_SIZE);
- font_name = pango_font_description_to_string (font_description);
+ font_name = pango2_font_description_to_string (font_description);
result = g_strdup_printf ("%s: %s (%d dpi)", opt_viewer->name, font_name, opt_dpi);
- pango_font_description_free (font_description);
+ pango2_font_description_free (font_description);
g_free (font_name);
return result;
}
static void
-output_body (PangoLayout *layout,
+output_body (Pango2Layout *layout,
RenderCallback render_cb,
gpointer cb_context,
gpointer cb_data,
@@ -226,23 +226,23 @@ output_body (PangoLayout *layout,
int *height,
gboolean supports_matrix)
{
- PangoRectangle logical_rect;
+ Pango2Rectangle logical_rect;
int size, start_size, end_size, increment;
int x = 0, y = 0;
if (!supports_matrix)
{
- const PangoMatrix* matrix;
- const PangoMatrix identity = PANGO_MATRIX_INIT;
- PangoContext *context = pango_layout_get_context (layout);
- matrix = pango_context_get_matrix (context);
+ const Pango2Matrix* matrix;
+ const Pango2Matrix identity = PANGO2_MATRIX_INIT;
+ Pango2Context *context = pango2_layout_get_context (layout);
+ matrix = pango2_context_get_matrix (context);
if (matrix)
{
x += matrix->x0;
y += matrix->y0;
}
- pango_context_set_matrix (context, &identity);
- pango_layout_context_changed (layout);
+ pango2_context_set_matrix (context, &identity);
+ pango2_layout_context_changed (layout);
}
if (opt_waterfall)
@@ -264,40 +264,40 @@ output_body (PangoLayout *layout,
{
if (size > 0)
{
- PangoFontDescription *desc = pango_font_description_copy (pango_layout_get_font_description (layout));
- pango_font_description_set_size (desc, size * PANGO_SCALE);
- pango_layout_set_font_description (layout, desc);
- pango_font_description_free (desc);
+ Pango2FontDescription *desc = pango2_font_description_copy (pango2_layout_get_font_description (layout));
+ pango2_font_description_set_size (desc, size * PANGO2_SCALE);
+ pango2_layout_set_font_description (layout, desc);
+ pango2_font_description_free (desc);
}
- pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &logical_rect);
- pango_extents_to_pixels (&logical_rect, NULL);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), NULL, &logical_rect);
+ pango2_extents_to_pixels (&logical_rect, NULL);
if (render_cb)
(*render_cb) (layout, x, y+*height, cb_context, cb_data);
*width = MAX (*width,
MAX (logical_rect.x + logical_rect.width,
- PANGO_PIXELS (pango_layout_get_width (layout))));
+ PANGO2_PIXELS (pango2_layout_get_width (layout))));
*height += MAX (logical_rect.y + logical_rect.height,
- PANGO_PIXELS (pango_layout_get_height (layout)));
+ PANGO2_PIXELS (pango2_layout_get_height (layout)));
}
}
static void
-set_transform (PangoContext *context,
+set_transform (Pango2Context *context,
TransformCallback transform_cb,
gpointer cb_context,
gpointer cb_data,
- PangoMatrix *matrix)
+ Pango2Matrix *matrix)
{
- pango_context_set_matrix (context, matrix);
+ pango2_context_set_matrix (context, matrix);
if (transform_cb)
(*transform_cb) (context, matrix, cb_context, cb_data);
}
void
-do_output (PangoContext *context,
+do_output (Pango2Context *context,
RenderCallback render_cb,
TransformCallback transform_cb,
gpointer cb_context,
@@ -305,10 +305,10 @@ do_output (PangoContext *context,
int *width_out,
int *height_out)
{
- PangoLayout *layout;
- PangoRectangle rect;
- PangoMatrix matrix = PANGO_MATRIX_INIT;
- PangoMatrix *orig_matrix;
+ Pango2Layout *layout;
+ Pango2Rectangle rect;
+ Pango2Matrix matrix = PANGO2_MATRIX_INIT;
+ Pango2Matrix *orig_matrix;
gboolean supports_matrix;
int rotated_width, rotated_height;
int x = opt_margin_l;
@@ -318,7 +318,7 @@ do_output (PangoContext *context,
width = 0;
height = 0;
- orig_matrix = pango_matrix_copy (pango_context_get_matrix (context));
+ orig_matrix = pango2_matrix_copy (pango2_context_get_matrix (context));
/* If the backend sets an all-zero matrix on the context,
* means that it doesn't support transformations.
*/
@@ -329,26 +329,26 @@ do_output (PangoContext *context,
set_transform (context, transform_cb, cb_context, cb_data, NULL);
- pango_context_set_language (context,
- opt_language ? pango_language_from_string (opt_language)
- : pango_language_get_default ());
- pango_context_set_base_dir (context,
- opt_rtl ? PANGO_DIRECTION_RTL : PANGO_DIRECTION_LTR);
+ pango2_context_set_language (context,
+ opt_language ? pango2_language_from_string (opt_language)
+ : pango2_language_get_default ());
+ pango2_context_set_base_dir (context,
+ opt_rtl ? PANGO2_DIRECTION_RTL : PANGO2_DIRECTION_LTR);
if (opt_header)
{
char *options_string = get_options_string ();
- pango_context_set_base_gravity (context, PANGO_GRAVITY_SOUTH);
+ pango2_context_set_base_gravity (context, PANGO2_GRAVITY_SOUTH);
layout = make_layout (context, options_string, 10);
- pango_lines_get_extents (pango_layout_get_lines (layout), NULL, &rect);
+ pango2_lines_get_extents (pango2_layout_get_lines (layout), NULL, &rect);
- width = MAX (width, PANGO_PIXELS (rect.width));
- height += PANGO_PIXELS (rect.height);
+ width = MAX (width, PANGO2_PIXELS (rect.width));
+ height += PANGO2_PIXELS (rect.height);
if (render_cb)
(*render_cb) (layout, x, y, cb_context, cb_data);
- y += PANGO_PIXELS (rect.height);
+ y += PANGO2_PIXELS (rect.height);
g_object_unref (layout);
g_free (options_string);
@@ -357,19 +357,19 @@ do_output (PangoContext *context,
if (opt_rotate != 0)
{
if (supports_matrix)
- pango_matrix_rotate (&matrix, opt_rotate);
+ pango2_matrix_rotate (&matrix, opt_rotate);
else
g_printerr ("The backend does not support rotated text\n");
}
- pango_context_set_base_gravity (context, opt_gravity);
- pango_context_set_gravity_hint (context, opt_gravity_hint);
+ pango2_context_set_base_gravity (context, opt_gravity);
+ pango2_context_set_gravity_hint (context, opt_gravity_hint);
layout = make_layout (context, text, -1);
if (opt_serialized && supports_matrix)
{
- const PangoMatrix *context_matrix = pango_context_get_matrix (pango_layout_get_context (layout));
- matrix = context_matrix ? *context_matrix : (PangoMatrix) PANGO_MATRIX_INIT;
+ const Pango2Matrix *context_matrix = pango2_context_get_matrix (pango2_layout_get_context (layout));
+ matrix = context_matrix ? *context_matrix : (Pango2Matrix) PANGO2_MATRIX_INIT;
}
set_transform (context, transform_cb, cb_context, cb_data, &matrix);
@@ -383,7 +383,7 @@ do_output (PangoContext *context,
rect.width = rotated_width;
rect.height = rotated_height;
- pango_matrix_transform_pixel_rectangle (&matrix, &rect);
+ pango2_matrix_transform_pixel_rectangle (&matrix, &rect);
matrix.x0 = x - rect.x;
matrix.y0 = y - rect.y;
@@ -407,8 +407,8 @@ do_output (PangoContext *context,
if (height_out)
*height_out = height;
- pango_context_set_matrix (context, orig_matrix);
- pango_matrix_free (orig_matrix);
+ pango2_context_set_matrix (context, orig_matrix);
+ pango2_matrix_free (orig_matrix);
g_object_unref (layout);
}
@@ -495,7 +495,7 @@ parse_align (const char *name,
gpointer data,
GError **error)
{
- return parse_enum (PANGO_TYPE_ALIGNMENT, (int*)(void*)&opt_align,
+ return parse_enum (PANGO2_TYPE_ALIGNMENT, (int*)(void*)&opt_align,
name, arg, data, error);
}
@@ -505,7 +505,7 @@ parse_ellipsis (const char *name,
gpointer data,
GError **error)
{
- return parse_enum (PANGO_TYPE_ELLIPSIZE_MODE, (int*)(void*)&opt_ellipsize,
+ return parse_enum (PANGO2_TYPE_ELLIPSIZE_MODE, (int*)(void*)&opt_ellipsize,
name, arg, data, error);
}
@@ -515,7 +515,7 @@ parse_gravity (const char *name,
gpointer data,
GError **error)
{
- return parse_enum (PANGO_TYPE_GRAVITY, (int*)(void*)&opt_gravity,
+ return parse_enum (PANGO2_TYPE_GRAVITY, (int*)(void*)&opt_gravity,
name, arg, data, error);
}
@@ -525,7 +525,7 @@ parse_gravity_hint (const char *name,
gpointer data,
GError **error)
{
- return parse_enum (PANGO_TYPE_GRAVITY_HINT, (int*)(void*)&opt_gravity_hint,
+ return parse_enum (PANGO2_TYPE_GRAVITY_HINT, (int*)(void*)&opt_gravity_hint,
name, arg, data, error);
}
@@ -643,7 +643,7 @@ parse_wrap (const char *name,
GError **error)
{
gboolean ret;
- if ((ret = parse_enum (PANGO_TYPE_WRAP_MODE, (int*)(void*)&opt_wrap,
+ if ((ret = parse_enum (PANGO2_TYPE_WRAP_MODE, (int*)(void*)&opt_wrap,
name, arg, data, error)))
{
opt_wrap_set = TRUE;
@@ -652,7 +652,7 @@ parse_wrap (const char *name,
}
static gboolean
-parse_rgba_color (PangoColor *color,
+parse_rgba_color (Pango2Color *color,
guint16 *alpha,
const char *name,
const char *arg,
@@ -694,7 +694,7 @@ parse_rgba_color (PangoColor *color,
else
*alpha = 65535;
- ret = pango_color_parse (color, arg);
+ ret = pango2_color_parse (color, arg);
err:
if (!ret && error)
@@ -768,7 +768,7 @@ static char *
backends_to_string (void)
{
GString *backends = g_string_new (NULL);
- const PangoViewer **viewer;
+ const Pango2Viewer **viewer;
for (viewer = viewers; *viewer; viewer++)
if ((*viewer)->id)
@@ -784,7 +784,7 @@ backends_to_string (void)
static int
backends_get_count (void)
{
- const PangoViewer **viewer;
+ const Pango2Viewer **viewer;
int i = 0;
for (viewer = viewers; *viewer; viewer++)
@@ -798,7 +798,7 @@ backends_get_count (void)
static char *
backend_description (void)
{
- GString *description = g_string_new("Pango backend to use for rendering ");
+ GString *description = g_string_new("Pango2 backend to use for rendering ");
int backends_count = backends_get_count ();
if (backends_count > 1)
@@ -819,7 +819,7 @@ parse_backend (const char *name G_GNUC_UNUSED,
GError **error)
{
gboolean ret = TRUE;
- const PangoViewer **viewer;
+ const Pango2Viewer **viewer;
for (viewer = viewers; *viewer; viewer++)
if (!g_ascii_strcasecmp ((*viewer)->id, arg))
@@ -852,8 +852,8 @@ show_version(const char *name G_GNUC_UNUSED,
{
g_printf("%s (%s) %s\n", g_get_prgname (), PACKAGE_NAME, PACKAGE_VERSION);
- if (PANGO_VERSION != pango_version())
- g_printf("Linked Pango library has a different version: %s\n", pango_version_string ());
+ if (PANGO2_VERSION != pango2_version())
+ g_printf("Linked Pango2 library has a different version: %s\n", pango2_version_string ());
exit(0);
}
@@ -913,21 +913,21 @@ parse_options (int argc, char *argv[])
{"margin", 0, 0, G_OPTION_ARG_CALLBACK, &parse_margin,
"Set the margin on the output in pixels", "CSS-style numbers in pixels"},
{"markup", 0, 0, G_OPTION_ARG_NONE, &opt_markup,
- "Interpret text as Pango markup", NULL},
+ "Interpret text as Pango2 markup", NULL},
{"output", 'o', 0, G_OPTION_ARG_STRING, &opt_output,
"Save rendered image to output file", "file"},
{"pangorc", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_pangorc,
"Deprecated", "file"},
{"pixels", 0, 0, G_OPTION_ARG_NONE, &opt_pixels,
"Use pixel units instead of points (sets dpi to 72)", NULL},
- {"pango-units", 0, 0, G_OPTION_ARG_NONE, &opt_pango_units,
- "Use Pango units instead of points", NULL},
+ {"pango-units", 0, 0, G_OPTION_ARG_NONE, &opt_pango2_units,
+ "Use Pango2 units instead of points", NULL},
{"rtl", 0, 0, G_OPTION_ARG_NONE, &opt_rtl,
"Set base direction to right-to-left", NULL},
{"rotate", 0, 0, G_OPTION_ARG_DOUBLE, &opt_rotate,
"Angle at which to rotate results", "degrees"},
{"runs", 'n', 0, G_OPTION_ARG_INT, &opt_runs,
- "Run Pango layout engine this many times", "integer"},
+ "Run Pango2 layout engine this many times", "integer"},
{"single-par", 0, 0, G_OPTION_ARG_NONE, &opt_single_par,
"Enable single-paragraph mode", NULL},
{"text", 't', 0, G_OPTION_ARG_STRING, &opt_text,
@@ -950,7 +950,7 @@ parse_options (int argc, char *argv[])
GError *parse_error = NULL;
GOptionContext *context;
size_t len;
- const PangoViewer **viewer;
+ const Pango2Viewer **viewer;
context = g_option_context_new ("- FILE");
g_option_context_add_main_entries (context, entries, NULL);
@@ -1031,7 +1031,7 @@ parse_options (int argc, char *argv[])
/* Make sure we have valid markup
*/
if (opt_markup &&
- !pango_parse_markup (text, -1, 0, NULL, NULL, NULL, &error))
+ !pango2_parse_markup (text, -1, 0, NULL, NULL, NULL, &error))
fail ("Cannot parse input as markup: %s", error->message);
}
diff --git a/utils/viewer-render.h b/utils/viewer-render.h
index 65df915a..c57b9588 100644
--- a/utils/viewer-render.h
+++ b/utils/viewer-render.h
@@ -55,13 +55,13 @@ typedef enum {
HINT_METRICS_OFF
} HintMetrics;
-typedef void (*RenderCallback) (PangoLayout *layout,
+typedef void (*RenderCallback) (Pango2Layout *layout,
int x,
int y,
gpointer cb_context,
gpointer cb_data);
-typedef void (*TransformCallback) (PangoContext *context,
- PangoMatrix *transform,
+typedef void (*TransformCallback) (Pango2Context *context,
+ Pango2Matrix *transform,
gpointer cb_context,
gpointer cb_data);
@@ -69,7 +69,7 @@ void fail (const char *format, ...) G_GNUC_PRINTF (1, 2) G_GNUC_NORETURN;
void parse_options (int argc,
char *argv[]);
-void do_output (PangoContext *context,
+void do_output (Pango2Context *context,
RenderCallback render_cb,
TransformCallback transform_cb,
gpointer cb_context,
@@ -93,13 +93,13 @@ extern const char *opt_text;
extern gboolean opt_waterfall;
extern int opt_width;
extern int opt_indent;
-extern PangoEllipsizeMode opt_ellipsize;
+extern Pango2EllipsizeMode opt_ellipsize;
/* handled by viewer-main.c */
extern gboolean opt_display;
extern const char *opt_output;
extern int opt_runs;
-extern const PangoViewer *opt_viewer;
+extern const Pango2Viewer *opt_viewer;
/* handled by backend-specific code */
extern int opt_dpi;
@@ -108,10 +108,10 @@ extern SubpixelOrder opt_subpixel_order;
extern Antialias opt_antialias;
extern HintMetrics opt_hint_metrics;
extern gboolean opt_subpixel_positions;
-extern PangoColor opt_fg_color;
+extern Pango2Color opt_fg_color;
extern guint16 opt_fg_alpha;
extern gboolean opt_bg_set;
-extern PangoColor opt_bg_color;
+extern Pango2Color opt_bg_color;
extern guint16 opt_bg_alpha;
#endif /* VIEWER_RENDER_H */
diff --git a/utils/viewer-x.c b/utils/viewer-x.c
index 0bc9286c..9451f666 100644
--- a/utils/viewer-x.c
+++ b/utils/viewer-x.c
@@ -26,7 +26,7 @@
void
x_view_init (gpointer instance,
- const PangoViewer *klass G_GNUC_UNUSED)
+ const Pango2Viewer *klass G_GNUC_UNUSED)
{
XViewer *x = (XViewer *)instance;
@@ -38,7 +38,7 @@ x_view_init (gpointer instance,
}
gpointer
-x_view_create (const PangoViewer *klass)
+x_view_create (const Pango2Viewer *klass)
{
XViewer *instance;
@@ -219,7 +219,7 @@ x_view_display (gpointer instance,
}
}
-const PangoViewer pangox_viewer = {
+const Pango2Viewer pangox_viewer = {
"X",
"x",
NULL,
diff --git a/utils/viewer-x.h b/utils/viewer-x.h
index 5611f20c..f39ed188 100644
--- a/utils/viewer-x.h
+++ b/utils/viewer-x.h
@@ -36,12 +36,12 @@ typedef struct
} XViewer;
-extern const PangoViewer pangox_viewer;
+extern const Pango2Viewer pangox_viewer;
void x_view_init (gpointer instance,
- const PangoViewer *klass);
+ const Pango2Viewer *klass);
-gpointer x_view_create (const PangoViewer *klass);
+gpointer x_view_create (const Pango2Viewer *klass);
void x_view_destroy (gpointer instance);
diff --git a/utils/viewer.h b/utils/viewer.h
index c4d58193..adcd740a 100644
--- a/utils/viewer.h
+++ b/utils/viewer.h
@@ -1,4 +1,4 @@
-/* viewer.h: PangoViewer class
+/* viewer.h: Pango2Viewer class
*
* Copyright (C) 1999,2004,2005 Red Hat, Inc.
* Copyright (C) 2001 Sun Microsystems
@@ -23,9 +23,9 @@
#include <pango/pango.h>
-typedef struct _PangoViewer PangoViewer;
+typedef struct _Pango2Viewer Pango2Viewer;
-struct _PangoViewer {
+struct _Pango2Viewer {
const char *name;
@@ -33,11 +33,11 @@ struct _PangoViewer {
const char *write_suffix;
- gpointer (*create) (const PangoViewer *klass);
+ gpointer (*create) (const Pango2Viewer *klass);
void (*destroy) (gpointer instance);
- PangoContext * (*get_context) (gpointer instance);
+ Pango2Context * (*get_context) (gpointer instance);
gpointer (*create_surface) (gpointer instance,
int width,
@@ -48,7 +48,7 @@ struct _PangoViewer {
void (*render) (gpointer instance,
gpointer surface,
- PangoContext *context,
+ Pango2Context *context,
int *width,
int *height,
gpointer state);
@@ -90,9 +90,9 @@ struct _PangoViewer {
int height,
int stride);
- GOptionGroup * (*get_option_group) (const PangoViewer *klass);
+ GOptionGroup * (*get_option_group) (const Pango2Viewer *klass);
};
-extern const PangoViewer *viewers[];
+extern const Pango2Viewer *viewers[];
#endif /* VIEWER_H */