summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost/context
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2009-08-23 11:11:32 +0000
committerTaco Hoekwater <taco@elvenkind.com>2009-08-23 11:11:32 +0000
commit8fc3039c82d48605b5ca8b2eda3f4fdd755681e1 (patch)
tree3cd9bbdd599bc4d1ac0409e167fee2136e4c0ec9 /Master/texmf-dist/metapost/context
parent850fc99b7cd3ae7a20065531fe866ff7bae642ec (diff)
this is context 2009.08.19 17:10
git-svn-id: svn://tug.org/texlive/trunk@14827 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost/context')
-rw-r--r--Master/texmf-dist/metapost/context/base/metafun.mp2
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-base.mp5
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-char.mp8
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-chem.mp729
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-core.mp202
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-grph.mp6
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-mlib.mp152
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-page.mp2
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-spec.mp10
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-text.mp20
-rw-r--r--Master/texmf-dist/metapost/context/base/mp-tool.mp137
-rw-r--r--Master/texmf-dist/metapost/context/font/punkfont.mp854
12 files changed, 1968 insertions, 159 deletions
diff --git a/Master/texmf-dist/metapost/context/base/metafun.mp b/Master/texmf-dist/metapost/context/base/metafun.mp
index b828b8b9ebb..00011c8be51 100644
--- a/Master/texmf-dist/metapost/context/base/metafun.mp
+++ b/Master/texmf-dist/metapost/context/base/metafun.mp
@@ -49,6 +49,8 @@ input mp-figs.mp ;
input mp-mlib.mp ;
+if known context_mlib : input mp-chem.mp ; fi ; % only when mkiv
+
% mp-form.mp ;
input mp-grid.mp ;
input mp-func.mp ;
diff --git a/Master/texmf-dist/metapost/context/base/mp-base.mp b/Master/texmf-dist/metapost/context/base/mp-base.mp
index 41eb7aa96a5..d0b3991c856 100644
--- a/Master/texmf-dist/metapost/context/base/mp-base.mp
+++ b/Master/texmf-dist/metapost/context/base/mp-base.mp
@@ -521,7 +521,7 @@ tertiarydef m thru n =
%% Overall adminstration
string extra_beginfig, extra_endfig;
-extra_beginfig = extra_endfig = "";
+extra_beginfig = extra_endfig = "" ;
def beginfig(expr c) =
begingroup
@@ -533,8 +533,9 @@ def beginfig(expr c) =
enddef;
def endfig =
+ ; % added by HH
scantokens extra_endfig;
- shipit;
+ shipit ;
endgroup
enddef;
diff --git a/Master/texmf-dist/metapost/context/base/mp-char.mp b/Master/texmf-dist/metapost/context/base/mp-char.mp
index cd774d50962..786c1f904d2 100644
--- a/Master/texmf-dist/metapost/context/base/mp-char.mp
+++ b/Master/texmf-dist/metapost/context/base/mp-char.mp
@@ -28,7 +28,7 @@ def save_text_position (expr p) = % beware: clip shift needed
savedata
"\MPposition{" & decimal current_position & "}{"
& decimal xpart p & "}{"
- & decimal ypart p & "}" ;
+ & decimal ypart p & "}%" ;
enddef ;
%D settings
@@ -900,6 +900,7 @@ def begin_chart (expr n, maxx, maxy) =
chart_figure := n ;
chart_scale := 1 ;
if chart_figure>0: beginfig(chart_figure) ; fi ;
+ startsavingdata ;
initialize_grid (maxx, maxy) ;
bboxmargin := 0 ;
cmin_x := 1 ;
@@ -932,14 +933,15 @@ def end_chart =
decimal xpart llcorner p & "}{" &
decimal ypart llcorner p & "}{" &
decimal xpart urcorner p & "}{" &
- decimal ypart urcorner p & "}" ;
+ decimal ypart urcorner p & "}%" ;
savedata
"\MPareapath{" &
decimal (xpart llcorner p + 2chart_offset) & "}{" &
decimal (ypart llcorner p + 2chart_offset) & "}{" &
decimal (xpart urcorner p - 2chart_offset) & "}{" &
- decimal (ypart urcorner p - 2chart_offset) & "}" ;
+ decimal (ypart urcorner p - 2chart_offset) & "}%" ;
currentpicture := currentpicture scaled chart_scale ;
+ stopsavingdata ;
if chart_figure>0: endfig ; fi ;
enddef ;
diff --git a/Master/texmf-dist/metapost/context/base/mp-chem.mp b/Master/texmf-dist/metapost/context/base/mp-chem.mp
new file mode 100644
index 00000000000..1a5be841633
--- /dev/null
+++ b/Master/texmf-dist/metapost/context/base/mp-chem.mp
@@ -0,0 +1,729 @@
+%D \module
+%D [ file=mp-chem.mp,
+%D version=2009.05.13,
+%D title=\CONTEXT\ \METAPOST\ graphics,
+%D subtitle=chemicals,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright=\PRAGMA]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
+%C details.
+
+%D This module in incomplete and experimental.
+
+% either consistent setting or not
+
+if known chem_reset : endinput ; fi ;
+
+numeric
+ chem_width, chem_radical_min, chem_radical_max, chem_text_max, chem_circle_radius,
+ chem_rotation, chem_adjacent, chem_stack, chem_substituent, chem_direction, chem_setting_scale,
+ chem_setting_offset, chem_text_offset, chem_picture_offset, chem_center_offset, chem_substituent_offset,
+ chem_setting_l, chem_setting_r, chem_setting_t, chem_setting_b ;
+
+boolean
+ chem_setting_axis,
+ chem_setting_fixedwidth, chem_setting_fixedheight,
+ chem_doing_pb, chem_text_trace ;
+
+path
+ chem_setting_bbox ;
+
+pair
+ chem_shift,
+ chem_adjacent_p, chem_substituent_p, chem_direction_p, chem_move_p ;
+
+numeric
+ chem_width[], chem_angle[], chem_start[], chem_initialrot[], chem_initialmov[] ;
+
+pair
+ chem_stack_d[],
+ chem_b_zero[], chem_n_zero[],
+ chem_r_max[], chem_r_min[],
+ chem_r_zero[], chem_mr_zero[], chem_pr_zero[], chem_crz_zero[],
+ chem_rt_zero[], chem_rtt_zero[], chem_rbt_zero[],
+ chem_mid_zero[] ;
+
+path
+ chem_b_path[], chem_bx_path[], chem_eb_path[], chem_sr_path[], chem_br_path[],
+ chem_sb_path[], chem_msb_path[], chem_psb_path[],
+ chem_s_path[], chem_ss_path[], chem_mss_path[], chem_pss_path[],
+ chem_e_path[], chem_sd_path[], chem_bb_path[], chem_oe_path[],
+ chem_ddt_path[], chem_ddb_path[], chem_ldt_path[], chem_ldb_path[], chem_rdt_path[], chem_rdb_path[],
+ chem_dbl_path[], chem_dbr_path[],
+ chem_ad_path[], chem_au_path[],
+ chem_r_path[], chem_rl_path[], chem_rr_path[],
+ chem_rb_path[], chem_prb_path[], chem_mrb_path[],
+ chem_srl_path[], chem_srr_path[],
+ chem_msr_path[], chem_psr_path[],
+ chem_mr_path[], chem_pr_path[],
+ chem_c_path[], chem_cc_path[],
+ chem_midt_path[], chem_midb_path[], chem_midst_path[], chem_midsb_path[] ;
+
+chem_setting_scale := 1 ;
+chem_base_width := 40pt ;
+chem_text_offset := 3pt ;
+chem_center_offset := 6pt ;
+chem_picture_offset := 10pt ;
+chem_substituent_offset := 10pt ;
+chem_radical_min := 1.25 ;
+chem_radical_max := 1.50 ;
+chem_text_min := 0.75 ;
+chem_text_max := 1.75 ;
+chem_circle_radius := 0.80 ;
+chem_rotation := 1 ;
+chem_adjacent := 0 ;
+chem_substituent := 0 ;
+chem_direction := 0 ;
+chem_stack_n := 0 ;
+chem_doing_pb := false ;
+chem_shift := origin ;
+chem_dot_factor := 4 ;
+chem_text_trace := false ;
+
+vardef chem_start_structure(expr n, l, r, t, b, scale, axis, fixedwidth, fixedheight, offset) =
+ chem_setting_axis := axis ;
+ chem_setting_l := l * scale ;
+ chem_setting_r := r * scale ;
+ chem_setting_t := t * scale ;
+ chem_setting_b := b * scale ;
+ chem_setting_fixedwidth := fixedwidth ;
+ chem_setting_fixedheight := fixedheight ;
+ chem_setting_offset := offset ;
+ if scale <> chem_setting_scale :
+ chem_setting_scale := scale ;
+ chem_init_all ;
+ fi ;
+ chem_rotation := 1 ;
+ chem_adjacent := 0 ;
+ chem_substituent := 0 ;
+ chem_direction := 0 ;
+ chem_stack_n := 0 ;
+ chem_doing_pb := false ;
+ chem_shift := origin ;
+enddef ;
+
+def chem_stop_structure =
+ currentpicture := currentpicture shifted - chem_shift ;
+ % axis here
+ if chem_setting_fixedwidth :
+ chem_setting_l := - xpart llcorner currentpicture ;
+ chem_setting_r := xpart urcorner currentpicture ;
+ fi ;
+ if chem_setting_fixedheight :
+ chem_setting_t := ypart urcorner currentpicture ;
+ chem_setting_b := - ypart llcorner currentpicture ;
+ fi ;
+ chem_setting_bbox :=
+ (-chem_setting_l,-chem_setting_b) -- ( chem_setting_r,-chem_setting_b) --
+ ( chem_setting_r, chem_setting_t) -- (-chem_setting_l, chem_setting_t) -- cycle ;
+ % maybe put it behind the picture
+ if chem_setting_axis :
+ save stp ; stp := chem_base_width/ 2 * chem_setting_scale ;
+ save siz ; siz := chem_base_width/10 * chem_setting_scale ;
+ draw (-chem_setting_l,0) -- (chem_setting_r,0) withcolor blue ;
+ draw (0,-chem_setting_b) -- (0,chem_setting_t) withcolor blue ;
+ for i = 0 step stp until chem_setting_r : draw (i,-siz) -- (i,siz) withcolor blue ; endfor ;
+ for i = 0 step -stp until -chem_setting_l : draw (i,-siz) -- (i,siz) withcolor blue ; endfor ;
+ for i = 0 step stp until chem_setting_t : draw (-siz,i) -- (siz,i) withcolor blue ; endfor ;
+ for i = 0 step -stp until -chem_setting_b : draw (-siz,i) -- (siz,i) withcolor blue ; endfor ;
+ draw chem_setting_bbox withcolor blue ;
+ fi ;
+ setbounds currentpicture to chem_setting_bbox ;
+enddef ;
+
+def chem_start_component =
+enddef ;
+def chem_stop_component =
+enddef ;
+
+def chem_pb =
+% draw boundingbox currentpicture withpen pencircle scaled 1mm withcolor blue ;
+% draw origin withpen pencircle scaled 2mm withcolor blue ;
+ chem_doing_pb := true ;
+enddef ;
+def chem_pe =
+% draw boundingbox currentpicture withpen pencircle scaled .5mm withcolor red ;
+% draw origin withpen pencircle scaled 1mm withcolor red ;
+ currentpicture := currentpicture shifted - chem_shift ;
+% draw origin withpen pencircle scaled .5mm withcolor green ;
+ chem_shift := origin ;
+ chem_doing_pb := false ;
+enddef ;
+
+vardef chem_do (expr p) =
+ if chem_doing_pb :
+ chem_doing_pb := false ;
+% save pp ; pair pp ; pp := point 1 of ((origin -- p) enlonged chem_picture_offset) ;
+% currentpicture := currentpicture shifted - pp ;
+% chem_shift := chem_shift - center pp ;
+ currentpicture := currentpicture shifted - p ;
+ chem_shift := chem_shift - p ;
+ origin % nullpicture
+ else :
+ p
+ fi
+enddef ;
+
+vardef chem_b (expr n, f, t, r, c) =
+ chem_draw (n, chem_b_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_sb (expr n, f, t, r, c) =
+ chem_draw (n, chem_sb_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_s (expr n, f, t, r, c) =
+ chem_draw (n, chem_s_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_ss (expr n, f, t, r, c) =
+ chem_draw (n, chem_ss_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_mid (expr n, r, c) =
+ chem_draw_fixed (n, chem_midt_path[n], r, c) ;
+ chem_draw_fixed (n, chem_midb_path[n], r, c) ;
+enddef ;
+vardef chem_mids (expr n, r, c) =
+ chem_draw_fixed (n, chem_midst_path[n], r, c) ;
+ chem_draw_fixed (n, chem_midsb_path[n], r, c) ;
+enddef ;
+vardef chem_mss (expr n, f, t, r, c) =
+ chem_draw (n, chem_mss_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_pss (expr n, f, t, r, c) =
+ chem_draw (n, chem_pss_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_msb (expr n, f, t, r, c) =
+ chem_draw (n, chem_msb_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_psb (expr n, f, t, r, c) =
+ chem_draw (n, chem_psb_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_eb (expr n, f, t, r, c) =
+ chem_draw (n, chem_eb_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_db (expr n, f, t, r, c) =
+ if n = 1 :
+ chem_draw (n, chem_msb_path [n], f, t, r, c) ;
+ chem_draw (n, chem_psb_path [n], f, t, r, c) ;
+ else :
+ chem_draw (n, chem_dbl_path [n], f, t, r, c) ;
+ chem_draw (n, chem_dbr_path [n], f, t, r, c) ;
+ fi ;
+enddef ;
+vardef chem_er (expr n, f, t, r, c) =
+ chem_draw (n, chem_rl_path[n], f, t, r, c) ;
+ chem_draw (n, chem_rr_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_dr (expr n, f, t, r, c) =
+ chem_draw (n, chem_srl_path[n], f, t, r, c) ;
+ chem_draw (n, chem_srr_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_ad (expr n, f, t, r, c) =
+ chem_draw_arrow(n, chem_ad_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_au (expr n, f, t, r, c) =
+ chem_draw_arrow(n, chem_au_path[n], f, t, r, c)
+enddef ;
+vardef chem_r (expr n, f, t, r, c) =
+ if n < 0 :
+ chem_draw_vertical (n, chem_r_path[n], f, t, r, c) ;
+ else :
+ chem_draw (n, chem_r_path[n], f, t, r, c) ;
+ fi ;
+enddef ;
+vardef chem_rd (expr n, f, t, r, c) =
+ chem_dashed_normal (n, chem_r_path[n], f, t, r, c)
+enddef ;
+vardef chem_mrd (expr n, f, t, r, c) =
+ chem_dashed_normal (n, chem_mr_path[n], f, t, r, c)
+enddef ;
+vardef chem_prd (expr n, f, t, r, c) =
+ chem_dashed_normal (n, chem_pr_path[n], f, t, r, c)
+enddef ;
+vardef chem_br (expr n, f, t, r, c) =
+ chem_fill (n, chem_br_path[n], f, t, r, c )
+enddef ;
+vardef chem_rb (expr n, f, t, r, c) =
+ chem_fill (n, chem_rb_path[n], f, t, r, c)
+enddef ;
+vardef chem_mrb (expr n, f, t, r, c) =
+ chem_fill (n, chem_mrb_path[n], f, t, r, c)
+enddef ;
+vardef chem_prb (expr n, f, t, r, c) =
+ chem_fill (n, chem_prb_path[n], f, t, r, c)
+enddef ;
+vardef chem_mr (expr n, f, t, r, c) =
+ if n < 0 :
+ chem_draw_vertical(n, chem_mr_path[n], f, t, r, c)
+ else :
+ chem_draw (n, chem_mr_path[n], f, t, r, c)
+ fi
+enddef ;
+vardef chem_pr (expr n, f, t, r, c) =
+ if n < 0 :
+ chem_draw_vertical(n, chem_pr_path[n], f, t, r, c)
+ else :
+ chem_draw (n, chem_pr_path[n], f, t, r, c)
+ fi
+enddef ;
+vardef chem_sr (expr n, f, t, r, c) =
+ chem_draw (n, chem_sr_path[n], f, t, r, c)
+enddef ;
+vardef chem_msr (expr n, f, t, r, c) =
+ chem_draw (n, chem_msr_path[n], f, t, r, c)
+enddef ;
+vardef chem_psr (expr n, f, t, r, c) =
+ chem_draw (n, chem_psr_path[n], f, t, r, c)
+enddef ;
+vardef chem_c (expr n, f, t, r, c) =
+ chem_draw (n, chem_c_path[n], f, t, r, c)
+enddef ;
+vardef chem_cc (expr n, f, t, r, c) =
+ chem_draw (n, chem_cc_path[n], f, f, r, c)
+enddef ;
+vardef chem_cd (expr n, f, t, r, c) =
+ chem_dashed_connected (n, chem_c_path[n], f, t, r, c)
+enddef ;
+vardef chem_ccd (expr n, f, t, r, c) =
+ chem_dashed_normal (n, chem_cc_path[n], f, f, r, c)
+enddef ;
+vardef chem_rn (expr n, i, t) =
+ chem_rt (n,i,t) ;
+enddef ;
+vardef chem_rtn (expr n, i, t) =
+ chem_rtt(n,i,t) ;
+enddef ;
+vardef chem_rbn (expr n, i, t) =
+ chem_rbt(n,i,t) ;
+enddef ;
+vardef chem_tb (expr n, f, t, r, c) = % one
+ chem_draw (n, chem_msb_path[n], f, t, r, c) ;
+ chem_draw (n, chem_sb_path [n], f, t, r, c) ;
+ chem_draw (n, chem_psb_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_ep (expr n, f, t, r, c) = % one
+ chem_draw (n, chem_e_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_es (expr n, f, t, r, c) = % one
+ chem_draw_dot (n, center chem_e_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_ed (expr n, f, t, r, c) = % one
+ chem_draw_dot (n, point 0 of chem_e_path[n], f, t, r, c) ;
+ chem_draw_dot (n, point 1 of chem_e_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_et (expr n, f, t, r, c) = % one
+ chem_draw_dot (n, point 0 of chem_e_path[n], f, t, r, c) ;
+ chem_draw_dot (n, center chem_e_path[n], f, t, r, c) ;
+ chem_draw_dot (n, point 1 of chem_e_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_sd (expr n, f, t, r, c) = % one
+ chem_draw (n, chem_ddt_path[n], f, t, r, c) ;
+ chem_draw (n, chem_ddb_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_rdd (expr n, f, t, r, c) = % one
+ chem_draw (n, chem_ldt_path[n], f, t, r, c) ;
+ chem_draw (n, chem_ldb_path[n], f, t, r, c) ;
+ chem_draw (n, chem_psb_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_ldd (expr n, f, t, r, c) = % one
+ chem_draw (n, chem_msb_path[n], f, t, r, c) ;
+ chem_draw (n, chem_rdt_path[n], f, t, r, c) ;
+ chem_draw (n, chem_rdb_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_hb (expr n, f, t, r, c) = % one
+ chem_draw_dot (n, point 0 of chem_sb_path[n], f, t, r, c) ;
+ chem_draw_dot (n, center chem_sb_path[n], f, t, r, c) ;
+ chem_draw_dot (n, point 1 of chem_sb_path[n], f, t, r, c) ;
+enddef ;
+vardef chem_bb (expr n, f, t, r, c) = % one
+ if n < 0 :
+ chem_fill (n, chem_bb_path[n], 1, 1, r, c) ;
+ chem_b (n, f, t, r, c) ;
+ else :
+ chem_fill (n, chem_bb_path[n], f, t, r, c) ;
+ fi ;
+enddef ;
+vardef chem_oe (expr n, f, t, r, c) = % one
+ chem_draw (n, chem_oe_path[n], f, t, r, c) ;
+enddef ;
+
+vardef chem_z_zero@#(text t) =
+ chem_text@#(t, chem_do(origin)) ;
+enddef ;
+vardef chem_cz_zero@#(text t) =
+ chem_text@#(t, chem_do(origin)) ;
+enddef ;
+vardef chem_z@#(expr n, p) (text t) =
+ if p = 0 :
+ chem_text@#(t, chem_do(origin)) ;
+ else :
+ chem_text@#(t, chem_do(chem_b_zero[n] rotated chem_ang(n,p))) ;
+ fi ;
+enddef ;
+vardef chem_cz@#(expr n, p) (text t) =
+ if n = 1 :
+ chem_c_text(t, chem_do(chem_crz_zero[n] rotated chem_ang(n,p))) ;
+ else :
+ chem_text@#(t, chem_do(chem_b_zero[n] rotated chem_ang(n,p))) ;
+ fi ;
+enddef ;
+vardef chem_midz@#(expr n, p) (text t) =
+ chem_text@#(t, chem_do(chem_mid_zero[n] rotated chem_ang(n,p))) ;
+enddef ;
+vardef chem_rz@#(expr n, p) (text t) =
+ if n < 0 :
+ % quite special
+ chem_text@#(t, chem_do(chem_r_zero[n] shifted (chem_b_zero[n] rotated chem_ang(n,p)))) ;
+ else :
+ chem_text@#(t, chem_do(chem_r_zero[n] rotated chem_ang(n,p))) ;
+ fi ;
+enddef ;
+vardef chem_crz@#(expr n, p) (text tx) =
+ chem_text(tx, chem_do(chem_crz_zero[n] rotated chem_ang(n,p))) ;
+enddef ;
+vardef chem_mrz@#(expr n, p) (text t) =
+ if n < 0 :
+ % quite special
+ chem_text@#(t, chem_do(chem_mr_zero[n] shifted (chem_b_zero[n] rotated chem_ang(n,p)))) ;
+ else :
+ chem_text@#(t, chem_do(chem_mr_zero[n] rotated chem_ang(n,p))) ;
+ fi ;
+enddef ;
+vardef chem_prz@#(expr n, p) (text t) =
+ if n < 0 :
+ % quite special
+ chem_text@#(t, chem_do(chem_pr_zero[n] shifted (chem_b_zero[n] rotated chem_ang(n,p)))) ;
+ else :
+ chem_text@#(t, chem_do(chem_pr_zero[n] rotated chem_ang(n,p))) ;
+ fi ;
+enddef ;
+vardef chem_rt@#(expr n, p) (text t) =
+ chem_text@#(t, chem_do(chem_rt_zero[n] rotated chem_ang(n,p))) ;
+enddef ;
+vardef chem_rtt@#(expr n, p) (text t) =
+ chem_text@#(t, chem_do(chem_rtt_zero[n] rotated chem_ang(n,p))) ;
+enddef ;
+vardef chem_rbt@#(expr n, p) (text t) =
+ chem_text@#(t, chem_do(chem_rbt_zero[n] rotated chem_ang(n,p))) ;
+enddef ;
+vardef chem_zt@#(expr n, p) (text t) =
+ if n = 1 :
+ chem_text@#(t, chem_do(chem_rt_zero[n] rotated chem_ang(n,p))) ;
+ else :
+ chem_text@#(t, chem_do(chem_n_zero[n] rotated chem_ang(n,p))) ;
+ fi ;
+enddef ;
+vardef chem_zn@#(expr n, p) (text t) =
+ if n = 1 :
+ chem_text@#(t, chem_do(chem_rt_zero[n] rotated chem_ang(n,p))) ;
+ else :
+ chem_text@#(t, chem_do(chem_n_zero[n] rotated chem_ang(n,p))) ;
+ fi ;
+enddef ;
+vardef chem_zbt@#(expr n, p) (text t) =
+ chem_text@#(t, chem_do(chem_rtt_zero[n] rotated chem_ang(n,p))) ;
+enddef ;
+vardef chem_zbn@#(expr n, p) (text t) =
+ chem_text@#(t, chem_do(chem_rtt_zero[n] rotated chem_ang(n,p))) ;
+enddef ;
+vardef chem_ztt@#(expr n, p) (text t) =
+ chem_text@#(t, chem_do(chem_rbt_zero[n] rotated chem_ang(n,p))) ;
+enddef ;
+vardef chem_ztn@#(expr n, p) (text t) =
+ chem_text@#(t, chem_do(chem_rbt_zero[n] rotated chem_ang(n,p))) ;
+enddef ;
+
+vardef chem_symbol(expr t) =
+ draw textext(t) ;
+enddef ;
+
+vardef chem_text@#(expr txt, z) = % adapted copy of thelabel@
+ save p ; picture p ;
+ p := textext(txt) ;
+ p := p
+ if (labtype@# >= 10) : shifted (0,ypart center p) fi
+ shifted (z + chem_text_offset*laboff@# - (labxf@#*lrcorner p + labyf@#*ulcorner p + (1-labxf@#-labyf@#)*llcorner p)) ;
+ if chem_text_trace :
+ draw z withpen pencircle scaled 2pt withcolor red ;
+ draw boundingbox p withpen pencircle scaled 1pt withcolor red ;
+ fi ;
+ draw p
+enddef ;
+
+vardef chem_c_text(expr txt, z) = % adapted copy of thelabel@
+ save p ; picture p ; p := textext(txt) ;
+ save b ; path b ; b := (boundingbox p) shifted z ;
+ save a ; pair a ; a := (origin--z) intersection_point b ;
+ if intersection_found :
+ draw p shifted (z enlonged arclength(a -- center b)) ;
+ else :
+ draw p shifted z ;
+ fi
+% draw b withcolor green ;
+% draw a withcolor red ;
+enddef ;
+
+vardef chem_ang (expr n, d) =
+ ((-1 * (d-1) * chem_angle[n]) + (-chem_rotation+1) * 90 + chem_start[n]) % no ;
+enddef ;
+vardef chem_rot (expr n, d) =
+ chem_rotation := d ;
+enddef ;
+vardef chem_adj (expr n, d) =
+ chem_adjacent := d ;
+enddef ;
+vardef chem_sub (expr n, d) =
+ chem_substituent := d ;
+enddef ;
+vardef chem_dir (expr n, d) =
+ if n = 1 :
+ chem_direction_p := (origin - 2*center(chem_b_path[n] rotated chem_ang(n,d+1))) ;
+ currentpicture := currentpicture shifted chem_direction_p ;
+ chem_shift := chem_shift + chem_direction_p ;
+ fi ;
+enddef ;
+vardef chem_mov (expr n, d) =
+ if d = 0 :
+ currentpicture := currentpicture shifted - chem_shift ;
+ chem_shift := origin ;
+ else :
+ chem_move_p := (origin - 2*center(chem_b_path[n] rotated chem_ang(n,d+chem_initialmov[n]))) ;
+ currentpicture := currentpicture shifted chem_move_p ;
+ chem_shift := chem_shift + chem_move_p ;
+ fi ;
+enddef ;
+vardef chem_off (expr n, d) =
+ if (d = 1) or (d = 2) or (d = 8) : % positive
+ currentpicture := currentpicture shifted (-chem_setting_offset,0) ;
+ chem_shift := chem_shift + (-chem_setting_offset,0)
+ elseif (d = 4) or (d = 5) or (d = 6) : % negative
+ currentpicture := currentpicture shifted ( chem_setting_offset,0) ;
+ chem_shift := chem_shift + ( chem_setting_offset,0)
+ fi ;
+enddef ;
+
+vardef chem_set(expr n, m) =
+ if chem_adjacent > 0 :
+ chem_adjacent_d := xpart chem_b_zero[n] + xpart chem_b_zero[m] ;
+ if chem_adjacent = 1 : chem_adjacent_p := (-chem_adjacent_d, 0) ;
+ elseif chem_adjacent = 2 : chem_adjacent_p := (0, -chem_adjacent_d) ;
+ elseif chem_adjacent = 3 : chem_adjacent_p := ( chem_adjacent_d, 0) ;
+ elseif chem_adjacent = 4 : chem_adjacent_p := (0, chem_adjacent_d) ;
+ else : chem_adjacent_p := origin ;
+ fi ;
+ currentpicture := currentpicture shifted chem_adjacent_p ;
+ chem_shift := chem_shift + chem_adjacent_p ;
+ chem_adjacent := 0 ;
+ fi ;
+ if chem_substituent > 0 :
+ if m = 1 :
+ chem_substituent_d := xpart chem_crz_zero[n] + chem_substituent_offset ;
+ else :
+ chem_substituent_d := xpart chem_crz_zero[n] + xpart chem_b_zero[m] ;
+ fi ;
+ if chem_substituent = 1 : chem_substituent_p := (-chem_substituent_d, 0) ; % - ?
+ elseif chem_substituent = 2 : chem_substituent_p := (0, chem_substituent_d) ;
+ elseif chem_substituent = 3 : chem_substituent_p := ( chem_substituent_d, 0) ;
+ elseif chem_substituent = 4 : chem_substituent_p := (0, -chem_substituent_d) ;
+ else : chem_substituent_p := origin ;
+ fi ;
+ currentpicture := currentpicture shifted chem_substituent_p ;
+ chem_shift := chem_shift + chem_substituent_p ;
+ chem_substituent := 0 ;
+ fi ;
+ chem_rotation := chem_initialrot[m] ;
+enddef ;
+
+vardef chem_draw (expr n, path_fragment, from_point, to_point, linewidth, linecolor) =
+ for i:=from_point upto to_point:
+ draw (path_fragment rotated chem_ang(n,i)) withpen pencircle scaled linewidth withcolor linecolor ;
+ endfor ;
+enddef ;
+vardef chem_fill (expr n, path_fragment, from_point, to_point, linewidth, linecolor) =
+ for i:=from_point upto to_point:
+ fill (path_fragment rotated chem_ang(n,i)) withpen pencircle scaled 0 withcolor linecolor ;
+ endfor ;
+enddef ;
+
+vardef chem_dashed_normal (expr n, path_fragment, from_point, to_point, linewidth, linecolor) =
+ for i:=from_point upto to_point:
+ draw (path_fragment rotated chem_ang(n,i)) withpen pencircle scaled linewidth withcolor linecolor dashed evenly ;
+ endfor ;
+enddef ;
+vardef chem_dashed_connected (expr n, path_fragment, from_point, to_point, linewidth, linecolor) =
+ draw for i:=from_point upto to_point:
+ (path_fragment rotated chem_ang(n,i)) if i < to_point : -- fi
+ endfor withpen pencircle scaled linewidth withcolor linecolor dashed evenly ;
+enddef ;
+vardef chem_draw_dot (expr n, path_fragment, from_point, to_point, linewidth, linecolor) =
+ for i:=from_point upto to_point:
+ draw (path_fragment rotated chem_ang(n,i)) withpen pencircle scaled (chem_dot_factor*linewidth) withcolor linecolor ;
+ endfor ;
+enddef ;
+vardef chem_draw_fixed (expr n, path_fragment, linewidth, linecolor) =
+ draw (path_fragment rotated chem_ang(n,1)) withpen pencircle scaled linewidth withcolor linecolor ;
+enddef ;
+vardef chem_draw_arrow (expr n, path_fragment, from_point, to_point, linewidth, linecolor) =
+ for i:=from_point upto to_point:
+ drawarrow (path_fragment rotated chem_ang(n,i)) withpen pencircle scaled linewidth withcolor linecolor ;
+ endfor ;
+enddef ;
+vardef chem_draw_vertical (expr n, path_fragment, from_point, to_point, linewidth, linecolor) =
+ % quite special
+ for i:=from_point upto to_point:
+ draw (path_fragment shifted (chem_b_zero[n] rotated chem_ang(n,i))) withpen pencircle scaled linewidth withcolor linecolor ;
+ endfor ;
+enddef ;
+
+picture chem_stack_p[] ;
+pair chem_stack_shift[] ;
+
+vardef chem_save =
+ chem_stack_n := chem_stack_n + 1 ;
+ chem_stack_p[chem_stack_n] := currentpicture ;
+ chem_stack_shift[chem_stack_n] := chem_shift ;
+ chem_shift := origin ;
+% chem_adjacent := 0 ;
+% chem_substituent := 0 ;
+% chem_rotation := 1 ;
+ currentpicture := nullpicture ;
+enddef ;
+vardef chem_restore =
+ if chem_stack_n > 0 :
+ currentpicture := currentpicture shifted - chem_shift ;
+ addto chem_stack_p[chem_stack_n] also currentpicture ;
+ currentpicture := chem_stack_p[chem_stack_n] ;
+ chem_stack_p[chem_stack_n] := nullpicture ;
+ chem_shift := chem_stack_shift[chem_stack_n] ;
+ chem_stack_n := chem_stack_n - 1 ;
+ fi ;
+enddef ;
+
+def chem_init_some(expr n, ratio, angle, start, initialrot, initialmov) =
+ chem_width [n] := ratio * chem_base_width * chem_setting_scale ;
+ chem_angle [n] := angle ;
+ chem_start [n] := start ;
+ chem_initialrot[n] := initialrot ;
+ chem_initialmov[n] := initialmov ;
+ chem_b_zero [n] := (chem_width[n],0) rotated (angle/2) ;
+ chem_n_zero [n] := (chem_text_min*chem_width[n],0) rotated (angle/2) ;
+ chem_r_max [n] := chem_radical_max*chem_b_zero[n] ;
+ chem_r_path [n] := chem_b_zero[n] -- chem_r_max[n] ;
+ chem_mr_path [n] := chem_r_path [n] rotatedaround(chem_b_zero[n], (180-angle)/2) ;
+ chem_pr_path [n] := chem_r_path [n] rotatedaround(chem_b_zero[n],-(180-angle)/2) ;
+ chem_r_zero [n] := point 1 of chem_r_path [n] ;
+ chem_mr_zero [n] := point 1 of chem_mr_path[n] ;
+ chem_pr_zero [n] := point 1 of chem_pr_path[n] ;
+ chem_crz_zero [n] := point 1 of (chem_r_path[n] enlonged chem_center_offset) ;
+ chem_au_path [n] := subpath (0.2,0.8) of (chem_r_max[n] -- (chem_r_max[n] rotated angle)) ;
+ chem_ad_path [n] := reverse(chem_au_path[n]) ;
+ chem_rt_zero [n] := (((chem_radical_max+chem_radical_min)/2)*chem_width[n],0) rotated (angle/2) ;
+ chem_rtt_zero [n] := chem_rt_zero[n] rotated + 10 ;
+ chem_rbt_zero [n] := chem_rt_zero[n] rotated - 10 ;
+ chem_b_path [n] := reverse(chem_b_zero[n] -- (chem_b_zero[n] rotated -angle)) ;
+ chem_bx_path [n] := reverse(chem_b_zero[n] -- (chem_b_zero[n] rotated -angle)) ; % ?
+ chem_sb_path [n] := subpath (0.25,0.75) of chem_b_path[n] ;
+ chem_s_path [n] := point 0 of chem_b_path[n] -- point 0 of (chem_b_path[n] rotated (2angle)) ;
+ chem_ss_path [n] := subpath (0.25,0.75) of (chem_s_path[n]) ;
+ chem_pss_path [n] := subpath (0.00,0.75) of (chem_s_path[n]) ;
+ chem_mss_path [n] := subpath (0.25,1.00) of (chem_s_path[n]) ;
+ chem_mid_zero [n] := origin shifted (-.25chem_width[n],0) ;
+ chem_midst_path[n] := chem_mid_zero[n] -- (chem_width[n],0) rotated ( angle + angle/2) ;
+ chem_midsb_path[n] := chem_mid_zero[n] -- (chem_width[n],0) rotated (-angle - angle/2) ;
+ chem_midt_path [n] := subpath (0.25,1.00) of chem_midst_path [n] ;
+ chem_midb_path [n] := subpath (0.25,1.00) of chem_midsb_path [n] ;
+ chem_msb_path [n] := subpath (0.00,0.75) of chem_b_path[n] ;
+ chem_psb_path [n] := subpath (0.25,1.00) of chem_b_path[n] ;
+ chem_dbl_path [n] := chem_sb_path[n] shifted - (0.05[origin,center chem_sb_path[n]]) ; % parallel
+ chem_dbr_path [n] := chem_sb_path[n] shifted + (0.05[origin,center chem_sb_path[n]]) ;
+ chem_eb_path [n] := chem_sb_path[n] shifted - (0.25[origin,center chem_sb_path[n]]) ;
+ chem_sr_path [n] := chem_radical_min*chem_b_zero[n] -- chem_r_max[n] ;
+ chem_rl_path [n] := chem_r_path[n] paralleled (chem_base_width/20) ;
+ chem_rr_path [n] := chem_r_path[n] paralleled -(chem_base_width/20) ;
+ chem_srl_path [n] := chem_sr_path[n] paralleled (chem_base_width/20) ;
+ chem_srr_path [n] := chem_sr_path[n] paralleled -(chem_base_width/20) ;
+ chem_br_path [n] := point 1 of chem_sb_path[n] --
+ point 0 of chem_sb_path[n] rotatedaround(point 1 of chem_sb_path[n], -4) --
+ point 0 of chem_sb_path[n] rotatedaround(point 1 of chem_sb_path[n], 4) -- cycle ;
+ chem_rb_path [n] := chem_b_zero[n] -- chem_r_max[n] rotated -2 -- chem_r_max[n] -- chem_r_max[n] rotated 2 -- cycle ;
+ chem_mrb_path [n] := chem_rb_path[n] rotatedaround(chem_b_zero[n], (180-angle)/2) ;
+ chem_prb_path [n] := chem_rb_path[n] rotatedaround(chem_b_zero[n],-(180-angle)/2) ;
+ chem_msr_path [n] := chem_sr_path[n] rotatedaround(chem_b_zero[n], (180-angle)/2) ;
+ chem_psr_path [n] := chem_sr_path[n] rotatedaround(chem_b_zero[n],-(180-angle)/2) ;
+ % not yet ok:
+ chem_c_path [n] := subpath (30/45, -30/45) of (fullcircle scaled (1.25*chem_circle_radius*chem_width[n]));
+ chem_cc_path [n] := subpath (30/45,8-30/45) of (fullcircle rotated 90 scaled (1.25*chem_circle_radius*chem_width[n]));
+enddef ;
+
+def chem_init_three = chem_init_some(3,30/52 ,120,-60,1,2) ; enddef ; % 60
+def chem_init_four = chem_init_some(4,30/42.5, 90, 0,1,0) ; enddef ; % 45
+def chem_init_five = chem_init_some(5,30/35 , 72, 0,1,0) ; enddef ; % 36
+def chem_init_six = chem_init_some(6, 1 , 60, 0,1,0) ; enddef ; % 30
+def chem_init_eight = chem_init_some(8,30/22.5, 45, 0,1,0) ; enddef ; % 22.5
+
+% bb R -R R Z -RZ +RZ
+
+def chem_init_some_front(expr n, ratio, angle, start, initialrot, initialmov) =
+ chem_init_some(n, ratio, angle, start, initialrot, initialmov) ;
+ chem_bb_path [n] := chem_b_path[n] rotated -angle -- chem_b_path[n] -- chem_b_path[n] rotated angle --
+ (reverse(chem_b_path[n] shortened (chem_base_width/20))) paralleled (chem_base_width/20) --
+ cycle ;
+ chem_r_max [n] := chem_radical_max*chem_b_zero[n] ;
+ chem_mr_path [n] := origin -- origin shifted (0,-.25chem_base_width) ;
+ chem_pr_path [n] := origin -- origin shifted (0, .25*chem_base_width) ;
+ chem_r_path [n] := point 1 of chem_mr_path[n] -- point 1 of chem_pr_path[n] ;
+ chem_mr_zero [n] := point 1 of chem_mr_path[n] ;
+ chem_pr_zero [n] := point 1 of chem_pr_path[n] ;
+enddef ;
+
+def chem_init_five_front = chem_init_some_front(-5,30/35,72,0,2,0) ; enddef ; % 36
+def chem_init_six_front = chem_init_some_front(-6, 1 ,60,0,2,0) ; enddef ; % 30
+
+def chem_init_one =
+ chem_width [1] := .75 * chem_base_width * chem_setting_scale ;
+ chem_angle [1] := 45 ;
+ chem_start [1] := 0 ;
+ chem_initialrot[1] := 1 ;
+ chem_initialmov[1] := 1 ;
+ chem_b_zero [1] := (1.75*chem_width[1],0) ;
+ chem_r_min [1] := chem_radical_min*chem_b_zero[1] ;
+ chem_r_max [1] := chem_radical_max*chem_b_zero[1] ;
+ chem_r_path [1] := (.5*chem_width[1],0) -- (1.25*chem_width[1],0) ;
+ chem_r_zero [1] := point 1 of chem_r_path [1] ;
+ chem_b_path [1] := chem_r_path[1] rotated + (chem_angle[1]) ; % used for move here
+ chem_b_zero [1] := chem_r_zero[1] ;
+ chem_crz_zero [1] := chem_r_zero[1] enlonged chem_center_offset ;
+ chem_e_path [1] := (.5*chem_width[1],-.25*chem_width[1]) -- (.5*chem_width[1],.25*chem_width[1]) ;
+ chem_sb_path [1] := chem_r_path [1] ;
+ chem_msb_path [1] := chem_r_path [1] shifted (0,-.1chem_width[1]) ;
+ chem_psb_path [1] := chem_r_path [1] shifted (0, .1chem_width[1]) ;
+ chem_ddt_path [1] := subpath(0,.4) of chem_r_path [1] ;
+ chem_ddb_path [1] := subpath(.6,1) of chem_r_path [1] ;
+ chem_ldt_path [1] := chem_ddt_path [1] shifted (0,-.1chem_width[1]) ; % parallel
+ chem_ldb_path [1] := chem_ddb_path [1] shifted (0,-.1chem_width[1]) ;
+ chem_rdt_path [1] := chem_ddt_path [1] shifted (0, .1chem_width[1]) ;
+ chem_rdb_path [1] := chem_ddb_path [1] shifted (0, .1chem_width[1]) ;
+ chem_bb_path [1] := point 0 of chem_r_path[1] --
+ point 1 of chem_r_path[1] rotatedaround(point 0 of chem_r_path[1], -4) --
+ point 1 of chem_r_path[1] rotatedaround(point 0 of chem_r_path[1], 4) -- cycle ;
+ chem_oe_path [1] := ((-20,0)--(10,0){up}..(20,10)..(30,0)..(40,-10)..(50.0,0)..(60,10)..(70,0)..(80,-10)..{up}(90,0)--(120,0))
+ xsized (.75*chem_width[1]) shifted point 0 of chem_r_path[1] ;
+ chem_rt_zero [1] := point .5 of chem_r_path[1] ;
+ chem_rtt_zero [1] := chem_rt_zero[1] rotated + (chem_angle[1]/2) ;
+ chem_rbt_zero [1] := chem_rt_zero[1] rotated - (chem_angle[1]/2) ;
+enddef ;
+
+def chem_init_all =
+ chem_init_one ;
+ chem_init_three ;
+ chem_init_four ;
+ chem_init_five ;
+ chem_init_six ;
+ chem_init_eight ;
+ chem_init_five_front ;
+ chem_init_six_front ;
+enddef ;
+
+chem_init_all ;
+
diff --git a/Master/texmf-dist/metapost/context/base/mp-core.mp b/Master/texmf-dist/metapost/context/base/mp-core.mp
index 2b62559b8bc..7c5d5a1c1b1 100644
--- a/Master/texmf-dist/metapost/context/base/mp-core.mp
+++ b/Master/texmf-dist/metapost/context/base/mp-core.mp
@@ -1,15 +1,3 @@
-%D \module
-%D [ file=mp-core.mp,
-%D version=2000.something, % 1999.08.12,
-%D title=\CONTEXT\ \METAPOST\ graphics,
-%D subtitle=core interfacing,
-%D author=Hans Hagen,
-%D date=\currentdate,
-%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%C
-%C This module is part of the \CONTEXT\ macro||package and is
-%C therefore copyrighted by \PRAGMA. See licen-en.pdf for
-%C details.
if unknown context_tool : input mp-tool ; fi ;
if known context_core : endinput ; fi ;
@@ -135,7 +123,6 @@ def initialize_area_par (expr fn,fx,fy,fw,fh,fd,
numeric mpos ; mpos := 6 ; freeze_box(mpos) ;
-% do_initialize_area (fpos, tpos) ;
do_initialize_par (fpos, tpos, mpos, ffpos, 0,0,0,0,0,0) ;
enddef ;
@@ -359,6 +346,8 @@ boolean force_multi_par_chain ; force_multi_par_chain := true ;
boolean one_piece_multi_par ; one_piece_multi_par := false ;
boolean check_multi_par_chain ; check_multi_par_chain := true ; % extra page check
+boolean multi_column_first_page_hack; multi_column_first_page_hack := true ; % seems to work ok
+
def simplify_multi_pars = % boundingbox ipv shape als optie
for i := 1 upto nofmultipars :
multipars[i] := boundingbox multipars[i] ;
@@ -422,7 +411,6 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd,
pair par_start_pos ;
-% par_start_pos := llxy[fpos] if par_indent<0: shifted (-par_indent,0) fi ;
par_start_pos := llxy[fpos]
if par_indent <0: shifted (-par_indent, 0) fi
@@ -442,8 +430,6 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd,
numeric multi_par_pages ; multi_par_pages := nxy[tpos]-nxy[fpos]+1 ;
- ii := 0 ; nn := NOfTextAreas+1 ; nofmultipars := 0 ;
-
vardef snapped_multi_pos (expr p) =
if snap_multi_par_tops :
if abs(ypart p - ypart ulcorner multipar) < par_line_height :
@@ -516,15 +502,13 @@ def prepare_multi_pars (expr fn,fx,fy,fw,fh,fd,
vardef left_top_hang (expr same_area) =
-par_hang_after := ra + estimated_par_lines(py-fy) ;
+ par_hang_after := ra + estimated_par_lines(py-fy) ;
if (par_hang_indent>0) and (par_hang_after<0) and obey_multi_par_hang :
pair _ul_ ; _ul_ := (xpart ulcorner multipar, ypart snapped_multi_pos(ulxy[fpos]));
pair _pa_ ; _pa_ := _ul_ shifted (0,par_hang_after*par_line_height) ;
-% _pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ;
_pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart llcorner multipar)) ;
if same_area :
-% _pa_ := (xpart _pa_,max(ypart _pa_,ypart llxy[tpos])) ;
_pa_ := (xpart _pa_,max(ypart _pa_ -TopSkipCorrection,ypart llxy[tpos])) ;
fi ;
if obey_multi_par_more and (round(par_line_height)>0) :
@@ -541,8 +525,7 @@ par_hang_after := ra + estimated_par_lines(py-fy) ;
vardef right_top_hang (expr same_area) =
-% par_hang_after := ra - estimated_par_lines(py-fy) ;
-par_hang_after := ra + estimated_par_lines(py-fy) ;
+ par_hang_after := ra + estimated_par_lines(py-fy) ;
if (par_hang_indent<0) and (par_hang_after<0) and obey_multi_par_hang :
pair _ur_ ; _ur_ := (xpart urcorner multipar, ypart snapped_multi_pos(urxy[fpos])) ;
@@ -569,17 +552,15 @@ par_hang_after := ra + estimated_par_lines(py-fy) ;
pair _ul_ ; _ul_ := ulcorner multipar ;
pair _pa_ ; _pa_ := _ul_ shifted (0,par_hang_after*par_line_height) ;
_pa_ := (xpart _pa_,max(ypart _pa_,ypart llcorner multipar)) ;
-
-if t :
- _pa_ := (xpart _pa_,max(ypart _pa_,ypart llxy[tpos]));
-fi ;
-if abs(ypart _pa_-ypart llxy[tpos])<par_line_height :
- _pa_ := (xpart _pa_,ypart llxy[tpos]);
-fi ;
-if abs(ypart _pa_-ypart llcorner multipar)<par_line_height :
- _pa_ := (xpart _pa_,ypart llcorner multipar);
-fi ;
-
+ if t :
+ _pa_ := (xpart _pa_,max(ypart _pa_,ypart llxy[tpos]));
+ fi ;
+ if abs(ypart _pa_-ypart llxy[tpos])<par_line_height :
+ _pa_ := (xpart _pa_,ypart llxy[tpos]);
+ fi ;
+ if abs(ypart _pa_-ypart llcorner multipar)<par_line_height :
+ _pa_ := (xpart _pa_,ypart llcorner multipar);
+ fi ;
(xpart _ul_, ypart _pa_) --
(xpart _ul_ + par_hang_indent, ypart _pa_) --
(xpart _ul_ + par_hang_indent, ypart _ul_)
@@ -588,27 +569,15 @@ fi ;
fi
enddef ;
-% here
-
vardef x_right_top_hang (expr i, t) =
par_hang_after := min(0,ra + estimated_multi_par_height(i,t)) ;
if (par_hang_indent<0) and (par_hang_after<0) :
pair _ur_ ; _ur_ := urcorner multipar ;
pair _pa_ ; _pa_ := _ur_ shifted (0,par_hang_after*par_line_height) ;
_pa_ := (xpart _pa_,max(ypart _pa_,ypart lrcorner multipar)) ;
-if t :
- _pa_ := (xpart _pa_,max(ypart _pa_,ypart snapped_multi_pos(urxy[tpos]))) ;
-fi ;
-
-%todo
-%
-%if abs(ypart _pa_-ypart llxy[tpos])<par_line_height :
-% _pa_ := (xpart _pa_,ypart llxy[tpos]);
-%fi ;
-%if abs(ypart _pa_-ypart llcorner multipar)<par_line_height :
-% _pa_ := (xpart _pa_,ypart llcorner multipar);
-%fi ;
-
+ if t :
+ _pa_ := (xpart _pa_,max(ypart _pa_,ypart snapped_multi_pos(urxy[tpos]))) ;
+ fi ;
(xpart _ur_ + par_hang_indent, ypart _ur_) --
(xpart _ur_ + par_hang_indent, ypart _pa_) --
(xpart _ur_, ypart _pa_)
@@ -702,17 +671,13 @@ fi ;
enddef ;
def test_multipar =
-% multipar :=
-% llcorner multipar --
-% urcorner multipar --
-% lrcorner multipar --
-% ulcorner multipar --
-% cycle ;
multipar := boundingbox multipar ;
enddef ;
% first loop
+ ii := 0 ; nn := NOfTextAreas+1 ; nofmultipars := 0 ;
+
if enable_multi_par_fallback and
(nxy[fpos]=RealPageNumber) and
(nxy[tpos]=RealPageNumber) and not
@@ -908,8 +873,7 @@ fi ;
x_left_top_hang(i,true) --
x_right_top_hang(i,true) --
x_right_bottom_hang(i,true) --
-% ulxy[tpos] --
-snapped_multi_pos(ulxy[tpos]) --
+ snapped_multi_pos(ulxy[tpos]) --
llxy[tpos] --
x_left_bottom_hang(i,true) --
cycle ;
@@ -920,8 +884,7 @@ snapped_multi_pos(ulxy[tpos]) --
ulcorner multipar --
urcorner multipar --
(xpart lrcorner multipar, ypart urxy[tpos]) --
-% ulxy[tpos] --
-snapped_multi_pos(ulxy[tpos]) --
+ snapped_multi_pos(ulxy[tpos]) --
llxy[tpos] --
(xpart llcorner multipar, ypart llxy[tpos]) --
cycle ;
@@ -930,47 +893,50 @@ snapped_multi_pos(ulxy[tpos]) --
save_multipar (i,3,multipar) ;
- else :
+ elseif multi_column_first_page_hack and ((nxy[fpos]=RealPageNumber) and (nxy[tpos]>=RealPageNumber) and (NOfTextColumns>1)) :
- % handled later
+ save_multipar (i,2,multipar) ;
+ else :
+ % handled later
fi ;
endfor ;
% second loop
-if force_multi_par_chain or (ii > 1) :
+ if force_multi_par_chain or (ii > 1) :
- for i=ii+1 upto nn-1 :
+ for i=ii+1 upto nn-1 :
- % rest of chain / todo : hang
+ % rest of chain / todo : hang
-% we need to test, else we get a <lineheight bottom one
-% triggering a whole text frame; weird
+% hm, the second+ column in column sets now gets lost in a NOfTextColumns
-if (not check_multi_par_chain) or ((nxy[fpos]<RealPageNumber) and (nxy[tpos]>RealPageNumber)) :
+ if (not check_multi_par_chain) or
+ ((nxy[fpos]<RealPageNumber) and (nxy[tpos]>RealPageNumber))
+ :
- multipar := set_multipar(i) ;
+ multipar := set_multipar(i) ;
- if obey_multi_par_hang and obey_multi_par_more :
+ if obey_multi_par_hang and obey_multi_par_more :
- multipar :=
- x_left_top_hang(i,false) --
- x_right_top_hang(i,false) --
- x_right_bottom_hang(i,false) --
- x_left_bottom_hang(i,false) --
- cycle ;
+ multipar :=
+ x_left_top_hang(i,false) --
+ x_right_top_hang(i,false) --
+ x_right_bottom_hang(i,false) --
+ x_left_bottom_hang(i,false) --
+ cycle ;
- fi ;
+ fi ;
- save_multipar(i,2,multipar) ;
+ save_multipar(i,2,multipar) ;
-fi ;
+ fi ;
- endfor ;
+ endfor ;
-fi ;
+ fi ;
% end of normal/fallback
@@ -1079,9 +1045,6 @@ def sort_multi_pars =
fi ;
enddef ;
-% This collapses successive areas (possibly interrupted by
-% floats. First we need to sort the areas, since they are
-% normally in de order start, end, inbetween.
def collapse_multi_pars =
if nofmultipars>1 :
@@ -1110,20 +1073,40 @@ multirefs[_nofmultipars_] := multirefs[i+1] ;
fi ;
enddef ;
+% def draw_multi_pars =
+% for i=1 upto nofmultipars :
+% do_draw_par(multipars[i]) ;
+% if boxgridtype= 1 :
+% draw baseline_grid (multipars[i],up,true ) ; % withcolor boxgridcolor ;
+% elseif boxgridtype= 2 :
+% draw baseline_grid (multipars[i],up,false) ; % withcolor boxgridcolor ;
+% elseif boxgridtype= 3 :
+% draw baseline_grid (multipars[i],up,true ) ; % withcolor boxgridcolor ;
+% draw baseline_grid (multipars[i],up,true )
+% shifted (0,ExHeight) ; % withcolor boxgridcolor ;
+% elseif boxgridtype= 4 :
+% draw baseline_grid (multipars[i],up,true )
+% shifted (0,ExHeight/2) ; % withcolor boxgridcolor ;
+% elseif boxgridtype=11 :
+% draw graphic_grid(multipars[i],boxgriddistance,boxgriddistance,boxgriddistance/2,boxgriddistance/2) ;
+% elseif boxgridtype=12 :
+% draw graphic_grid(multipars[i],boxgriddistance,boxgriddistance,0,0) ;
+% fi ;
+% endfor ;
+% enddef ;
+
def draw_multi_pars =
for i=1 upto nofmultipars :
do_draw_par(multipars[i]) ;
if boxgridtype= 1 :
- draw baseline_grid (multipars[i],up,true ) ; % withcolor boxgridcolor ;
+ draw baseline_grid (multipars[i],if multilocs[i]=1: down else: up fi,true) ; % withcolor boxgridcolor ;
elseif boxgridtype= 2 :
- draw baseline_grid (multipars[i],up,false) ; % withcolor boxgridcolor ;
+ draw baseline_grid (multipars[i],if multilocs[i]=1: down else: up fi,false) ; % withcolor boxgridcolor ;
elseif boxgridtype= 3 :
- draw baseline_grid (multipars[i],up,true ) ; % withcolor boxgridcolor ;
- draw baseline_grid (multipars[i],up,true )
- shifted (0,ExHeight) ; % withcolor boxgridcolor ;
+ draw baseline_grid (multipars[i],if multilocs[i]=1: down else: up fi,true) ; % withcolor boxgridcolor ;
+ draw baseline_grid (multipars[i],if multilocs[i]=1: down else: up fi,true) shifted (0,ExHeight) ; % withcolor boxgridcolor ;
elseif boxgridtype= 4 :
- draw baseline_grid (multipars[i],up,true )
- shifted (0,ExHeight/2) ; % withcolor boxgridcolor ;
+ draw baseline_grid (multipars[i],if multilocs[i]=1: down else: up fi,true) shifted (0,ExHeight/2) ; % withcolor boxgridcolor ;
elseif boxgridtype=11 :
draw graphic_grid(multipars[i],boxgriddistance,boxgriddistance,boxgriddistance/2,boxgriddistance/2) ;
elseif boxgridtype=12 :
@@ -1231,7 +1214,6 @@ let draw_area = draw_box ;
let anchor_area = anchor_box ;
let anchor_par = anchor_box ;
-% new and experimental and yet undocumented
numeric sync_n[], sync_p[][], sync_w[][], sync_h[][], sync_d[][], sync_t[][] ;
pair sync_xy[][] ; color sync_c[][] ;
@@ -1286,7 +1268,6 @@ vardef PrepareSyncTasks(expr n, collapse, extendtop, prestartnext) =
NOfSyncPaths := NOfSyncPaths + 1 ;
if not ok :
if i>1 :
-% not yet correct when two of the same follow each other
if sync_t[n][i-1] = sync_t[n][i] :
SyncPaths[NOfSyncPaths] := SyncBox(n, i, SyncLeftOffset, SyncWidth, PaperHeight, -PaperHeight) ;
SyncTasks[NOfSyncPaths] := i ;
@@ -1394,3 +1375,44 @@ def ProcessSyncTask(expr p, c) =
enddef ;
endinput ;
+
+end
+
+% for Jelle Huisman
+%
+% \setupcolors[state=start]
+% \dontcomplain
+% \definecolumnset[example][n=3,distance=5mm]
+% \startMPextensions
+% multi_column_first_page_hack := true ;
+% \stopMPextensions
+% \startuseMPgraphic{mpos:par:trick}
+% for i=1 upto nofmultipars-1 : draw (rightboundary multipars[i]) shifted (2.5mm, 0) ; endfor ;
+% \stopuseMPgraphic
+% \definetextbackground[test][mp=mpos:par:trick,method=mpos:par:columnset]
+% \starttext
+% \definecolumnsetspan[chapter][n=3]
+% \startcolumnset[example]
+% \startcolumnsetspan[chapter]
+% \chapter{Chapter One}
+% \stopcolumnsetspan
+% \starttextbackground[test] \dorecurse {3}{\input knuth } \stoptextbackground
+% \stopcolumnset
+% \startcolumnset[example]
+% \startcolumnsetspan[chapter]
+% \chapter{Chapter One}
+% \stopcolumnsetspan
+% \starttextbackground[test] \dorecurse {10}{\input knuth } \stoptextbackground
+% \stopcolumnset
+% \stoptext
+%
+% fast variant:
+%
+% \startuseMPgraphic{whatever}
+% for i=1 upto NOfTextColumns-1 :
+% draw (rightboundary TextColumns[i]) shifted (2.5mm,0) shifted -\MPxy\textanchor ;
+% endfor ;
+% setbounds currentpicture to OverlayBox ;
+% \stopuseMPgraphic
+% \defineoverlay[whatever][\useMPgraphic{whatever}]
+% \setupbackgrounds[text][background=whatever]
diff --git a/Master/texmf-dist/metapost/context/base/mp-grph.mp b/Master/texmf-dist/metapost/context/base/mp-grph.mp
index 87a17967734..243b45318b0 100644
--- a/Master/texmf-dist/metapost/context/base/mp-grph.mp
+++ b/Master/texmf-dist/metapost/context/base/mp-grph.mp
@@ -56,8 +56,8 @@ string graphictextformat ; graphictextformat := "plain" ;
string graphictextstring ; graphictextstring := "" ;
string graphictextfile ; graphictextfile := "dummy.mpo" ;
-def data_mpo_file = job_name & "-mp.mpo" enddef ;
-def data_mpy_file = job_name & "-mp.mpy" enddef ;
+def data_mpo_file = job_name & "-mpgraph.mpo" enddef ;
+def data_mpy_file = job_name & "-mpgraph.mpy" enddef ;
def savegraphictext (expr str) =
if (graphictextstring<>"") :
@@ -94,7 +94,7 @@ enddef ;
def doloadfigure (expr filename) text figureattributes =
begingroup ;
save figurenumber, figurepicture, number, fixedplace ;
- numeric figurenumber ; figurenumber := 0 ;
+ numeric figurenumber ; figurenumber := 0 ;
boolean figureshift ; figureshift := true ;
picture figurepicture ; figurepicture := currentpicture ;
def number primary n = hide(figurenumber := n) enddef ;
diff --git a/Master/texmf-dist/metapost/context/base/mp-mlib.mp b/Master/texmf-dist/metapost/context/base/mp-mlib.mp
index 6722c81e4f4..bf2372ca390 100644
--- a/Master/texmf-dist/metapost/context/base/mp-mlib.mp
+++ b/Master/texmf-dist/metapost/context/base/mp-mlib.mp
@@ -26,38 +26,153 @@ def resettextexts =
_tt_p_ := nullpicture ;
enddef ;
-extra_endfig := ";draw _tt_p_; " & extra_endfig ;
+extra_endfig := ";addto currentpicture also _tt_p_; " & extra_endfig; % was draw _tt_p_
extra_beginfig := extra_beginfig & "resettextexts;";
vardef rawtextext(expr str) =
- if _trial_run_ :
+ if str = "" :
+ nullpicture
+ elseif _trial_run_ :
image (
_tt_n_ := _tt_n_ + 1 ;
_tt_p_ := image (
- draw _tt_p_ ;
- draw unitsquare withprescript "tf" withpostscript decimal _tt_n_ & ":" & str ;
+ addto currentpicture also _tt_p_ ;
+ addto currentpicture doublepath unitsquare withprescript "tf" withpostscript decimal _tt_n_ & ":" & str ;
) ;
- draw unitsquare ;
+ addto currentpicture doublepath unitsquare withpen pencircle scaled 0 ;
)
else :
image (
_tt_n_ := _tt_n_ + 1 ;
- draw unitsquare
+ addto currentpicture doublepath unitsquare
xscaled _tt_w_[_tt_n_]
yscaled (_tt_h_[_tt_n_] + _tt_d_[_tt_n_])
withprescript "ts"
withpostscript decimal _tt_n_ & ":" & str ;
- )
+ ) shifted (0,-_tt_d_[_tt_n_])
+ fi
+enddef ;
+
+% not ok yet
+
+pair laboff.d, laboff.dlft, laboff.drt ; % new positional suffixes
+pair laboff.origin, laboff.raw ; % graph mess
+
+laboff.d := laboff ; labxf.d := labxf ; labyf.d := labyf ;
+laboff.dlft := laboff.lft ; labxf.dlft := labxf.lft ; labyf.dlft := labyf.lft ;
+laboff.drt := laboff.rt ; labxf.drt := labxf.rt ; labyf.drt := labyf.rt ;
+
+labtype := 0 ; labtype.lft := 1 ; labtype.rt := 2 ;
+labtype.bot := 3 ; labtype.top := 4 ; labtype.ulft := 5 ;
+labtype.urt := 6 ; labtype.llft := 7 ; labtype.lrt := 8 ;
+labtype.d := 10 ; labtype.dlft := 11 ; labtype.drt := 12 ;
+labtype.origin := 0 ; labtype.raw := 0 ;
+
+% laboff.origin = (infinity,infinity) ; labxf.origin := 0 ; labyf.origin := 0 ;
+% laboff.raw = (infinity,infinity) ; labxf.raw := 0 ; labyf.raw := 0 ;
+
+% todo: thelabel.origin("xxxx",origin) (overflows)
+
+laboff.origin = (0,0) ; labxf.origin := 0 ; labyf.origin := 0 ;
+laboff.raw = (0,0) ; labxf.raw := 0 ; labyf.raw := 0 ;
+
+pair laboff.l ; laboff.l = laboff.lft ;
+pair laboff.r ; laboff.r = laboff.rt ;
+pair laboff.b ; laboff.b = laboff.bot ;
+pair laboff.t ; laboff.t = laboff.top ;
+pair laboff.l_t ; laboff.l_t = laboff.ulft ;
+pair laboff.r_t ; laboff.r_t = laboff.urt ;
+pair laboff.l_b ; laboff.l_b = laboff.llft ;
+pair laboff.r_b ; laboff.r_b = laboff.lrt ;
+pair laboff.t_l ; laboff.t_l = laboff.ulft ;
+pair laboff.t_r ; laboff.t_r = laboff.urt ;
+pair laboff.b_l ; laboff.b_l = laboff.llft ;
+pair laboff.b_r ; laboff.b_r = laboff.lrt ;
+
+labxf.l ; labxf.l = labxf.lft ;
+labxf.r ; labxf.r = labxf.rt ;
+labxf.b ; labxf.b = labxf.bot ;
+labxf.t ; labxf.t = labxf.top ;
+labxf.l_t ; labxf.l_t = labxf.ulft ;
+labxf.r_t ; labxf.r_t = labxf.urt ;
+labxf.l_b ; labxf.l_b = labxf.llft ;
+labxf.r_b ; labxf.r_b = labxf.lrt ;
+labxf.t_l ; labxf.t_l = labxf.ulft ;
+labxf.t_r ; labxf.t_r = labxf.urt ;
+labxf.b_l ; labxf.b_l = labxf.llft ;
+labxf.b_r ; labxf.b_r = labxf.lrt ;
+
+labyf.l ; labyf.l = labyf.lft ;
+labyf.r ; labyf.r = labyf.rt ;
+labyf.b ; labyf.b = labyf.bot ;
+labyf.t ; labyf.t = labyf.top ;
+labyf.l_t ; labyf.l_t = labyf.ulft ;
+labyf.r_t ; labyf.r_t = labyf.urt ;
+labyf.l_b ; labyf.l_b = labyf.llft ;
+labyf.r_b ; labyf.r_b = labyf.lrt ;
+labyf.t_l ; labyf.t_l = labyf.ulft ;
+labyf.t_r ; labyf.t_r = labyf.urt ;
+labyf.b_l ; labyf.b_l = labyf.llft ;
+labyf.b_r ; labyf.b_r = labyf.lrt ;
+
+labtype.l ; labtype.l = labtype.lft ;
+labtype.r ; labtype.r = labtype.rt ;
+labtype.b ; labtype.b = labtype.bot ;
+labtype.t ; labtype.t = labtype.top ;
+labtype.l_t ; labtype.l_t = labtype.ulft ;
+labtype.r_t ; labtype.r_t = labtype.urt ;
+labtype.l_b ; labtype.l_b = labtype.llft ;
+labtype.r_b ; labtype.r_b = labtype.lrt ;
+labtype.t_l ; labtype.t_l = labtype.ulft ;
+labtype.t_r ; labtype.t_r = labtype.urt ;
+labtype.b_l ; labtype.b_l = labtype.llft ;
+labtype.b_r ; labtype.b_r = labtype.lrt ;
+
+vardef thetextext@#(expr p,z) = % adapted copy of thelabel@
+ if string p :
+ thetextext@#(rawtextext(p),z)
+ else :
+ p
+ if (labtype@# >= 10) : shifted (0,ypart center p) fi
+ shifted (z + labeloffset*laboff@# - (labxf@#*lrcorner p + labyf@#*ulcorner p + (1-labxf@#-labyf@#)*llcorner p))
fi
enddef ;
vardef textext@#(expr txt) =
- interim labeloffset := textextoffset ;
- if string txt :
- thelabel@#(rawtextext(txt),origin)
- else :
- thelabel@#(txt,origin)
- fi
+ interim labeloffset := textextoffset ;
+ if string txt :
+ thetextext@#(rawtextext(txt),origin)
+ else :
+ thetextext@#(txt,origin)
+ fi
+enddef ;
+
+% \starttext
+% \startMPpage
+% numeric value ; value = 123 ;
+% label.lft(decimal value,origin) ;
+% draw "oeps" infont defaultfont ;
+% \stopMPpage
+% \stoptext
+
+vardef thelabel@#(expr s, z) =
+ save p ; picture p ;
+ if picture s :
+ p = s ;
+ else :
+ p = textext("\definedfont[" & defaultfont & "]" & s) scaled defaultscale ;
+ fi ;
+ p shifted (z + labeloffset*laboff@# - (labxf@#*lrcorner p + labyf@#*ulcorner p + (1-labxf@#-labyf@#)*llcorner p))
+enddef;
+
+let normalinfont = infont ;
+
+primarydef str infont name = % very naughty !
+ if name = "" :
+ textext(str)
+ else :
+ textext("\definedfont[" & name & "]" & str)
+ fi
enddef ;
def circular_shade (expr p, n, ca, cb) =
@@ -144,13 +259,24 @@ enddef ;
def erasegraphictextfile =
enddef ;
+def externalfigure primary filename =
+ doexternalfigure (filename)
+enddef ;
def doexternalfigure (expr filename) text transformation =
draw unitsquare transformation withprescript "fg" withpostscript filename ;
enddef ;
+def register (expr label, width, height, offset) =
+ draw unitsquare xscaled width yscaled height shifted offset withprescript "ps" withpostscript label ;
+enddef ;
+
extra_beginfig := extra_beginfig & "currentgraphictext := 0 ; " ;
extra_endfig := extra_endfig & "finishsavingdata ; " ;
extra_endfig := extra_endfig & "resettextexts ; " ;
boolean cmykcolors ; cmykcolors := true ;
boolean spotcolors ; spotcolors := true ;
+
+vardef verbatim(expr str) =
+ ditto & "\detokenize{" & str & "}" & ditto
+enddef ;
diff --git a/Master/texmf-dist/metapost/context/base/mp-page.mp b/Master/texmf-dist/metapost/context/base/mp-page.mp
index e3750b55b75..71ca12aa021 100644
--- a/Master/texmf-dist/metapost/context/base/mp-page.mp
+++ b/Master/texmf-dist/metapost/context/base/mp-page.mp
@@ -444,4 +444,4 @@ def Enlarged (expr p, d) =
ulEnlarged (p,d) -- cycle)
enddef ;
-endinput ; \ No newline at end of file
+endinput ;
diff --git a/Master/texmf-dist/metapost/context/base/mp-spec.mp b/Master/texmf-dist/metapost/context/base/mp-spec.mp
index f28e5a5d3ce..9125b4b8bc2 100644
--- a/Master/texmf-dist/metapost/context/base/mp-spec.mp
+++ b/Master/texmf-dist/metapost/context/base/mp-spec.mp
@@ -113,9 +113,11 @@ boolean insidefigure ; insidefigure := false ;
extra_beginfig :=
" insidefigure := true ; " &
" reset_extra_specials ; " &
- extra_beginfig ;
+ extra_beginfig &
+ " ; " ;
extra_endfig :=
+ " ; " &
" add_special_signal ; " &
extra_endfig &
" add_extra_specials ; " &
@@ -258,7 +260,7 @@ vardef define_linear_shade (expr a, b, ca, cb) =
elseif (mp_shade_version > 1) and _is_spot_(ca) and _is_spot_(cb) :
flush_special(34, 17, "0 1 " & decimal shadefactor & " " &
spotcolorpattern[bluepart ca] & " " & ddecimal (a shifted shadeoffset) & " " &
- cmykcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) ) ;
+ spotcolorpattern[bluepart cb] & " " & ddecimal (b shifted shadeoffset) ) ;
else :
flush_special(30, 15, "0 1 " & decimal shadefactor & " " &
dddecimal ca & " " & ddecimal (a shifted shadeoffset) & " " &
@@ -474,7 +476,7 @@ enddef ;
_cmyk_counter_ := 0 ;
-extra_endfig := " resetcmykcolors ; " & extra_endfig ;
+extra_endfig := " ; resetcmykcolors ; " & extra_endfig ;
def resetcmykcolors =
numeric cmykcolorhash[][][][] ;
@@ -522,7 +524,7 @@ enddef ;
_spotcolor_counter_ := 0 ;
_spotcolor_number_ := 0 ;
-extra_endfig := " resetspotcolors ; " & extra_endfig ;
+extra_endfig := " ; resetspotcolors ; " & extra_endfig ;
def resetspotcolors =
numeric spotcolorhash[][] ;
diff --git a/Master/texmf-dist/metapost/context/base/mp-text.mp b/Master/texmf-dist/metapost/context/base/mp-text.mp
index c1f9c80e909..efba39d7d1f 100644
--- a/Master/texmf-dist/metapost/context/base/mp-text.mp
+++ b/Master/texmf-dist/metapost/context/base/mp-text.mp
@@ -86,8 +86,9 @@ string laboff_l ; laboff_l := ".lft" ;
string laboff_r ; laboff_r := ".rt" ;
string laboff_b ; laboff_b := ".bot" ;
string laboff_t ; laboff_t := ".top" ;
+
string laboff_lt ; laboff_lt := ".ulft" ;
-string laboff_rt ; laboff_rt := ".urt" ;
+string laboff_rt ; laboff_rt := ".urt" ; % bugged, conflict with r
string laboff_lb ; laboff_lb := ".llft" ;
string laboff_rb ; laboff_rb := ".lrt" ;
string laboff_tl ; laboff_tl := ".ulft" ;
@@ -103,18 +104,19 @@ vardef textextstr(expr s, a) =
scantokens ss
enddef ;
-pair laboff.origin ; laboff.origin = (infinity,infinity) ;
-pair laboff.raw ; laboff.raw = (infinity,infinity) ;
+pair laboff.origin ; laboff.origin = (0,0) ; % (infinity,infinity) ;
+pair laboff.raw ; laboff.raw = (0,0) ; % (infinity,infinity) ;
vardef thelabel@#(expr s, z) =
save p ; picture p ;
p = s if not picture s : infont defaultfont scaled defaultscale fi ;
- if laboff@#<>laboff.origin :
+% wrong, see myway textext
+% if laboff@#<>laboff.origin :
(p shifted (z + labeloffset*laboff@# - (labxf@#*lrcorner p +
labyf@#*ulcorner p + (1-labxf@#-labyf@#)*llcorner p)))
- else :
- (p shifted z)
- fi
+% else :
+% (p shifted z)
+% fi
enddef;
def build_parshape (expr p, offset_or_path, dx, dy,
@@ -258,3 +260,7 @@ def build_parshape (expr p, offset_or_path, dx, dy,
endgroup ;
enddef ;
+
+vardef verbatim(expr str) =
+ ditto & "\detokenize{" & str & "}" & ditto
+enddef ;
diff --git a/Master/texmf-dist/metapost/context/base/mp-tool.mp b/Master/texmf-dist/metapost/context/base/mp-tool.mp
index 24f2e6676fd..aa3d77f263b 100644
--- a/Master/texmf-dist/metapost/context/base/mp-tool.mp
+++ b/Master/texmf-dist/metapost/context/base/mp-tool.mp
@@ -115,6 +115,12 @@ enddef ;
% & "&ddecimal urcorner currentpicture"
% & ");";
+%D Crap (experimental, not used):
+
+def forcemultipass =
+ % extra_endfig := extra_endfig & "special(" & ditto & "%%MetaPostOption: multipass" & ditto & ");" ;
+enddef ;
+
%D Colors:
nocolormodel := 1 ;
@@ -193,7 +199,8 @@ if unknown collapse_data :
boolean collapse_data ; collapse_data := false ;
fi ;
-boolean savingdata ; savingdata := false ;
+boolean savingdata ; savingdata := false ;
+boolean savingdatadone ; savingdatadone := false ;
def savedata expr txt =
if collapse_data :
@@ -208,6 +215,7 @@ enddef ;
def startsavingdata =
savingdata := true ;
+ savingdatadone := true ;
if collapse_data :
write
"\MPdata{" & decimal charcode & "}{%"
@@ -224,7 +232,10 @@ def stopsavingdata =
enddef ;
def finishsavingdata =
- write EOF to data_mpd_file ;
+ if savingdatadone :
+ write EOF to data_mpd_file ;
+ savingdatadone := false ;
+ fi ;
enddef ;
%D Instead of a keystroke eating save and allocation
@@ -811,10 +822,26 @@ enddef ;
%D Handy for testing/debugging:
primarydef p crossed d =
- (center p shifted (-d, 0) -- llcorner p --
- center p shifted ( 0,-d) -- lrcorner p --
- center p shifted (+d, 0) -- urcorner p --
- center p shifted ( 0,+d) -- ulcorner p -- cycle)
+ if pair p :
+ (p shifted (-d, 0) -- p --
+ p shifted ( 0,-d) -- p --
+ p shifted (+d, 0) -- p --
+ p shifted ( 0,+d) -- p -- cycle)
+ else :
+ (center p shifted (-d, 0) -- llcorner p --
+ center p shifted ( 0,-d) -- lrcorner p --
+ center p shifted (+d, 0) -- urcorner p --
+ center p shifted ( 0,+d) -- ulcorner p -- cycle)
+ fi
+enddef ;
+
+%D Also handy (math ladders):
+
+vardef laddered expr p =
+ point 0 of p
+ for i=1 upto length(p) :
+ -- (xpart (point i of p), ypart (point (i-1) of p)) -- (point i of p)
+ endfor
enddef ;
%D Saves typing:
@@ -964,6 +991,10 @@ enddef ;
% endgroup
%enddef ;
+primarydef p paralleled d =
+ p shifted if d < 0 : - fi ((point abs(d) on (p rotatedaround(point 0 of p,90))) - point 0 of p)
+enddef ;
+
vardef punked primary p =
(point 0 of p for i=1 upto length(p)-1 : -- point i of p endfor
if cycle p : -- cycle else : -- point length(p) of p fi)
@@ -985,34 +1016,16 @@ enddef ;
%D Rather fundamental.
-% vardef rightpath expr p =
-% save q, t, b ; path q ; pair t, b ;
-% t := (ulcorner p -- urcorner p) intersection_point p ;
-% b := (llcorner p -- lrcorner p) intersection_point p ;
-% if xpart directionpoint t of p < 0 : p := reverse p ; fi ;
-% q := p cutbefore b ;
-% q := q if xpart point 0 of p > 0 : & p fi cutafter t ;
-% q
-% enddef ;
-%
-% vardef leftpath expr p =
-% save q, t, b ; path q ; pair t, b ;
-% t := (ulcorner p -- urcorner p) intersection_point p ;
-% b := (llcorner p -- lrcorner p) intersection_point p ;
-% if xpart directionpoint t of p < 0 : p := reverse p ; fi ;
-% q := p cutbefore t ;
-% q := q if xpart point 0 of p > 0 : & p fi cutafter b ;
-% q
-% enddef ;
+% not yet ok
-def leftrightpath(expr p, l) =
- save q, t, b ; path q ; pair t, b ;
+def leftrightpath(expr p, l) = % used in s-pre-19
+ save q, r, t, b ; path q, r ; pair t, b ;
t := (ulcorner p -- urcorner p) intersection_point p ;
b := (llcorner p -- lrcorner p) intersection_point p ;
- if xpart directionpoint t of p < 0 : p := reverse p ; fi ;
- q := p cutbefore if l: t else: b fi ;
- q := q if xpart point 0 of p > 0 : &
- p fi cutafter if l: b else: t fi ;
+ r := if xpart directionpoint t of p < 0 : reverse p else : p fi ; % r is needed, else problems when reverse is fed
+ q := r cutbefore if l: t else: b fi ;
+ q := q if xpart point 0 of r > 0 : &
+ r fi cutafter if l: b else: t fi ;
q
enddef ;
@@ -1030,6 +1043,12 @@ enddef ;
let normaldraw = draw ;
let normalfill = fill ;
+% bugged in mplib so ...
+
+def normalfill expr c = addto currentpicture contour c _op_ enddef ;
+def normaldraw expr p = addto currentpicture if picture p: also p else: doublepath p withpen currentpen fi _op_ enddef ;
+
+
def drawlineoptions (text t) = def _lin_opt_ = t enddef ; enddef ;
def drawpointoptions (text t) = def _pnt_opt_ = t enddef ; enddef ;
def drawcontroloptions(text t) = def _ctr_opt_ = t enddef ; enddef ;
@@ -1256,6 +1275,13 @@ enddef ;
extra_endfig := extra_endfig & " naturalizepaths ; " ;
+%D Also handy:
+
+extra_beginfig := extra_beginfig & " truecorners := 0 ; " ; % restores
+extra_beginfig := extra_beginfig & " miterlimit := 10 ; " ; % restores
+extra_beginfig := extra_beginfig & " linejoin := rounded ; " ; % restores
+extra_beginfig := extra_beginfig & " linecap := rounded ; " ; % restores
+
%D Normally, arrowheads don't scale well. So we provide a
%D hack.
@@ -1735,12 +1761,55 @@ def condition primary b = if b : "true" else : "false" fi enddef ;
primarydef p stretched s =
begingroup
-% save pp ; path pp ; pp := p scaled s ;
save pp ; path pp ; pp := p xyscaled s ;
(pp shifted ((point 0 of p) - (point 0 of pp)))
endgroup
enddef ;
+% primarydef p enlonged len =
+% begingroup
+% save al ; al := arclength(p) ;
+% if al > 0 :
+% if pair p :
+% point 1 of ((origin -- p) stretched ((al+len)/al))
+% else :
+% p stretched ((al+len)/al)
+% fi
+% else :
+% p
+% fi
+% endgroup
+% enddef ;
+
+primarydef p enlonged len =
+ begingroup
+ if pair p :
+ save q ; path q ; q := origin -- p ;
+ save al ; al := arclength(q) ;
+ if al > 0 :
+ point 1 of (q stretched ((al+len)/al))
+ else :
+ p
+ fi
+ else :
+ save al ; al := arclength(p) ;
+ if al > 0 :
+ p stretched ((al+len)/al)
+ else :
+ p
+ fi
+ fi
+ endgroup
+enddef ;
+
+% path p ; p := (0,0) -- (10cm,5cm) ;
+% drawarrow p withcolor red ;
+% drawarrow p shortened 1cm withcolor green ;
+
+primarydef p shortened d =
+ reverse ( ( reverse (p enlonged -d) ) enlonged -d )
+enddef ;
+
% yes or no, untested -)
def xshifted expr dx = shifted(dx,0) enddef ;
@@ -2493,7 +2562,3 @@ enddef ;
% done
endinput ;
-
-end
-
-end
diff --git a/Master/texmf-dist/metapost/context/font/punkfont.mp b/Master/texmf-dist/metapost/context/font/punkfont.mp
new file mode 100644
index 00000000000..a96e2e29fb2
--- /dev/null
+++ b/Master/texmf-dist/metapost/context/font/punkfont.mp
@@ -0,0 +1,854 @@
+% Remark:
+%
+% This file is a merge of the original punk files by Donald Knuth, who
+% added this comment:
+%
+% Font inspired by Gerard and Marjan Unger's lectures,
+% Feb 1985
+%
+% The regular punk files are part of TeXLive and in metafont format. All
+% errors introduced are ours. We also changed the encoding to unicode. In
+% due time we might add a few more more characters. We still need to
+% improve some of the metrics which involves a bit of trial and error. The
+% font just covers basic latin shapes but in ConTeXt MkIV we add virtual
+% composed shapes. There is a module m-punk.tex that implements this. This
+% derivate is also used in mk.tex (mk.pdf) which is one of our tests for
+% LuaTeX. We published an article on it in the MAPS (NTG magazine).
+%
+% 2008, Taco Hoekwater & Hans Hagen
+
+if unknown punk_font_loaded :
+
+ if unknown scale_factor :
+ scale_factor := 1 ;
+ fi ;
+
+ boolean punk_font_loaded ;
+
+ punk_font_loaded := true ;
+ warningcheck := 0 ;
+ designsize := 10pt#;
+ font_identifier := "Punk Nova" ; % dedicated to Don Knuth and Hermann Zapf
+
+ ht# := 7pt# ; % height of characters
+ u# := 1/4pt# ; % unit width
+ % s# := 1.2pt# ; % extra sidebar
+ % s# := 0.1pt# ; % extra sidebar, needed because we use the bbox currently
+ s# := 0 ; % extra sidebar, ok
+% s# := 1.2pt# ; % extra sidebar
+ px# := .6pt# ; % horizontal thickness of pen
+ py# := .5pt# ; % vertical thickness of pen
+ dot# := 1.3pt# ; % diameter of dots
+ dev# := .3pt# ; % standard deviation of punk points
+
+ % dot# := .8pt# ; % diameter of dots
+ % px# := .3pt# ; % horizontal thickness of pen
+ % py# := .2pt# ; % vertical thickness of pen
+
+ % seed := sqrt2 ;
+ % randomseed := seed ;
+ proofing := 0 ;
+ pt := .1pt ;
+ mag := scale_factor * 10 ;
+ bp_per_pixel := bpppix_ * mag ;
+
+ define_pixels(u,dev) ;
+ define_blacker_pixels(px,py,dot) ;
+ define_whole_pixels(s) ;
+ xoffset := s ;
+
+ pickup pencircle xscaled px yscaled py ;
+ punk_pen := savepen ;
+ pickup pencircle scaled dot ;
+ path dot_pen_path ;
+ dot_pen_path := tensepath makepath currentpen ;
+
+ defaultcolormodel := 1 ;
+
+ def beginpunkchar(expr c,n,h,v) = % code $c$; width is $n$ units
+ hdev := h * dev ; % modify horizontal amounts of deviation
+ vdev := v * dev ; % modify vertical amounts of deviation
+ beginchar(c,n*u#,ht#,0) ;
+ italcorr 0 ;
+ % italcorr ht#*slant;
+ pickup punk_pen
+ enddef ;
+
+% extra_endchar := extra_endchar & "w := w+2s ; charwd := charwd+2s# ;" ;
+% extra_endchar := extra_endchar & "setbounds currentpicture to (0,-d)--(w*1.2,-d)--(w*1.2,h)--(0,h)--cycle;" ;
+
+% extra_endchar := extra_endchar & "w := w+2s ; " ;
+% extra_endchar := extra_endchar & "w := 1.2w ; " ;
+% extra_endchar := extra_endchar & "charwd := 1.2charwd ; " ;
+% extra_endchar := extra_endchar & "setbounds currentpicture to (0,-d)--(w,-d)--(w,h)--(0,h)--cycle;" ;
+
+% todo:
+
+% extra_endchar := extra_endchar &
+% "currentpicture := currentpicture shifted (0,1pt#) ; setbounds currentpicture to " &
+% "llcorner currentpicture shifted ( 0,-1pt#) -- lrcorner currentpicture shifted ( 1pt#,-1pt#) -- " &
+% "urcorner currentpicture shifted ( 1pt#, 1pt#) -- ulcorner currentpicture shifted ( 0, 1pt#) -- cycle ; " ;
+
+ def ^ =
+ transformed currenttransform
+ enddef ;
+
+ def makebox(text rule) =
+ for y=0, h : % horizontals
+ rule((-s,y)^,(w-s,y)^) ;
+ endfor
+ for x=-s, 0, w-2s, w-s : % verticals
+ rule((x,0)^,(x,h)^) ;
+ endfor
+ enddef ;
+
+ rulepen := pensquare ;
+
+ vardef pp expr z =
+ z + (hdev * normaldeviate, vdev * normaldeviate)
+ enddef;
+
+ def pd expr z = % {\bf drawdot}
+ addto currentpicture contour dot_pen_path shifted z.t_ withpen penspeck
+ enddef;
+
+ def initialize_punk_upper =
+ ht# := 7pt# ; dev# := .3pt# ;
+ enddef ;
+ def initialize_punk_lower =
+ sht# := ht#; sdev := dev;
+ ht# := .6ht# ; dev := .7dev ;
+ enddef ;
+ def revert_punk_lower =
+ ht# := sht#; dev := sdev;
+ enddef ;
+
+fi ;
+
+
+initialize_punk_upper ;
+
+beginpunkchar("A",13,1,2);
+z1=pp(1.5u,0); z2=(.5w,1.1h); z3=pp(w-1.5u,0);
+pd z1; pd z3; draw z1--z2--z3; % left and right diagonals
+z4=pp .3[z1,z2]; z5=pp .3[z3,z2]; pd z4; pd z5; draw z4--z5; % crossbar
+endchar;
+
+beginpunkchar("B",12,1,1);
+z1=pp(2u,0); z2=pp(2u,.6h); z3=pp(2u,h); pd z1; pd z3; draw z1--z3; % stem
+z1.5=pp(w-u,.5y2); z2.5=pp(w-u,.5[y2,y3]); draw z2--z2.5--z3; % upper lobe
+draw flex(z2,z1.5,z1); % lower lobe
+endchar;
+
+beginpunkchar("C",13,1,2);
+z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=(.6w,0); z5=(w-2u,.2h);
+pd z1; pd z5; draw z1..z2..z3..z4..z5; % arc
+endchar;
+
+beginpunkchar("D",14,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6h);
+pd z1; pd z2; draw flex(z1,z3,z2); % lobe
+draw z1--z2; % stem
+endchar;
+
+beginpunkchar("E",12,.5,1);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2.5u,h); z4=pp(w-2u,0);
+pd z3; pd z4; draw z4--z1--z2--z3; % stem and arms
+z5=pp(2u,.6h); z6=pp(w-3u,.6h); pd z5; pd z6; draw z5--z6; % crossbar
+endchar;
+
+beginpunkchar("F",12,.5,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,h);
+pd z1; pd z3; draw z1--z2--z3; % stem and arm
+z5=pp(2u,.6h); z6=pp(w-3u,.6h); z4=pp .5[z5,z6]-(0,.1h);
+pd z5; pd z6; draw flex (z5,z4,z6); % crossbar
+endchar;
+
+beginpunkchar("G",13,.5,.5);
+z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=pp(.6w,0); z5=(w-2u,0);
+pd z1; draw z1..z2..z3..z4---z5; % arc
+z6=pp(.5[u,x5],.4h); pd z6; pd z5; draw z6--(pp(x5,y6))--z5; % spur
+endchar;
+
+beginpunkchar("H",14,1,.5);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h);
+z5=pp(2u,.6h); z6=pp(w-2u,.6h);
+pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw flex(z3,z6,z4); % stems
+pd z5; draw z5--z6; % crossbar
+endchar;
+
+beginpunkchar("I",5,1,2);
+z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h);
+pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem
+endchar;
+
+beginpunkchar("J",9,1,2);
+z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0);
+pd z1; pd z3; draw z1--z2--z3; % arc
+endchar;
+
+beginpunkchar("K",14,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(2u,1/3h); z4=pp(w-1.5u,h);
+pd z1; pd z2; draw z1--z2; % stem
+pd z3; pd z4; draw z3--z4; % upper diagonal
+z6=pp(w-u,0); z5=1/3[z3,z4];
+pd z6; draw flex(z5,.8[z1,2/3[z5,z6] ],z6);% lower diagonal
+endchar;
+
+beginpunkchar("L",11,1,2);
+z1=pp(2u,h); z2=pp(2u,0); z3=pp(w-1.5u,0);
+pd z1; pd z3; draw z1--z2--z3; % stem and arm
+endchar;
+
+beginpunkchar("M",17,.5,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(.5w,0); z4=pp(w-2u,h); z5=pp(w-2u,0);
+pd z1; pd z5; draw z1--z2--z3--z4--z5; % stems and diagonals
+endchar;
+
+beginpunkchar("N",13,.75,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h);
+pd z1; pd z4; draw z1--z2--z3--z4; % stems and diagonals
+endchar;
+
+beginpunkchar("O",12,.5,2);
+z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h);
+pd z1; draw z1{left}..z2..z3..z4..z1; % bowl
+endchar;
+
+beginpunkchar("P",13,1,2);
+z1=pp(2u,0); z2=pp(2u,1.1h); z3=pp(2u,.5h); z4=pp(w,.6[y3,y2]);
+pd z1; pd z3; draw z1--z2--z4--z3; % stem and bowl
+endchar;
+
+beginpunkchar("Q",14,.5,2);
+z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h);
+pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl
+z5=pp(.4w,.2h); z6=pp(w-u,-.1h); z7=pp(.5[x5,x6],-.2h);
+pd z5; pd z6; draw z5--z7--z6; % tail
+endchar;
+
+beginpunkchar("R",16,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6[y2,y4]); z4=pp(2u,.5h); z5=pp(w-1.5u,0);
+pd z1; pd z2; pd z5; draw z1--flex(z2,z3,z4)--z5; % stem, bowl, and diagonal
+endchar;
+
+beginpunkchar("S",11,.3,1);
+z1=pp(w-2u,.9h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.6[z6,z2];
+z5=pp(w-u,.35h); z6=pp(.5w,u); z7=pp(u,.2h);
+pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % stroke
+endchar;
+
+beginpunkchar("T",13,.75,2);
+z1=pp(u,h); z2=pp(w-u,h); z3=pp(.5w,0);
+pd z1; pd z2; pd z3; draw z1--z2; % arms
+draw .5[z1,z2]--z3; % stem
+endchar;
+
+beginpunkchar("U",13,.3,2);
+z1=pp(2u,h); z2=pp(2u,.2h); z3=pp(.5w,0); z4=pp(w-2u,.2h); z5=pp(w-2u,h);
+pd z1; pd z5; draw z1---z2...z3{z4-z2}...z4---z5; % stroke
+endchar;
+
+beginpunkchar("V",13,1,2);
+z1=pp(1.5u,h); z2=pp(.5w,0); z3=pp(w-1.5u,h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar("W",18,1,2);
+z1=pp(1.5u,h); z2=pp(.5[x1,x3],0); z3=pp(.5w,.8h); z4=pp(.5[x3,x5],0);
+z5=pp(w-1.5u,h);
+pd z1; pd z5; draw z1--z2--z3--z4--z5; % diagonals
+endchar;
+
+beginpunkchar("X",13,1,1);
+z1=pp(1.5u,h); z2=pp(w-1.5u,0); z3=pp(1.5u,0); z4=pp(w-2.5u,h);
+pd z1; pd z2; draw z1--z2; % main diagonal
+pd z3; pd z4; draw z3--z4; % cross diagonal
+endchar;
+
+beginpunkchar("Y",13,1,2);
+z1=pp(1.5u,h); z2=pp(w-1.5u,h); z3=pp(.5w,.5h); z4=pp(.5w,0);
+pd z1; pd z2; pd z4; draw z1--z3--z4; % stem and left diagonal
+draw z2--z3; % right diagonal
+endchar;
+
+beginpunkchar("Z",11,1,2);
+z1=pp(1.5u,h); z2=pp(w-2.5u,h); z3=pp(1.5u,0); z4=pp(w-1.5u,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % diagonals
+endchar;
+
+beginpunkchar(198,16,1,2); % \AE
+z1=pp(1.5u,0); z2=pp(.6w,h); z3=pp(w-1.5u,h);
+pd z1; pd z3; draw z1--z2--z3; % left diagonal and upper arm
+z4=pp .3[z1,z2]; z5=pp(.6w,0); z6=pp(w-2u,.3h);
+pd z4; pd z6; draw z4--z6; % crossbar
+z7=pp(w-u,0); pd z2; pd z7; draw z2--z5--z7; % stem and lower arm
+endchar;
+
+beginpunkchar(338,18,1,2); % \OE
+z1=pp(.5w,h); z2=pp(u,.4h); z3=pp(.5w,0);
+pd z1; draw z1..z2..{right}z3; % bowl
+z4=pp(w-1.5u,h); z5=pp(w-2u,.4h); z6=pp(w-u,0);
+pd z4; pd z6; draw z4--z1--z3--z6; % arms and stem
+pd z5; draw z5--.4[z3,z1]; % crossbar
+endchar;
+
+beginpunkchar(216,14,1,1); % \O
+z1=pp(.5w,h); z2=pp(u,.5h); z3=pp(.5w,0); z4=pp(w-u,.5h);
+z5=pp(w-2u,1.1h); z6=pp(2u,-.1h);
+pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % bowl and diagonal
+endchar;
+
+beginpunkchar(915,11,1,2); % $\Gamma$
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-1.5u,h);
+pd z1; pd z3; draw z1--z2--z3; % stem and arm
+endchar;
+
+beginpunkchar(916,15,1,2); % $\Delta$
+z1=pp(u,0); z2=pp(.5w,h); z3=pp(w-u,0);
+pd z1; draw z1--z2..tension 5..z3..tension 5..z1; % triangle
+endchar;
+
+beginpunkchar(920,15,.5,2); % $\Theta$
+z1=pp(.5w,h); z2=pp(u,.6h); z3=pp(.5w,0); z4=pp(w-u,.6h);
+pd z1; draw z1..tension.8..z2..z3..z4..tension.8..z1; % bowl
+z5=pp(x2+2u,.4h); z6=pp(x4-2u,.4h); pd z5; pd z6; draw z5--z6; % bar
+endchar;
+
+beginpunkchar(923,12,1,2); % $\Lambda$
+z1=pp(u,0); z2=pp(.5w,h); z3=pp(w-u,0);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar(926,12,1,1); % $\Xi$
+z1=pp(u,h); z2=pp(w-u,h); pd z1; pd z2; draw z1--z2; % upper arm
+z3=pp(2u,.55h); z4=pp(w-2u,.55h); pd z3; pd z4; draw z3--z4; % bar
+z5=pp(u,0); z6=pp(w-u,0); pd z5; pd z6; draw z5--z6; % lower arm
+endchar;
+
+beginpunkchar(928,13,1,.5); % $\Pi$
+z1=pp(1.5u,0); z2=pp(1.5u,h); z3=pp(w-1.5u,h); z4=pp(w-1.5u,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % stems and bar
+endchar;
+
+beginpunkchar(930,13,1,1); % $\Sigma$
+z1=pp(w-u,h); z2=pp(u,h); z3=pp(.5w-u,.5h); z4=pp(u,0); z5=pp(w-u,0);
+pd z1; pd z5; draw z1--z2{.5[z4,z5]-z2}..z3--z4--z5; % arms and diagonals
+endchar;
+
+beginpunkchar(932,15,1,.5); % $\Upsilon$
+z1=pp(u,.8h); z2=pp(.3w,h); z3=pp(.5w,.5h); z4=pp(.5w,0);
+pd z1; pd z4; draw z1..z2..tension2..z3---z4; % left arc and stem
+z5=pp(w-u,.8h); z6=pp(.7w,h);
+pd z5; draw z5..z6..tension2..{z4-z3}z3; % right arc
+endchar;
+
+beginpunkchar(933,13,1,2); % $\Phi$
+z1=pp(.5w,h); z2=pp(.5w,0); pd z1; pd z2; draw z1--z2; % stem
+z3=pp(.5w,2/3h); z4=pp(u,.5h); z5=pp(.5w,1/4h); z6=pp(w-u,.5h);
+pd z3; draw z3..z4..z5..z6..z3; % bowl
+endchar;
+
+beginpunkchar(936,14,1,1); % $\Psi$
+z1=pp(.5w,h); z2=pp(.5w,0); pd z1; pd z2; draw z1--z2; % stem
+z3=pp(u,.8h); z4=pp(.5w,.2h); z5=pp(w-u,.8h);
+pd z3; pd z5; draw z3{.4[z1,z2]-z3}..z4{right}..{z5-.4[z1,z2]}z5; % stroke
+endchar;
+
+beginpunkchar(937,13,1,2); % $\Omega$
+z1=pp(u,0); z2=pp(1/3w,0); z3=pp(u,2/3h); z4=pp(.5w,h);
+z5=pp(w-u,2/3h); z6=pp(2/3w,0); z7=pp(w-u,0);
+pd z1; pd z7; draw z1--z2{up}..z3..z4..z5..{down}z6--z7; % bowl and arms
+endchar;
+
+beginpunkchar(".",5,1,2);
+pd pp(.5w,0); % dot
+endchar;
+
+beginpunkchar(",",5,.5,.5);
+z1=pp(.5w,0); z2=pp(w-u,-.1h); z3=pp(.5w,-.3h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+beginpunkchar(":",5,1,.5);
+pd pp(.5w,0); pd pp(.5w,.4h); % dots
+endchar;
+
+beginpunkchar(";",5,.5,.5);
+z1=pp(.5w,0); z2=pp(w-u,-.1h); z3=pp(.5w,-.3h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+pd pp(.5w,.4h); % dot
+endchar;
+
+beginpunkchar("!",5,.5,.5);
+pd pp(.5w,0); % dot
+z1=pp(.5w,1.05h); z2=pp(.5w,.3h); pd z1; pd z2; draw z1--z2; % stem
+endchar;
+
+beginpunkchar(161,5,.5,.5); % spanish inverted !
+pd pp(.5w,.9h); % dot
+z1=pp(.5w,-.1h); z2=pp(.5w,.6h); pd z1; pd z2; draw z1--z2; % stem
+endchar;
+
+beginpunkchar("?",9,1,.5);
+z1=pp(1.5u,.8h); z2=pp(.5w,h); z3=pp(w-u,.8h); z4=pp(.5w,.3h);
+pd z1; pd z4; draw z1..z2..z3..{down}z4; % arc and stem
+pd pp(.5w,0); % dot
+endchar;
+
+beginpunkchar(191,9,1,.5); % spanish inverted ?
+z1=pp(1.5u,.1h); z2=pp(.5w,-.1h); z3=pp(w-u,.1h); z4=pp(.5w,.6h);
+pd z1; pd z4; draw z1..z2..z3..{up}z4; % arc and stem
+pd pp(.5w,.9h); % dot
+endchar;
+
+beginpunkchar("&",14,.5,.5);
+z1=pp(w-2u,h); z2=pp(u,h); z3=pp(3u,0); z5=pp(w-u,.6h); z6=pp(w-2u,0);
+pd z1; pd z5; draw z1--z2--z3--z5; % arms and stem
+draw z1--.5[z2,z3]; pd z6; draw z6--.6[z3,z5]; % diagonals
+endchar;
+
+beginpunkchar("$",12,.5,.5);
+z1=pp(w-1.5u,.7h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.5[z3,z5];
+z5=pp(w-u,.3h); z6=pp(.5w,0); z7=pp(u,.3h);
+pd z1; pd z7; draw z1..z2..z3..z4..z5..z6..z7; % stroke
+z8=z2+(0,.1h); pd z8; draw z8--z6; % stem
+endchar;
+
+beginpunkchar("%",18,.5,.5);
+z1=pp(3.5u,1.1h); z2=pp(u,.8h); z3=pp(3.5u,.5h); z4=pp(6u,.8h);
+z5=pp(w-3.5u,.5h); z6=pp(w-6u,.2h); z7=pp(w-3.5u,-.1h); z8=pp(w-u,.2h);
+pd z1; draw z1..z2..z3..z4..z1; % upper bowl
+pd z5; draw z5..z6..z7..z8..z5; % lower bowl
+z9=pp(w-3u,1.1h); z0=pp(3u,-.1h); pd z0; draw z9--z0; % diagonal
+draw z1{z5-z1}..z9; % link
+endchar;
+
+beginpunkchar("@",18,1,.5);
+z1=pp(2u,0); z2=pp(1/3w,.7h); z3=pp(w-6u,0);
+z4=pp(w,.3h); z5=pp(1/3w,h); z6=pp(u,.5h); z7=.7[z2,z3];
+pd z1; pd z7; draw z1--z2--z3{right}..z4..z5..z6..z7; % diagonals and stroke
+endchar;
+
+beginpunkchar("-",7,.5,.5);
+z1=pp(u,.4h); z2=pp(w-u,.5h); pd z1; pd z2; draw z1--z2; % bar
+endchar;
+
+beginpunkchar(8211,9,.5,.5); % --
+z1=pp(0,.5h); z2=pp(w,.4h); pd z1; pd z2; draw z1--z2; % bar
+endchar;
+
+beginpunkchar(8212,18,.5,.5); % ---
+z1=pp(0,.5h); z2=pp(w,.4h); pd z1; pd z2; draw z1--z2; % bar
+endchar;
+
+beginpunkchar("+",9,.5,1);
+z1=pp(0,.5h); z2=pp(w,.5h); pd z1; pd z2; draw z1--z2; % bar
+z3=pp(.5w,.1h); z4=pp(.5w,.9h); pd z3; pd z4; draw z3--z4; % stem
+endchar;
+
+beginpunkchar("*",13,.5,1);
+z0=pp(.5w,1.1h); z1=pp(u,.9h); z2=pp(2u,.3h); z3=pp(w-u,.3h); z4=pp(w-u,.9h);
+pd z0; draw z0--z2..1/3[.5[z2,z4],z0]..z4--z1--z3--z0; % star
+endchar;
+
+beginpunkchar(39,5,.5,1.5); % ' apostrofe HH/TH (to be checked)
+z1=pp(w/2,h); z2=pp(w/2+u,.85h); z3=pp(w/2,2/3h);
+pd z1; pd z3; draw z1..z2..z3; % stroke
+endchar;
+
+beginpunkchar(34,9,1,1.5); % " HH/TH (to be checked)
+z1=pp(1.5u,h); z2=pp(1.5u,.6h); z3=pp(w-1.5u,h); z4=pp(w-1.5u,.6h);
+pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw z3--z4;
+endchar;
+
+beginpunkchar(8216,5,.3,.5); % `
+z1=pp(w-1.5u,h); z2=pp(u,.85h); z3=pp(w-u,2/3h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+beginpunkchar(8217,5,.3,.5); % '
+z1=pp(1.5u,h); z2=pp(w-u,.85h); z3=pp(u,2/3h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+beginpunkchar(8220,9,.3,.5); % `` quotedblleft
+z1=pp(.5w+.5u,h); z2=pp(w-u,.6h); z3=pp(u,.95h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+beginpunkchar(8221,9,.3,.5); % '' quotedblright
+z1=pp(.5w-.5u,h); z2=pp(u,.6h); z3=pp(w-u,.95h);
+pd z1; pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+beginpunkchar("(",7,.5,.5);
+z1=pp(w-u,h); z2=pp(u,.5h); z3=pp(w-u,0);
+pd z1; pd z3; draw z1..z2..z3; % stroke
+endchar;
+
+beginpunkchar(")",7,.5,.5);
+z1=pp(u,h); z2=pp(w-u,.5h); z3=pp(u,0); pd z1; pd z3; draw z1..z2..z3; % stroke
+endchar;
+
+beginpunkchar("[",8,.5,.5);
+z1=pp(w-u,h); z2=pp(.5w,h); z3=pp(.5w,0); z4=pp(w-u,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % bars and stem
+endchar;
+
+beginpunkchar("]",8,.5,.5);
+z1=pp(u,h); z2=pp(.5w,h); z3=pp(.5w,0); z4=pp(u,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % bars and stem
+endchar;
+
+beginpunkchar("<",9,.5,.5);
+z1=pp(w-u,.9h); z2=pp(u,.5h); z3=pp(w-u,.1h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar(">",9,.5,.5);
+z1=pp(u,.9h); z2=pp(w-u,.5h); z3=pp(u,.1h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar("{",10,.5,.5); % HH/TH
+z1=pp(w-2u,h); z3=pp(2u,.5h); z5=pp(w-2u,0);
+z2=pp(w-4u,.6h); z4=(w-4u,.4h);
+pd z1; pd z3; pd z5; draw z1{left}..z2--z3 & z3--z4..{right}z5;
+endchar;
+
+beginpunkchar("}",10,.5,.5); % HH/TH
+z1=pp(2u,h); z3=pp(w-2u,.5h); z5=pp(2u,0);
+z2=pp(4u,.6h); z4=(4u,.4h);
+pd z1; pd z3; pd z5; draw z1{right}..z2--z3 & z3--z4..{left}z5;
+endchar;
+
+beginpunkchar("=",9,.5,.5);
+z5=pp(u,2/3h); z6=pp(w-u,2/3h); pd z5; pd z6; draw z5--z6; % upper bar
+z7=pp(u,1/3h); z8=pp(w-u,1/3h); pd z7; pd z8; draw z7--z8; % lower bar
+endchar;
+
+beginpunkchar("#",15,.5,.5);
+z1=pp(.5w,h); z2=pp(3u,0); z3=pp(w-3u,h); z4=pp(.5w,0);
+pd z2; pd z3; draw z3--z1--z2; draw z3--z4--z2; % diagonals (linked)
+z5=pp(u,2/3h); z6=pp(w-u,2/3h); pd z5; pd z6; draw z5--z6; % upper bar
+z7=pp(u,1/3h); z8=pp(w-u,1/3h); pd z7; pd z8; draw z7--z8; % lower bar
+endchar;
+
+beginpunkchar("/",9,1,1);
+z1=pp(1.5u,-.05h); z2=pp(w-1.5u,1.05h); pd z1; pd z2; draw z1--z2; % diagonal
+endchar;
+
+beginpunkchar("\",9,1,1); % HH/TH
+z1=pp(1.5u,1.05h); z2=pp(w-1.5u,-.05h); pd z1; pd z2; draw z1--z2; % reverse diagonal
+endchar;
+
+
+beginpunkchar("0",9,.5,1);
+z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h);
+pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl
+endchar;
+
+beginpunkchar("1",9,.3,1);
+z1=pp(2u,.7h); z2=pp(.6w,h); z3=pp(.6w,0);
+pd z1; pd z3; draw z1--z2--z3; % serif and stem
+endchar;
+
+beginpunkchar("2",9,1,1);
+z1=pp(2u,.7h); z2=pp(.5w,h); z3=pp(w-u,.6h); z4=pp(u,0); z5=pp(w-2u,0);
+pd z1; pd z5; draw z1..z2..z3..z4--z5; % stroke
+endchar;
+
+beginpunkchar("3",9,.5,.5);
+z1=pp(2u,.7h); z2=pp(.5w,h); z3=pp(w-u,.5[y2,y4]);
+z4=pp(.5w-u,.55h); z5=pp(w-u,.5[y4,y6]); z6=pp(.5w,0); z7=pp(1.5u,.2h);
+pd z1; pd z7; draw z1..z2..z3..z4&z4..z5..z6..z7; % arcs
+endchar;
+
+beginpunkchar("4",9,1,1);
+z1=pp(w-u,.3h); z2=pp(u,.3h); z3=pp(2/3w,h); z4=pp(2/3w,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % stem and diagonals
+endchar;
+
+beginpunkchar("5",9,.5,.5);
+z1=pp(w-2u,h); z2=pp(2u,h); z3=pp(u,.7h); z4=pp(w-u,.5[y3,y5]);
+z5=pp(.5w,0); z6=pp(u,.2h);
+pd z1; pd z6; draw z1--z2--z3..z4..z5..z6; % stroke
+endchar;
+
+beginpunkchar("6",9,1,1);
+z1=pp(2/3w,h); z2=pp(u,.3h); z3=pp(.5w,0); z4=pp(w-u,.3h); z5=pp(.6w,.6h);
+z6=pp z2; pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % stroke
+endchar;
+
+beginpunkchar("7",9,.5,1);
+z1=pp(2u,h); z2=pp(w-.5u,h); z3=pp(.4w,0);
+pd z1; pd z3; draw z1--z2&z2..z3{down}; % stroke
+endchar;
+
+beginpunkchar("8",9,.5,.5);
+z1=pp(.5w,h); z2=pp(u,.5[y1,y3]); z3=pp(.5w,.6h); z4=pp(w-u,.5[y3,y5]);
+z5=pp(.5w,0); z6=pp(u,.5[y5,y3]); z7=pp(w-u,.5[y1,y3]);
+pd z1; draw z1{curl 8}..z2..z3..z4..z5..z6..z3..z7..z1; % stroke
+endchar;
+
+beginpunkchar("9",9,1,1);
+z1=pp(1/3w,0); z2=pp(w-u,.7h); z3=pp(.5w,h); z4=pp(u,.7h); z5=pp(.5w,.4h);
+pd z1; pd z5; draw z1..z2..z3..z4..z5; % stroke
+endchar;
+
+beginpunkchar(96,9,1,1); % \`{} grave
+z1=pp(2.5u,h); z2=pp(.6w,.8h); pd z1; pd z2; draw z1--z2; % diagonal
+endchar;
+
+beginpunkchar(180,9,1,1); % \'{} acute
+z1=pp(w-2.5u,h); z2=pp(.4w,.8h); pd z1; pd z2; draw z1--z2; % diagonal
+endchar;
+
+beginpunkchar(710,13,1,1); % \^{} circumflex
+z1=pp(2.5u,.8h); z2=pp(.5w,h); z3=(w-2.5u,.8h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar(711,13,1,1); % \v{} caron
+z1=pp(2.5u,.9h); z2=pp(.5w,.7h); z3=pp(w-2.5u,.9h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar(728,11,1,1); % \u{} breve
+z1=pp(2u,h); z2=pp(.5w,.75h); z3=pp(w-2u,h);
+pd z1; pd z3; draw flex(z1,z2,z3); % stroke
+endchar;
+
+beginpunkchar(175,12,1,1); % \={} macron
+z1=pp(u,.8h); z2=pp(w-u,.8h); pd z1; pd z2; draw z1--z2; % bar
+endchar;
+
+beginpunkchar(729,5,1,1); % \.{}
+pd pp(.5w,.9h); % dot
+endchar;
+
+beginpunkchar(168,13,1,1); % \"{} diaeresis
+pd pp(1/5w,.9h); pd pp(4/5w,.9h); % dots
+endchar;
+
+beginpunkchar(732,13,1,1); % \~{} tilde
+z1=pp(u,.75h); z2=pp(w-u,.9h); pd z1; pd z2; draw z1{up}..{up}z2; % stroke
+endchar;
+
+beginpunkchar(733,13,1,1); % \H{} hungarumlaut
+z1=pp(4u,h); z2=pp(2.5u,.7h); z3=pp(w-2u,h); z4=pp(w-3.5u,.7h);
+pd z1; pd z3; draw z1--z2--z4--z3; % diagonals (linked)
+endchar;
+
+beginpunkchar(730,13,0,0); % Scandinavian loop, for \AA\ and \aa (ring)
+z0=(.5w,.66h); % point $z^2$ of lowercase A
+z1=(.5w,.9h); draw z0{z0-(1.5u,0)}..z1..{(w-1.5u,0)-z0}z0; % loop
+endchar;
+
+beginpunkchar(184,13,.5,.5); % Cedilla, for \c c
+z1=(.6w,0); z2=pp(.6w,-.1h); z3=pp(2.5u,-.1h);
+pd z3; draw z1--z2--z3; % stroke
+endchar;
+
+initialize_punk_lower ;
+
+beginpunkchar(305,5,1,2); % dotless I
+z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h);
+pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem
+endchar;
+
+beginpunkchar(567,9,1,2); % dotless J
+z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0);
+pd z1; pd z3; draw z1--z2--z3; % arc
+endchar;
+
+beginpunkchar(223,18,.3,1); % German SS
+z1=pp(.5w-u,.9h); z2=pp(1/3w,h); z3=pp(u,.7h); z4=.6[z6,z2];
+z5=pp(.5w,.35h); z6=pp(1/3w,u); z7=pp(u,.2h);
+pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % left stroke
+for i=1 upto 7: z[i+10]=pp(z[i] shifted (.5w-u,0)); endfor
+pd z11; pd z17; draw z11--z12...z13..z14..z15...z16--z17; % right stroke
+endchar;
+
+beginpunkchar("a",13,1,2);
+z1=pp(1.5u,0); z2=(.5w,1.1h); z3=pp(w-1.5u,0);
+pd z1; pd z3; draw z1--z2--z3; % left and right diagonals
+z4=pp .3[z1,z2]; z5=pp .3[z3,z2]; pd z4; pd z5; draw z4--z5; % crossbar
+endchar;
+
+beginpunkchar("b",12,1,1);
+z1=pp(2u,0); z2=pp(2u,.6h); z3=pp(2u,h); pd z1; pd z3; draw z1--z3; % stem
+z1.5=pp(w-u,.5y2); z2.5=pp(w-u,.5[y2,y3]); draw z2--z2.5--z3; % upper lobe
+draw flex(z2,z1.5,z1); % lower lobe
+endchar;
+
+beginpunkchar("c",13,1,2);
+z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=(.6w,0); z5=(w-2u,.2h);
+pd z1; pd z5; draw z1..z2..z3..z4..z5; % arc
+endchar;
+
+beginpunkchar("d",14,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6h);
+pd z1; pd z2; draw flex(z1,z3,z2); % lobe
+draw z1--z2; % stem
+endchar;
+
+beginpunkchar("e",12,.5,1);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2.5u,h); z4=pp(w-2u,0);
+pd z3; pd z4; draw z4--z1--z2--z3; % stem and arms
+z5=pp(2u,.6h); z6=pp(w-3u,.6h); pd z5; pd z6; draw z5--z6; % crossbar
+endchar;
+
+beginpunkchar("f",12,.5,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,h);
+pd z1; pd z3; draw z1--z2--z3; % stem and arm
+z5=pp(2u,.6h); z6=pp(w-3u,.6h); z4=pp .5[z5,z6]-(0,.1h);
+pd z5; pd z6; draw flex (z5,z4,z6); % crossbar
+endchar;
+
+beginpunkchar("g",13,.5,.5);
+z1=pp(w-2u,.8h); z2=pp(.6w,h); z3=pp(u,.5h); z4=pp(.6w,0); z5=(w-2u,0);
+pd z1; draw z1..z2..z3..z4---z5; % arc
+z6=pp(.5[u,x5],.4h); pd z6; pd z5; draw z6--(pp(x5,y6))--z5; % spur
+endchar;
+
+beginpunkchar("h",14,1,.5);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h);
+z5=pp(2u,.6h); z6=pp(w-2u,.6h);
+pd z1; pd z2; pd z3; pd z4; draw z1--z2; draw flex(z3,z6,z4); % stems
+pd z5; draw z5--z6; % crossbar
+endchar;
+
+beginpunkchar("i",5,1,2);
+z1=pp(.5w,0); z2=(.5w,1/3h); z3=(.5w,2/3h); z4=(.5w,h);
+pd z1; pd z4; draw flex(z1,z2,z3,z4); % stem
+endchar;
+
+beginpunkchar("j",9,1,2);
+z1=pp(w-2u,h); z2=pp(w-2u,-.1h); z3=pp(u,0);
+pd z1; pd z3; draw z1--z2--z3; % arc
+endchar;
+
+beginpunkchar("k",14,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(2u,1/3h); z4=pp(w-1.5u,h);
+pd z1; pd z2; draw z1--z2; % stem
+pd z3; pd z4; draw z3--z4; % upper diagonal
+z6=pp(w-u,0); z5=1/3[z3,z4];
+pd z6; draw flex(z5,.8[z1,2/3[z5,z6] ],z6);% lower diagonal
+endchar;
+
+beginpunkchar("l",11,1,2);
+z1=pp(2u,h); z2=pp(2u,0); z3=pp(w-1.5u,0);
+pd z1; pd z3; draw z1--z2--z3; % stem and arm
+endchar;
+
+beginpunkchar("m",17,.5,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(.5w,0); z4=pp(w-2u,h); z5=pp(w-2u,0);
+pd z1; pd z5; draw z1--z2--z3--z4--z5; % stems and diagonals
+endchar;
+
+beginpunkchar("n",13,.75,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-2u,0); z4=pp(w-2u,h);
+pd z1; pd z4; draw z1--z2--z3--z4; % stems and diagonals
+endchar;
+
+beginpunkchar("o",12,.5,2);
+z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h);
+pd z1; draw z1{left}..z2..z3..z4..z1; % bowl
+endchar;
+
+beginpunkchar("p",13,1,2);
+z1=pp(2u,0); z2=pp(2u,1.1h); z3=pp(2u,.5h); z4=pp(w,.6[y3,y2]);
+pd z1; pd z3; draw z1--z2--z4--z3; % stem and bowl
+endchar;
+
+beginpunkchar("q",14,.5,2);
+z1=pp(.5w,h); z2=pp(u,.55h); z3=pp(.5w,0); z4=pp(w-u,.55h);
+pd z1; draw z1{curl 2}..z2..z3..z4..z1; % bowl
+z5=pp(.4w,.2h); z6=pp(w-u,-.1h); z7=pp(.5[x5,x6],-.2h);
+pd z5; pd z6; draw z5--z7--z6; % tail
+endchar;
+
+beginpunkchar("r",16,1,2);
+z1=pp(2u,0); z2=pp(2u,h); z3=pp(w-u,.6[y2,y4]); z4=pp(2u,.5h); z5=pp(w-1.5u,0);
+pd z1; pd z2; pd z5; draw z1--flex(z2,z3,z4)--z5; % stem, bowl, and diagonal
+endchar;
+
+beginpunkchar("s",11,.3,1);
+z1=pp(w-2u,.9h); z2=pp(.5w,h); z3=pp(u,.7h); z4=.6[z6,z2];
+z5=pp(w-u,.35h); z6=pp(.5w,u); z7=pp(u,.2h);
+pd z1; pd z7; draw z1--z2...z3..z4..z5...z6--z7; % stroke
+endchar;
+
+beginpunkchar("t",13,.75,2);
+z1=pp(u,h); z2=pp(w-u,h); z3=pp(.5w,0);
+pd z1; pd z2; pd z3; draw z1--z2; % arms
+draw .5[z1,z2]--z3; % stem
+endchar;
+
+beginpunkchar("u",13,.3,2);
+z1=pp(2u,h); z2=pp(2u,.2h); z3=pp(.5w,0); z4=pp(w-2u,.2h); z5=pp(w-2u,h);
+pd z1; pd z5; draw z1---z2...z3{z4-z2}...z4---z5; % stroke
+endchar;
+
+beginpunkchar("v",13,1,2);
+z1=pp(1.5u,h); z2=pp(.5w,0); z3=pp(w-1.5u,h);
+pd z1; pd z3; draw z1--z2--z3; % diagonals
+endchar;
+
+beginpunkchar("w",18,1,2);
+z1=pp(1.5u,h); z2=pp(.5[x1,x3],0); z3=pp(.5w,.8h); z4=pp(.5[x3,x5],0);
+z5=pp(w-1.5u,h);
+pd z1; pd z5; draw z1--z2--z3--z4--z5; % diagonals
+endchar;
+
+beginpunkchar("x",13,1,1);
+z1=pp(1.5u,h); z2=pp(w-1.5u,0); z3=pp(1.5u,0); z4=pp(w-2.5u,h);
+pd z1; pd z2; draw z1--z2; % main diagonal
+pd z3; pd z4; draw z3--z4; % cross diagonal
+endchar;
+
+beginpunkchar("y",13,1,2);
+z1=pp(1.5u,h); z2=pp(w-1.5u,h); z3=pp(.5w,.5h); z4=pp(.5w,0);
+pd z1; pd z2; pd z4; draw z1--z3--z4; % stem and left diagonal
+draw z2--z3; % right diagonal
+endchar;
+
+beginpunkchar("z",11,1,2);
+z1=pp(1.5u,h); z2=pp(w-2.5u,h); z3=pp(1.5u,0); z4=pp(w-1.5u,0);
+pd z1; pd z4; draw z1--z2--z3--z4; % diagonals
+endchar;
+
+beginpunkchar(230,16,1,2); % \ae
+z1=pp(1.5u,0); z2=pp(.6w,h); z3=pp(w-1.5u,h);
+pd z1; pd z3; draw z1--z2--z3; % left diagonal and upper arm
+z4=pp .3[z1,z2]; z5=pp(.6w,0); z6=pp(w-2u,.3h);
+pd z4; pd z6; draw z4--z6; % crossbar
+z7=pp(w-u,0); pd z2; pd z7; draw z2--z5--z7; % stem and lower arm
+endchar;
+
+beginpunkchar(339,18,1,2); % \oe
+z1=pp(.5w,h); z2=pp(u,.4h); z3=pp(.5w,0);
+pd z1; draw z1..z2..{right}z3; % bowl
+z4=pp(w-1.5u,h); z5=pp(w-2u,.4h); z6=pp(w-u,0);
+pd z4; pd z6; draw z4--z1--z3--z6; % arms and stem
+pd z5; draw z5--.4[z3,z1]; % crossbar
+endchar;
+
+beginpunkchar(248,14,1,1); % \o
+z1=pp(.5w,h); z2=pp(u,.5h); z3=pp(.5w,0); z4=pp(w-u,.5h);
+z5=pp(w-2u,1.1h); z6=pp(2u,-.1h);
+pd z1; pd z6; draw z1..z2..z3..z4..z5--z6; % bowl and diagonal
+endchar;
+
+revert_punk_lower;
+
+beginpunkchar("_",12,.5,.5); % _
+z1=pp(0,-.2h); z2=pp(w,-.2h); pd z1; pd z2; draw z1--z2; % bar
+endchar;
+
+beginpunkchar("^",12,1,.5); %
+z1=pp(.5w,h); z2=pp(1.5u,.6h); z3=pp(w-1.5u,.6h);
+pd z2; pd z3; draw z2--z1--z3;
+endchar;