Search code examples
fontscrystal-reportsfontforge

horizontally shrink text in CrystalReports


I have following problem. I'm recreating an A3-sized label in CrystalReports, and there is a text field which has to be Arial 115, bold, 0.5 usual width.

One can do it in HTML by using transform:scaleX(0.5).

<p style="font-family: 'Arial'; font-weight:bold; font-size: 115px;transform:scaleX(0.5);">SOME LONGER TEXT (scaled down)</p>

<p style="font-family: 'Arial'; font-weight:bold; font-size: 115px;">SOME LONGER TEXT (no scaling)</p>

And although CrystalReports has some understanding of HTML, it doesn't support the transforms.

So I'm asking if there is any way. This report is part of a .net-program, is there maybe some API-function for this?

I thought about generating and installing the shrunk down fonts I need (there will be 6 of them), but I couldn't find out how.

UPDATE I've posted my solution below.


Solution

  • What I ended up doing:

    1. get the font file (in my case: C:\Windows\Fonts\arialbd.ttf);
    2. open it in FontForge ("About" says it's the version from 31.07.2017);
    3. change it's name (Element - Font Info - PS Names). I ended up with Fontname: ArialShrunk-050-BoldMT, Family Name: Arial Shrunk 050, Name For Humans: Arial Shrunk 050 Bold; when asked about changing unique id press "Change";
    4. change or remove translated font names (Element - Font Info - TTF Names), else it won't be installed (because windows checks localized font names for some reason). I removed every line which wasn't "English (US)".
    5. save as .sfd;
    6. Edit - Select - Glyphs Worth Outputting;
    7. Element - Transformations - Transform;
    8. set Origin to Glyph Origin; first action to Scale, X to 50 (leave Y at 100); Transform All Layers, Transform Guide Layer Too, Round To Int unchecked; Transform Width Too, Transform kerning classes too, Transform simple positioning features & kern pairs checked; set up FontForge "Transform"-window
    9. press OK and wait a little;
    10. File - Generate Fonts, ensure TrueType is selected, uncheck Validate Before Saving (saves a click); press Generate, press OK in the "Lookup potentially too big"-Warning;
    11. Find the newly generated ArialShrunk-050-BoldMT.ttf file, double-click it, press Install to install the font.

    Now there is a new system-wide font Arial Shrunk 050 for me to use everywhere, especially in CrystalReports.

    It's not quite ideal, but since there is not too many scaling variations I need to generate, it works.