Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
pango
Commits
0eb9ca5a
Commit
0eb9ca5a
authored
Nov 19, 2021
by
Matthias Clasen
Browse files
Merge branch 'matthiasc/for-main' into 'main'
Tweak word and sentence attributes See merge request
!515
parents
f82c7d11
b3b87f67
Pipeline
#334862
failed with stages
in 7 minutes and 4 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pango/pango-attributes.c
View file @
0eb9ca5a
...
...
@@ -1391,7 +1391,7 @@ pango_attr_word_new (void)
pango_attr_int_equal
,
};
return
pango_attr_int_new
(
&
klass
,
0
);
return
pango_attr_int_new
(
&
klass
,
1
);
}
/**
...
...
@@ -1418,7 +1418,7 @@ pango_attr_sentence_new (void)
pango_attr_int_equal
,
};
return
pango_attr_int_new
(
&
klass
,
0
);
return
pango_attr_int_new
(
&
klass
,
1
);
}
/**
...
...
utils/viewer-pangocairo.c
View file @
0eb9ca5a
...
...
@@ -424,7 +424,7 @@ render_callback (PangoLayout *layout,
{
PangoRectangle
rect
;
pango_layout_iter_get_c
luste
r_extents
(
iter
,
NULL
,
&
rect
);
pango_layout_iter_get_c
ha
r_extents
(
iter
,
&
rect
);
cairo_rectangle
(
cr
,
(
double
)
rect
.
x
/
PANGO_SCALE
-
lw
/
2
,
(
double
)
rect
.
y
/
PANGO_SCALE
-
lw
/
2
,
...
...
utils/viewer-render.c
View file @
0eb9ca5a
...
...
@@ -77,6 +77,8 @@ guint16 opt_fg_alpha = 65535;
gboolean
opt_bg_set
=
FALSE
;
PangoColor
opt_bg_color
=
{
65535
,
65535
,
65535
};
guint16
opt_bg_alpha
=
65535
;
gboolean
opt_serialized
=
FALSE
;
const
char
*
file_arg
;
/* Text (or markup) to render */
static
char
*
text
;
...
...
@@ -103,6 +105,23 @@ make_layout(PangoContext *context,
PangoAlignment
align
;
PangoLayout
*
layout
;
if
(
opt_serialized
)
{
char
*
text
;
gsize
len
;
GBytes
*
bytes
;
GError
*
error
=
NULL
;
if
(
!
g_file_get_contents
(
file_arg
,
&
text
,
&
len
,
&
error
))
fail
(
"%s
\n
"
,
error
->
message
);
bytes
=
g_bytes_new_take
(
text
,
size
);
layout
=
pango_layout_deserialize
(
context
,
bytes
,
&
error
);
if
(
!
layout
)
fail
(
"%s
\n
"
,
error
->
message
);
g_bytes_unref
(
bytes
);
return
layout
;
}
layout
=
pango_layout_new
(
context
);
if
(
opt_markup
)
pango_layout_set_markup
(
layout
,
text
,
-
1
);
...
...
@@ -868,6 +887,8 @@ parse_options (int argc, char *argv[])
"Width in points to which to wrap lines or ellipsize"
,
"points"
},
{
"wrap"
,
0
,
0
,
G_OPTION_ARG_CALLBACK
,
&
parse_wrap
,
"Text wrapping mode (needs a width to be set)"
,
"word/char/word-char"
},
{
"serialized"
,
0
,
0
,
G_OPTION_ARG_NONE
,
&
opt_serialized
,
"Create layout from a serialized file"
,
NULL
},
{
NULL
}
};
GError
*
error
=
NULL
;
...
...
@@ -911,6 +932,12 @@ parse_options (int argc, char *argv[])
exit
(
1
);
}
if
(
opt_serialized
&&
argc
!=
2
)
{
g_printerr
(
"Usage: %s [OPTION...] FILE
\n
"
,
g_get_prgname
());
exit
(
1
);
}
/* set up the backend */
if
(
!
opt_viewer
)
{
...
...
@@ -921,7 +948,13 @@ parse_options (int argc, char *argv[])
/* Get the text
*/
if
(
opt_text
)
if
(
opt_serialized
)
{
file_arg
=
argv
[
1
];
text
=
g_strdup
(
""
);
len
=
0
;
}
else
if
(
opt_text
)
{
text
=
g_strdup
(
opt_text
);
len
=
strlen
(
text
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment