i built i custom editor that allows me to change many gameobject text settings like changing the font color and adding outline and more

when i set the stroke size = 0 , everything works fun with every font i try but when i change the stoke size only default unity font works other fonts shows a weird shapes like this :
i tried changing the stroke(outline) individually from inspector and its works well so maybe i miss something on the script
this is the script
public void UpdateSettings()
{
for(int x=0;x<transform.childCount ;x++)
{
GameObject country = transform.GetChild(x).gameObject;
country.GetComponent<SpriteRenderer>().color = countriesColor;
country.transform.GetChild(0).gameObject.SetActive(showNames);
if(showNames)
{
TextMeshProUGUI text = country.transform.GetChild(0).GetComponent<TextMeshProUGUI>();
Material mat = text.fontSharedMaterial;
if(fontAsset != null)
{
text.font = fontAsset;
}
if(strokeSize == 0)
{
}
else
{
mat.shaderKeywords = new string[]{"OUTLINE_ON"};
}
text.color = fontColor;
text.fontStyle = fontStyle;
text.outlineWidth = strokeSize;
text.outlineColor = strokeColor;
text.text = country.name;
}
}
}
note : i am using unity 2019.4
