Auto_Typst_Resume_Template icon indicating copy to clipboard operation
Auto_Typst_Resume_Template copied to clipboard

[Feature Request] 斜体支持

Open NorthSecond opened this issue 10 months ago • 1 comments

  • 考虑是否支持斜体定义重定向到开源的楷体字体
  • 需要考虑 Typst.app 和常见 Typst 部署的系统环境中的字体配置

NorthSecond avatar Feb 23 '25 11:02 NorthSecond

我阅读了cuti的源代码,现在可以简单的引入如下的函数来实现伪斜体功能

#let regex-fakeitalic(reg-exp: ".+?", ang: -18.4deg, s) = {
  show regex(reg-exp): it => {
    box(skew(ax: ang, reflow: false, it))
  }
  s
}

#let fakeitalic(
  ang: -18.4deg,
  s,
) = regex-fakeitalic(reg-exp: "(?:\b[^\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}!-・〇-〰—]+?\b|[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}])", ang: ang, s)

用法:

#fakeitalic[12312431若干其他sfaf]

完整的cuti代码应在这里获取

AyeeMinerva avatar Feb 24 '25 00:02 AyeeMinerva