mirror of
https://github.com/typst/typst
synced 2025-08-23 11:14:13 +08:00
Do not consider default ignorables when picking last resort font (#6805)
This commit is contained in:
parent
2501da4bb6
commit
aef36f3962
@ -7,7 +7,9 @@ use ttf_parser::{PlatformId, Tag, name_id};
|
|||||||
use unicode_segmentation::UnicodeSegmentation;
|
use unicode_segmentation::UnicodeSegmentation;
|
||||||
|
|
||||||
use super::exceptions::find_exception;
|
use super::exceptions::find_exception;
|
||||||
use crate::text::{Font, FontStretch, FontStyle, FontVariant, FontWeight};
|
use crate::text::{
|
||||||
|
Font, FontStretch, FontStyle, FontVariant, FontWeight, is_default_ignorable,
|
||||||
|
};
|
||||||
|
|
||||||
/// Metadata about a collection of fonts.
|
/// Metadata about a collection of fonts.
|
||||||
#[derive(Debug, Default, Clone, Hash)]
|
#[derive(Debug, Default, Clone, Hash)]
|
||||||
@ -99,8 +101,12 @@ impl FontBook {
|
|||||||
variant: FontVariant,
|
variant: FontVariant,
|
||||||
text: &str,
|
text: &str,
|
||||||
) -> Option<usize> {
|
) -> Option<usize> {
|
||||||
// Find the fonts that contain the text's first non-space char ...
|
// Find the fonts that contain the text's first non-space and
|
||||||
let c = text.chars().find(|c| !c.is_whitespace())?;
|
// non-ignorable char ...
|
||||||
|
let c = text
|
||||||
|
.chars()
|
||||||
|
.find(|&c| !c.is_whitespace() && !is_default_ignorable(c))?;
|
||||||
|
|
||||||
let ids = self
|
let ids = self
|
||||||
.infos
|
.infos
|
||||||
.iter()
|
.iter()
|
||||||
|
BIN
tests/ref/issue-5276-shaping-consecutive-ltr-with-lang.png
Normal file
BIN
tests/ref/issue-5276-shaping-consecutive-ltr-with-lang.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 179 B |
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
@ -92,3 +92,7 @@ Lריווח #h(1cm) R
|
|||||||
#text(lang: "ar")[سلام]
|
#text(lang: "ar")[سلام]
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
--- issue-5276-shaping-consecutive-ltr-with-lang ---
|
||||||
|
#let a = text(lang: "ar")[\u{645}]
|
||||||
|
#a#a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user