the standard for getting a font is in the LR.
[code]Function FontAvailable(FontName As String) as Boolean
Dim fc As Integer
fc = FontCount-1
For i As Integer = 0 To fc
If Font(i) = FontName Then
Fontname is the same as the system, I guess. Yes?? On a mac, the encoding of the string is Macintosh.
I also know it isn’t UTF8 because I’d saved the fontname to a file as that and this is my result: T?i?m?e?s? ?N?e?w? ?R?o?m?a?n?
I’m not sure what the LR means under Font by [quote]Result is in the appropriate WorldScript [/quote] but it isn’t UTF8, as I think I remember that Mac’s save their documents as.
Is there a shortcut like ‘System’ or do I have use #if TargetMacOS, or something else?
I’m not really sure what you’re asking. Does the method, as written, fail for you?
The way you described the saved characters looks like UTF-16, btw.
I would assume that the name is returned with the encoding SystemDefault.
Easy enough to check in the debugger.
I did have the fontname saved as UTF8. I imagine, haven’t tried on Windows, that system will work. When I tried setting that that text to ‘System’ it showed the encoding as Macintosh, so one of my problems is solved. System will work and I don’t have to use #if TargetMacOS. Interesting though is Macintosh isn’t listed under textencodings which is fine. It’s system.
Almost any time you send or receive data that originates with the operating system, you can expect to use Encodings.SystemDefault.
This isn’t true. Any textual data returned from the framework will have a valid encoding for the bytes provided, which appears not to be the case here.
So what you’re saying is that it ought to be true.
Ah - I think you misunderstood me. I meant that you can expect OS-provided text to have an encoding of SystemDefault, not that you should expect to need to define it as that encoding.
I still wouldn’t say that’s true. Most things from the Cocoa framework are returned as UTF-8 while the SystemDefault encoding will be something like MacRoman.
I’ve had this problem on Mac and Windows, so I am not sure if it’s Cocoa or Carbon. I solved that problem and another by making sure the font’s name is in systemdefault. I had filed a bug “28041 - korean (Asian) font display on Win7” which I resolved by making sure of the encoding. This may or may not be a bug, but it is definitely something that belongs in the LR. I don’t think it’s a bug, because if you mismatch a name it should go to the default font. Also, sometimes the name would show up as Times New Roman. How that can happen is beyond me. Also the reason I wanted systemdefault is it is cross platform.
Whoah - big conflation there, Arthur. For fonts, the default system font is specified as the font with name “System” and a smaller one named “SmallSystem”. “SystemDefault” is the name of the default text encoding on the operating system.
I looked for that in Mac’s FontBook and it’s not there. It’s there on Windows but not Mac; not even under computer. The auto-word spits out systemdefault.