mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-04 18:28:02 +00:00
feat: forbid weird embedded font uses and make toml dep optional (#1701)
* cg * fix: forbid weird embedded * feat: optional toml
This commit is contained in:
parent
2b3eb252f0
commit
042fc2a477
4 changed files with 11 additions and 18 deletions
|
@ -31,7 +31,7 @@ tinymist-world = { workspace = true }
|
|||
tinymist-std = { workspace = true, features = ["typst"] }
|
||||
tinymist-derive.workspace = true
|
||||
tinymist-l10n.workspace = true
|
||||
toml.workspace = true
|
||||
toml = { workspace = true, optional = true }
|
||||
typst.workspace = true
|
||||
typst-assets.workspace = true
|
||||
notify.workspace = true
|
||||
|
@ -40,7 +40,7 @@ notify.workspace = true
|
|||
|
||||
fonts = ["typst-assets/fonts"]
|
||||
no-content-hint = ["tinymist-task/no-content-hint"]
|
||||
lsp = ["system"]
|
||||
lsp = ["system", "toml"]
|
||||
|
||||
system = ["tinymist-std/system", "tinymist-world/system"]
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ web-sys = { workspace = true, optional = true, features = ["console"] }
|
|||
[features]
|
||||
|
||||
default = []
|
||||
browser-embedded-fonts = ["typst-assets/fonts"]
|
||||
fonts = ["typst-assets/fonts"]
|
||||
http-registry = ["reqwest"]
|
||||
web = [
|
||||
"chrono",
|
||||
|
|
|
@ -371,13 +371,7 @@ pub struct BrowserFontSearcher {
|
|||
impl BrowserFontSearcher {
|
||||
/// Create a new, empty browser searcher.
|
||||
pub fn new() -> Self {
|
||||
let mut searcher = Self { fonts: vec![] };
|
||||
|
||||
if cfg!(feature = "browser-embedded-fonts") {
|
||||
searcher.add_embedded();
|
||||
}
|
||||
|
||||
searcher
|
||||
Self { fonts: vec![] }
|
||||
}
|
||||
|
||||
/// Create a new browser searcher with fonts in a FontResolverImpl.
|
||||
|
@ -435,6 +429,7 @@ impl BrowserFontSearcher {
|
|||
|
||||
impl BrowserFontSearcher {
|
||||
/// Add fonts that are embedded in the binary.
|
||||
#[cfg(feature = "fonts")]
|
||||
pub fn add_embedded(&mut self) {
|
||||
for font_data in typst_assets::fonts() {
|
||||
let buffer = Bytes::new(font_data);
|
||||
|
|
|
@ -204,14 +204,12 @@
|
|||
}
|
||||
|
||||
context if shiroa-sys-target() == "html" {
|
||||
html.elem(
|
||||
"style",
|
||||
```css
|
||||
.pseudo-image svg {
|
||||
width: 100%
|
||||
}
|
||||
```.text,
|
||||
)
|
||||
show raw: it => html.elem("style", it.text)
|
||||
```css
|
||||
.pseudo-image svg {
|
||||
width: 100%
|
||||
}
|
||||
```
|
||||
}
|
||||
|
||||
show <typst-raw-func>: it => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue