Producing quotesingle glyph
Hello, This may be a stupid question, but I can't work out how to produce the ' character (quotesingle, unicode 0x0027) glyph in a document. Just typing the character in the source produces a quoteright as expected. Here are my other attempts: \starttext \quotesingle \getnamedglyphdirect{lm}{quotesingle} \uchar{00}{39} \stoptext They all produce quoteright as well. Does anyone have a better suggestion? I'm using MkIV, version 2011.02.25 22:03. Thanks, Pont
On Sat, Mar 19, 2011 at 01:29, Pontus Lurcock wrote:
Hello,
This may be a stupid question, but I can't work out how to produce the ' character (quotesingle, unicode 0x0027) glyph in a document. Just typing the character in the source produces a quoteright as expected. Here are my other attempts:
\starttext \quotesingle \getnamedglyphdirect{lm}{quotesingle} \uchar{00}{39} \stoptext
They all produce quoteright as well. Does anyone have a better suggestion? I'm using MkIV, version 2011.02.25 22:03.
In font-ini.mkiv you can find \definefontfeature [default] [%mode=node, liga=yes,kern=yes,tlig=yes,trep=yes] % texligatures=yes,texquotes=yes You can find those features defined in font-otc.lua, but in short: trep is responsible for auto-replacing 0x0027 into 0x2019. If you want to disable that behaviour, you need to turn trep feature off, for example with \definefontfeature[default][liga=yes,kern=yes,tlig=yes] % trep=no to be more explicit Sometimes you need to load the font after redefining the features, but I'm not sure when that is and maybe I'm wrong (it might be true for Type1 fonts or I may be wrong completely). Mojca PS: just as a thought ... it might make sense to map 0x27 to some (constant) private range slot and make it accessible with some control sequence. I don't know to what extent that would be usable though, so maybe that's just a way too silly idea.
On Sat, Mar 19, 2011 at 09:05, Mojca Miklavec wrote:
If you want to disable that behaviour, you need to turn trep feature off, for example with \definefontfeature[default][liga=yes,kern=yes,tlig=yes]
... or maybe just disable the font feature temporary with \subff{trep}. In theory that should work, but it didn't when I tried it. Mojca
On Sat, Mar 19, 2011 at 09:12:42AM +0100, Mojca Miklavec wrote:
On Sat, Mar 19, 2011 at 09:05, Mojca Miklavec wrote:
If you want to disable that behaviour, you need to turn trep feature off, for example with \definefontfeature[default][liga=yes,kern=yes,tlig=yes]
... or maybe just disable the font feature temporary with \subff{trep}. In theory that should work, but it didn't when I tried it.
You need node mode for that stuff to work. Regards, Khaled -- Khaled Hosny Egyptian Arab
Thanks, Mojca and Khaled! Taking trep out of the default features works nicely, but since in this case I want quote-replacement as the default and straight quotes only occasionally, I ended up with the following solution: \definefontfeature[default][liga=yes,kern=yes,tlig=yes,trep=yes,mode=node] \definefontfeature[notrep][liga=yes,kern=yes,tlig=yes,trep=no,mode=node] \def\realquotesingle{{\setfontfeature{notrep}'}} \starttext Straight quote: \realquotesingle Standard quote: ' \stoptext Will wikify later today in case anyone else ever needs this. Pont
On Sun 20 Mar 2011, Pontus Lurcock wrote:
Will wikify later today in case anyone else ever needs this.
Done: http://wiki.contextgarden.net/Quotesingle . At present it is only linked from http://wiki.contextgarden.net/Visuals , because I couldn't find many appropriate related pages. Pont
Am 19.03.2011 um 23:41 schrieb Pontus Lurcock:
Thanks, Mojca and Khaled!
Taking trep out of the default features works nicely, but since in this case I want quote-replacement as the default and straight quotes only occasionally, I ended up with the following solution:
\definefontfeature[default][liga=yes,kern=yes,tlig=yes,trep=yes,mode=node]
You can add a feature with this: \definefontfeature[default][default][mode=node]
\definefontfeature[notrep][liga=yes,kern=yes,tlig=yes,trep=no,mode=node] \def\realquotesingle{{\setfontfeature{notrep}'}}
Another option is to disable only a single feature: \definefontfeature[notrep][trep=no] \def\realquotesingle{{\addfs{notrep}'}} Wolfgang
On Sun, Mar 20, 2011 at 08:34, Pontus Lurcock wrote:
On Sun 20 Mar 2011, Wolfgang Schuster wrote:
Another option is to disable only a single feature:
\definefontfeature[notrep][trep=no] \def\realquotesingle{{\addfs{notrep}'}}
Thanks, that's more elegant. I've updated the wiki page to include it.
Just a question for Hans or Taco: would it be possible to create a command sequence that would avoid doing the auto-replacement even when trep is on? Say, \textapostrophe, \asciiapostrophe, \textquote, \asciiquote or some similar name. One option would be to automatically create a "virtual font" with duplicate of 0x27 at some constant slot and then access that glyph (even though that might have consequences for searching in PDFs). This is ugly, but maybe there is some better and more elegant approach. Mojca
Am 20.03.2011 um 11:04 schrieb Mojca Miklavec:
On Sun, Mar 20, 2011 at 08:34, Pontus Lurcock wrote:
On Sun 20 Mar 2011, Wolfgang Schuster wrote:
Another option is to disable only a single feature:
\definefontfeature[notrep][trep=no] \def\realquotesingle{{\addfs{notrep}'}}
Thanks, that's more elegant. I've updated the wiki page to include it.
Just a question for Hans or Taco: would it be possible to create a command sequence that would avoid doing the auto-replacement even when trep is on? Say, \textapostrophe, \asciiapostrophe, \textquote, \asciiquote or some similar name.
{ : \letteropenbrace, \letterbgroup, \letterleftbrace, \textbraceleft } : \letterclosebrace, \letteregroup, \letterrightbrace, \textbraceright & : \letterampersand < : \letterless
: \lettermore # : \letterhash " : \letterdoublequote, \quotedbl ' : \lettersinglequote, \quotesingle $ : \letterdollar, \textdollar % : \letterpercent, \percent ^ : \letterhat _ : \letterunderscore, \textunderscore | : \letterbar, \textbar ~ : \lettertilde, \textasciitilde \ : \letterbackslash, \letterescape, \textbackslash / : \letterslash, \textslash ? : \letterquestionmark ! : \letterexclamationmark @ : \letterat, \textat : : \lettercolon ` : \textgrave
Wolfgang
On Sun, Mar 20, 2011 at 12:35, Wolfgang Schuster
Am 20.03.2011 um 11:04 schrieb Mojca Miklavec:
On Sun, Mar 20, 2011 at 08:34, Pontus Lurcock wrote:
On Sun 20 Mar 2011, Wolfgang Schuster wrote:
Another option is to disable only a single feature:
\definefontfeature[notrep][trep=no] \def\realquotesingle{{\addfs{notrep}'}}
Thanks, that's more elegant. I've updated the wiki page to include it.
Just a question for Hans or Taco: would it be possible to create a command sequence that would avoid doing the auto-replacement even when trep is on? Say, \textapostrophe, \asciiapostrophe, \textquote, \asciiquote or some similar name.
' : \lettersinglequote, \quotesingle
This is the right one, but if autoreplacement 0x27->0x2019 is on, it doesn't help - this will still generate the curly 0x2019. Mojca
participants (4)
-
Khaled Hosny
-
Mojca Miklavec
-
Pontus Lurcock
-
Wolfgang Schuster