mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Fix bug where not all text nodes were detected (#2136)
This commit is contained in:
parent
c203eff9f4
commit
47c7975d70
@ -15,7 +15,7 @@ use image::codecs::png::PngDecoder;
|
|||||||
use image::io::Limits;
|
use image::io::Limits;
|
||||||
use image::{guess_format, ImageDecoder, ImageResult};
|
use image::{guess_format, ImageDecoder, ImageResult};
|
||||||
use typst_macros::{cast, Cast};
|
use typst_macros::{cast, Cast};
|
||||||
use usvg::{TreeParsing, TreeTextToPath};
|
use usvg::{NodeExt, TreeParsing, TreeTextToPath};
|
||||||
|
|
||||||
use crate::diag::{bail, format_xml_like_error, StrResult};
|
use crate::diag::{bail, format_xml_like_error, StrResult};
|
||||||
use crate::eval::Bytes;
|
use crate::eval::Bytes;
|
||||||
@ -370,9 +370,9 @@ fn traverse_svg<F>(node: &usvg::Node, f: &mut F)
|
|||||||
where
|
where
|
||||||
F: FnMut(&usvg::Node),
|
F: FnMut(&usvg::Node),
|
||||||
{
|
{
|
||||||
f(node);
|
for descendant in node.descendants() {
|
||||||
for child in node.children() {
|
f(&descendant);
|
||||||
traverse_svg(&child, f);
|
descendant.subroots(|subroot| traverse_svg(&subroot, f))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user