diff --git a/Source/SharpFontShared/TrueType/SfntName.cs b/Source/SharpFontShared/TrueType/SfntName.cs index 2697054..1f4b10c 100644 --- a/Source/SharpFontShared/TrueType/SfntName.cs +++ b/Source/SharpFontShared/TrueType/SfntName.cs @@ -107,6 +107,31 @@ public ushort NameId } } + /// + /// This property returns interpreted as UTF-16. + /// + public string String + { + get + { + //TODO it may be possible to consolidate all of these properties + //if the strings follow some sane structure. Otherwise, leave + //them or add more overloads for common encodings like UTF-8. + return Marshal.PtrToStringUni(rec.@string, (int)rec.string_len); + } + } + + /// + /// This property returns interpreted as ANSI. + /// + public string StringAnsi + { + get + { + return Marshal.PtrToStringAnsi(rec.@string, (int)rec.string_len); + } + } + /// /// Gets the ‘name’ string. Note that its format differs depending on the (platform,encoding) pair. It can be a /// Pascal String, a UTF-16 one, etc. @@ -114,13 +139,11 @@ public ushort NameId /// Generally speaking, the string is not zero-terminated. Please refer to the TrueType specification for /// details. /// - public string String + public IntPtr StringPtr { get { - //TODO look at TrueType specs, interpret string based on platform, encoding pair. - //return string.Empty; - return Marshal.PtrToStringUni(rec.@string, (int)rec.string_len); + return rec.@string; } }