using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMProOld;
using TeamCherry.Localization;
using UnityEngine;
using UnityEngine.TextCore;
using UnityEngine.TextCore.LowLevel;
using UnityEngine.TextCore.Text;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CustomFont")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1+193a02092c0857435c92365e96832f3751e97598")]
[assembly: AssemblyProduct("CustomFont")]
[assembly: AssemblyTitle("CustomFont")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/CarrieForle/CustomFontSilksong")]
[assembly: NeutralResourcesLanguage("EN")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
int ICollection.Count => _items.Length;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => this;
object IList.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
bool IList.IsFixedSize => true;
bool IList.IsReadOnly => true;
int IReadOnlyCollection<T>.Count => _items.Length;
T IReadOnlyList<T>.this[int index] => _items[index];
int ICollection<T>.Count => _items.Length;
bool ICollection<T>.IsReadOnly => true;
T IList<T>.this[int index]
{
get
{
return _items[index];
}
set
{
throw new NotSupportedException();
}
}
public <>z__ReadOnlyArray(T[] items)
{
_items = items;
}
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable)_items).GetEnumerator();
}
void ICollection.CopyTo(Array array, int index)
{
((ICollection)_items).CopyTo(array, index);
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Clear()
{
throw new NotSupportedException();
}
bool IList.Contains(object value)
{
return ((IList)_items).Contains(value);
}
int IList.IndexOf(object value)
{
return ((IList)_items).IndexOf(value);
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
void IList.Remove(object value)
{
throw new NotSupportedException();
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return ((IEnumerable<T>)_items).GetEnumerator();
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
return ((ICollection<T>)_items).Contains(item);
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
((ICollection<T>)_items).CopyTo(array, arrayIndex);
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
int IList<T>.IndexOf(T item)
{
return ((IList<T>)_items).IndexOf(item);
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Microsoft.CodeAnalysis
{
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace CustomFont
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("io.github.carrieforle.customfont", "CustomFont", "0.1.1")]
internal class CustomFontPlugin : BaseUnityPlugin
{
internal static ConfigEntry<ReplaceFontMode> configReplaceFontMode;
internal static ConfigEntry<float> configFontScale;
internal static string fontPath;
internal static ManualLogSource logger;
internal static TMP_FontAsset? fontAsset;
internal static Dictionary<TextMeshPro, (float FontScale, TMP_FontAsset Font)> oldFonts = new Dictionary<TextMeshPro, (float, TMP_FontAsset)>();
private Harmony harmony;
public const string Id = "io.github.carrieforle.customfont";
public static string Name => "CustomFont";
public static string Version => "0.1.1";
private void Awake()
{
harmony = Harmony.CreateAndPatchAll(typeof(Patch), "io.github.carrieforle.customfont");
logger = ((BaseUnityPlugin)this).Logger;
TryLoadFont(new <>z__ReadOnlyArray<string>(new string[2]
{
Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "font.otf"),
Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "font.ttf")
}));
}
private void Start()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
harmony.PatchAll(typeof(LanguagePatch));
configReplaceFontMode = ((BaseUnityPlugin)this).Config.Bind<ReplaceFontMode>("General", "ReplaceFontMode", ReplaceFontMode.EffectedByLanguage, LocalisedString.op_Implicit(Localized("OPTION_DESCRIPTION_REPLACE_FONT_MODE")));
configFontScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "FontScale", 1f, Localized("OPTION_DESCRIPTION_FONT_SCALE", 1));
configReplaceFontMode.SettingChanged += delegate
{
PatchTMPros();
ChangeFontByLanguage[] array = Object.FindObjectsByType<ChangeFontByLanguage>((FindObjectsSortMode)0);
for (int i = 0; i < array.Length; i++)
{
array[i].SetFont();
}
};
configFontScale.SettingChanged += delegate
{
if (configFontScale.Value <= 0f)
{
logger.LogError((object)"Invalid font scale. Resetted to 1.");
configFontScale.Value = 1f;
}
};
}
private static void TryLoadFont(IEnumerable<string> fontPaths)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
try
{
fontPath = fontPaths.FirstOrDefault((string fontPath) => File.Exists(fontPath));
if (fontPath == null)
{
logger.LogInfo((object)"No font found.");
return;
}
fontAsset = new FontAssetBuilder(new Font(fontPath))
{
AtlasHeight = 4096,
AtlasWidth = 4096
}.Create();
}
catch (Exception ex)
{
logger.LogError((object)("Error while loading font: " + ex.Message + "\n" + ex.StackTrace));
}
}
internal static void PatchTMPro(TextMeshPro tmpro, float scale)
{
fontAsset.fallbackFontAssets = ((TMP_Text)tmpro).font.fallbackFontAssets;
if (Extensions.IsNullOrEmpty<TMP_FontAsset>((ICollection<TMP_FontAsset>)fontAsset.fallbackFontAssets))
{
fontAsset.fallbackFontAssets = new List<TMP_FontAsset>(1) { ((TMP_Text)tmpro).font };
}
else if (!fontAsset.fallbackFontAssets.Contains(((TMP_Text)tmpro).font))
{
fontAsset.fallbackFontAssets.Insert(0, ((TMP_Text)tmpro).font);
}
((TMP_Text)tmpro).fontSize = scale;
((TMP_Text)tmpro).font = fontAsset;
}
internal static void UnpatchTMPro(TextMeshPro tmpro)
{
(float, TMP_FontAsset) tuple = oldFonts[tmpro];
((TMP_Text)tmpro).font = tuple.Item2;
((TMP_Text)tmpro).fontSize = tuple.Item1;
}
internal static void PatchTMPros()
{
if ((Object)(object)fontAsset == (Object)null)
{
return;
}
TextMeshPro[] componentsInChildren = ((Component)GameCameras.SilentInstance.hudCamera).gameObject.GetComponentsInChildren<TextMeshPro>(true);
TextMeshPro[] array = componentsInChildren;
foreach (TextMeshPro val in array)
{
oldFonts.TryAdd(val, (((TMP_Text)val).fontSize, ((TMP_Text)val).font));
}
array = componentsInChildren;
foreach (TextMeshPro val2 in array)
{
if (configReplaceFontMode.Value == ReplaceFontMode.All)
{
PatchTMPro(val2, oldFonts[val2].FontScale * configFontScale.Value);
}
else
{
UnpatchTMPro(val2);
}
}
logger.LogDebug((object)$"Patched {componentsInChildren.Length} TMPros in GameCameras");
}
public static string PathOf(GameObject go)
{
Transform val = go.transform;
StringBuilder stringBuilder = new StringBuilder(((Object)val).name);
while ((Object)(object)val.parent != (Object)null)
{
val = val.parent;
stringBuilder.Insert(0, ((Object)val).name + "/");
}
return stringBuilder.ToString();
}
public static LocalisedString Localized(string key)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return new LocalisedString("Mods.io.github.carrieforle.customfont", key);
}
public static string Localized(string key, params object[] args)
{
return string.Format(Language.Get(key, "Mods.io.github.carrieforle.customfont"), args);
}
}
internal static class Patch
{
[HarmonyPostfix]
[HarmonyPriority(500)]
[HarmonyPatch(typeof(ChangeFontByLanguage), "SetFont", new Type[] { })]
private static void SetFont(ChangeFontByLanguage __instance)
{
if (!((Object)(object)CustomFontPlugin.fontAsset == (Object)null) && CustomFontPlugin.configReplaceFontMode.Value != 0)
{
CustomFontPlugin.PatchTMPro(__instance.tmpro, ((TMP_Text)__instance.tmpro).fontSize * CustomFontPlugin.configFontScale.Value);
Material fontSharedMaterial = (__instance.FallbackMaterialReference = TMP_MaterialManager.GetFallbackMaterial(__instance.defaultMaterial, ((TMP_Text)__instance.tmpro).fontSharedMaterial));
((TMP_Text)__instance.tmpro).fontSharedMaterial = fontSharedMaterial;
}
}
[HarmonyPostfix]
[HarmonyPriority(500)]
[HarmonyPatch(typeof(GameManager), "ContinueGame")]
[HarmonyPatch(typeof(GameManager), "StartNewGame")]
private static void PatchTMPros()
{
CustomFontPlugin.PatchTMPros();
}
}
internal static class LanguagePatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(Language), "DoSwitch")]
private static void ClearOldFonts()
{
CustomFontPlugin.oldFonts.Clear();
}
}
internal enum ReplaceFontMode
{
Disabled,
EffectedByLanguage,
All
}
public class CustomFontException : Exception
{
public CustomFontException(string message)
: base(message)
{
}
}
public class FontAssetBuilder
{
public Font Font { get; set; }
public ICollection<char>? CharList { get; set; }
public int FaceIndex { get; set; }
public int SamplingPointSize { get; set; } = 90;
public int AtlasPadding { get; set; } = 9;
public GlyphRenderMode RenderMode { get; set; } = (GlyphRenderMode)4165;
public int AtlasWidth { get; set; } = 1024;
public int AtlasHeight { get; set; } = 1024;
public FontAssetBuilder(Font font)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
Font = font;
}
public TMP_FontAsset Create()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Invalid comparison between Unknown and I4
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Invalid comparison between Unknown and I4
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Invalid comparison between Unknown and I4
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Invalid comparison between Unknown and I4
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Invalid comparison between Unknown and I4
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Invalid comparison between Unknown and I4
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Invalid comparison between Unknown and I4
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Invalid comparison between Unknown and I4
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Invalid comparison between Unknown and I4
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Invalid comparison between Unknown and I4
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Invalid comparison between Unknown and I4
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Unknown result type (might be due to invalid IL or missing references)
//IL_028f: Invalid comparison between Unknown and I4
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Invalid comparison between Unknown and I4
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Expected O, but got Unknown
//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Invalid comparison between Unknown and I4
//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02cb: Expected O, but got Unknown
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Expected O, but got Unknown
GlyphRenderMode renderMode = RenderMode;
if ((int)renderMode <= 4169)
{
if ((int)renderMode <= 4122)
{
if (renderMode - 4117 <= 1 || renderMode - 4121 <= 1)
{
goto IL_008d;
}
}
else if ((int)renderMode == 4134 || (int)renderMode == 4165 || (int)renderMode == 4169)
{
goto IL_0089;
}
}
else if ((int)renderMode <= 16422)
{
if ((int)renderMode == 8230 || (int)renderMode == 16422)
{
goto IL_0089;
}
}
else
{
if ((int)renderMode == 32806)
{
goto IL_0089;
}
if ((int)renderMode == 69652 || (int)renderMode == 69656)
{
goto IL_008d;
}
}
throw new CustomFontException("GlyphRenderMode.DEFAULT is not allowed.");
IL_009c:
FontAsset val = FontAsset.CreateFontAsset(Font, FaceIndex, SamplingPointSize, AtlasPadding, RenderMode, AtlasWidth, AtlasHeight, (AtlasPopulationMode)1, false);
if ((Object)(object)val == (Object)null)
{
throw new CustomFontException("Failed to create font asset.");
}
TMP_FontAsset val2 = ScriptableObject.CreateInstance<TMP_FontAsset>();
((Object)val2).name = ((Object)Font).name;
val2.fallbackFontAssets = new List<TMP_FontAsset>();
IEnumerable<uint> source = CharList?.Select((Func<char, uint>)((char ch) => ch)) ?? (from c in Enumerable.Range(0, 65535)
select (uint)c);
uint[] source2 = default(uint[]);
if (!val.TryAddCharacters(source.ToArray(), ref source2, false))
{
string text = new string(source2.Select((uint c) => (char)c).ToArray());
if (CharList != null)
{
CustomFontPlugin.logger.LogWarning((object)("Failed to add characters: \"" + text + "\". These will not be rendered."));
}
}
TMP_Glyph[] array = val.characterTable.Select((Character character) => NewToOld(character, AtlasHeight)).ToArray();
CustomFontPlugin.logger.LogDebug((object)$"Loaded {array.Length} glyphs.");
val2.m_fontInfo = NewToOld(val.faceInfo, AtlasWidth, AtlasHeight, AtlasPadding, array.Length);
val2.AddGlyphInfo(array);
val2.AddKerningInfo(NewToOld(val));
FontAssetTypes fontAssetType;
val2.fontAssetType = fontAssetType;
Texture2D val3 = (val2.atlas = val.atlasTexture);
CustomFontPlugin.logger.LogDebug((object)$"Created {val.atlasTextureCount} atlases.");
TextureFormat val4 = (TextureFormat)(((RenderMode & 0x10000) != 65536) ? 1 : 4);
if ((RenderMode & 0x10) == 16)
{
int num = 0;
Material val5 = (((int)val4 != 1) ? new Material(Shader.Find("TextMeshPro/Sprite")) : new Material(TextShaderUtilities.ShaderRef_MobileBitmap));
val5.SetTexture(TextShaderUtilities.ID_MainTex, (Texture)(object)val3);
val5.SetFloat(TextShaderUtilities.ID_TextureWidth, (float)AtlasWidth);
val5.SetFloat(TextShaderUtilities.ID_TextureHeight, (float)AtlasHeight);
((TMP_Asset)val2).material = val5;
}
else
{
int num = 1;
Material val6 = new Material(TextShaderUtilities.ShaderRef_MobileSDF);
val6.SetTexture(TextShaderUtilities.ID_MainTex, (Texture)(object)val3);
val6.SetFloat(TextShaderUtilities.ID_TextureWidth, (float)AtlasWidth);
val6.SetFloat(TextShaderUtilities.ID_TextureHeight, (float)AtlasHeight);
val6.SetFloat(TextShaderUtilities.ID_GradientScale, (float)(AtlasPadding + num));
val6.SetFloat(TextShaderUtilities.ID_WeightNormal, val2.normalStyle);
val6.SetFloat(TextShaderUtilities.ID_WeightBold, val2.boldStyle);
((TMP_Asset)val2).material = val6;
}
((TMP_Asset)val2).material.renderQueue = 3000;
((TMP_Asset)val2).material.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)5;
val2.ReadFontDefinition();
FontEngine.UnloadFontFace();
return val2;
IL_0089:
fontAssetType = (FontAssetTypes)1;
goto IL_009c;
IL_008d:
fontAssetType = (FontAssetTypes)2;
goto IL_009c;
}
private static KerningTable NewToOld(FontAsset fontAsset)
{
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
Dictionary<uint, uint> glyphToUnicode = new Dictionary<uint, uint>();
HashSet<uint> hashSet = new HashSet<uint>();
foreach (Character item in fontAsset.characterTable)
{
if (!glyphToUnicode.TryAdd(((TextElement)item).glyphIndex, ((TextElement)item).unicode))
{
hashSet.Add(((TextElement)item).glyphIndex);
}
}
CollectionExtensions.Do<uint>((IEnumerable<uint>)hashSet, (Action<uint>)delegate(uint glyph)
{
glyphToUnicode.Remove(glyph);
});
KerningTable val = new KerningTable();
foreach (GlyphPairAdjustmentRecord glyphPairAdjustmentRecord in fontAsset.fontFeatureTable.glyphPairAdjustmentRecords)
{
GlyphPairAdjustmentRecord current2 = glyphPairAdjustmentRecord;
Dictionary<uint, uint> dictionary = glyphToUnicode;
GlyphAdjustmentRecord val2 = ((GlyphPairAdjustmentRecord)(ref current2)).firstAdjustmentRecord;
if (dictionary.TryGetValue(((GlyphAdjustmentRecord)(ref val2)).glyphIndex, out var value))
{
Dictionary<uint, uint> dictionary2 = glyphToUnicode;
val2 = ((GlyphPairAdjustmentRecord)(ref current2)).secondAdjustmentRecord;
if (dictionary2.TryGetValue(((GlyphAdjustmentRecord)(ref val2)).glyphIndex, out var value2))
{
uint num = value;
uint num2 = value2;
val2 = ((GlyphPairAdjustmentRecord)(ref current2)).firstAdjustmentRecord;
GlyphValueRecord glyphValueRecord = ((GlyphAdjustmentRecord)(ref val2)).glyphValueRecord;
val.AddKerningPair((int)num, (int)num2, ((GlyphValueRecord)(ref glyphValueRecord)).xAdvance);
}
}
}
return val;
}
private static TMP_Glyph NewToOld(Character character, int atlasHeight)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Expected O, but got Unknown
TMP_Glyph val = new TMP_Glyph
{
id = (int)((TextElement)character).m_Unicode
};
GlyphRect glyphRect = ((TextElement)character).glyph.glyphRect;
((TMP_TextElement)val).x = ((GlyphRect)(ref glyphRect)).x;
glyphRect = ((TextElement)character).glyph.glyphRect;
float num = atlasHeight - ((GlyphRect)(ref glyphRect)).y;
GlyphMetrics metrics = ((TextElement)character).glyph.metrics;
((TMP_TextElement)val).y = num - ((GlyphMetrics)(ref metrics)).height;
metrics = ((TextElement)character).glyph.metrics;
((TMP_TextElement)val).width = ((GlyphMetrics)(ref metrics)).width;
metrics = ((TextElement)character).glyph.metrics;
((TMP_TextElement)val).height = ((GlyphMetrics)(ref metrics)).height;
metrics = ((TextElement)character).glyph.metrics;
((TMP_TextElement)val).xOffset = ((GlyphMetrics)(ref metrics)).horizontalBearingX;
metrics = ((TextElement)character).glyph.metrics;
((TMP_TextElement)val).yOffset = ((GlyphMetrics)(ref metrics)).horizontalBearingY;
metrics = ((TextElement)character).glyph.metrics;
((TMP_TextElement)val).xAdvance = ((GlyphMetrics)(ref metrics)).horizontalAdvance;
((TMP_TextElement)val).scale = 1f;
return val;
}
private static FaceInfo NewToOld(FaceInfo newFaceInfo, float atlasWidth, float atlasHeight, float atlasPadding, int charCount)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Expected O, but got Unknown
return new FaceInfo
{
Name = ((FaceInfo)(ref newFaceInfo)).familyName,
PointSize = ((FaceInfo)(ref newFaceInfo)).pointSize,
Scale = ((FaceInfo)(ref newFaceInfo)).scale,
CharacterCount = charCount,
LineHeight = ((FaceInfo)(ref newFaceInfo)).lineHeight,
Baseline = ((FaceInfo)(ref newFaceInfo)).baseline,
Ascender = ((FaceInfo)(ref newFaceInfo)).ascentLine,
CapHeight = ((FaceInfo)(ref newFaceInfo)).capLine,
Descender = ((FaceInfo)(ref newFaceInfo)).descentLine,
CenterLine = ((FaceInfo)(ref newFaceInfo)).meanLine,
SuperscriptOffset = ((FaceInfo)(ref newFaceInfo)).superscriptOffset,
SubscriptOffset = ((FaceInfo)(ref newFaceInfo)).subscriptOffset,
SubSize = ((FaceInfo)(ref newFaceInfo)).subscriptSize,
Underline = ((FaceInfo)(ref newFaceInfo)).underlineOffset,
UnderlineThickness = ((FaceInfo)(ref newFaceInfo)).underlineThickness,
TabWidth = ((FaceInfo)(ref newFaceInfo)).tabWidth,
Padding = atlasPadding,
AtlasWidth = atlasWidth,
AtlasHeight = atlasHeight
};
}
}
}