<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Le 21/06/2011 16:16, Arno Trautmann a écrit :
<blockquote cite="mid:4E00A7BF.2000207@gmx.de" type="cite">
<pre wrap="">Hi all,
I was just having some fun with Paul Isamert's nice article in the
TUGboat 31, 3.</pre>
</blockquote>
<br>
`Isambert', actually, but thanks for the appreciation :)<br>
<br>
<blockquote cite="mid:4E00A7BF.2000207@gmx.de" type="cite">
<pre wrap="">Now I wanted to extend that code to show the influence of font expansion
on the badness. It is already very impressive to see how the greyness of
the page is much smoother when working with mircotype. However, I'd like
to colorize the amount of stretching/shrinking directly for each line. I
tried to access the expansion_factor field for the first glyph node in
each line, but I always get a "0" as result. So I assume, I'm doing
something stupid. Is expansion_factor the correct field after all?
</pre>
</blockquote>
<br>
That's a field I've been wondering about for some time now, and
perhaps even had an answer once (from Taco or my own investigations)
and have forgotten it...<br>
<br>
Anyway that's apparently not the right field, or there is some
trouble with its value for the moment. But you can compare your
(expanded) glyph node's width with its normal width in the font.
Suppose you're investigating node N, then:<br>
<br>
N.width % Expanded width in scaled points<br>
font.getfont(font.current()).characters[N.char].width % Original
width in scaled point.<br>
<br>
Why not use N's font, i.e.:<br>
font.getfont(N.font).characters[N.char].width<br>
<br>
? Because N's font isn't the original font, but a virtual expanded
one (so to speak). So you have to make do with the current font,
which of course is the current font at the end of the paragraph, so
perhaps it's not the best one... (Or you can link real font to
expanded ones at font loading time, but that's another thing.)<br>
<br>
Hope I haven't said too many false things, I haven't investigated
those things lately.<br>
<br>
Best,<br>
Paul<br>
<br>
<blockquote cite="mid:4E00A7BF.2000207@gmx.de" type="cite">
<pre wrap="">print_expansion_factor = function(head)
for line in node.traverse_id(HLIST,head) do
first_glyph = line.head
while not(first_glyph.next == nil) do
first_glyph = first_glyph.next
if first_glyph.id == 37 then
exp_factor = first_glyph.expansion_factor
tex.write(exp_factor)
end
end
end
return head
end
I'd be happy if anyone could point me to my mistakes,
cheers
Arno
</pre>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
TeX FAQ: <a class="moz-txt-link-freetext" href="http://www.tex.ac.uk/faq">http://www.tex.ac.uk/faq</a>
Mailing list archives: <a class="moz-txt-link-freetext" href="http://tug.org/pipermail/texhax/">http://tug.org/pipermail/texhax/</a>
More links: <a class="moz-txt-link-freetext" href="http://tug.org/begin.html">http://tug.org/begin.html</a>
Automated subscription management: <a class="moz-txt-link-freetext" href="http://tug.org/mailman/listinfo/texhax">http://tug.org/mailman/listinfo/texhax</a>
Human mailing list managers: <a class="moz-txt-link-abbreviated" href="mailto:postmaster@tug.org">postmaster@tug.org</a></pre>
</blockquote>
</body>
</html>