@@ -124,47 +124,47 @@ impl KeyboardRenderer {
124
124
}
125
125
}
126
126
127
- #[ profiling:: function]
128
- fn rebuild_text_cache ( & mut self , font_system : & mut glyphon:: FontSystem ) {
129
- let range_start = self . layout . range . start ( ) as usize ;
130
- for key in self . layout . keys . iter ( ) . filter ( |key| key. note_id ( ) == 0 ) {
131
- let x = self . pos . x + key. x ( ) ;
132
- let y = self . pos . y ;
133
-
134
- let w = key. width ( ) ;
135
- let h = key. height ( ) ;
136
-
137
- let size = w * 0.7 ;
138
-
139
- let oct_number = ( key. id ( ) + range_start) / 12 ;
140
-
141
- let mut buffer = glyphon:: Buffer :: new ( font_system, glyphon:: Metrics :: new ( size, size) ) ;
142
- buffer. set_size ( font_system, Some ( w) , Some ( h) ) ;
143
- buffer. set_wrap ( font_system, glyphon:: Wrap :: None ) ;
144
- buffer. set_text (
145
- font_system,
146
- & format ! ( "C{}" , oct_number as i8 - 1 ) ,
147
- glyphon:: Attrs :: new ( ) . family ( glyphon:: Family :: SansSerif ) ,
148
- glyphon:: Shaping :: Basic ,
149
- ) ;
150
- buffer. lines [ 0 ] . set_align ( Some ( glyphon:: cosmic_text:: Align :: Center ) ) ;
151
- buffer. shape_until_scroll ( font_system, false ) ;
152
-
153
- self . text_cache . push ( super :: text:: TextArea {
154
- buffer,
155
- left : x,
156
- top : y + h - size * 1.2 ,
157
- scale : 1.0 ,
158
- bounds : glyphon:: TextBounds {
159
- left : x. round ( ) as i32 ,
160
- top : y. round ( ) as i32 ,
161
- right : x. round ( ) as i32 + w. round ( ) as i32 ,
162
- bottom : y. round ( ) as i32 + h. round ( ) as i32 ,
163
- } ,
164
- default_color : glyphon:: Color :: rgb ( 153 , 153 , 153 ) ,
165
- } ) ;
166
- }
127
+ #[ profiling:: function]
128
+ fn rebuild_text_cache ( & mut self , font_system : & mut glyphon:: FontSystem ) {
129
+ let range_start = self . layout . range . start ( ) as usize ;
130
+ for key in self . layout . keys . iter ( ) {
131
+ let x = self . pos . x + key. x ( ) ;
132
+ let y = self . pos . y ;
133
+
134
+ let w = key. width ( ) ;
135
+ let h = key. height ( ) ;
136
+
137
+ let size = w * 0.7 ;
138
+
139
+ let oct_number = ( key. id ( ) + range_start) / 12 ;
140
+
141
+ let mut buffer = glyphon:: Buffer :: new ( font_system, glyphon:: Metrics :: new ( size, size) ) ;
142
+ buffer. set_size ( font_system, Some ( w) , Some ( h) ) ;
143
+ buffer. set_wrap ( font_system, glyphon:: Wrap :: None ) ;
144
+ buffer. set_text (
145
+ font_system,
146
+ & format ! ( "C{}" , oct_number as i8 - 1 ) ,
147
+ glyphon:: Attrs :: new ( ) . family ( glyphon:: Family :: SansSerif ) ,
148
+ glyphon:: Shaping :: Basic ,
149
+ ) ;
150
+ buffer. lines [ 0 ] . set_align ( Some ( glyphon:: cosmic_text:: Align :: Center ) ) ;
151
+ buffer. shape_until_scroll ( font_system, false ) ;
152
+
153
+ self . text_cache . push ( super :: text:: TextArea {
154
+ buffer,
155
+ left : x,
156
+ top : y + h - size * 1.2 ,
157
+ scale : 1.0 ,
158
+ bounds : glyphon:: TextBounds {
159
+ left : x. round ( ) as i32 ,
160
+ top : y. round ( ) as i32 ,
161
+ right : x. round ( ) as i32 + w. round ( ) as i32 ,
162
+ bottom : y. round ( ) as i32 + h. round ( ) as i32 ,
163
+ } ,
164
+ default_color : glyphon:: Color :: rgb ( 153 , 153 , 153 ) ,
165
+ } ) ;
167
166
}
167
+ }
168
168
169
169
#[ profiling:: function]
170
170
pub fn update ( & mut self , quads : & mut QuadPipeline , layer : usize , text : & mut TextRenderer ) {
0 commit comments