Forum > General

[SOLVED] Font question

(1/4) > >>

Hello , I have a question about changing the font in the project . If I change the font to my own, compile the project and move it to another computer where this font is not installed, will the font be displayed or will it be replaced?

1. If the font is not available, both on Linux and Windows an effort is made to replace it with a font from the same "font family". This can lead to disappointing results, though.
2. A better way is to include the font as a font resource, so the font is part of your application.

I often use 1), but if the font is really special, say, e.g. for music notation, I always use 2). In commercial software I only use 2) except if I use a font that is known to be part of the OS distribution and the application is restricted to that OS.
When in doubt, or X--platform, choose 2)

Adding a font resource is quite easy and I already gave an example sometime ago.

Note that many fonts are copyrighted or otherwise subject to licensing, so try to use a font without many restrictions, like "Creative Commons" versions. Many of the best fonts have such a license.

Of course if you have an interest in Typography/Typesetting you can also design your own font. There are many freeware font designers available. (Challenging, though, at least to me)

@Thaddy, I found this code to read font from resources

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.FormCreate(Sender: TObject);var  MyResStream: TResourceStream;begin  MyResStream:=TResourceStream.Create(hInstance, 'MYFONT', RT_RCDATA);  MyResStream.SavetoFile('Gen4.ttf');  AddFontResource(PChar('Gen4.ttf'));  SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0);  Label1.Font.Charset:=SYMBOL_CHARSET;  Label1.Font.Size:=24;  Label1.Font.Name:='Gen4';end; 

Here you find my way  :P

Thank you  :)


[0] Message Index

[#] Next page

Go to full version