[PATCH v2 7/7] gdi32: Improve the determine code whether the chracter is the fullwidth.
Akihiro Sagawa
sagawa.aki at gmail.com
Wed Jan 30 08:44:24 CST 2019
On Wed, 30 Jan 2019 02:12:41 +0900, Byeongsik Jeon wrote:
> Signed-off-by: Byeongsik Jeon <bsjeon at hanmail.net>
> ---
> At the MS Korean dual-width fonts embedded bitmap,
> full-width character's advance width is smaller than expected in wine.
> We can solve this problem by slightly changing the logic.
>
> Ex.
> gulim.ttc:GulimChe EM=1024 AvgWidth=512
> ppem=19px half-width character advance = 10px
> ppem=19px full-width character advance = 18px
> But, Wine expects 19px.
>
> dlls/gdi32/freetype.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
> index bddcd56837..cb804f8e5c 100644
> --- a/dlls/gdi32/freetype.c
> +++ b/dlls/gdi32/freetype.c
> @@ -6839,9 +6839,7 @@ static FT_Vector get_advance_metric(GdiFont *incoming_font, GdiFont *font,
> em_scale = MulDiv(incoming_font->ppem, 1 << 16,
> incoming_font->ft_face->units_per_EM);
> avg_advance = pFT_MulFix(incoming_font->ntmAvgWidth, em_scale);
> - fixed_pitch_full = (avg_advance > 0 &&
> - (base_advance + 63) >> 6 ==
> - pFT_MulFix(incoming_font->ntmAvgWidth*2, em_scale));
> + fixed_pitch_full = avg_advance > 0 && (base_advance + 63) >> 6 != avg_advance;
> if (fixed_pitch_full && !transMat)
> adv.x = (avg_advance * 2) << 6;
In my opinion, why don't we test the following condition for fixed_pitch_full?
fixed_pitch_full = avg_advance > 0
&& (base_advance + 63) >> 6
>= pFT_MulFix(MulDiv(incoming_font->ntmAvgWidth, x, y), em_scale);
The x and y are heuristic ratio. I think they will be 1.5~1.8.
Because base_advance can be based on linked font, i.e. another font
replaced by get_glyph_index_linked(), the glyph might be a proportional
typeface. In that case, "(base_advance + 63) >> 6 != avg_advance" is
very loose restriction. A narrow character may be treated as a
Full-width character in that case.
Regards,
Akihiro Sagawa
More information about the wine-devel
mailing list