@@ -617,7 +617,7 @@ public static FontAsset CreateFontAsset(string familyName, string styleName, int
617617        internal  static   FontAsset ?  CreateFontAssetInternal ( string  familyName ,  string  styleName ,  int  pointSize  =  90 ) 
618618        { 
619619            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 ) ; 
621621            return  null ; 
622622        } 
623623
@@ -683,7 +683,7 @@ static FontAsset CreateFontAssetFromFamilyName(string familyName, int pointSize
683683            FontAsset  fontAsset  =  null ; 
684684
685685            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 ) ; 
687687
688688            if  ( fontAsset  ==  null ) 
689689                return  null ; 
@@ -723,7 +723,8 @@ static FontAsset CreateFontAsset(string fontFilePath, int faceIndex, int samplin
723723            var  fontAsset  =  CreateFontAssetInstance ( null ,  atlasPadding ,  renderMode ,  atlasWidth ,  atlasHeight ,  atlasPopulationMode ,  enableMultiAtlasSupport ) ; 
724724
725725            // Set font file path 
726-             fontAsset . m_SourceFontFilePath  =  fontFilePath ; 
726+             if  ( fontAsset ) 
727+                 fontAsset . m_SourceFontFilePath  =  fontFilePath ; 
727728
728729            return  fontAsset ; 
729730        } 
@@ -795,6 +796,11 @@ static FontAsset CreateFontAssetInstance(Font font, int atlasPadding, GlyphRende
795796            fontAsset . m_Version  =  "1.1.0" ; 
796797            fontAsset . faceInfo  =  FontEngine . GetFaceInfo ( ) ; 
797798
799+             if  ( renderMode  ==  GlyphRenderMode . DEFAULT ) 
800+             { 
801+                 renderMode  =  FontEngine . IsColorFontFace ( )  ?  GlyphRenderMode . COLOR  :  GlyphRenderMode . SDFAA ; 
802+             } 
803+ 
798804            if  ( atlasPopulationMode  ==  AtlasPopulationMode . Dynamic  &&  font  !=  null ) 
799805            { 
800806                fontAsset . sourceFontFile  =  font ; 
@@ -829,9 +835,19 @@ static FontAsset CreateFontAssetInstance(Font font, int atlasPadding, GlyphRende
829835                packingModifier  =  0 ; 
830836
831837                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+                 } 
833844                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+                 } 
835851
836852                //tmp_material.name = texture.name + " Material"; 
837853                tmpMaterial . SetTexture ( TextShaderUtilities . ID_MainTex ,  texture ) ; 
0 commit comments