PDA

View Full Version : Solved: ToggleCharacterCode changes font



Paul_Hossler
11-28-2009, 09:01 PM
Word2007, Vista

If I have a Unicode font applied to a paragraph, and I enter e.g. E000,Alt-X, it does not seem to use the glyph from that font, but always uses Calibri (Body) and I get a little dot displayed :banghead: :banghead: :banghead:

If I use InsetSymbol, and type E000 into the 'Character Code' box and Insert, then it stays in the original font :dunno

I tried to show what's happening in the attachment

Can anyone give me an idea why the Alt-X puts it back to some other font, or even better ... a way to make it not happen??: pray2:

Paul

TonyJollans
11-29-2009, 04:37 PM
The way Word chooses Fonts is complex and not fully documented, but is tied to flags set in the Font that show its capabilities. How exactly it works with Private Use code points is, I think, even more complex and it is possible there is nothing you can do.

That said, when I open your document the E000 character shows as a Chinese character in font MingLiu_HKSCS, which is also the font it chooses when I enter E000, Alt+X. Under "Font Substitution", Word tells me that it will substitute TNR for Adobe Garamond Pro, although clearly it hasn't.

I'm not sure I'm any wiser for having looked at this - it's one of those areas where Word seems to want to do its own thing. Sorry I can't help.

Paul_Hossler
11-29-2009, 06:53 PM
Tony -- thanks, I sometimes get MingLiu_HKSCS popping up



it's one of those areas where Word seems to want to do its own thing

I have Adobe Garamond Pro installed and set as my Normal font (for that template), so I really don't understand why any Font Substatution would be required.

Given that, it still does not explain why the Alt-x operates differently than InsertSymbol, other that it's different code of course.

If I go back and re-apply AGP to the 'mis-fonted' text entered by Alt-X, I get the expected glyph. :banghead:

Paul

Paul_Hossler
11-29-2009, 08:19 PM
http://word.mvps.org/



"Word rarely misses an opportunity to perplex" -- Bob Buckland



Did some more experimenting

Used BabelMap to list all the glyphs, and tried the ones on the page bounderies. They all seemed to work as expected except for the E-page: InsertSymbol works, Alt-x changes it to some other font

Pasted the list of glyphs that I used to test below and the unicode seems to be correct after pasting (go figure) for the E000, E001, etc.



U+0100 Ā LATIN CAPITAL LETTER A WITH MACRON
U+0218 Ș LATIN CAPITAL LETTER S WITH COMMA BELOW
U+03C0 π GREEK SMALL LETTER PI
U+2010 ‐ HYPHEN
U+25CA ◊ LOZENGE
U+E000  PRIVATE USE CHARACTER-E000
U+E001  PRIVATE USE CHARACTER-E001
U+E0C0  PRIVATE USE CHARACTER-E0C0
U+E0C1  PRIVATE USE CHARACTER-E0C1
U+F634  PRIVATE USE CHARACTER-F634
U+FB03 ffi LATIN SMALL LIGATURE FFI
U+FB04 ffl LATIN SMALL LIGATURE FFL


:banghead: very confusing

I'd just give up and use Insert Symbol, except that Alt-X will change the font even it it was done with Insert Symbol,

Paul

TonyJollans
11-30-2009, 12:39 PM
As you're using Word 2007, you can look at the xml. I must warn you that this is not simple, and I haven't studied it in depth, and it may not help anyway, but ..

In \word\fontTable.xml, the fonts and their usage are defined. Each font should show


<w:sig w:usb0="xxxxxxxx" w:usb1="xxxxxxxx" w:usb2="xxxxxxxx" w:usb3="xxxxxxxx" ...

and this maps to the unicode subset bitfields for the font (see here (http://msdn.microsoft.com/en-us/library/dd374090(VS.85).aspx) for more details).

I really don't know how it works for Private Use characters but I think, in general, they default to using East Asian fonts if things are not explicit, and, even though you are using Garamond Pro for Latin, it may not be your default for Asian, although perhaps you can make it so.

Paul_Hossler
11-30-2009, 05:45 PM
Tony,

That is WAY over my head

I was hoping I was missing a checkbox or something

Paul

TonyJollans
12-01-2009, 02:26 AM
You're certainly not missing any simple checkbox.

You might try setting - in your template - (in VBA) the Font.NameFarEast (and/or Font.NameBi) to "Adobe garamond Pro" as well as the Font.Name. You can do this through the UI if you have any appropriate languages enabled, but can do it through VBA any time.

Paul_Hossler
12-01-2009, 06:53 AM
OK, I'll try that, but the Alt-X flips the font to "Calibrini (Body)" (at least in the current document)

Right now, I'm thinking I'll might have to write (with help) my own ToggleCharacterCode and hook it to Alt-X.

Normally I'd just say "That's the Word is" and use InsertSymbol.

But if I (or some one else) uses the Alt-x shortcut, there's a real chance of leaving the wrong font in the document

Paul