Why OTF substitutes don't work properly in MS Word?

Hey Guys,

I’m currently trying to figure out why

sub hyphen a by amacron;

works in Pages, Textedit, InDesign, etc. but not in Microsoft Word.
I know I have to enable Ligatures in Word for each document and all other substitutions I have work too.

What could probably cause that sub hyphen a by amacron; wouldn’t work in MS Word, where other substitutions like sub u ogonek by uogonek; work just fine.

Kind Regards,
sepp88

Why are you doing that at all? It’s a dangerous practice because the hyphen has so many different uses. It could easily lead to a lot of frustration and/or confusion on the part of the end user, especially anyone using basic word-processing products.

It’s just for a little university project where I’m doing “logic” substitutions for a phonetic alphabet. The hyphen is the closest thing to a macron and when typing a hyphen and a letter, I want it to be the letter-with-macron-ontop.

I know it’s not a good practice, but I just wonder about the behaviour of MS Word and why it would work in all other applications. It doesn’t work on Word (win) and Word (mac)

There are many things that don’t work in Word compared to professional-level products such as InDesign.

My guess about why the hyphen doesn’t work in Word may have to do with how the programmers at Microsoft viewed hyphen usage along with how diacritical characters are normally accessed.

They likely never envisioned someone attempting to do what you are doing, i.e. programming a feature to make a diacritical character appear when keyboarding it in the manner one would expect of a ligature.

I think the hyphen is likely considered a special type of character given its uses – and the way different people use it, so you may never get it to work as you desire.

I guess what you need to develop is a keyboard layout, not font. For Mac, there’s a keyboard layout editor called Ukelele.
http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ukelele

Does any other substitution work? Have a look here: http://typedrawers.com/discussion/comment/2572/#Comment_2572

All other substitutions work, even really complex ones.
However only the hyphen doesn’t work.

I just don’t get why? Weirdly everything else works.

The easy solution: since you had to supply other diacritics, make a “macron” from the hyphen and sub that. It should work.

What keyboard layout do your users use?

Keep in mind that Word does some of its own substitutions regardless of what is in your OT tables. They have precedence over OT substitutions, and many of them involve the hyphen.

If it definitely has to be /hyphen/a, and if it is for a limited circle of users, I would recommend ditching Word.

@George Thomas How’d I do that? Can you give me an example?
I’m building combinations of characters with their diacritics so the fit perfectly on top of the character. That’s why I completely subsitute the combination with a new glyph.

@Georg Seifert
It varies. I’m on a mac, however the font substitutions should also work on Windows. And it does. Everything seems to work just fine, only the hyphen doesn’t.

@mekkablue I’m already considering ditching Word. I just wonderd why it wouldn’t work when everything else works.

I’d second what Tosche said. This is a problem that should not be solved with a font hack but by finding an input method. Handling this with a font hack is dirty and will probably cause you problems some day. Try to work with the technology, not against it.

@TimAhrens and Tosche

What I don’t get is how you actually mean this. I’ll try to explain my current project:

I’m working on a phonetic alphabet for a university project. It’s a font full of combinations with weird diacritics. There are even glyhps with 4 stacked diacritics on top of each other.

I’m trying to make the font as easy to type and learn as possible

E.g. how would you type an “a” with three diacritics (tilde, dieresis and circumflex) … well, what I do is just type them in their order of appearance and substitute them.

e.g. sub asciitilde colon asciicircum a by atildedieresiscircum;

I know that might sound weird, but it works just perfect and is really logical.

And like mentioned above, it works really well and just fine in almost every editor and software. Only the hyphen substitution on mac doesn’t.

What would be the other way of doing this?

@sepp88: You would make a macron from a hyphen by creating a new glyph named “macron”, copy/paste the hyphen into that window and adjust it for position. You then use that glyph to make all the composite characters that use the macron. The Glyphs manual should be more help to you with all the details. There’s more to it than what I’ve written here, and this really isn’t the place to go into the full details.

Then, regarding your method of input: The right way to do it is make the actual glyph rather than depending upon keyboarding every element. Then access the glyph through the various apps’ glyphs panels or whatever they may be called. Much easier and far more accurate.

You would type them using the correct keyboard commands or use the character palette of the app or the system. Then you either rely on mark positioning (using anchors) or build precomposed glyphs and substitute them in the ccmp feature. But you will need to keep the input text correct. Everything else will break searching, layout and will haunt you later.

You can also make a keyboard layout that can output combining marks. You can use a free app called Ukelele for this.

In Glyphs, just make sure you have combining marks with both a _top and a top anchor, then Glyphs can build mark and mkmk for you:
http://www.glyphsapp.com/tutorials/mark-to-base-positioning
http://www.glyphsapp.com/tutorials/mark-to-mark-positioning

BTW, you do not need to set widths to zero anymore, or write any of the code there. It is all done automatically now as soon as you insert those anchors.

I need to update those tutorials.