Commit c88faa3c authored by François Cartegnie's avatar François Cartegnie 🤞

text_style: add DOUBLE_WIDTH

so we can match all width/height combinations
using width modifiers and font size scaling.
parent 7b6f68f6
......@@ -98,6 +98,7 @@ typedef struct
#define STYLE_STRIKEOUT (1 << 6)
#define STYLE_HALFWIDTH (1 << 7)
#define STYLE_MONOSPACED (1 << 8)
#define STYLE_DOUBLEWIDTH (1 << 9)
#define STYLE_DEFAULT_FONT_SIZE 20
#define STYLE_DEFAULT_REL_FONT_SIZE 6.25
......
......@@ -56,8 +56,11 @@ static FT_Face LoadFace( filter_t *p_filter, const char *psz_fontfile, int i_idx
char *psz_key = NULL;
int i_font_size = ConvertToLiveSize( p_filter, p_style );
int i_font_width = p_style->i_style_flags & STYLE_HALFWIDTH ?
i_font_size / 2 : i_font_size;
int i_font_width = i_font_size;
if( p_style->i_style_flags & STYLE_HALFWIDTH )
i_font_width /= 2;
else if( p_style->i_style_flags & STYLE_DOUBLEWIDTH )
i_font_width *= 2;
if( asprintf( &psz_key, "%s - %d - %d - %d",
psz_fontfile, i_idx,
......
......@@ -572,7 +572,7 @@ static bool FaceStyleEquals( filter_t *p_filter, const text_style_t *p_style1,
if( p_style1 == p_style2 )
return true;
const int i_style_mask = STYLE_BOLD | STYLE_ITALIC | STYLE_HALFWIDTH;
const int i_style_mask = STYLE_BOLD | STYLE_ITALIC | STYLE_HALFWIDTH | STYLE_DOUBLEWIDTH;
const char *psz_fontname1 = p_style1->i_style_flags & STYLE_MONOSPACED
? p_style1->psz_monofontname : p_style1->psz_fontname;
......@@ -1134,9 +1134,11 @@ static int LayoutLine( filter_t *p_filter,
p_style = p_run->p_style;
p_face = p_run->p_face;
i_font_size = ConvertToLiveSize( p_filter, p_style );
i_font_width = p_style->i_style_flags & STYLE_HALFWIDTH ?
i_font_size / 2 : i_font_size;
i_font_width = i_font_size = ConvertToLiveSize( p_filter, p_style );
if( p_style->i_style_flags & STYLE_HALFWIDTH )
i_font_width /= 2;
else if( p_style->i_style_flags & STYLE_DOUBLEWIDTH )
i_font_width *= 2;
}
FT_Vector pen_new = {
......
Markdown is supported
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