Skip to content

Commit 2e8281c

Browse files
authored
[206_20] 伪粗体针对楷体、仿宋优化 (#3049)
1 parent 747f66c commit 2e8281c

File tree

2 files changed

+28
-19
lines changed

2 files changed

+28
-19
lines changed

devel/206_20.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
# 206_20 优化伪粗体效果
2-
3-
## 如何测试
4-
- 打开测试文档:TeXmacs/tests/tmu/206_20.tmu
5-
- 检查字体加粗后效果
6-
- 与 main 分支的进行对比
7-
- 与 WPS/Word 进行对比
8-
9-
## 2026/03/05
10-
### What
11-
- 回退 https://gitee.com/MoganLab/mogan/pulls/1239/files 中的修改,让simsun的伪粗体走统一的 -poorbf 机制
12-
- 优化部分常用cjk字体的加粗效果
1+
# 206_20 优化伪粗体效果
2+
3+
## 如何测试
4+
- 打开测试文档:TeXmacs/tests/tmu/206_20.tmu
5+
- 检查字体加粗后效果
6+
- 与 main 分支的进行对比
7+
- 与 WPS/Word 进行对比
8+
9+
## 2026/03/27
10+
### What
11+
- 优化 kaiti_gb2312 的加粗效果
12+
- 优化导出pdf的伪粗体质量
13+
14+
## 2026/03/05
15+
### What
16+
- 回退 https://gitee.com/MoganLab/mogan/pulls/1239/files 中的修改,让simsun的伪粗体走统一的 -poorbf 机制
17+
- 优化部分常用cjk字体的加粗效果
1318
- 后续补充优化更多的cjk字体效果

src/Graphics/Fonts/poor_bold.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ poor_bold_font_rep::draw_fixed (renderer ren, string s, SI x, SI y, SI* xpos,
183183
int start= i;
184184
base->advance_glyph (s, i, ligf);
185185
string ss= s (start, i);
186-
if (ren->is_screen) {
186+
if (ren->is_screen || ren->is_printer ()) {
187187
font_metric fnm;
188188
font_glyphs fng;
189189
int c= index_glyph (ss, fnm, fng);
@@ -193,8 +193,8 @@ poor_bold_font_rep::draw_fixed (renderer ren, string s, SI x, SI y, SI* xpos,
193193
SI dpen, dtot;
194194
fatten (ss, dpen, dtot);
195195
if (dpen == dtot) {
196-
for (int k= 0; k <= 8; k++) {
197-
SI dx= (k * dpen) / 8;
196+
for (int k= 0; k <= 32; k++) {
197+
SI dx= (k * dpen) / 32;
198198
base->draw (ren, ss, x + dx + (start == 0 ? 0 : xpos[start]), y);
199199
}
200200
}
@@ -209,9 +209,9 @@ poor_bold_font_rep::draw_fixed (renderer ren, string s, SI x, SI y, SI* xpos,
209209
lambda = floor (100.0 * lambda + 0.5) / 100.0;
210210
// font mbase= base->magnify (lambda, 1.0);
211211
font mbase= poor_stretched_font (base, lambda, 1.0);
212-
for (int k= 0; k <= 8; k++) {
212+
for (int k= 0; k <= 32; k++) {
213213
double slope= -((double) vertical (dpen)) / ((double) dpen);
214-
SI dx = (k * dpen2) / 8;
214+
SI dx = (k * dpen2) / 32;
215215
SI dy = (SI) floor (slope * (dx - (dpen2 >> 1)));
216216
mbase->draw (ren, ss, x + dx + (start == 0 ? 0 : xpos[start]),
217217
y + dy);
@@ -350,9 +350,13 @@ static double
350350
get_bold_factor (string font_name) {
351351
string lname= locase_all (font_name);
352352
if (occurs ("simsun", lname)) return 0.5;
353-
if (occurs ("kaiti_gb2312", lname)) return 0.3;
354353
if (occurs ("simhei", lname)) return 0.5;
355-
if (occurs ("fangsong_gb2312", lname)) return 0.3;
354+
// Check all possible variations for KaiTi/SimKai
355+
if (occurs ("kaiti_gb2312", lname)) return 0.5;
356+
if (occurs ("simkai", lname)) return 0.5;
357+
// Check all possible variations for FangSong/SimFang
358+
if (occurs ("fangsong_gb2312", lname)) return 0.5;
359+
if (occurs ("simfang", lname)) return 0.5;
356360
return 1.0;
357361
}
358362

0 commit comments

Comments
 (0)