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