Debian Codegraph @

texk/web2c/xetexdir/char-warning-xetex.ch

raw
1 % $Id: char-warning-xetex.ch 57769 2021-02-17 03:03:54Z karl $
2 % Public domain. See ../pdftexdir/char-warning-pdftex.ch for basic info.
3 % In addition to the basic change, we also define a new procedure
4 % print_ucs_code to print in the format U+.... for system fonts.
5 %
6 % To test:
7 % xetex -ini
8 % \font\x=/usr/local/texlive/2020/texmf-dist/fonts/tfm/public/knuth-lib/logo10.tfm
9 % \tracinglostchars=3 \x \char99\end
10 % should get:
11 % ! Missing character: There is no c ("63) in font logo10.
12 % And:
13 % \font\y="Nimbus Mono" \tracinglostchars=3 \y \char43981\end
14 % should get:
15 % ! Missing character: There is no ꯍ (U+ABCD) in font Nimbus Mono Regular!.
16 % Assuming that font is findable as a system font, e.g., shown by
17 % fc-list :scalable=true family
18
19 @x [30] If \tracinglostchars > 2, then promote to full error.
20 procedure char_warning(@!f:internal_font_number;@!c:integer);
21 var old_setting: integer; {saved value of |tracing_online|}
22 begin if tracing_lost_chars>0 then
23 begin old_setting:=tracing_online;
24 if eTeX_ex and(tracing_lost_chars>1) then tracing_online:=1;
25 begin begin_diagnostic;
26 print_nl("Missing character: There is no ");
27 @.Missing character@>
28 if c < @"10000 then print_ASCII(c)
29 else print_char(c); {non-Plane 0 Unicodes can't be sent through |print_ASCII|}
30 print(" in font ");
31 slow_print(font_name[f]); print_char("!"); end_diagnostic(false);
32 end;
33 tracing_online:=old_setting;
34 end;
35 end;
36 @y
37 procedure print_ucs_code(@!n: UnicodeScalar); { cf.~|print_hex| }
38 var k: 0..22; {index to current digit; we assume that $0\L n<16^{22}$}
39 begin
40 k := 0;
41 print("U+"); { prefix with U+ instead of " }
42 repeat
43 dig[k] := n mod 16;
44 n := n div 16;
45 incr(k);
46 until n = 0;
47 { pad to at least 4 hex digits }
48 while k < 4 do
49 begin
50 dig[k] := 0;
51 incr(k);
52 end;
53 print_the_digs(k);
54 end;
55
56 procedure char_warning(@!f:internal_font_number;@!c:integer);
57 var old_setting: integer; {saved value of |tracing_online|}
58 begin if tracing_lost_chars>0 then
59 begin old_setting:=tracing_online;
60 if eTeX_ex and(tracing_lost_chars>1) then tracing_online:=1;
61 if tracing_lost_chars > 2 then
62 print_err("Missing character: There is no ")
63 else begin
64 begin_diagnostic;
65 print_nl("Missing character: There is no ")
66 end;
67 @.Missing character@>
68 if c < @"10000 then print_ASCII(c)
69 else print_char(c); {non-Plane 0 Unicodes can't be sent through |print_ASCII|}
70 print(" (");
71 if is_native_font(f) then print_ucs_code(c)
72 else print_hex(c);
73 print(")");
74 print(" in font ");
75 slow_print(font_name[f]);
76 if tracing_lost_chars < 3 then print_char("!");
77 tracing_online:=old_setting;
78 if tracing_lost_chars > 2 then begin
79 help0;
80 error;
81 end else end_diagnostic(false);
82 end; {of |tracing_lost_chars>0|}
83 end; {of procedure}
84 @z