Example #1
0
 public TextToTexture(Font customFont, int fontCountX, int fontCountY,PerCharacterKerning[] perCharacterKerning,bool supportSpecialCharacters)
 {
     this.customFont = customFont;
     fontTexture = (Texture2D)customFont.material.mainTexture;
     this.fontCountX = fontCountX;
     this.fontCountY = fontCountY;
     kerningValues = GetCharacterKerningValuesFromPerCharacterKerning(perCharacterKerning);
     this.supportSpecialCharacters = supportSpecialCharacters;
 }
Example #2
0
    private float[] GetCharacterKerningValuesFromPerCharacterKerning(PerCharacterKerning[] perCharacterKerning)
    {
        float[] perCharKerning = new float[128 - ASCII_START_OFFSET];
        int charCode;

        foreach (PerCharacterKerning perCharKerningObj in perCharacterKerning)
        {
            if (perCharKerningObj.First != "")
            {
                charCode = (int)perCharKerningObj.GetChar(); ;
                if (charCode >= 0 && charCode - ASCII_START_OFFSET < perCharKerning.Length)
                {
                    perCharKerning[charCode - ASCII_START_OFFSET] = perCharKerningObj.GetKerningValue();
                }
            }
        }
        return perCharKerning;
    }