0

i got a request to change the Font family of a string that im drawing on a rectangle and after in an image , my question is : How? , i know how to add a custom font on the html but this time im assigning it by code behind like this :

   `StringFormat stringformat2 = new StringFormat();
    stringformat2.Alignment = StringAlignment.Center;
    stringformat2.LineAlignment = StringAlignment.Center;

    Color StringColor2 = System.Drawing.ColorTranslator.FromHtml("#ffffff");

     graphicsImage.DrawString(Str_TextOnImage2, new Font("arial", 25,
                    FontStyle.Bold), new SolidBrush(StringColor2), rect,
                    stringformat2); Response.ContentType = "image/png";`

I need to change the "Arial" to a google font named Open Sans. I really appreciate if anyone can help in what direction should i go or what article should i read to achieve this . thanks in advance , im currently working on c# asp.net visual studio.

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.