feat(lint): add warning for vf font (#1649)

* feat(lint): add warning for vf font

* feat: detect font object

---------

Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
This commit is contained in:
Wenzhuo Liu 2025-04-12 20:55:39 +08:00 committed by GitHub
parent 1cd566aedc
commit 58ec6ab1e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 114 additions and 0 deletions

View file

@ -0,0 +1,5 @@
#text(font: "DejaVu Sans Mono")[123]
#text(font: ("DejaVu Sans Mono",))[123]
#text(font: (name: "DejaVu Sans Mono"))[123]
#text(font: ((name: "DejaVu Sans Mono"),))[123]

View file

@ -0,0 +1,6 @@
---
source: crates/tinymist-query/src/analysis.rs
expression: "JsonRepr::new_redacted(result, &REDACT_LOC)"
input_file: crates/tinymist-query/src/fixtures/lint/good_font.typ
---
{}

View file

@ -0,0 +1,21 @@
---
source: crates/tinymist-query/src/analysis.rs
expression: "JsonRepr::new_redacted(result, &REDACT_LOC)"
input_file: crates/tinymist-query/src/fixtures/lint/vf.typ
---
{
"s0.typ": [
{
"message": "variable font is not supported by typst yet\nHint: consider using a static font instead. For more information, see https://github.com/typst/typst/issues/185",
"range": "0:16:0:30",
"severity": 2,
"source": "typst"
},
{
"message": "variable font is not supported by typst yet\nHint: consider using a static font instead. For more information, see https://github.com/typst/typst/issues/185",
"range": "2:22:2:36",
"severity": 2,
"source": "typst"
}
]
}

View file

@ -0,0 +1,21 @@
---
source: crates/tinymist-query/src/analysis.rs
expression: "JsonRepr::new_redacted(result, &REDACT_LOC)"
input_file: crates/tinymist-query/src/fixtures/lint/vf_object.typ
---
{
"s0.typ": [
{
"message": "variable font is not supported by typst yet\nHint: consider using a static font instead. For more information, see https://github.com/typst/typst/issues/185",
"range": "0:20:0:34",
"severity": 2,
"source": "typst"
},
{
"message": "variable font is not supported by typst yet\nHint: consider using a static font instead. For more information, see https://github.com/typst/typst/issues/185",
"range": "1:19:1:33",
"severity": 2,
"source": "typst"
}
]
}

View file

@ -0,0 +1,3 @@
#set text(font: "Noto Sans VF")
#text(font: ("Arial", "Noto Sans VF"))[123]

View file

@ -0,0 +1,3 @@
#text(font: ((name: "Noto Sans VF"),))[123]
#text(font: (name: "Noto Sans VF"))[123]