Hi @Donald Symmons,
But when I retrieve this font from database to display on the labels, it does not work.
You will see this part of the jquery.fontselect.js file
, which means that the fonts you reference come from online resources, therefore you cannot correctly set the control's font without referencing the resource.
In this case, for a specific font resource, you can first reference the resource and then set the font of the Label control, something like this:
Taking Anton
as an example, add it as a parameter after the url to reference the corresponding resource.
https://fonts.googleapis.com/css?family=<font-family you stored>
protected void Page_Load(object sender, EventArgs e)
{
Page.Header.Controls.Add(
new System.Web.UI.LiteralControl("<link rel=\"stylesheet\" type=\"text/css\" href=\" https://fonts.googleapis.com/css?family=Anton \" />"));
label4.Attributes.Add("style", "font-family: 'Anton';");
}
Result:
Best regards,
Xudong Peng
If the answer is the right solution, please click "Accept Answer" and kindly upvote. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.