@@ -617,7 +617,7 @@ public static FontAsset CreateFontAsset(string familyName, string styleName, int
617
617
internal static FontAsset ? CreateFontAssetInternal ( string familyName , string styleName , int pointSize = 90 )
618
618
{
619
619
if ( FontEngine . TryGetSystemFontReference ( familyName , styleName , out FontReference fontRef ) )
620
- return CreateFontAsset ( fontRef . filePath , fontRef . faceIndex , pointSize , 9 , GlyphRenderMode . SDFAA , 1024 , 1024 , AtlasPopulationMode . DynamicOS , true ) ;
620
+ return CreateFontAsset ( fontRef . filePath , fontRef . faceIndex , pointSize , 9 , GlyphRenderMode . DEFAULT , 1024 , 1024 , AtlasPopulationMode . DynamicOS , true ) ;
621
621
return null ;
622
622
}
623
623
@@ -683,7 +683,7 @@ static FontAsset CreateFontAssetFromFamilyName(string familyName, int pointSize
683
683
FontAsset fontAsset = null ;
684
684
685
685
if ( FontEngine . TryGetSystemFontReference ( familyName , null , out FontReference fontRef ) )
686
- fontAsset = CreateFontAsset ( fontRef . filePath , fontRef . faceIndex , pointSize , 9 , GlyphRenderMode . SDFAA , 1024 , 1024 , AtlasPopulationMode . DynamicOS , true ) ;
686
+ fontAsset = CreateFontAsset ( fontRef . filePath , fontRef . faceIndex , pointSize , 9 , GlyphRenderMode . DEFAULT , 1024 , 1024 , AtlasPopulationMode . DynamicOS , true ) ;
687
687
688
688
if ( fontAsset == null )
689
689
return null ;
@@ -723,7 +723,8 @@ static FontAsset CreateFontAsset(string fontFilePath, int faceIndex, int samplin
723
723
var fontAsset = CreateFontAssetInstance ( null , atlasPadding , renderMode , atlasWidth , atlasHeight , atlasPopulationMode , enableMultiAtlasSupport ) ;
724
724
725
725
// Set font file path
726
- fontAsset . m_SourceFontFilePath = fontFilePath ;
726
+ if ( fontAsset )
727
+ fontAsset . m_SourceFontFilePath = fontFilePath ;
727
728
728
729
return fontAsset ;
729
730
}
@@ -795,6 +796,11 @@ static FontAsset CreateFontAssetInstance(Font font, int atlasPadding, GlyphRende
795
796
fontAsset . m_Version = "1.1.0" ;
796
797
fontAsset . faceInfo = FontEngine . GetFaceInfo ( ) ;
797
798
799
+ if ( renderMode == GlyphRenderMode . DEFAULT )
800
+ {
801
+ renderMode = FontEngine . IsColorFontFace ( ) ? GlyphRenderMode . COLOR : GlyphRenderMode . SDFAA ;
802
+ }
803
+
798
804
if ( atlasPopulationMode == AtlasPopulationMode . Dynamic && font != null )
799
805
{
800
806
fontAsset . sourceFontFile = font ;
@@ -829,9 +835,19 @@ static FontAsset CreateFontAssetInstance(Font font, int atlasPadding, GlyphRende
829
835
packingModifier = 0 ;
830
836
831
837
if ( texFormat == TextureFormat . Alpha8 )
832
- tmpMaterial = new Material ( TextShaderUtilities . ShaderRef_MobileBitmap ) ;
838
+ {
839
+ if ( TextShaderUtilities . ShaderRef_MobileBitmap )
840
+ tmpMaterial = new Material ( TextShaderUtilities . ShaderRef_MobileBitmap ) ;
841
+ else
842
+ return null ;
843
+ }
833
844
else
834
- tmpMaterial = new Material ( TextShaderUtilities . ShaderRef_Sprite ) ;
845
+ {
846
+ if ( TextShaderUtilities . ShaderRef_Sprite )
847
+ tmpMaterial = new Material ( TextShaderUtilities . ShaderRef_Sprite ) ;
848
+ else
849
+ return null ;
850
+ }
835
851
836
852
//tmp_material.name = texture.name + " Material";
837
853
tmpMaterial . SetTexture ( TextShaderUtilities . ID_MainTex , texture ) ;
0 commit comments