File tree Expand file tree Collapse file tree 5 files changed +25
-1
lines changed
components/rich_text/image_cache Expand file tree Collapse file tree 5 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,15 @@ In case you would like to change:
81
81
# family = "Noto Color Emoji"
82
82
```
83
83
84
+ ## Hinting
85
+
86
+ Enable or disable font hinting. It is enabled by default.
87
+
88
+ ``` toml
89
+ [fonts ]
90
+ hinting = true
91
+ ```
92
+
84
93
## User interface
85
94
86
95
You can specify user interface font on Rio.
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ language: 'en'
18
18
- Microsoft Windows: [ Rio terminal is now available on WinGet packages] ( https://github.com/microsoft/winget-pkgs/pull/184792 ) .
19
19
- Microsoft Windows: [ Rio terminal is now available on MINGW packages] ( https://github.com/msys2/MINGW-packages/pull/22248 ) .
20
20
- Allow MacOS automation via events.
21
+ - Support disable font hinting: ` fonts.hinting = false ` .
21
22
- Fix: Configuration updates triggered multiple times on one save.
22
23
- Support to RetroArch shaders [ @igorsaux ] ( https://github.com/igorsaux ) .
23
24
- Fix: Set notepad as a default editor on Windows by [ @igorsaux ] ( https://github.com/igorsaux ) .
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ impl<'a> GlyphCacheSession<'a> {
126
126
127
127
self . scaled_image . data . clear ( ) ;
128
128
let mut font_library_data = self . font_library . inner . lock ( ) ;
129
+ let enable_hint = font_library_data. hinting ;
129
130
let font_data = font_library_data. get ( & self . font ) ;
130
131
let should_embolden = font_data. should_embolden ;
131
132
let should_italicize = font_data. should_italicize ;
@@ -140,7 +141,7 @@ impl<'a> GlyphCacheSession<'a> {
140
141
// As a result Apple's Quartz text renderer, which is targeted for Retina displays,
141
142
// now ignores font hint information completely.
142
143
// .hint(!IS_MACOS)
143
- . hint ( true )
144
+ . hint ( enable_hint )
144
145
. size ( self . quant_size . into ( ) )
145
146
// .normalized_coords(coords)
146
147
. build ( ) ;
Original file line number Diff line number Diff line change @@ -40,6 +40,11 @@ pub fn default_font_size() -> f32 {
40
40
14.
41
41
}
42
42
43
+ #[ inline]
44
+ pub fn default_font_hinting ( ) -> bool {
45
+ true
46
+ }
47
+
43
48
fn default_font_family ( ) -> String {
44
49
DEFAULT_FONT_FAMILY . to_string ( )
45
50
}
@@ -80,6 +85,8 @@ pub fn default_font_bold_italic() -> SugarloafFont {
80
85
pub struct SugarloafFonts {
81
86
#[ serde( default = "default_font_size" ) ]
82
87
pub size : f32 ,
88
+ #[ serde( default = "default_font_hinting" ) ]
89
+ pub hinting : bool ,
83
90
#[ serde( default = "Option::default" ) ]
84
91
pub features : Option < Vec < String > > ,
85
92
#[ serde( default = "Option::default" ) ]
@@ -104,6 +111,7 @@ impl Default for SugarloafFonts {
104
111
fn default ( ) -> SugarloafFonts {
105
112
SugarloafFonts {
106
113
features : None ,
114
+ hinting : true ,
107
115
size : default_font_size ( ) ,
108
116
family : None ,
109
117
emoji : None ,
Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ pub struct FontLibraryData {
123
123
// Standard is fallback for everything, it is also the inner number 0
124
124
pub inner : FxHashMap < usize , FontData > ,
125
125
pub stash : LruCache < usize , SharedData > ,
126
+ pub hinting : bool ,
126
127
}
127
128
128
129
impl Default for FontLibraryData {
@@ -131,6 +132,7 @@ impl Default for FontLibraryData {
131
132
ui : FontArc :: try_from_slice ( FONT_CASCADIAMONO_REGULAR ) . unwrap ( ) ,
132
133
inner : FxHashMap :: default ( ) ,
133
134
stash : LruCache :: new ( NonZeroUsize :: new ( 2 ) . unwrap ( ) ) ,
135
+ hinting : true ,
134
136
}
135
137
}
136
138
}
@@ -243,6 +245,9 @@ impl FontLibraryData {
243
245
244
246
#[ cfg( not( target_arch = "wasm32" ) ) ]
245
247
pub fn load ( & mut self , mut spec : SugarloafFonts ) -> Vec < SugarloafFont > {
248
+ // Configure hinting through spec
249
+ self . hinting = spec. hinting ;
250
+
246
251
let mut fonts_not_fount: Vec < SugarloafFont > = vec ! [ ] ;
247
252
248
253
// If fonts.family does exist it will overwrite all families
You can’t perform that action at this time.
0 commit comments