让我们得到十六进制

让我们得到十六进制

换句话说,问题是:为什么日志输出会抱怨源代码输入中未给出的字符?

让我们得到十六进制

这里使用 UTF-8 十六进制表示,因为我的文件使用以 UTF-8 编码的 unicode 字符。因此我使用xelatexfontspec进行排版。

源代码输入分析

从这里可以看出5c(反斜杠)后面跟着5e抑扬音符).utf-8编码源代码16进制表示相关部分:

 00000a0: 7d0a 5c5e 320a 5c65 6e64 7b64 6f63 756d  }.\^2.\end{docum

日志输出分析

这里可以看到输入源代码对应的错误导致了错误,即该字符82 毫升结合抑扬符) 缺失(UTF-8 有多字节字符)。

0004d40: 6163 7465 723a 2054 6865 7265 2069 7320  acter: There is
0004d50: 6e6f 20cc 8220 696e 2066 6f6e 7420 5b2e  no .. in font [.

例子

使用 Verdana.ttf 重现该问题,尽管我使用了不同的字体,但由于法律原因我不允许在这里分享。

\documentclass{article}
\usepackage{fontspec}
\setmainfont[
  Path = ../../Resources/Fonts/ ,
  Extension = .ttf ,
  UprightFont = *,
]{Verdana}
\begin{document}
\^2
\end{document}

终端输出

This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
(./JiraCircumflexIsolated.tex
LaTeX2e <2017-04-15>
Babel <3.13> and hyphenation patterns for 84 language(s) loaded.
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2017/texmf-dist/tex/latex/fontspec/fontspec.sty (/usr/local/texlive/2017/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/local/texlive/2017/texmf-dist/tex/latex/l3kernel/expl3-code.tex) (/usr/local/texlive/2017/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def)) (/usr/local/texlive/2017/texmf-dist/tex/latex/l3packages/xparse/xparse.sty) (/usr/local/texlive/2017/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty (/usr/local/texlive/2017/texmf-dist/tex/latex/base/fontenc.sty (/usr/local/texlive/2017/texmf-dist/tex/latex/base/tuenc.def)) (/usr/local/texlive/2017/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (./JiraCircumflexIsolated.aux) [1] (./JiraCircumflexIsolated.aux) )
(see the transcript file for additional information)
Output written on JiraCircumflexIsolated.pdf (1 page).
Transcript written on JiraCircumflexIsolated.log.

日志输出

This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017) (preloaded format=xelatex 2017.10.4)  18 OCT 2017 10:41
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**JiraCircumflexIsolated.tex
(./JiraCircumflexIsolated.tex
LaTeX2e <2017-04-15>
Babel <3.13> and hyphenation patterns for 84 language(s) loaded.
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) (/usr/local/texlive/2017/texmf-dist/tex/latex/fontspec/fontspec.sty (/usr/local/texlive/2017/texmf-dist/tex/latex/l3kernel/expl3.sty
Package: expl3 2017/09/18 L3 programming layer (loader) 
 (/usr/local/texlive/2017/texmf-dist/tex/latex/l3kernel/expl3-code.tex
Package: expl3 2017/09/18 L3 programming layer (code)
\c_max_int=\count87
\l_tmpa_int=\count88
\l_tmpb_int=\count89
\g_tmpa_int=\count90
\g_tmpb_int=\count91
\g__intarray_font_int=\count92
\g__prg_map_int=\count93
\c_log_iow=\count94
\l_iow_line_count_int=\count95
\l__iow_line_target_int=\count96
\l__iow_one_indent_int=\count97
\l__iow_indent_int=\count98
\c_zero_dim=\dimen103
\c_max_dim=\dimen104
\l_tmpa_dim=\dimen105
\l_tmpb_dim=\dimen106
\g_tmpa_dim=\dimen107
\g_tmpb_dim=\dimen108
\c_zero_skip=\skip43
\c_max_skip=\skip44
\l_tmpa_skip=\skip45
\l_tmpb_skip=\skip46
\g_tmpa_skip=\skip47
\g_tmpb_skip=\skip48
\c_zero_muskip=\muskip10
\c_max_muskip=\muskip11
\l_tmpa_muskip=\muskip12
\l_tmpb_muskip=\muskip13
\g_tmpa_muskip=\muskip14
\g_tmpb_muskip=\muskip15
\l_keys_choice_int=\count99
\c__fp_leading_shift_int=\count100
\c__fp_middle_shift_int=\count101
\c__fp_trailing_shift_int=\count102
\c__fp_big_leading_shift_int=\count103
\c__fp_big_middle_shift_int=\count104
\c__fp_big_trailing_shift_int=\count105
\c__fp_Bigg_leading_shift_int=\count106
\c__fp_Bigg_middle_shift_int=\count107
\c__fp_Bigg_trailing_shift_int=\count108
\l__sort_length_int=\count109
\l__sort_min_int=\count110
\l__sort_top_int=\count111
\l__sort_max_int=\count112
\l__sort_true_max_int=\count113
\l__sort_block_int=\count114
\l__sort_begin_int=\count115
\l__sort_end_int=\count116
\l__sort_A_int=\count117
\l__sort_B_int=\count118
\l__sort_C_int=\count119
\l__tl_build_start_index_int=\count120
\l__tl_build_index_int=\count121
\l__tl_analysis_normal_int=\count122
\l__tl_analysis_index_int=\count123
\l__tl_analysis_nesting_int=\count124
\l__tl_analysis_type_int=\count125
\l__regex_internal_a_int=\count126
\l__regex_internal_b_int=\count127
\l__regex_internal_c_int=\count128
\l__regex_balance_int=\count129
\l__regex_group_level_int=\count130
\l__regex_mode_int=\count131
\c__regex_cs_in_class_mode_int=\count132
\c__regex_cs_mode_int=\count133
\l__regex_catcodes_int=\count134
\l__regex_default_catcodes_int=\count135
\c__regex_catcode_L_int=\count136
\c__regex_catcode_O_int=\count137
\c__regex_catcode_A_int=\count138
\c__regex_all_catcodes_int=\count139
\l__regex_show_lines_int=\count140
\l__regex_min_state_int=\count141
\l__regex_max_state_int=\count142
\l__regex_left_state_int=\count143
\l__regex_right_state_int=\count144
\l__regex_capturing_group_int=\count145
\l__regex_min_pos_int=\count146
\l__regex_max_pos_int=\count147
\l__regex_curr_pos_int=\count148
\l__regex_start_pos_int=\count149
\l__regex_success_pos_int=\count150
\l__regex_curr_char_int=\count151
\l__regex_curr_catcode_int=\count152
\l__regex_last_char_int=\count153
\l__regex_case_changed_char_int=\count154
\l__regex_curr_state_int=\count155
\l__regex_step_int=\count156
\l__regex_min_active_int=\count157
\l__regex_max_active_int=\count158
\l__regex_replacement_csnames_int=\count159
\l__regex_match_count_int=\count160
\l__regex_min_submatch_int=\count161
\l__regex_submatch_int=\count162
\l__regex_zeroth_submatch_int=\count163
\g__debug_trace_regex_int=\count164
\c_empty_box=\box26
\l_tmpa_box=\box27
\l_tmpb_box=\box28
\g_tmpa_box=\box29
\g_tmpb_box=\box30
\l__box_top_dim=\dimen109
\l__box_bottom_dim=\dimen110
\l__box_left_dim=\dimen111
\l__box_right_dim=\dimen112
\l__box_top_new_dim=\dimen113
\l__box_bottom_new_dim=\dimen114
\l__box_left_new_dim=\dimen115
\l__box_right_new_dim=\dimen116
\l__box_internal_box=\box31
\l__coffin_internal_box=\box32
\l__coffin_internal_dim=\dimen117
\l__coffin_offset_x_dim=\dimen118
\l__coffin_offset_y_dim=\dimen119
\l__coffin_x_dim=\dimen120
\l__coffin_y_dim=\dimen121
\l__coffin_x_prime_dim=\dimen122
\l__coffin_y_prime_dim=\dimen123
\c_empty_coffin=\box33
\l__coffin_aligned_coffin=\box34
\l__coffin_aligned_internal_coffin=\box35
\l_tmpa_coffin=\box36
\l_tmpb_coffin=\box37
\l__coffin_display_coffin=\box38
\l__coffin_display_coord_coffin=\box39
\l__coffin_display_pole_coffin=\box40
\l__coffin_display_offset_dim=\dimen124
\l__coffin_display_x_dim=\dimen125
\l__coffin_display_y_dim=\dimen126
\l__coffin_bounding_shift_dim=\dimen127
\l__coffin_left_corner_dim=\dimen128
\l__coffin_right_corner_dim=\dimen129
\l__coffin_bottom_corner_dim=\dimen130
\l__coffin_top_corner_dim=\dimen131
\l__coffin_scaled_total_height_dim=\dimen132
\l__coffin_scaled_width_dim=\dimen133
) (/usr/local/texlive/2017/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def
File: l3xdvidpfmx.def 2017/03/18 v L3 Experimental driver: xdvipdfmx
\g__driver_image_int=\count165
\l__driver_tmp_box=\box41
)) (/usr/local/texlive/2017/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
Package: xparse 2017/09/18 L3 Experimental document command parser
\l__xparse_current_arg_int=\count166
\g__xparse_grabber_int=\count167
\l__xparse_m_args_int=\count168
\l__xparse_mandatory_args_int=\count169
\l__xparse_v_nesting_int=\count170
)
Package: fontspec 2017/09/22 v2.6e Font selection for XeLaTeX and LuaLaTeX
 (/usr/local/texlive/2017/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
Package: fontspec-xetex 2017/09/22 v2.6e Font selection for XeLaTeX and LuaLaTeX
\l__fontspec_script_int=\count171
\l__fontspec_language_int=\count172
\l__fontspec_strnum_int=\count173
\l__fontspec_tmp_int=\count174
\l__fontspec_em_int=\count175
\l__fontspec_emdef_int=\count176
\l__fontspec_strong_int=\count177
\l__fontspec_strongdef_int=\count178
\l__fontspec_tmpa_dim=\dimen134
\l__fontspec_tmpb_dim=\dimen135
\l__fontspec_tmpc_dim=\dimen136
\g__file_internal_ior=\read1
 (/usr/local/texlive/2017/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2017/04/05 v2.0i Standard LaTeX package
 (/usr/local/texlive/2017/texmf-dist/tex/latex/base/tuenc.def
File: tuenc.def 2017/04/05 v2.0i Standard LaTeX file
LaTeX Font Info:    Redeclaring font encoding TU on input line 82.
))
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \fontspec with sig. 'O{}mO{}' on line 479.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setmainfont with sig. 'O{}mO{}' on line 483.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setsansfont with sig. 'O{}mO{}' on line 487.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setmonofont with sig. 'O{}mO{}' on line 491.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setmathrm with sig. 'O{}mO{}' on line 495.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setboldmathrm with sig. 'O{}mO{}' on line 499.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setmathsf with sig. 'O{}mO{}' on line 503.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setmathtt with sig. 'O{}mO{}' on line 507.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \setromanfont with sig. 'O{}mO{}' on line 511.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newfontfamily with sig. 'mO{}mO{}' on line 515.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newfontface with sig. 'mO{}mO{}' on line 519.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \defaultfontfeatures with sig. 't+om' on line 523.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \addfontfeatures with sig. 'm' on line 527.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \addfontfeature with sig. 'm' on line 531.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newfontfeature with sig. 'mm' on line 535.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newAATfeature with sig. 'mmmm' on line 539.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newopentypefeature with sig. 'mmm' on line 543.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newICUfeature with sig. 'mmm' on line 547.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \aliasfontfeature with sig. 'mm' on line 551.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \aliasfontfeatureoption with sig. 'mmm' on line 555.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newfontscript with sig. 'mm' on line 559.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \newfontlanguage with sig. 'mm' on line 563.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \DeclareFontsExtensions with sig. 'm' on line 567.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \IfFontFeatureActiveTF with sig. 'mmm' on line 571.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \EncodingCommand with sig. 'mO{}m' on line 3563.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \EncodingAccent with sig. 'mm' on line 3569.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \EncodingSymbol with sig. 'mm' on line 3575.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \EncodingComposite with sig. 'mmm' on line 3581.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \EncodingCompositeCommand with sig. 'mmm' on line 3587.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \DeclareUnicodeEncoding with sig. 'mm' on line 3612.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \UndeclareSymbol with sig. 'm' on line 3618.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \UndeclareComposite with sig. 'mm' on line 3626.
.................................................
 (/usr/local/texlive/2017/texmf-dist/tex/latex/fontspec/fontspec.cfg)
LaTeX Info: Redefining \itshape on input line 3804.
LaTeX Info: Redefining \slshape on input line 3809.
LaTeX Info: Redefining \scshape on input line 3814.
LaTeX Info: Redefining \upshape on input line 3819.
LaTeX Info: Redefining \em on input line 3849.
LaTeX Info: Redefining \emph on input line 3874.
LaTeX Info: Redefining \- on input line 3925.
.................................................
. LaTeX info: "xparse/redefine-command"
. 
. Redefining command \oldstylenums with sig. 'm' on line 4020.
.................................................
.................................................
. LaTeX info: "xparse/define-command"
. 
. Defining command \liningnums with sig. 'm' on line 4024.
.................................................
))
\g__fontspec_family_Verdana_int=\count179
.................................................
. fontspec info: "defining-font"
. 
. Font family 'Verdana(0)' created for font 'Verdana' with options
. [Ligatures=TeX,Path = ../../Resources/Fonts/,Extension = .ttf,UprightFont =
. *].
.  
.  This font family consists of the following NFSS series/shapes:
.  
. - 'normal' (m/n) with NFSS spec.:
. <->"[../../Resources/Fonts/Verdana.ttf]/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'small caps'  (m/sc) with NFSS spec.: 
.................................................
LaTeX Info: Redefining \rmfamily on input line 7.
 (./JiraCircumflexIsolated.aux)
\openout1 = `JiraCircumflexIsolated.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for TU/lmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 8.
LaTeX Font Info:    ... okay on input line 8.
.................................................
. fontspec info: "setup-math"
. 
. Adjusting the maths setup (use [no-math] to avoid this).
.................................................
\symlegacymaths=\mathgroup4
LaTeX Font Info:    Overwriting symbol font `legacymaths' in version `bold'
(Font)                  OT1/cmr/m/n --> OT1/cmr/bx/n on input line 8.
LaTeX Font Info:    Redeclaring math accent \acute on input line 8.
LaTeX Font Info:    Redeclaring math accent \grave on input line 8.
LaTeX Font Info:    Redeclaring math accent \ddot on input line 8.
LaTeX Font Info:    Redeclaring math accent \tilde on input line 8.
LaTeX Font Info:    Redeclaring math accent \bar on input line 8.
LaTeX Font Info:    Redeclaring math accent \breve on input line 8.
LaTeX Font Info:    Redeclaring math accent \check on input line 8.
LaTeX Font Info:    Redeclaring math accent \hat on input line 8.
LaTeX Font Info:    Redeclaring math accent \dot on input line 8.
LaTeX Font Info:    Redeclaring math accent \mathring on input line 8.
LaTeX Font Info:    Redeclaring math symbol \colon on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Gamma on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Delta on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Theta on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Lambda on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Xi on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Pi on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Sigma on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Upsilon on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Phi on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Psi on input line 8.
LaTeX Font Info:    Redeclaring math symbol \Omega on input line 8.
LaTeX Font Info:    Redeclaring math symbol \mathdollar on input line 8.
LaTeX Font Info:    Redeclaring symbol font `operators' on input line 8.
LaTeX Font Info:    Encoding `OT1' has changed to `TU' for symbol font
(Font)              `operators' in the math version `normal' on input line 8.
LaTeX Font Info:    Overwriting symbol font `operators' in version `normal'
(Font)                  OT1/cmr/m/n --> TU/Verdana(0)/m/n on input line 8.
LaTeX Font Info:    Encoding `OT1' has changed to `TU' for symbol font
(Font)              `operators' in the math version `bold' on input line 8.
LaTeX Font Info:    Overwriting symbol font `operators' in version `bold'
(Font)                  OT1/cmr/bx/n --> TU/Verdana(0)/m/n on input line 8.
LaTeX Font Info:    Overwriting symbol font `operators' in version `normal'
(Font)                  TU/Verdana(0)/m/n --> TU/Verdana(0)/m/n on input line 8.
LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `normal'
(Font)                  OT1/cmr/m/it --> TU/Verdana(0)/m/it on input line 8.
LaTeX Font Info:    Overwriting math alphabet `\mathbf' in version `normal'
(Font)                  OT1/cmr/bx/n --> TU/Verdana(0)/bx/n on input line 8.
LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `normal'
(Font)                  OT1/cmss/m/n --> TU/lmss/m/n on input line 8.
LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `normal'
(Font)                  OT1/cmtt/m/n --> TU/lmtt/m/n on input line 8.
LaTeX Font Info:    Overwriting symbol font `operators' in version `bold'
(Font)                  TU/Verdana(0)/m/n --> TU/Verdana(0)/bx/n on input line 8.
LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `bold'
(Font)                  OT1/cmr/bx/it --> TU/Verdana(0)/bx/it on input line 8.
LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `bold'
(Font)                  OT1/cmss/bx/n --> TU/lmss/bx/n on input line 8.
LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `bold'
(Font)                  OT1/cmtt/m/n --> TU/lmtt/bx/n on input line 8.
Missing character: There is no ̂ in font [../../Resources/Fonts/Verdana.ttf]/OT:script=latn;language=DFLT;mapping=tex-text;!
 [1

] (./JiraCircumflexIsolated.aux) ) 
Here is how much of TeX's memory you used:
 10048 strings out of 492998
 234670 string characters out of 6134491
 301486 words of memory out of 5000000
 14072 multiletter control sequences out of 15000+600000
 530312 words of font info for 27 fonts, out of 8000000 for 9000
 1348 hyphenation exceptions out of 8191
 35i,4n,65p,10375b,236s stack positions out of 5000i,500n,10000p,200000b,80000s

Output written on JiraCircumflexIsolated.pdf (1 page).

笔记

  • TeX Live 2017
  • xelatex
  • fontspec
  • Verdana 字体

答案1

根据常见的 TeX.Stackexchange Crew 的有用评论,我想出了这个。

这里的文档fontspec不是特别强大 - 可能是因为它很复杂并且涉及其他组件 - 所以我不得不通过反复试验来完成此操作。

使其发挥作用的步骤

  • 删除 Verdana,因为它没有所需的抑扬符。我刚刚在一个充满字体的目录中找到了它otfinfo -u * | grep 005E
  • 使用以下显着名称声明我自己的 unicode 编码\DeclareUnicodeEncoding
  • \^将原本代表组合脱字符的设置为代表脱字符。
  • fontspec使用键 NFSSEncoding在字体定义中应用此编码。

代码

\documentclass{article}
\usepackage{fontspec}
\makeatletter
\DeclareUnicodeEncoding{preventcombinedcircumflex}{
  \input{tuenc.def}% adds U+00A0 in the case of empty args \^{}
  \EncodingAccent{\^}{"005E}
}%
\makeatother

\setmainfont[
  Path = ../../Resources/Fonts/ ,
  Extension = .otf ,
  UprightFont = *-Roman,
  NFSSEncoding= preventcombinedcircumflex,
]{SomeTypefaceThatHasNoCombinedCircumflexAndOnlyCircumFlex}

\begin{document}
\^2
\end{document}

警告

在我的项目中,我无意中产生了一个不可中断的空格 U+00A0 (utf-8 hex c2a0),我的字体也不支持这个空格。这是由文件中的定义引起的tuenc.def

\def\add@unicode@accent#1#2{%
  \if\relax\detokenize{#2}\relax^^a0\else#2\fi
  \char#1\relax}

修复方法可以在这里找到:为什么当我使用自定义编码 \DeclareUnicodeEncoding 将脱字符 \^ 后跟 {} 时,它会映射到不可断开的空格 U+00A0?

笔记

  • xunicode.sty定义\^\DeclareEncodedCompositeCharacter{\UTFencname}{\^}{0302}{02C6} % Combining circumflex accent

相关内容