fonts: Reduce the public API surface (#39112)

This change marks all items that are not used by other crates as
`pub(crate)` instead of `pub`.

Additionally, I've removed all code that turned out to be unused. I
think most of it was used only by `layout-2013`.


Testing: The correctness of these changes is verified by the compiler,
so no tests are needed.

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-09-03 22:15:51 +02:00 committed by GitHub
parent 8993235e8f
commit 73e39cf085
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 106 additions and 157 deletions

View file

@ -42,7 +42,7 @@ fn pt_to_px(pt: f64) -> f64 {
}
impl FontTable {
pub fn wrap(data: CFData) -> FontTable {
pub(crate) fn wrap(data: CFData) -> FontTable {
FontTable { data }
}
}

View file

@ -16,7 +16,7 @@ use crate::{
FontTemplateDescriptor, LowercaseFontFamilyName,
};
pub fn for_each_available_family<F>(mut callback: F)
pub(crate) fn for_each_available_family<F>(mut callback: F)
where
F: FnMut(String),
{
@ -26,7 +26,7 @@ where
}
}
pub fn for_each_variation<F>(family_name: &str, mut callback: F)
pub(crate) fn for_each_variation<F>(family_name: &str, mut callback: F)
where
F: FnMut(FontTemplate),
{
@ -175,7 +175,9 @@ pub fn fallback_font_families(options: FallbackFontSelectionOptions) -> Vec<&'st
families
}
pub fn default_system_generic_font_family(generic: GenericFontFamily) -> LowercaseFontFamilyName {
pub(crate) fn default_system_generic_font_family(
generic: GenericFontFamily,
) -> LowercaseFontFamilyName {
match generic {
GenericFontFamily::None | GenericFontFamily::Serif => "Times",
GenericFontFamily::SansSerif => "Helvetica",