mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Support loading fonts with names longer than 31 characters
This commit is contained in:
@@ -172,7 +172,7 @@ namespace Microsoft.Iris.Drawing
|
||||
GCHandle gcHandle = GCHandle.Alloc(textFlow);
|
||||
_currentlyMeasuringText = content != null ? content : string.Empty;
|
||||
fixed (char* content1 = _currentlyMeasuringText)
|
||||
fixed (char* chPtr = measureParams._textStyle.FontFace)
|
||||
fixed (char* chPtr = measureParams._textStyle.TruncatedFontFace)
|
||||
{
|
||||
var style = new TextStyle.MarshalledData(measureParams._textStyle)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace Microsoft.Iris.Drawing
|
||||
public unsafe bool CanMeasure(string content, TextStyle textStyle)
|
||||
{
|
||||
bool fPossible;
|
||||
fixed (char* chPtr = textStyle.FontFace)
|
||||
|
||||
fixed (char* chPtr = textStyle.TruncatedFontFace)
|
||||
{
|
||||
var style = new TextStyle.MarshalledData(textStyle)
|
||||
{
|
||||
@@ -70,7 +71,7 @@ namespace Microsoft.Iris.Drawing
|
||||
}
|
||||
IntPtr hGlyphRunInfo;
|
||||
NativeApi.RasterizeRunPacket rasterizeRunPacket;
|
||||
fixed (char* chPtr = textStyle.FontFace)
|
||||
fixed (char* chPtr = textStyle.TruncatedFontFace)
|
||||
{
|
||||
var style = new TextStyle.MarshalledData(textStyle)
|
||||
{
|
||||
|
||||
@@ -164,9 +164,8 @@ namespace Microsoft.Iris.Drawing
|
||||
EnableKerning = additional.EnableKerning;
|
||||
if (additional._flags[256])
|
||||
CharacterSpacing = additional.CharacterSpacing;
|
||||
if (!additional._flags[64])
|
||||
return;
|
||||
Color = additional.Color;
|
||||
if (additional._flags[64])
|
||||
Color = additional.Color;
|
||||
}
|
||||
|
||||
public bool HasColor => _flags[64];
|
||||
@@ -225,6 +224,8 @@ namespace Microsoft.Iris.Drawing
|
||||
info.AddValue("flags", _flags.Data);
|
||||
}
|
||||
|
||||
internal string TruncatedFontFace => _fontFace.Length < 32 ? _fontFace : _fontFace.Substring(0, 31);
|
||||
|
||||
[Flags]
|
||||
internal enum SetFlags
|
||||
{
|
||||
|
||||
@@ -290,10 +290,9 @@ namespace Microsoft.Iris.Markup.UIX
|
||||
|
||||
private static Result RangeValidateFontName(object value)
|
||||
{
|
||||
string str = (string)value;
|
||||
if (str == null)
|
||||
return Result.Fail("Script runtime failure: Invalid 'null' value for '{0}'", "FontName");
|
||||
return str.Length > 31 ? Result.Fail("\"{0}\" cannot be longer than {1} characters", str, "31") : Result.Success;
|
||||
return value is not string
|
||||
? Result.Fail("Script runtime failure: Invalid '{0}' value for '{1}'", value ?? "null", "FontName")
|
||||
: Result.Success;
|
||||
}
|
||||
|
||||
public static void Pass1Initialize() => Type = new UIXTypeSchema(93, "Font", null, 153, typeof(Font), UIXTypeFlags.Immutable);
|
||||
|
||||
@@ -84,11 +84,7 @@ namespace Microsoft.Iris.Markup.UIX
|
||||
|
||||
private static object Construct() => new TextStyle();
|
||||
|
||||
private static Result RangeValidateFontFace(object value)
|
||||
{
|
||||
string str = (string)value;
|
||||
return str.Length > 31 ? Result.Fail("\"{0}\" cannot be longer than {1} characters", str, "31") : Result.Success;
|
||||
}
|
||||
private static Result RangeValidateFontFace(object value) => Result.Success;
|
||||
|
||||
public static void Pass1Initialize() => Type = new UIXTypeSchema(220, "TextStyle", null, 153, typeof(TextStyle), UIXTypeFlags.None);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user