[mythtv-commits] Ticket #12057: Improve legibility and display of CEA-608 captions.
MythTV
noreply at mythtv.org
Sat Sep 27 06:25:18 UTC 2014
#12057: Improve legibility and display of CEA-608 captions.
-----------------------------------+-----------------------------
Reporter: faginbagin <mythtv@…> | Owner: stichnot
Type: Patch - Feature | Status: accepted
Priority: minor | Milestone: 0.28
Component: MythTV - Captions | Version: Unspecified
Severity: medium | Resolution:
Keywords: | Ticket locked: 0
-----------------------------------+-----------------------------
Comment (by faginbagin <mythtv@…>):
I am attaching a new patch based on offline discussions with stichnot. The
highlights:
!SubtitleFormat has a new font cache, m_fullFontMap, which caches fonts
based on the full set of attributes: family, cc708 attrs, zoom & stretch.
SubtitleFormat::Load implements a default font sizing algorithm shared by
all caption types. It chooses a better font.pixelSize by making a first
guess, then adjusting using QFontMetrics' height and lineSpacing to choose
a font.pixelSize that works for all but the most extreme fonts.
The algorithm takes into account video aspect ratio for 708 and text
captions, outline size and shadow offset, font stretch and left & right
padding.
If the resulting font metrics lead to a font width that exceeds a max
width based on the above, it logs a warning. It does not try to make a
third adjustment. I haven't found a test case that triggers that warning.
SubtitleFormat::!GetFont depends on Load, to initialize a default font
cached in m_fontMap. !GetFont then applies more transient changes, such as
zoom, color, italics, etc. and caches the result in m_fullFontMap.
To reduce the number of calls to SubtitleFormat::!GetFont,
!FormattedText[Chunk|Line]::Calc methods that were const, aren't anymore
and the SubtitleScreen::Calc method now take an optional mythfont
argument.
Fixed a memory leak in SubtitleFormat::!CreateProviderDefault.
Fixed a problem where left padding was outside the safe area and, when
using the Slim display profile, the padding would be clipped. The root
cause was due to padding being applied twice in
FormattedTextSubtitle::Layout. I addressed it by adding a bool addPadding
argument to FormattedTextLine::!CalcSize.
Made sure captions are drawn after new ones are added. Don't just depend
on bounding rectangle changes. Affects captions using Slim profile that
happen to have the same bounding box as the preceding caption. Effect can
be seen playing:
http://ncamftp.wgbh.org/DTV/CEA%20test%20material/Iteration_1/CEAv1.2zero.trp
Without this patch, no captions are displayed for slides 3, 4 and 11,
because their bounding box is identical to the preceding caption.
--
Ticket URL: <https://code.mythtv.org/trac/ticket/12057#comment:7>
MythTV <http://www.mythtv.org>
MythTV Media Center
More information about the mythtv-commits
mailing list