File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
internal/renderers/femtovg Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -303,10 +303,18 @@ impl<B: GraphicsBackend> RendererSealed for FemtoVGRenderer<B> {
303303
304304 fn font_metrics (
305305 & self ,
306- _font_request : i_slint_core:: graphics:: FontRequest ,
306+ font_request : i_slint_core:: graphics:: FontRequest ,
307307 _scale_factor : ScaleFactor ,
308308 ) -> i_slint_core:: items:: FontMetrics {
309- todo ! ( ) //crate::fonts::font_metrics(font_request)
309+ let font = font_request. query_fontique ( ) . unwrap ( ) ;
310+ let face = sharedfontique:: ttf_parser:: Face :: parse ( font. blob . data ( ) , font. index ) . unwrap ( ) ;
311+
312+ i_slint_core:: items:: FontMetrics {
313+ ascent : face. ascender ( ) as _ ,
314+ descent : face. descender ( ) as _ ,
315+ x_height : face. x_height ( ) . unwrap_or_default ( ) as _ ,
316+ cap_height : face. capital_height ( ) . unwrap_or_default ( ) as _ ,
317+ }
310318 }
311319
312320 fn text_input_byte_offset_for_position (
You can’t perform that action at this time.
0 commit comments