Difference between revisions of "textext positioning"
Jump to navigation
Jump to search
(Created page with "<context source="yes"> \define[1]\MyFont{\definedfont[#1]\ignorespaces} \starttext \startMPpage draw (0cm,0cm)--(20cm,0cm)--(20cm,20cm)--(0cm,20cm)--cycle withpen penci...") |
|||
(28 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | Note: | |
+ | * With MkIV, be careful to use {{code|textext.dflt}} which means DeFauLT. | ||
+ | * With LMTX, be careful to use {{code|textext.dlft}}) for LeFT, like {{code|textext.ulft}}) and {{code|textext.llft}}) | ||
+ | ** ({{code|textext.dflt}} does not work with LMTX). | ||
− | + | <context source="yes" mode="lmtx" > | |
− | |||
\starttext | \starttext | ||
+ | |||
+ | \setupMPinstance | ||
+ | [metafun] | ||
+ | [textstyle={\definedfont[name:dejavusans*default at 15pt]\ignorespaces}] | ||
\startMPpage | \startMPpage | ||
− | draw (0cm,0cm)--( | + | string MonTexte ; |
+ | MonTexte := "Aujourd'hui"; | ||
+ | |||
+ | draw (0cm,0cm)--(15cm,0cm)--(15cm,15cm)--(0cm,15cm)--cycle | ||
withpen pencircle | withpen pencircle | ||
scaled 0.5mm | scaled 0.5mm | ||
withcolor red; | withcolor red; | ||
+ | |||
+ | pair decal ; decal := (0.0cm,-1.8cm) ; | ||
%------------------------------------------------------------------------------ | %------------------------------------------------------------------------------ | ||
− | pair PA ; PA := ( | + | pair PA ; PA := (7.5cm,13.5cm) ; |
− | draw textext.urt(" | + | draw textext.urt ("URT-" & MonTexte) shifted PA; |
− | draw textext.ulft(" | + | draw textext.ulft("ULFT-" & MonTexte) shifted PA; |
− | + | draw textext.llft("LLFT-" & MonTexte) shifted PA; | |
− | draw textext.llft(" | + | draw textext.lrt ("LRT-" & MonTexte) shifted PA; |
− | draw textext.lrt(" | ||
draw PA withpen pencircle scaled 1.5mm withcolor red; | draw PA withpen pencircle scaled 1.5mm withcolor red; | ||
Line 26: | Line 36: | ||
%------------------------------------------------------------------------------ | %------------------------------------------------------------------------------ | ||
− | pair PB ; PB := PA shifted | + | pair PB ; PB := PA shifted decal ; |
− | draw textext.drt(" | + | draw textext.drt ("DRT-" & MonTexte) shifted PB; |
− | draw textext.dlft(" | + | draw textext.dlft("DLFT-" & MonTexte) shifted PB; |
draw PB withpen pencircle scaled 1.5mm withcolor red; | draw PB withpen pencircle scaled 1.5mm withcolor red; | ||
Line 35: | Line 45: | ||
%------------------------------------------------------------------------------ | %------------------------------------------------------------------------------ | ||
− | pair PC ; PC := PB shifted | + | pair PC ; PC := PB shifted decal ; |
− | draw textext.d(" | + | draw textext.d("D-" & MonTexte) shifted PC; |
− | |||
draw PC withpen pencircle scaled 1.5mm withcolor red; | draw PC withpen pencircle scaled 1.5mm withcolor red; | ||
Line 44: | Line 53: | ||
%------------------------------------------------------------------------------ | %------------------------------------------------------------------------------ | ||
− | pair PD ; PD := PC shifted | + | pair PD ; PD := PC shifted decal ; |
− | draw textext.bot(" | + | draw textext.bot("BOT-" & MonTexte) shifted PD; |
− | draw textext.top(" | + | draw textext.top("TOP-" & MonTexte) shifted PD; |
draw PD withpen pencircle scaled 1.5mm withcolor red; | draw PD withpen pencircle scaled 1.5mm withcolor red; | ||
Line 53: | Line 62: | ||
%------------------------------------------------------------------------------ | %------------------------------------------------------------------------------ | ||
− | pair PE ; PE := PD shifted | + | pair PE ; PE := PD shifted decal ; |
− | draw textext.lft(" | + | draw textext.lft("LFT-" & MonTexte) shifted PE; |
− | draw textext.rt(" | + | draw textext.rt("RT-" & MonTexte) shifted PE; |
draw PE withpen pencircle scaled 1.5mm withcolor red; | draw PE withpen pencircle scaled 1.5mm withcolor red; | ||
Line 62: | Line 71: | ||
%------------------------------------------------------------------------------ | %------------------------------------------------------------------------------ | ||
− | pair PF ; PF := PE shifted | + | pair PF ; PF := PE shifted decal ; |
− | draw textext( | + | draw textext(MonTexte) shifted PF; |
draw PF withpen pencircle scaled 1.5mm withcolor red; | draw PF withpen pencircle scaled 1.5mm withcolor red; | ||
Line 70: | Line 79: | ||
%------------------------------------------------------------------------------ | %------------------------------------------------------------------------------ | ||
− | pair PG ; PG := PF shifted | + | pair PG ; PG := PF shifted decal ; |
− | draw textext.origin(" | + | draw textext.origin("ORIGIN-" & MonTexte) shifted PG; |
draw PG withpen pencircle scaled 1.5mm withcolor red; | draw PG withpen pencircle scaled 1.5mm withcolor red; | ||
Line 78: | Line 87: | ||
%------------------------------------------------------------------------------ | %------------------------------------------------------------------------------ | ||
− | pair PH ; PH := PG shifted | + | pair PH ; PH := PG shifted decal ; |
− | draw textext.raw(" | + | draw textext.raw("RAW-" & MonTexte) shifted PH; |
draw PH withpen pencircle scaled 1.5mm withcolor red; | draw PH withpen pencircle scaled 1.5mm withcolor red; | ||
Line 89: | Line 98: | ||
\stoptext | \stoptext | ||
− | |||
</context> | </context> |
Latest revision as of 14:06, 27 April 2024
Note:
- With MkIV, be careful to use
textext.dflt
which means DeFauLT. - With LMTX, be careful to use
textext.dlft
) for LeFT, liketextext.ulft
) andtextext.llft
)- (
textext.dflt
does not work with LMTX).
- (
\starttext \setupMPinstance [metafun] [textstyle={\definedfont[name:dejavusans*default at 15pt]\ignorespaces}] \startMPpage string MonTexte ; MonTexte := "Aujourd'hui"; draw (0cm,0cm)--(15cm,0cm)--(15cm,15cm)--(0cm,15cm)--cycle withpen pencircle scaled 0.5mm withcolor red; pair decal ; decal := (0.0cm,-1.8cm) ; %------------------------------------------------------------------------------ pair PA ; PA := (7.5cm,13.5cm) ; draw textext.urt ("URT-" & MonTexte) shifted PA; draw textext.ulft("ULFT-" & MonTexte) shifted PA; draw textext.llft("LLFT-" & MonTexte) shifted PA; draw textext.lrt ("LRT-" & MonTexte) shifted PA; draw PA withpen pencircle scaled 1.5mm withcolor red; %------------------------------------------------------------------------------ pair PB ; PB := PA shifted decal ; draw textext.drt ("DRT-" & MonTexte) shifted PB; draw textext.dlft("DLFT-" & MonTexte) shifted PB; draw PB withpen pencircle scaled 1.5mm withcolor red; %------------------------------------------------------------------------------ pair PC ; PC := PB shifted decal ; draw textext.d("D-" & MonTexte) shifted PC; draw PC withpen pencircle scaled 1.5mm withcolor red; %------------------------------------------------------------------------------ pair PD ; PD := PC shifted decal ; draw textext.bot("BOT-" & MonTexte) shifted PD; draw textext.top("TOP-" & MonTexte) shifted PD; draw PD withpen pencircle scaled 1.5mm withcolor red; %------------------------------------------------------------------------------ pair PE ; PE := PD shifted decal ; draw textext.lft("LFT-" & MonTexte) shifted PE; draw textext.rt("RT-" & MonTexte) shifted PE; draw PE withpen pencircle scaled 1.5mm withcolor red; %------------------------------------------------------------------------------ pair PF ; PF := PE shifted decal ; draw textext(MonTexte) shifted PF; draw PF withpen pencircle scaled 1.5mm withcolor red; %------------------------------------------------------------------------------ pair PG ; PG := PF shifted decal ; draw textext.origin("ORIGIN-" & MonTexte) shifted PG; draw PG withpen pencircle scaled 1.5mm withcolor red; %------------------------------------------------------------------------------ pair PH ; PH := PG shifted decal ; draw textext.raw("RAW-" & MonTexte) shifted PH; draw PH withpen pencircle scaled 1.5mm withcolor red; %------------------------------------------------------------------------------ \stopMPpage \stoptext