Commit f82c7d11 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Merge branch 'serializer2' into 'main'

Add layout serialization api

See merge request !513
parents 97300279 43f78996
Pipeline #334460 failed with stages
in 7 minutes and 13 seconds
......@@ -8,7 +8,7 @@ stages:
variables:
COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror"
MESON_TEST_TIMEOUT_MULTIPLIER: 2
FEDORA_IMAGE: registry.gitlab.gnome.org/gnome/pango/fedora:v6
FEDORA_IMAGE: registry.gitlab.gnome.org/gnome/pango/fedora:v7
.only-default:
only:
......
......@@ -26,6 +26,7 @@ RUN dnf -y install \
harfbuzz-devel \
hicolor-icon-theme \
itstool \
json-glib-devel \
libasan \
lcov \
libthai-devel \
......
......@@ -232,6 +232,7 @@ harfbuzz_req_version = '>= 2.6.0'
fontconfig_req_version = '>= 2.13.0'
xft_req_version = '>= 2.0.0'
cairo_req_version = '>= 1.12.10'
json_glib_version = '>= 1.6.0'
# libm
mathlib_dep = cc.find_library('m', required: false)
......@@ -251,6 +252,10 @@ fribidi_dep = dependency('fribidi', version: fribidi_req_version,
default_options: ['docs=false'])
pango_deps += fribidi_dep
json_glib_dep = dependency('json-glib-1.0', version: json_glib_version,
fallback: ['json-glib', 'json_glib_dep'])
pango_deps += json_glib_dep
thai_dep = dependency('libthai', version: libthai_req_version, required: get_option('libthai'))
if thai_dep.found()
pango_conf.set('HAVE_LIBTHAI', 1)
......
......@@ -19,6 +19,14 @@
fun:_cairo_ft_font_options_substitute
}
{
pango 3
Memcheck:Leak
fun:calloc
...
fun:pango_language_from_string
}
# Fontconfig
{
FcFontSetList
......@@ -84,6 +92,13 @@
...
fun:g_intern_static_string
}
{
glib GThread
Memcheck:Leak
fun:calloc
...
fun:g_thread_new_internal
}
# libthai
{
......
......@@ -27,6 +27,7 @@ pango_sources = [
'pango-utils.c',
'reorder-items.c',
'shape.c',
'serializer.c',
]
pango_headers = [
......
......@@ -2802,7 +2802,7 @@ pango_attr_list_from_string (const char *text)
p = endp + strspn (endp, " ");
endp = (char *)strpbrk (p, " ");
endp = (char *)p + strcspn (p, " ");
attr_type = get_attr_type_by_nick (p, endp - p);
p = endp + strspn (endp, " ");
......@@ -2929,8 +2929,7 @@ pango_attr_list_from_string (const char *text)
break;
case PANGO_ATTR_SHAPE:
endp = (char *)strpbrk (p, ",\n");
p = endp + strspn (endp, " ");
endp = (char *)p + strcspn (p, ",\n");
continue; /* FIXME */
case PANGO_ATTR_SCALE:
......
......@@ -351,6 +351,31 @@ GSList * pango_layout_get_lines (PangoLayout *layout);
PANGO_AVAILABLE_IN_1_16
GSList * pango_layout_get_lines_readonly (PangoLayout *layout);
#define PANGO_LAYOUT_SERIALIZE_ERROR (pango_layout_serialize_error_quark ())
typedef enum {
PANGO_LAYOUT_SERIALIZE_INVALID,
PANGO_LAYOUT_SERIALIZE_INVALID_SYNTAX,
PANGO_LAYOUT_SERIALIZE_INVALID_VALUE,
PANGO_LAYOUT_SERIALIZE_MISSING_VALUE,
} PangoLayoutSerializeError;
PANGO_AVAILABLE_IN_1_50
GQuark pango_layout_serialize_error_quark (void);
PANGO_AVAILABLE_IN_1_50
GBytes * pango_layout_serialize (PangoLayout *layout);
PANGO_AVAILABLE_IN_1_50
PangoLayout * pango_layout_deserialize (PangoContext *context,
GBytes *bytes,
GError **error);
PANGO_AVAILABLE_IN_1_50
gboolean pango_layout_write_to_file (PangoLayout *layout,
const char *filename,
GError **error);
#define PANGO_TYPE_LAYOUT_LINE (pango_layout_line_get_type ())
......
This diff is collapsed.
[wrap-git]
directory=json-glib
url=https://gitlab.gnome.org/GNOME/json-glib.git
revision=master
depth=1
{
"text" : "This is a test of the automatic emergency brake!\n",
"attributes" : [
{
"start" : 22,
"end" : 41,
"type" : "foreground",
"value" : "#00000000ffff"
},
{
"start" : 22,
"end" : 41,
"type" : "underline",
"value" : "single"
}
],
"font" : "Cantarell 11",
"ellipsize" : "end",
"width" : 225280
}
width=220,ellipsize=end
This is a test of the <span foreground="#0000ff" underline="single">automatic emergency</span> brake!
{
"text" : "Hello שלום Γειά σας\n",
"attributes" : [],
"font" : "Cantarell 11",
"justify" : true,
"ellipsize" : "end",
"width" : 102400
}
width=100,justify=true,ellipsize=end
Hello שלום Γειά σας
{
"text" : "double low error\n",
"attributes" : [
{
"end" : 6,
"type" : "underline",
"value" : "double"
},
{
"end" : 6,
"type" : "overline",
"value" : "single"
},
{
"start" : 7,
"end" : 10,
"type" : "underline",
"value" : "low"
},
{
"start" : 7,
"end" : 10,
"type" : "strikethrough",
"value" : true
},
{
"start" : 11,
"end" : 16,
"type" : "underline",
"value" : "error"
},
{
"start" : 11,
"end" : 16,
"type" : "rise",
"value" : 1024
}
],
"font" : "Cantarell 11",
"wrap" : "char",
"width" : 225280
}
width=220,wrap=char
<span underline='double' overline='single'>double</span> <span underline='low' strikethrough='true'>low</span> <span underline='error' rise='1024'>error</span>
{
"text" : "a b c d
e f g h\n",
"attributes" : [],
"font" : "Cantarell 11",
"tabs" : {
"positions-in-pixels" : true,
"positions" : [
0,
50,
100,
150,
200
]
}
}
wrap=word,tabs=0 50 100 150 200
a b c d
e f g h
{
"text" : "a b c d
e f g h\n",
"attributes" : [],
"font" : "Cantarell 11",
"tabs" : {
"positions-in-pixels" : true,
"positions" : [
0,
50,
100,
150,
200
]
},
"single-paragraph" : true
}
wrap=word,tabs=0 50 100 150 200,single_paragraph=true
a b c d
e f g h
{
"text" : "你好 Hello שלום Γειά σας\n",
"attributes" : [],
"font" : "Cantarell 11",
"ellipsize" : "start",
"width" : 161792,
"line-spacing" : 1.5
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment