Do not consider default ignorables when picking last resort font (#6805)

This commit is contained in:
Laurenz 2025-08-22 15:04:12 +02:00 committed by GitHub
parent 2501da4bb6
commit aef36f3962
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 13 additions and 3 deletions

View File

@ -7,7 +7,9 @@ use ttf_parser::{PlatformId, Tag, name_id};
use unicode_segmentation::UnicodeSegmentation;
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.
#[derive(Debug, Default, Clone, Hash)]
@ -99,8 +101,12 @@ impl FontBook {
variant: FontVariant,
text: &str,
) -> Option<usize> {
// Find the fonts that contain the text's first non-space char ...
let c = text.chars().find(|c| !c.is_whitespace())?;
// Find the fonts that contain the text's first non-space and
// non-ignorable char ...
let c = text
.chars()
.find(|&c| !c.is_whitespace() && !is_default_ignorable(c))?;
let ids = self
.infos
.iter()

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

View File

@ -92,3 +92,7 @@ Lריווח #h(1cm) R
#text(lang: "ar")[سلام]
],
)
--- issue-5276-shaping-consecutive-ltr-with-lang ---
#let a = text(lang: "ar")[\u{645}]
#a#a