Changes

Jump to navigation Jump to search
864 bytes added ,  14:30, 6 August 2007
m
Corrected small mistakes; commented the LuaTeX code a bit.
 
<div class='floatright'>[http://livewiki.contextgarden.net/.hahahaimages/0/0e/MKIV.avi <context>\starttext\externalfigure[/opt/local/texmf/tex/context/sample/.hahaha/MKIV.png]\stoptext</context>]
<font size='+1'><strong>''Accelerate to Mark IV!''</strong></font>
</div>
==== Good ol' typescripts ====
Of course, Mark IV allows you to use typescripts as you've always done; for example:
<texcode>
==== Opentype features ====
A “feature”, in the Opentype jargon, is a set of rules describing changes in the appearance of the text. Hmm, that's not very precise. Let's show some examples. First of all, you have to know that features are referred to with by 4-letteres tagletter tags, and you will see this a lot. One of them is ‘smcp‘, for “small caps“. Let's consider the following Mark IV-only code:
<texcode>
</texcode>
Here you basically define a (Mark IV) feature with the name ”smallcaps”, and associate it with the (Opentype) feature “smcp”. You have to specify with which script you want to use itwith; scripts in Opentype are also tagged with four letters, and “latn” is of course Latin.
Then you define a TeX font with that feature.
fontname = 'texgyrepagella-regular.otf'
--[[ First read the font data.
This makes heavy use of some of the Mark IV code]]
tfmdata = fonts.tfm.read_and_define("file:" .. fontname, 655360)
font = tfmdata.shared.otfdata
if gsubfeatures then
table.sort(gsubfeatures)% We want our list sorted alphabetically! tex.sprint("\\rm GSUB features: \\tt ")% Beware: you don't want \rm to be interpreted by lua (\rm would yield carriage return + letter m)!
for _, feat in ipairs(gsubfeatures)
do tex.sprint(feat) tex.sprint(' ')
</texcode>
It prints the list on the page. You'll notice there are two sets of features, each one of them defined in a different table of the Opentype font: the <code>GSUB</code> table (for Glyph SUBstitution) gives rules for replacing glyphs in certains circumstances (think of ligatures: f + i -> fi); the <code>GPOS</code> table (Glyph POSititioning) gives rules for moving glyphs (think of kerning: A + V -> A <kerning> V). Incidentally, the above code gives some basic examples of LuaTeX programming, a mixture of both Lua and TeX programming with some special features (features in the general sense, not the Opentype one :-).
45

edits

Navigation menu