ttmlrender: apply correct line height to blocks with multiple text sizes

In TTML, the height of every line in a block is determined by lineHeight
and fontSize style attributes, and should be the same for each line in
that block, regardless of whether different sized text appears on
different lines. Currently, a single PangoLayout is used to lay out all
the text in a block; however, pango will vary the line height in a
layout depending on the size of text used in each line, which is not
compliant with TTML.

This patch makes ttmlrender lay out the lines in a block itself, rather
than using a PangoLayout to do the work. The code still uses a
PangoLayout to render the text of each element, but the overall layout
of the text in a block is now controlled by ttmlrender itself. By doing
this, ttmlrender is able to ensure that the height of each line in a
block is correct.

https://bugzilla.gnome.org/show_bug.cgi?id=780402
This commit is contained in:
Chris Bass 2017-03-22 09:21:09 +00:00 committed by Sebastian Dröge
parent 2a4a18b2ab
commit f28df30a8b
2 changed files with 747 additions and 414 deletions

File diff suppressed because it is too large Load diff

View file

@ -49,7 +49,6 @@ G_BEGIN_DECLS
typedef struct _GstTtmlRender GstTtmlRender; typedef struct _GstTtmlRender GstTtmlRender;
typedef struct _GstTtmlRenderClass GstTtmlRenderClass; typedef struct _GstTtmlRenderClass GstTtmlRenderClass;
typedef struct _GstTtmlRenderRenderedImage GstTtmlRenderRenderedImage; typedef struct _GstTtmlRenderRenderedImage GstTtmlRenderRenderedImage;
typedef struct _GstTtmlRenderRenderedText GstTtmlRenderRenderedText;
struct _GstTtmlRenderRenderedImage { struct _GstTtmlRenderRenderedImage {
GstBuffer *image; GstBuffer *image;
@ -59,16 +58,6 @@ struct _GstTtmlRenderRenderedImage {
guint height; guint height;
}; };
struct _GstTtmlRenderRenderedText {
GstTtmlRenderRenderedImage *text_image;
/* The coordinates in @layout will be offset horizontally with respect to the
* position of those characters in @text_image. Store that offset here so
* that the information in @layout can be used to locate the position and
* extent of text areas in @text_image. */
guint horiz_offset;
};
struct _GstTtmlRender { struct _GstTtmlRender {
GstElement element; GstElement element;