Replacement lookup
mauro sacchetto
Posts: 353
I would like to implement a replacement lookup in a font instead of relying on the software.
I explain the thing from the software point of view, since I am more expert in LaTeX than in fonts.
The relevant part of code is as follows:
<div>\directlua{
</div><div> fonts.handlers.otf.addfeature{</div><div>
name = "apo-nosc",</div><div>
type = "chainsubstitution",</div><div>
lookups = {</div><div>
{</div><div>
type = "substitution",</div><div>
data = {</div><div>
["quoteright.sc"] = "quoteright.fr", </div><div>
},</div><div>
},</div><div>
},</div><div>
data = {</div><div>
rules = {</div><div>
{</div><div>
before = { { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"} },</div><div>
current = { { "quoteright.sc" } },</div><div>
lookups = { 1 },</div><div>
},</div><div>
},</div><div>
},</div><div>
}</div><div>
}</div>
When I write, for example, < \textsc{l'albero L'Albero} >, the first apostrophe is correctly rendered with the low apostrophe, that is with quoteright.sc. In the second case, the replacement rule for Luatex that I set replaces quoteright.sc with the high apostrophe, that is quoteright because the apostrophe is still between two capitals:Is it possible to create a similar rule within the font that makes additional code in the text unnecessary?
And what should I adopt? A Contextual or Chaining Contextual Substitution?
Thank you
Thank you
0
Comments
-
Are the two quotes intentionally at the same height? Because they are.
0 -
ops... sorry, obviously not. This is the right image
0 -
mauro sacchetto said:Is it possible to create a similar rule within the font that makes additional code in the text unnecessary?
Does it matter? Implementations will often replace a contextual with a chaining contextual for generality.And what should I adopt? A Contextual or Chaining Contextual Substitution?
Thank you0 -
You could also do this just by putting the /quoteright.sc/ in the c2sc but not in the smcp feature. That way, you could select the whole word and apply either just smcp or both smcp/c2sc to determine what gets converted to smallcaps.0
-
I managed to build a Contextual Alternates lookup that refers to a Single Substitution lookup: it works fine. The second solution is actually simpler. Is there reason to prefer one or the other, or are they equivalent?
0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 800 Font Technology
- 1K Technique and Theory
- 617 Type Business
- 444 Type Design Critiques
- 541 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 483 Typography
- 301 History of Typography
- 114 Education
- 68 Resources
- 498 Announcements
- 79 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 269 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports