Jump to content

fractions glyphs populating unwanted characters


Recommended Posts

I am trying to get the glyph characters for the fractions using font KT Fold. I thought a function would be a good approach.

function createFraction(rep){
rep = rep.replace(/(1\/4)/gi, String.fromCharCode(0x00BC));
rep = rep.replace(/(1\/2)/gi, String.fromCharCode(0x00BD));
rep = rep.replace(/(3\/4)/gi, String.fromCharCode(0x00BE));

return rep;

 

I am able to get 1/2, but not 1/4 and 3/4 when I input the values directly into the Fusion Pro 13 file on my mac (OS 12.6.3)

If pulling the values in from the CSV file, none of them populate the proper glyph. Should I be saving the CSV file a certain encoding?

Is it possible to get the 1/4 and 3/4 glyphs to appear properly? They are currently are coming in as unwanted characters.

I have disabled the "Limit Processing.." option in the compose settings. (screenshot attached)

Collected files and composed PDF attached.

Many thanks in advance for looking into this.

 

 

Screen Shot 2024-08-12 at 6.55.01 PM.png

testing fractions.zip FlatFile-Output.pdf

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for making such a great minimal sample job.  That makes it much easier for me/us to understand and analyze the problem.

This does work as expected on Windows, and outputs the correct glyphs.  Note that, instead of calling String.fromCharCode(0x00BC), you can use the literal characters such as '¼' and '¾' directly in both the Text Editor and the Rule Editor.

As to why it doesn't work on Mac, that has to do with historical differences between the Windows-1252 and Mac Roman character sets, and how we load fonts accordingly on the different platforms.

We're investigating how to fix this now, though it will likely be a non-trivial change to the way fonts are loaded, and will require some care to avoid changing the behavior of existing jobs in the field.

In the meantime, here's a modified function that does work on Mac, by accessing glyph numbers instead of Unicode character codes:

//// return fractions
function createFraction(rep)
{
    // Glyph codes specific to the "KT Fold" font.
    rep = rep.replace(/(1\/4)/gi, '<unicode gid=true>01F1</unicode>');
    rep = rep.replace(/(1\/2)/gi, '<unicode gid=true>01EE</unicode>');
    rep = rep.replace(/(3\/4)/gi, '<unicode gid=true>01F2</unicode>');
    return rep;
}

Please note that the numbers there are glyph codes which are specific to that KT Fold font; for other fonts, the glyphs IDs will likely be different, even for the same Unicode character numbers.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...