public SkiaTextLayout( string value, RectangleF rect, ITextAttributes textAttributes, LayoutLine callback, TextFlow textFlow = TextFlow.ClipBounds, SKPaint paint = null) { _value = value; _textAttributes = textAttributes; _rect = rect; _callback = callback; _textFlow = textFlow; _paint = paint; if (paint == null) { _paint = new SKPaint() { Typeface = SkiaDelegatingFontService.Instance.GetTypeface(_textAttributes.FontName), TextSize = _textAttributes.FontSize }; _disposePaint = true; } var metrics = _paint.FontMetrics; _descent = metrics.Descent; _lineHeight = _paint.FontSpacing; }
public AttributedTextRun( int start, int length, ITextAttributes attributes) { Start = start; Length = length; Attributes = attributes; }
private void Write( ITextAttributes currentAttributes, TextAttribute key, string defaultValue, TextWriter writer) { currentAttributes.TryGetValue(key, out var value); if (!string.Equals(value, defaultValue)) { WriteAttribute(writer, key.ToString(), value); } }
public static string GetAttribute( this ITextAttributes attributes, TextAttribute type, string defaultValue = null) { if (attributes != null) { if (attributes.TryGetValue(type, out var value)) { return(value); } } return(defaultValue); }
public static float GetFloatAttribute( this ITextAttributes attributes, TextAttribute type, float defaultValue) { var value = attributes.GetAttribute(type); if (value != null) { if (float.TryParse(value, out var floatValue)) { return(floatValue); } } return(defaultValue); }
public static int GetIntAttribute( this ITextAttributes attributes, TextAttribute type, int defaultValue) { var value = attributes.GetAttribute(type); if (value != null) { if (int.TryParse(value, out var intValue)) { return(intValue); } } return(defaultValue); }
public static T GetEnumAttribute <T>( this ITextAttributes attributes, TextAttribute type, T defaultValue) where T : struct { var value = attributes.GetAttribute(type); if (value != null) { if (Enum.TryParse(value, out T enumValue)) { return(enumValue); } } return(defaultValue); }
public static bool GetBoolAttribute( this ITextAttributes attributes, TextAttribute type, bool defaultValue = false) { var value = attributes.GetAttribute(type); if (value != null) { if (bool.TryParse(value, out var boolValue)) { return(boolValue); } } return(defaultValue); }
public static bool GetItalic(this ITextAttributes attributes) { return(attributes.GetBoolAttribute(TextAttribute.Italic)); }
public static bool GetBold(this ITextAttributes attributes) { return(attributes.GetBoolAttribute(TextAttribute.Bold)); }
public Size MeasureString(string text, ITextAttributes textAttributes, int maxWidth);
public void LayoutText(PathF path, string text, ITextAttributes textAttributes, LayoutLine callback) { // Do nothing }
public CTFont LoadFont(ITextAttributes aTextAttributes) { return(aTextAttributes.FontName == null ? NativeFontService.Instance.LoadFont(_systemFontName, (float)aTextAttributes.FontSize) : NativeFontService.Instance.LoadFont(aTextAttributes.FontName, (float)aTextAttributes.FontSize)); }
public static string GetFontName(this ITextAttributes attributes) { return(attributes.GetAttribute(TextAttribute.FontName)); }
public static bool GetUnorderedList(this ITextAttributes attributes) { return(attributes.GetBoolAttribute(TextAttribute.UnorderedList)); }
public static MarkerType GetMarker(this ITextAttributes attributes) { return(attributes.GetEnumAttribute(TextAttribute.UnorderedList, MarkerType.ClosedCircle)); }
public static bool GetSubscript(this ITextAttributes attributes) => attributes.GetBoolAttribute(TextAttribute.Subscript);
public static bool GetStrikethrough(this ITextAttributes attributes) { return(attributes.GetBoolAttribute(TextAttribute.Strikethrough)); }
public static string GetForegroundColor(this ITextAttributes attributes) => attributes.GetAttribute(TextAttribute.Color);
public static string GetBackgroundColor(this ITextAttributes attributes) => attributes.GetAttribute(TextAttribute.Background);
public static float GetFontSize( this ITextAttributes attributes, float?fontSize = null) { return(attributes.GetFloatAttribute(TextAttribute.FontName, fontSize ?? DefaultFontSize)); }
public AttributedTextBlock(string text, ITextAttributes attributes) { Text = text; Attributes = attributes; }
public static bool GetUnderline(this ITextAttributes attributes) { return(attributes.GetBoolAttribute(TextAttribute.Underline)); }
public List <PathF> ConvertToPaths(PathF aPath, string text, ITextAttributes textual, float ppu, float zoom) { return(new List <PathF>()); }
public void DrawStyledText(DrawingContext graphics, string text, ITextAttributes textAttributes, Rect textBounds);