mirror of
https://gitee.com/csharpui/CPF.git
synced 2026-03-23 09:43:24 +08:00
增加ResponsivePanel 调整绘图API
This commit is contained in:
@@ -303,7 +303,7 @@ namespace CPF.Skia
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetDefaultLineHeight(in Font font)
|
||||
public override float GetLineHeight(in Font font)
|
||||
{
|
||||
using (SKPaint paint = new SKPaint())
|
||||
{
|
||||
@@ -318,6 +318,38 @@ namespace CPF.Skia
|
||||
return paint.FontSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetAscent(in Font font)
|
||||
{
|
||||
using (SKPaint paint = new SKPaint())
|
||||
{
|
||||
paint.TextEncoding = SKTextEncoding.Utf16;
|
||||
//paint.IsStroke = false;
|
||||
//paint.LcdRenderText = true;
|
||||
//paint.SubpixelText = true;
|
||||
paint.IsAntialias = true;
|
||||
paint.Typeface = (font.AdapterFont as FontWrapper).SKTypeface;
|
||||
paint.TextSize = font.FontSize;
|
||||
|
||||
return -paint.FontMetrics.Ascent;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetDescent(in Font font)
|
||||
{
|
||||
using (SKPaint paint = new SKPaint())
|
||||
{
|
||||
paint.TextEncoding = SKTextEncoding.Utf16;
|
||||
//paint.IsStroke = false;
|
||||
//paint.LcdRenderText = true;
|
||||
//paint.SubpixelText = true;
|
||||
paint.IsAntialias = true;
|
||||
paint.Typeface = (font.AdapterFont as FontWrapper).SKTypeface;
|
||||
paint.TextSize = font.FontSize;
|
||||
|
||||
return paint.FontMetrics.Descent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class FontWrapper : IDisposable
|
||||
|
||||
Reference in New Issue
Block a user