public FontDefinition ReadFontDefinition(int index) { FontAsset fontAsset = null; Font font = null; var value = m_Values[m_CurrentValueIndex + index]; switch (value.handle.valueType) { case StyleValueType.ResourcePath: { string path = value.sheet.ReadResourcePath(value.handle); if (!string.IsNullOrEmpty(path)) { font = Panel.LoadResource(path, typeof(Font), dpiScaling) as Font; if (font == null) { fontAsset = Panel.LoadResource(path, typeof(FontAsset), dpiScaling) as FontAsset; } } if (fontAsset == null && font == null) { Debug.LogWarning(string.Format("Font not found for path: {0}", path)); } break; } case StyleValueType.AssetReference: { font = value.sheet.ReadAssetReference(value.handle) as Font; if (font == null) { fontAsset = value.sheet.ReadAssetReference(value.handle) as FontAsset; } break; } case StyleValueType.Keyword: { if (value.handle.valueIndex != (int)StyleValueKeyword.None) { Debug.LogWarning("Invalid keyword for font " + (StyleValueKeyword)value.handle.valueIndex); } break; } default: Debug.LogWarning("Invalid value for font " + value.handle.valueType); break; } FontDefinition sfd; if (font != null) { sfd = FontDefinition.FromFont(font); } else if (fontAsset != null) { sfd = FontDefinition.FromSDFFont(fontAsset); } else { sfd = new FontDefinition(); } return(sfd); }