Metafont: how to set sharp dimensions and use online display?
Consider io.mf
:
mode_setup;
em#:=10pt#; cap#:=7pt#;
thin#:=1/3pt#; thick#:=5/6pt#;
o#:=1/5pt#;
define_pixels(em,cap);
define_blacker_pixels(thin,thick);
define_corrected_pixels(o);
curve_sidebar=round 1/18em;
beginchar("O",0.8em#,cap#,0); "The letter O";
penpos1(thick,10); penpos2(.1[thin,thick],90-10);
penpos3(thick,180+10); penpos4(thin,270-10);
x1l=w-x3l=curve_sidebar; x2=x4=.5w;
y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
penstroke z1e{down}..z2e{right}
..z3e{up}..z4e{left}..cycle;
penlabels(1,2,3,4); endchar;
end
When we run mf io
, letter O
is shown in online display.
The question is how to make online display work in the following logo.mf
: if we don't use mode:=localfont;
, it does not work, and if we use mode:=localfont;
, it does not show online output:
mode:=localfont;
mode_setup;
beginchar ("A", 29mm# , 25mm# , 0); thick# := 2mm#; thin# := 5/4mm#;
define_whole_blacker_pixels(thick , thin);
forsuffixes $ = a, b, c: transform $;
forsuffixes e = l, r: path $e, $'e; numeric t$e; endfor endfor
penpos1(thick, 0); penpos2(thick, 90); penpos3(thick, 180); penpos4(thick, 270);
penpos5(thick, 0); penpos6(thick, 90); penpos7(thick, 180); penpos8(thick, 270);
x2 = x4 = x6 = x8 = .5[x5, x7] = .5w; x1r = w; x3r = 0; x5 - x7 = y6 - y8;
y1 = y3 = y5 = y7 = .5[y6, y8] = .5h; y2r = h; y4r = 0; y6r = .75h;
forsuffixes e = l,r: a.e = b'e = c'e = superellipse(z1e, z2e, z3e, z4e, .75);
a'e = b.e = c.e = superellipse (z5e, z6e, z7e, z8e, .72); endfor
penpos.a1(thin, 0); penpos.a5(whatever, -90); penpos.a9(thin, 180);
x.a1l - x.a9l = 1/3(x5l - x7l); x.a5 = .5w; y.a1 = y.a9; y.a5r = 4/7h;
x.a3l = x.a1l; x.a3r = x.a1r; x.a4r = 1/6[x.a3r, x1l]; x0 = .5w; y0 = .52h;
x.a6l + x.a4l = x.a6r + x.a4r = x.a7l + x.a3l = x.a7r + x.a3r = x.a9 + x.a1 = w;
y.a3r = y.a4r = y.a6r = y.a7r = .2[y2l, y0]; y.a3l = y.a4l = y.a6l = y.a7l = y.a3r - thin;
z.a4l = z.a4r + (thin, 0) rotated(angle(z.a4r - z.a5r) + 90)
+ whatever*(z.a4r - z.a5r); z.a4l - z.a5l = whatever*(z.a4r - z.a5r);
z = a.r intersectionpoint (z0 -- (w, 0)); y.a1 - y.a5 = length(z - z0);
b = identity shifted (0, y0 - y.a1) rotatedaround(z0, 90 - angle(z0 - (w, 0)));
c = b reflectedabout (z2, z4);
for n = 1, 3, 4, 5, 6, 7, 9: forsuffixes e = l,,r: forsuffixes $ = b,c:
z.$[n]e = z.a[n]e transformed $; endfor endfor endfor
forsuffixes e = l, r: forsuffixes $ = a, b, c:
z.$2e = $r intersectionpoint (z.$1e -- z.$3e );
z.$8e = $r intersectionpoint (z.$9e -- z.$7e );
t.$1e = xpart($e intersectiontimes(z.$1l -- z.$3l));
t.$9e = xpart($e intersectiontimes(z.$9l -- z.$7l));
t.$4e = xpart($'e intersectiontimes(z.$5r -- z.$4l));
t.$6e = xpart($'e intersectiontimes(z.$5r -- z.$6l)); endfor endfor
penstroke subpath(t.a9e, t.b6e) of a.e;
penstroke subpath(t.b4e, t.c4e) of b'e;
penstroke subpath(t.c6e, t.a1e + 8) of c'e;
penstroke subpath(t.a6e, t.b9e) of a'e;
penstroke subpath(t.b1e, t.c1e) of b.e;
penstroke subpath(t.c9e, t.a4e + 8) of c.e;
forsuffixes $ = a, b, c: penlabels($1, $2, $3, $4, $5, $6, $7, $8, $9);
penstroke z.$2e -- z.$3e -- z.$4e -- z.$5e -- z.$6e -- z.$7e -- z.$8e; endfor
penlabels(range 0 thru 8); endchar;
end
metafont
add a comment |
Consider io.mf
:
mode_setup;
em#:=10pt#; cap#:=7pt#;
thin#:=1/3pt#; thick#:=5/6pt#;
o#:=1/5pt#;
define_pixels(em,cap);
define_blacker_pixels(thin,thick);
define_corrected_pixels(o);
curve_sidebar=round 1/18em;
beginchar("O",0.8em#,cap#,0); "The letter O";
penpos1(thick,10); penpos2(.1[thin,thick],90-10);
penpos3(thick,180+10); penpos4(thin,270-10);
x1l=w-x3l=curve_sidebar; x2=x4=.5w;
y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
penstroke z1e{down}..z2e{right}
..z3e{up}..z4e{left}..cycle;
penlabels(1,2,3,4); endchar;
end
When we run mf io
, letter O
is shown in online display.
The question is how to make online display work in the following logo.mf
: if we don't use mode:=localfont;
, it does not work, and if we use mode:=localfont;
, it does not show online output:
mode:=localfont;
mode_setup;
beginchar ("A", 29mm# , 25mm# , 0); thick# := 2mm#; thin# := 5/4mm#;
define_whole_blacker_pixels(thick , thin);
forsuffixes $ = a, b, c: transform $;
forsuffixes e = l, r: path $e, $'e; numeric t$e; endfor endfor
penpos1(thick, 0); penpos2(thick, 90); penpos3(thick, 180); penpos4(thick, 270);
penpos5(thick, 0); penpos6(thick, 90); penpos7(thick, 180); penpos8(thick, 270);
x2 = x4 = x6 = x8 = .5[x5, x7] = .5w; x1r = w; x3r = 0; x5 - x7 = y6 - y8;
y1 = y3 = y5 = y7 = .5[y6, y8] = .5h; y2r = h; y4r = 0; y6r = .75h;
forsuffixes e = l,r: a.e = b'e = c'e = superellipse(z1e, z2e, z3e, z4e, .75);
a'e = b.e = c.e = superellipse (z5e, z6e, z7e, z8e, .72); endfor
penpos.a1(thin, 0); penpos.a5(whatever, -90); penpos.a9(thin, 180);
x.a1l - x.a9l = 1/3(x5l - x7l); x.a5 = .5w; y.a1 = y.a9; y.a5r = 4/7h;
x.a3l = x.a1l; x.a3r = x.a1r; x.a4r = 1/6[x.a3r, x1l]; x0 = .5w; y0 = .52h;
x.a6l + x.a4l = x.a6r + x.a4r = x.a7l + x.a3l = x.a7r + x.a3r = x.a9 + x.a1 = w;
y.a3r = y.a4r = y.a6r = y.a7r = .2[y2l, y0]; y.a3l = y.a4l = y.a6l = y.a7l = y.a3r - thin;
z.a4l = z.a4r + (thin, 0) rotated(angle(z.a4r - z.a5r) + 90)
+ whatever*(z.a4r - z.a5r); z.a4l - z.a5l = whatever*(z.a4r - z.a5r);
z = a.r intersectionpoint (z0 -- (w, 0)); y.a1 - y.a5 = length(z - z0);
b = identity shifted (0, y0 - y.a1) rotatedaround(z0, 90 - angle(z0 - (w, 0)));
c = b reflectedabout (z2, z4);
for n = 1, 3, 4, 5, 6, 7, 9: forsuffixes e = l,,r: forsuffixes $ = b,c:
z.$[n]e = z.a[n]e transformed $; endfor endfor endfor
forsuffixes e = l, r: forsuffixes $ = a, b, c:
z.$2e = $r intersectionpoint (z.$1e -- z.$3e );
z.$8e = $r intersectionpoint (z.$9e -- z.$7e );
t.$1e = xpart($e intersectiontimes(z.$1l -- z.$3l));
t.$9e = xpart($e intersectiontimes(z.$9l -- z.$7l));
t.$4e = xpart($'e intersectiontimes(z.$5r -- z.$4l));
t.$6e = xpart($'e intersectiontimes(z.$5r -- z.$6l)); endfor endfor
penstroke subpath(t.a9e, t.b6e) of a.e;
penstroke subpath(t.b4e, t.c4e) of b'e;
penstroke subpath(t.c6e, t.a1e + 8) of c'e;
penstroke subpath(t.a6e, t.b9e) of a'e;
penstroke subpath(t.b1e, t.c1e) of b.e;
penstroke subpath(t.c9e, t.a4e + 8) of c.e;
forsuffixes $ = a, b, c: penlabels($1, $2, $3, $4, $5, $6, $7, $8, $9);
penstroke z.$2e -- z.$3e -- z.$4e -- z.$5e -- z.$6e -- z.$7e -- z.$8e; endfor
penlabels(range 0 thru 8); endchar;
end
metafont
add a comment |
Consider io.mf
:
mode_setup;
em#:=10pt#; cap#:=7pt#;
thin#:=1/3pt#; thick#:=5/6pt#;
o#:=1/5pt#;
define_pixels(em,cap);
define_blacker_pixels(thin,thick);
define_corrected_pixels(o);
curve_sidebar=round 1/18em;
beginchar("O",0.8em#,cap#,0); "The letter O";
penpos1(thick,10); penpos2(.1[thin,thick],90-10);
penpos3(thick,180+10); penpos4(thin,270-10);
x1l=w-x3l=curve_sidebar; x2=x4=.5w;
y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
penstroke z1e{down}..z2e{right}
..z3e{up}..z4e{left}..cycle;
penlabels(1,2,3,4); endchar;
end
When we run mf io
, letter O
is shown in online display.
The question is how to make online display work in the following logo.mf
: if we don't use mode:=localfont;
, it does not work, and if we use mode:=localfont;
, it does not show online output:
mode:=localfont;
mode_setup;
beginchar ("A", 29mm# , 25mm# , 0); thick# := 2mm#; thin# := 5/4mm#;
define_whole_blacker_pixels(thick , thin);
forsuffixes $ = a, b, c: transform $;
forsuffixes e = l, r: path $e, $'e; numeric t$e; endfor endfor
penpos1(thick, 0); penpos2(thick, 90); penpos3(thick, 180); penpos4(thick, 270);
penpos5(thick, 0); penpos6(thick, 90); penpos7(thick, 180); penpos8(thick, 270);
x2 = x4 = x6 = x8 = .5[x5, x7] = .5w; x1r = w; x3r = 0; x5 - x7 = y6 - y8;
y1 = y3 = y5 = y7 = .5[y6, y8] = .5h; y2r = h; y4r = 0; y6r = .75h;
forsuffixes e = l,r: a.e = b'e = c'e = superellipse(z1e, z2e, z3e, z4e, .75);
a'e = b.e = c.e = superellipse (z5e, z6e, z7e, z8e, .72); endfor
penpos.a1(thin, 0); penpos.a5(whatever, -90); penpos.a9(thin, 180);
x.a1l - x.a9l = 1/3(x5l - x7l); x.a5 = .5w; y.a1 = y.a9; y.a5r = 4/7h;
x.a3l = x.a1l; x.a3r = x.a1r; x.a4r = 1/6[x.a3r, x1l]; x0 = .5w; y0 = .52h;
x.a6l + x.a4l = x.a6r + x.a4r = x.a7l + x.a3l = x.a7r + x.a3r = x.a9 + x.a1 = w;
y.a3r = y.a4r = y.a6r = y.a7r = .2[y2l, y0]; y.a3l = y.a4l = y.a6l = y.a7l = y.a3r - thin;
z.a4l = z.a4r + (thin, 0) rotated(angle(z.a4r - z.a5r) + 90)
+ whatever*(z.a4r - z.a5r); z.a4l - z.a5l = whatever*(z.a4r - z.a5r);
z = a.r intersectionpoint (z0 -- (w, 0)); y.a1 - y.a5 = length(z - z0);
b = identity shifted (0, y0 - y.a1) rotatedaround(z0, 90 - angle(z0 - (w, 0)));
c = b reflectedabout (z2, z4);
for n = 1, 3, 4, 5, 6, 7, 9: forsuffixes e = l,,r: forsuffixes $ = b,c:
z.$[n]e = z.a[n]e transformed $; endfor endfor endfor
forsuffixes e = l, r: forsuffixes $ = a, b, c:
z.$2e = $r intersectionpoint (z.$1e -- z.$3e );
z.$8e = $r intersectionpoint (z.$9e -- z.$7e );
t.$1e = xpart($e intersectiontimes(z.$1l -- z.$3l));
t.$9e = xpart($e intersectiontimes(z.$9l -- z.$7l));
t.$4e = xpart($'e intersectiontimes(z.$5r -- z.$4l));
t.$6e = xpart($'e intersectiontimes(z.$5r -- z.$6l)); endfor endfor
penstroke subpath(t.a9e, t.b6e) of a.e;
penstroke subpath(t.b4e, t.c4e) of b'e;
penstroke subpath(t.c6e, t.a1e + 8) of c'e;
penstroke subpath(t.a6e, t.b9e) of a'e;
penstroke subpath(t.b1e, t.c1e) of b.e;
penstroke subpath(t.c9e, t.a4e + 8) of c.e;
forsuffixes $ = a, b, c: penlabels($1, $2, $3, $4, $5, $6, $7, $8, $9);
penstroke z.$2e -- z.$3e -- z.$4e -- z.$5e -- z.$6e -- z.$7e -- z.$8e; endfor
penlabels(range 0 thru 8); endchar;
end
metafont
Consider io.mf
:
mode_setup;
em#:=10pt#; cap#:=7pt#;
thin#:=1/3pt#; thick#:=5/6pt#;
o#:=1/5pt#;
define_pixels(em,cap);
define_blacker_pixels(thin,thick);
define_corrected_pixels(o);
curve_sidebar=round 1/18em;
beginchar("O",0.8em#,cap#,0); "The letter O";
penpos1(thick,10); penpos2(.1[thin,thick],90-10);
penpos3(thick,180+10); penpos4(thin,270-10);
x1l=w-x3l=curve_sidebar; x2=x4=.5w;
y1=.49h; y2l=-o; y3=.51h; y4l=h+o;
penstroke z1e{down}..z2e{right}
..z3e{up}..z4e{left}..cycle;
penlabels(1,2,3,4); endchar;
end
When we run mf io
, letter O
is shown in online display.
The question is how to make online display work in the following logo.mf
: if we don't use mode:=localfont;
, it does not work, and if we use mode:=localfont;
, it does not show online output:
mode:=localfont;
mode_setup;
beginchar ("A", 29mm# , 25mm# , 0); thick# := 2mm#; thin# := 5/4mm#;
define_whole_blacker_pixels(thick , thin);
forsuffixes $ = a, b, c: transform $;
forsuffixes e = l, r: path $e, $'e; numeric t$e; endfor endfor
penpos1(thick, 0); penpos2(thick, 90); penpos3(thick, 180); penpos4(thick, 270);
penpos5(thick, 0); penpos6(thick, 90); penpos7(thick, 180); penpos8(thick, 270);
x2 = x4 = x6 = x8 = .5[x5, x7] = .5w; x1r = w; x3r = 0; x5 - x7 = y6 - y8;
y1 = y3 = y5 = y7 = .5[y6, y8] = .5h; y2r = h; y4r = 0; y6r = .75h;
forsuffixes e = l,r: a.e = b'e = c'e = superellipse(z1e, z2e, z3e, z4e, .75);
a'e = b.e = c.e = superellipse (z5e, z6e, z7e, z8e, .72); endfor
penpos.a1(thin, 0); penpos.a5(whatever, -90); penpos.a9(thin, 180);
x.a1l - x.a9l = 1/3(x5l - x7l); x.a5 = .5w; y.a1 = y.a9; y.a5r = 4/7h;
x.a3l = x.a1l; x.a3r = x.a1r; x.a4r = 1/6[x.a3r, x1l]; x0 = .5w; y0 = .52h;
x.a6l + x.a4l = x.a6r + x.a4r = x.a7l + x.a3l = x.a7r + x.a3r = x.a9 + x.a1 = w;
y.a3r = y.a4r = y.a6r = y.a7r = .2[y2l, y0]; y.a3l = y.a4l = y.a6l = y.a7l = y.a3r - thin;
z.a4l = z.a4r + (thin, 0) rotated(angle(z.a4r - z.a5r) + 90)
+ whatever*(z.a4r - z.a5r); z.a4l - z.a5l = whatever*(z.a4r - z.a5r);
z = a.r intersectionpoint (z0 -- (w, 0)); y.a1 - y.a5 = length(z - z0);
b = identity shifted (0, y0 - y.a1) rotatedaround(z0, 90 - angle(z0 - (w, 0)));
c = b reflectedabout (z2, z4);
for n = 1, 3, 4, 5, 6, 7, 9: forsuffixes e = l,,r: forsuffixes $ = b,c:
z.$[n]e = z.a[n]e transformed $; endfor endfor endfor
forsuffixes e = l, r: forsuffixes $ = a, b, c:
z.$2e = $r intersectionpoint (z.$1e -- z.$3e );
z.$8e = $r intersectionpoint (z.$9e -- z.$7e );
t.$1e = xpart($e intersectiontimes(z.$1l -- z.$3l));
t.$9e = xpart($e intersectiontimes(z.$9l -- z.$7l));
t.$4e = xpart($'e intersectiontimes(z.$5r -- z.$4l));
t.$6e = xpart($'e intersectiontimes(z.$5r -- z.$6l)); endfor endfor
penstroke subpath(t.a9e, t.b6e) of a.e;
penstroke subpath(t.b4e, t.c4e) of b'e;
penstroke subpath(t.c6e, t.a1e + 8) of c'e;
penstroke subpath(t.a6e, t.b9e) of a'e;
penstroke subpath(t.b1e, t.c1e) of b.e;
penstroke subpath(t.c9e, t.a4e + 8) of c.e;
forsuffixes $ = a, b, c: penlabels($1, $2, $3, $4, $5, $6, $7, $8, $9);
penstroke z.$2e -- z.$3e -- z.$4e -- z.$5e -- z.$6e -- z.$7e -- z.$8e; endfor
penlabels(range 0 thru 8); endchar;
end
metafont
metafont
asked 13 mins ago
Igor Liferenko
2,098729
2,098729
add a comment |
add a comment |
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f467472%2fmetafont-how-to-set-sharp-dimensions-and-use-online-display%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f467472%2fmetafont-how-to-set-sharp-dimensions-and-use-online-display%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown