replacing characters in a font

This may be more of a question on TrueType fonts than VBA, but here goes!

The following will replace a selected character with an "a"

...

     sh.Text.Story.Text = ChrW(&H41)

but what I really need to do is:
    if the letter is a lowercase letter, replace it with a "stylized" replacement character whose unicode values start at &hF000.

I can tell you what doesn't work, so that may make it clearer as to what I want to do

     sh.Text.Story.Text = ChrW(&H41+&HEF9F)      ' (&hF000 - &h41) =&HEF9F 

Possibly it is significant to say that CHARMAP shows the starting, stylized set begins at &hF000 and labels that as "Private Use"

Parents
  • Roy, 

    ChrW(&H41) is actually a captial "A". The lower case "a" whould be ChrW(&H61)

    Stylized Sets are an OpenType Feature. So you will need to set the feature for this to work. Here is a quick example. 

    Using the font "Arial" type the letter A, select it, and in the VBA Immediate window type:

    ActiveShape.Text.Story.Text = ChrW(&H36)

    The "A" should now be a "6"

    Now lets used the Sylized version of this. Keep your "6" selected and in the VBA Immediate window type:

    ActiveShape.Text.Story.SetOpenTypeFeature "ss03", 1

    You should see it change. Here are the two versions:

    I was able to see what Stylistic Set the character belongs too by using the Glyphs Docker

    I was able to get the Open Type Feature String "ss03" by looking it up here:

    OpenType Registered Features

    The 1 turns the feature on, if you wanted to turn it off and go back to the stardard "6" select the character again and in the VBA Immediate window type:

    ActiveShape.Text.Story.SetOpenTypeFeature "ss03", 0

    Hopefully that all helps. All testing I did for this was in CorelDRAW 2022, I did not have time to test previous versions. 

    Happy coding, 

    -Shelby

Reply Children
No Data