mirror of
https://github.com/servo/servo.git
synced 2025-09-29 16:19:14 +01:00
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:
parent
8993235e8f
commit
73e39cf085
15 changed files with 106 additions and 157 deletions
|
@ -413,7 +413,7 @@ impl FontList {
|
|||
}
|
||||
|
||||
// Functions used by SystemFontSerivce
|
||||
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),
|
||||
{
|
||||
|
@ -425,7 +425,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),
|
||||
{
|
||||
|
@ -534,7 +534,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 => "serif",
|
||||
GenericFontFamily::SansSerif => "sans-serif",
|
||||
|
|
|
@ -34,7 +34,7 @@ use crate::{
|
|||
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),
|
||||
{
|
||||
|
@ -69,7 +69,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),
|
||||
{
|
||||
|
@ -180,7 +180,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 {
|
||||
let generic_string = match generic {
|
||||
GenericFontFamily::None | GenericFontFamily::Serif => "serif",
|
||||
GenericFontFamily::SansSerif => "sans-serif",
|
||||
|
|
|
@ -53,7 +53,7 @@ extern "C" fn ft_realloc(
|
|||
/// dropped during execution.
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct FreeTypeLibraryHandle {
|
||||
pub freetype_library: FT_Library,
|
||||
pub(crate) freetype_library: FT_Library,
|
||||
freetype_memory: FT_Memory,
|
||||
}
|
||||
|
||||
|
|
|
@ -425,7 +425,7 @@ impl FontList {
|
|||
}
|
||||
|
||||
// Functions used by SystemFontService
|
||||
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),
|
||||
{
|
||||
|
@ -437,7 +437,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),
|
||||
{
|
||||
|
@ -565,7 +565,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 {
|
||||
let default_font = "HarmonyOS Sans".into();
|
||||
match generic {
|
||||
GenericFontFamily::Monospace => {
|
||||
|
|
|
@ -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 }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -49,7 +49,7 @@ pub struct FontTable {
|
|||
}
|
||||
|
||||
impl FontTable {
|
||||
pub fn wrap(data: &[u8]) -> FontTable {
|
||||
pub(crate) fn wrap(data: &[u8]) -> FontTable {
|
||||
FontTable {
|
||||
data: data.to_vec(),
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
{
|
||||
|
@ -28,7 +28,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),
|
||||
{
|
||||
|
@ -338,7 +338,9 @@ fn font_template_descriptor_from_font(font: &Font) -> FontTemplateDescriptor {
|
|||
FontTemplateDescriptor::new(weight, stretch, style)
|
||||
}
|
||||
|
||||
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 New Roman",
|
||||
GenericFontFamily::SansSerif => "Arial",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue