Can't get SYMBOL or Zapf Dingbats to work

Drop this into the PAINT event of a canvas

  g.textsize=100
  //g.TextFont="Wingdings" // works
  //g.TextFont="Chalkboard" // works
  //g.TextFont="Symbol" // NO WORK
  g.TextFont="Zapf Dingbats" // No Work
  g.drawstring "THIS IS A TEST",20,200

if I list the Fonts both are there…but the display does not change if I select either of those (there may be others, but its these two I must have)

Any ideas?

When you say “no work”, what result do you get?

the default font , as if I had not assigned a new one

The name of the font when I get them from the system is ZapfDingbats. I had a similar issue with LucidaGrande. I had a space in it and it was not recognized. When I removed the space, LucidaGrande was then recognized. BUT, when I tried Zapfdingbats without the space it made no difference. The font still appears to be the system font.

Tried it both ways…
Just found this post https://forum.xojo.com/24354-question-about-retrieving-fonts/0#p202931
where there is a app that is supposed to retrieve all the COCOA fonts and display samples… It too doesnt not work for these two fonts

searching the web it seems that this may be a COCOA (osx) issue,

I found this…

And I think the problem is PDF is one of those “smarter” apps

Note : I compile the above test code in Real Studio 2011 (Carbon) and it produced what I expected … so it seems it is a Cocoa issue making these fonts pretty much useless for my needs :frowning:

Cocoa is Unicode, so if you draw an “A”, it will look to get &u41 from the font file. There is no “A” in the font file “Zapf Dingbats”, so Cocoa will use the system font to draw it.

Zapf Dingbats starts at &u2701:

g.TextSize = 100 g.TextFont = "Zapf Dingbats" g.DrawString (&u41 + &u2701, 20, 200)
This will show “A?”
See UTF-8 encoding table and Unicode characters, choose U+2700…U+27BF: Dingbats.

Zapf Dingbat and Symbol, as well as WebDings and WingDings or Segoe UI Symbol, are encoded as Symbol fonts.

I have not found a way to use them the way they can be used in Windows, where symbols can be used by their slot in the font, as it used to be pre-unicode.

Yup… just figured that out myself… :slight_smile:
So I need to remap the characters for those fonts before I display them…
for Zap is would be CHR(&H26E0+ASCB(s))
and for Symbol is not so straight forward it seems

You may want to download the demo Fontlab Studio which will let you look at the Unicode values of each character within a font. That may help you deal with some ambiguous characters.

http://old.fontlab.com/font-editor/fontlab-studio/

Dang… turns out ZapF is not quite as easy a mapping as I thought :frowning:

for Zap is would be CHR(&H26E0+ASCB(s))

works for some but not all