1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// Copyright (c) 2023 Xu Shaohua <shaohua@biofan.org>. All rights reserved.
// Use of this source is governed by Lesser General Public License that can be found
// in the LICENSE file.
use crate::core::font_style::FontStyle;
pub trait FontStyleSet {
fn count(&self) -> i32;
fn get_style(&self, index: i32, style: &mut FontStyle, style_str: &mut String);
fn create_type_face(&self, index: i32) -> Typeface;
fn match_style(&self, pattern: &FontStyle) -> Option<Typeface>;
}
pub(crate) fn match_style_css3(_pattern: &FontStyle) -> Option<Typeface> {
unimplemented!()
}
pub struct FontManager {}
impl FontManager {
#[must_use]
pub const fn count_families(&self) -> i32 {
unimplemented!()
}
#[must_use]
pub fn get_family_name(&self, _index: i32) -> String {
unimplemented!()
}
#[must_use]
pub fn create_style_sheet(&self, _index: i32) -> Box<dyn FontStyleSet> {
unimplemented!()
}
/// The caller must call unref() on the returned object.
///
/// Never returns NULL; will return an empty set if the name is not found.
/// Passing nullptr as the parameter will return the default system family.
///
/// Note that most systems don't have a default system family, so passing nullptr will often
/// result in the empty set.
///
/// It is possible that this will return a style set not accessible from
/// `create_style_set(int)` due to hidden or auto-activated fonts.
#[must_use]
pub fn match_family(&self, _family_name: &str) -> Box<dyn FontStyleSet> {
unimplemented!()
}
/// Find the closest matching typeface to the specified familyName and style
/// and return a ref to it.
///
/// The caller must call unref() on the returned object.
/// Will return nullptr if no 'good' match is found.
///
/// Passing |nullptr| as the parameter for `family_name` will return the
/// default system font.
///
/// It is possible that this will return a style set not accessible from
/// `create_style_set(int)` or matchFamily(const char[]) due to hidden or
/// auto-activated fonts.
#[must_use]
pub fn match_family_style(&self, _family_name: &str, _style: &FontStyle) -> Option<Typeface> {
unimplemented!()
}
/// Use the system fallback to find a typeface for the given character.
///
/// Note that bcp47 is a combination of ISO 639, 15924, and 3166-1 codes,
/// so it is fine to just pass a ISO 639 here.
///
/// Will return NULL if no family can be found for the character
/// in the system fallback.
///
/// Passing |nullptr| as the parameter for |familyName| will return the
/// default system font.
///
/// bcp47[0] is the least significant fallback, bcp47[bcp47Count-1] is the
/// most significant. If no specified bcp47 codes match, any font with the
/// requested character will be matched.
#[must_use]
pub fn match_family_style_character(
&self,
_family_name: &str,
_style: &FontStyle,
_bcp47: &str,
_character: char,
) -> Option<Typeface> {
unimplemented!()
}
}