How do you add custom fonts in TCPDF?

I figured out my issue, I was almost there. Here is a step by step: First convert your font using the tcpdf_addfont.php tool font in the TCPDF tools folder: php/tcpdf/tools/tcpdf_addfont.php -i php/font/rumpelstiltskin-webfont.ttf This will generate the required files and put them in the TCPDF fonts folder. Check the fonts folder and copy the name of … Read more

Embed font into PDF file by using iText

If you are doing more work with iText, you may want to invest into the iText book – it has examples for all the features of iText. There is a parameter that you specify when you create your font that defines font embedding: BaseFont helvetica = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED); Font font = new Font(helvetica, 12, … Read more

Changing font in a Console window in C#

There’s two problems with the way you’ve defined those API calls. First, the documentation for SetCurrentConsoleFontEx says: lpConsoleCurrentFontEx A pointer to a CONSOLE_FONT_INFOEX structure that contains the font information. So the third parameter needs to be passed by reference: [DllImport(“kernel32.dll”, SetLastError = true)] static extern bool SetCurrentConsoleFontEx( IntPtr consoleOutput, bool maximumWindow, ref CONSOLE_FONT_INFO_EX consoleCurrentFontEx); and … Read more

Changing Font Icon in WPF using Font Awesome

Font Awesome has NuGet packages named FontAwesome.UWP and FontAwesome.WPF. Just download one of this. If you will use a icon import follow namespace into your XAML code: xmlns:fa=”http://schemas.fontawesome.io/icons/” Use it into your button like this: <Button x:Name=”btnButton”> <Button.Content> <fa:ImageAwesome Icon=”LongArrowLeft”/> </Button.Content> </Button> And finally in your C# code behind: using FontAwesome.WPF; // on the top … Read more

How to calculate length of string in pixels for specific font and size?

Based on comment from @Selcuk, I found an answer as: from PIL import ImageFont font = ImageFont.truetype(‘times.ttf’, 12) size = font.getsize(‘Hello world’) print(size) which prints (x, y) size as: (58, 11) Here it is as a function: from PIL import ImageFont def get_pil_text_size(text, font_size, font_name): font = ImageFont.truetype(font_name, font_size) size = font.getsize(text) return size get_pil_text_size(‘Hello … Read more

css different font sizes on different families

There is a way to do this, but it’s as of now very badly supported. The CSS property you are looking for is font-size-adjust – a new CSS3 property introduced specifically to address this problem. The specification says: In situations where font fallback occurs, fallback fonts may not share the same aspect ratio as the … Read more