1 Star 0 Fork 25

zhangqiumiao/cairo

forked from src-openEuler/cairo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-ft-Use-normal-font-size-when-detecting-the-format.patch 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
zhangqiumiao 提交于 2023-07-21 17:05 . update to 1.17.8
From 2766d9feeccd5d66e346b0abab38726b8e0aa1e9 Mon Sep 17 00:00:00 2001
From: Adrian Johnson <ajohnson@redneon.com>
Date: Tue, 7 Mar 2023 19:40:21 +1030
Subject: [PATCH] ft: Use normal font size when detecting the format
The format may depend on the font size.
Fixes #643
Reference:https://gitlab.freedesktop.org/cairo/cairo/-/commit/2766d9feeccd5d66e346b0abab38726b8e0aa1e9
Conflict:NA
---
src/cairo-ft-font.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 22a6a622b..89af6193d 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -3314,11 +3314,13 @@ _cairo_ft_scaled_glyph_init_metrics (cairo_ft_scaled_font_t *scaled_font,
if (scaled_font->unscaled->have_color && scaled_font->base.options.color_mode != CAIRO_COLOR_MODE_NO_COLOR)
color_flag = FT_LOAD_COLOR;
#endif
+ /* Ensure use_em_size = FALSE as the format (bitmap or outline)
+ * may change with the size. */
status = _cairo_ft_scaled_glyph_load_glyph (scaled_font,
scaled_glyph,
face,
load_flags | color_flag,
- !hint_metrics,
+ FALSE,
vertical_layout);
if (unlikely (status))
return status;
@@ -3344,6 +3346,18 @@ _cairo_ft_scaled_glyph_init_metrics (cairo_ft_scaled_font_t *scaled_font,
glyph_priv->format = CAIRO_FT_GLYPH_TYPE_BITMAP;
}
+ /* If hinting is off, load the glyph with font size set the the em size. */
+ if (!hint_metrics) {
+ status = _cairo_ft_scaled_glyph_load_glyph (scaled_font,
+ scaled_glyph,
+ face,
+ load_flags | color_flag,
+ TRUE,
+ vertical_layout);
+ if (unlikely (status))
+ return status;
+ }
+
_cairo_ft_scaled_glyph_get_metrics (scaled_font,
face,
vertical_layout,
@@ -3369,6 +3383,7 @@ _cairo_ft_scaled_glyph_init_metrics (cairo_ft_scaled_font_t *scaled_font,
}
if (glyph_priv->format == CAIRO_FT_GLYPH_TYPE_COLR_V1) {
+ /* Restore font size if previously loaded at em_size. */
if (!hint_metrics) {
status = _cairo_ft_scaled_glyph_load_glyph (scaled_font,
scaled_glyph,
--
GitLab
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangqiumiao/cairo.git
git@gitee.com:zhangqiumiao/cairo.git
zhangqiumiao
cairo
cairo
master

搜索帮助