Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC
Commits:
ed7d4c09 by Francois Cartegnie at 2022-04-14T17:00:53+00:00
freetype: fix first glyph non zero bearing alignment offset
When box xMin is 0, lines starting with non 0 bearing can't
be aligned properly due to wrong offset
(cherry picked from commit 7ae7c53c5d6495a54ba1f6cf2a2007b9cee4d7f2)
- - - - -
1 changed file:
- modules/text_renderer/freetype/freetype.c
Changes:
=====================================
modules/text_renderer/freetype/freetype.c
=====================================
@@ -273,20 +273,22 @@ static FT_Vector GetAlignedOffset( const line_desc_t
*p_line,
int i_align )
{
FT_Vector offsets = { 0, 0 };
+
+ /* aligns left to textbbox's min first */
+ offsets.x = p_textbbox->xMin - p_line->bbox.xMin;
+
const int i_text_width = p_textbbox->xMax - p_textbbox->xMin;
if ( p_line->i_width < i_text_width &&
(i_align & SUBPICTURE_ALIGN_LEFT) == 0 )
{
/* Left offset to take into account alignment */
if( i_align & SUBPICTURE_ALIGN_RIGHT )
- offsets.x = ( i_text_width - p_line->i_width );
+ offsets.x += ( i_text_width - p_line->i_width );
else /* center */
- offsets.x = ( i_text_width - p_line->i_width ) / 2;
- }
- else
- {
- offsets.x = p_textbbox->xMin - p_line->bbox.xMin;
+ offsets.x += ( i_text_width - p_line->i_width ) / 2;
}
+ /* else already left aligned */
+
return offsets;
}
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/commit/ed7d4c09343fd9042c3f0bb3ea14b7171ee3fcfd
--
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/commit/ed7d4c09343fd9042c3f0bb3ea14b7171ee3fcfd
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits