├── .gitattributes ├── LICENSE ├── README.md ├── demo ├── LICENSE ├── README.md ├── demo-halfwidth.svg ├── demo-language.svg ├── demo-tracking-2.svg └── demo-tracking.svg └── newxeCJK.tex /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The LaTeX Project Public License 2 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 3 | 4 | LPPL Version 1.3c 2008-05-04 5 | 6 | Copyright 1999 2002-2008 LaTeX3 Project 7 | Everyone is allowed to distribute verbatim copies of this 8 | license document, but modification of it is not allowed. 9 | 10 | 11 | PREAMBLE 12 | ======== 13 | 14 | The LaTeX Project Public License (LPPL) is the primary license under 15 | which the LaTeX kernel and the base LaTeX packages are distributed. 16 | 17 | You may use this license for any work of which you hold the copyright 18 | and which you wish to distribute. This license may be particularly 19 | suitable if your work is TeX-related (such as a LaTeX package), but 20 | it is written in such a way that you can use it even if your work is 21 | unrelated to TeX. 22 | 23 | The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE', 24 | below, gives instructions, examples, and recommendations for authors 25 | who are considering distributing their works under this license. 26 | 27 | This license gives conditions under which a work may be distributed 28 | and modified, as well as conditions under which modified versions of 29 | that work may be distributed. 30 | 31 | We, the LaTeX3 Project, believe that the conditions below give you 32 | the freedom to make and distribute modified versions of your work 33 | that conform with whatever technical specifications you wish while 34 | maintaining the availability, integrity, and reliability of 35 | that work. If you do not see how to achieve your goal while 36 | meeting these conditions, then read the document `cfgguide.tex' 37 | and `modguide.tex' in the base LaTeX distribution for suggestions. 38 | 39 | 40 | DEFINITIONS 41 | =========== 42 | 43 | In this license document the following terms are used: 44 | 45 | `Work' 46 | Any work being distributed under this License. 47 | 48 | `Derived Work' 49 | Any work that under any applicable law is derived from the Work. 50 | 51 | `Modification' 52 | Any procedure that produces a Derived Work under any applicable 53 | law -- for example, the production of a file containing an 54 | original file associated with the Work or a significant portion of 55 | such a file, either verbatim or with modifications and/or 56 | translated into another language. 57 | 58 | `Modify' 59 | To apply any procedure that produces a Derived Work under any 60 | applicable law. 61 | 62 | `Distribution' 63 | Making copies of the Work available from one person to another, in 64 | whole or in part. Distribution includes (but is not limited to) 65 | making any electronic components of the Work accessible by 66 | file transfer protocols such as FTP or HTTP or by shared file 67 | systems such as Sun's Network File System (NFS). 68 | 69 | `Compiled Work' 70 | A version of the Work that has been processed into a form where it 71 | is directly usable on a computer system. This processing may 72 | include using installation facilities provided by the Work, 73 | transformations of the Work, copying of components of the Work, or 74 | other activities. Note that modification of any installation 75 | facilities provided by the Work constitutes modification of the Work. 76 | 77 | `Current Maintainer' 78 | A person or persons nominated as such within the Work. If there is 79 | no such explicit nomination then it is the `Copyright Holder' under 80 | any applicable law. 81 | 82 | `Base Interpreter' 83 | A program or process that is normally needed for running or 84 | interpreting a part or the whole of the Work. 85 | 86 | A Base Interpreter may depend on external components but these 87 | are not considered part of the Base Interpreter provided that each 88 | external component clearly identifies itself whenever it is used 89 | interactively. Unless explicitly specified when applying the 90 | license to the Work, the only applicable Base Interpreter is a 91 | `LaTeX-Format' or in the case of files belonging to the 92 | `LaTeX-format' a program implementing the `TeX language'. 93 | 94 | 95 | 96 | CONDITIONS ON DISTRIBUTION AND MODIFICATION 97 | =========================================== 98 | 99 | 1. Activities other than distribution and/or modification of the Work 100 | are not covered by this license; they are outside its scope. In 101 | particular, the act of running the Work is not restricted and no 102 | requirements are made concerning any offers of support for the Work. 103 | 104 | 2. You may distribute a complete, unmodified copy of the Work as you 105 | received it. Distribution of only part of the Work is considered 106 | modification of the Work, and no right to distribute such a Derived 107 | Work may be assumed under the terms of this clause. 108 | 109 | 3. You may distribute a Compiled Work that has been generated from a 110 | complete, unmodified copy of the Work as distributed under Clause 2 111 | above, as long as that Compiled Work is distributed in such a way that 112 | the recipients may install the Compiled Work on their system exactly 113 | as it would have been installed if they generated a Compiled Work 114 | directly from the Work. 115 | 116 | 4. If you are the Current Maintainer of the Work, you may, without 117 | restriction, modify the Work, thus creating a Derived Work. You may 118 | also distribute the Derived Work without restriction, including 119 | Compiled Works generated from the Derived Work. Derived Works 120 | distributed in this manner by the Current Maintainer are considered to 121 | be updated versions of the Work. 122 | 123 | 5. If you are not the Current Maintainer of the Work, you may modify 124 | your copy of the Work, thus creating a Derived Work based on the Work, 125 | and compile this Derived Work, thus creating a Compiled Work based on 126 | the Derived Work. 127 | 128 | 6. If you are not the Current Maintainer of the Work, you may 129 | distribute a Derived Work provided the following conditions are met 130 | for every component of the Work unless that component clearly states 131 | in the copyright notice that it is exempt from that condition. Only 132 | the Current Maintainer is allowed to add such statements of exemption 133 | to a component of the Work. 134 | 135 | a. If a component of this Derived Work can be a direct replacement 136 | for a component of the Work when that component is used with the 137 | Base Interpreter, then, wherever this component of the Work 138 | identifies itself to the user when used interactively with that 139 | Base Interpreter, the replacement component of this Derived Work 140 | clearly and unambiguously identifies itself as a modified version 141 | of this component to the user when used interactively with that 142 | Base Interpreter. 143 | 144 | b. Every component of the Derived Work contains prominent notices 145 | detailing the nature of the changes to that component, or a 146 | prominent reference to another file that is distributed as part 147 | of the Derived Work and that contains a complete and accurate log 148 | of the changes. 149 | 150 | c. No information in the Derived Work implies that any persons, 151 | including (but not limited to) the authors of the original version 152 | of the Work, provide any support, including (but not limited to) 153 | the reporting and handling of errors, to recipients of the 154 | Derived Work unless those persons have stated explicitly that 155 | they do provide such support for the Derived Work. 156 | 157 | d. You distribute at least one of the following with the Derived Work: 158 | 159 | 1. A complete, unmodified copy of the Work; 160 | if your distribution of a modified component is made by 161 | offering access to copy the modified component from a 162 | designated place, then offering equivalent access to copy 163 | the Work from the same or some similar place meets this 164 | condition, even though third parties are not compelled to 165 | copy the Work along with the modified component; 166 | 167 | 2. Information that is sufficient to obtain a complete, 168 | unmodified copy of the Work. 169 | 170 | 7. If you are not the Current Maintainer of the Work, you may 171 | distribute a Compiled Work generated from a Derived Work, as long as 172 | the Derived Work is distributed to all recipients of the Compiled 173 | Work, and as long as the conditions of Clause 6, above, are met with 174 | regard to the Derived Work. 175 | 176 | 8. The conditions above are not intended to prohibit, and hence do not 177 | apply to, the modification, by any method, of any component so that it 178 | becomes identical to an updated version of that component of the Work as 179 | it is distributed by the Current Maintainer under Clause 4, above. 180 | 181 | 9. Distribution of the Work or any Derived Work in an alternative 182 | format, where the Work or that Derived Work (in whole or in part) is 183 | then produced by applying some process to that format, does not relax or 184 | nullify any sections of this license as they pertain to the results of 185 | applying that process. 186 | 187 | 10. a. A Derived Work may be distributed under a different license 188 | provided that license itself honors the conditions listed in 189 | Clause 6 above, in regard to the Work, though it does not have 190 | to honor the rest of the conditions in this license. 191 | 192 | b. If a Derived Work is distributed under a different license, that 193 | Derived Work must provide sufficient documentation as part of 194 | itself to allow each recipient of that Derived Work to honor the 195 | restrictions in Clause 6 above, concerning changes from the Work. 196 | 197 | 11. This license places no restrictions on works that are unrelated to 198 | the Work, nor does this license place any restrictions on aggregating 199 | such works with the Work by any means. 200 | 201 | 12. Nothing in this license is intended to, or may be used to, prevent 202 | complete compliance by all parties with all applicable laws. 203 | 204 | 205 | NO WARRANTY 206 | =========== 207 | 208 | There is no warranty for the Work. Except when otherwise stated in 209 | writing, the Copyright Holder provides the Work `as is', without 210 | warranty of any kind, either expressed or implied, including, but not 211 | limited to, the implied warranties of merchantability and fitness for a 212 | particular purpose. The entire risk as to the quality and performance 213 | of the Work is with you. Should the Work prove defective, you assume 214 | the cost of all necessary servicing, repair, or correction. 215 | 216 | In no event unless required by applicable law or agreed to in writing 217 | will The Copyright Holder, or any author named in the components of the 218 | Work, or any other party who may distribute and/or modify the Work as 219 | permitted above, be liable to you for damages, including any general, 220 | special, incidental or consequential damages arising out of any use of 221 | the Work or out of inability to use the Work (including, but not limited 222 | to, loss of data, data being rendered inaccurate, or losses sustained by 223 | anyone as a result of any failure of the Work to operate with any other 224 | programs), even if the Copyright Holder or said author or said other 225 | party has been advised of the possibility of such damages. 226 | 227 | 228 | MAINTENANCE OF THE WORK 229 | ======================= 230 | 231 | The Work has the status `author-maintained' if the Copyright Holder 232 | explicitly and prominently states near the primary copyright notice in 233 | the Work that the Work can only be maintained by the Copyright Holder 234 | or simply that it is `author-maintained'. 235 | 236 | The Work has the status `maintained' if there is a Current Maintainer 237 | who has indicated in the Work that they are willing to receive error 238 | reports for the Work (for example, by supplying a valid e-mail 239 | address). It is not required for the Current Maintainer to acknowledge 240 | or act upon these error reports. 241 | 242 | The Work changes from status `maintained' to `unmaintained' if there 243 | is no Current Maintainer, or the person stated to be Current 244 | Maintainer of the work cannot be reached through the indicated means 245 | of communication for a period of six months, and there are no other 246 | significant signs of active maintenance. 247 | 248 | You can become the Current Maintainer of the Work by agreement with 249 | any existing Current Maintainer to take over this role. 250 | 251 | If the Work is unmaintained, you can become the Current Maintainer of 252 | the Work through the following steps: 253 | 254 | 1. Make a reasonable attempt to trace the Current Maintainer (and 255 | the Copyright Holder, if the two differ) through the means of 256 | an Internet or similar search. 257 | 258 | 2. If this search is successful, then enquire whether the Work 259 | is still maintained. 260 | 261 | a. If it is being maintained, then ask the Current Maintainer 262 | to update their communication data within one month. 263 | 264 | b. If the search is unsuccessful or no action to resume active 265 | maintenance is taken by the Current Maintainer, then announce 266 | within the pertinent community your intention to take over 267 | maintenance. (If the Work is a LaTeX work, this could be 268 | done, for example, by posting to comp.text.tex.) 269 | 270 | 3a. If the Current Maintainer is reachable and agrees to pass 271 | maintenance of the Work to you, then this takes effect 272 | immediately upon announcement. 273 | 274 | b. If the Current Maintainer is not reachable and the Copyright 275 | Holder agrees that maintenance of the Work be passed to you, 276 | then this takes effect immediately upon announcement. 277 | 278 | 4. If you make an `intention announcement' as described in 2b. above 279 | and after three months your intention is challenged neither by 280 | the Current Maintainer nor by the Copyright Holder nor by other 281 | people, then you may arrange for the Work to be changed so as 282 | to name you as the (new) Current Maintainer. 283 | 284 | 5. If the previously unreachable Current Maintainer becomes 285 | reachable once more within three months of a change completed 286 | under the terms of 3b) or 4), then that Current Maintainer must 287 | become or remain the Current Maintainer upon request provided 288 | they then update their communication data within one month. 289 | 290 | A change in the Current Maintainer does not, of itself, alter the fact 291 | that the Work is distributed under the LPPL license. 292 | 293 | If you become the Current Maintainer of the Work, you should 294 | immediately provide, within the Work, a prominent and unambiguous 295 | statement of your status as Current Maintainer. You should also 296 | announce your new status to the same pertinent community as 297 | in 2b) above. 298 | 299 | 300 | WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE 301 | ====================================================== 302 | 303 | This section contains important instructions, examples, and 304 | recommendations for authors who are considering distributing their 305 | works under this license. These authors are addressed as `you' in 306 | this section. 307 | 308 | Choosing This License or Another License 309 | ---------------------------------------- 310 | 311 | If for any part of your work you want or need to use *distribution* 312 | conditions that differ significantly from those in this license, then 313 | do not refer to this license anywhere in your work but, instead, 314 | distribute your work under a different license. You may use the text 315 | of this license as a model for your own license, but your license 316 | should not refer to the LPPL or otherwise give the impression that 317 | your work is distributed under the LPPL. 318 | 319 | The document `modguide.tex' in the base LaTeX distribution explains 320 | the motivation behind the conditions of this license. It explains, 321 | for example, why distributing LaTeX under the GNU General Public 322 | License (GPL) was considered inappropriate. Even if your work is 323 | unrelated to LaTeX, the discussion in `modguide.tex' may still be 324 | relevant, and authors intending to distribute their works under any 325 | license are encouraged to read it. 326 | 327 | A Recommendation on Modification Without Distribution 328 | ----------------------------------------------------- 329 | 330 | It is wise never to modify a component of the Work, even for your own 331 | personal use, without also meeting the above conditions for 332 | distributing the modified component. While you might intend that such 333 | modifications will never be distributed, often this will happen by 334 | accident -- you may forget that you have modified that component; or 335 | it may not occur to you when allowing others to access the modified 336 | version that you are thus distributing it and violating the conditions 337 | of this license in ways that could have legal implications and, worse, 338 | cause problems for the community. It is therefore usually in your 339 | best interest to keep your copy of the Work identical with the public 340 | one. Many works provide ways to control the behavior of that work 341 | without altering any of its licensed components. 342 | 343 | How to Use This License 344 | ----------------------- 345 | 346 | To use this license, place in each of the components of your work both 347 | an explicit copyright notice including your name and the year the work 348 | was authored and/or last substantially modified. Include also a 349 | statement that the distribution and/or modification of that 350 | component is constrained by the conditions in this license. 351 | 352 | Here is an example of such a notice and statement: 353 | 354 | %% pig.dtx 355 | %% Copyright 2005 M. Y. Name 356 | % 357 | % This work may be distributed and/or modified under the 358 | % conditions of the LaTeX Project Public License, either version 1.3 359 | % of this license or (at your option) any later version. 360 | % The latest version of this license is in 361 | % http://www.latex-project.org/lppl.txt 362 | % and version 1.3 or later is part of all distributions of LaTeX 363 | % version 2005/12/01 or later. 364 | % 365 | % This work has the LPPL maintenance status `maintained'. 366 | % 367 | % The Current Maintainer of this work is M. Y. Name. 368 | % 369 | % This work consists of the files pig.dtx and pig.ins 370 | % and the derived file pig.sty. 371 | 372 | Given such a notice and statement in a file, the conditions 373 | given in this license document would apply, with the `Work' referring 374 | to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being 375 | generated from `pig.dtx' using `pig.ins'), the `Base Interpreter' 376 | referring to any `LaTeX-Format', and both `Copyright Holder' and 377 | `Current Maintainer' referring to the person `M. Y. Name'. 378 | 379 | If you do not want the Maintenance section of LPPL to apply to your 380 | Work, change `maintained' above into `author-maintained'. 381 | However, we recommend that you use `maintained', as the Maintenance 382 | section was added in order to ensure that your Work remains useful to 383 | the community even when you can no longer maintain and support it 384 | yourself. 385 | 386 | Derived Works That Are Not Replacements 387 | --------------------------------------- 388 | 389 | Several clauses of the LPPL specify means to provide reliability and 390 | stability for the user community. They therefore concern themselves 391 | with the case that a Derived Work is intended to be used as a 392 | (compatible or incompatible) replacement of the original Work. If 393 | this is not the case (e.g., if a few lines of code are reused for a 394 | completely different task), then clauses 6b and 6d shall not apply. 395 | 396 | 397 | Important Recommendations 398 | ------------------------- 399 | 400 | Defining What Constitutes the Work 401 | 402 | The LPPL requires that distributions of the Work contain all the 403 | files of the Work. It is therefore important that you provide a 404 | way for the licensee to determine which files constitute the Work. 405 | This could, for example, be achieved by explicitly listing all the 406 | files of the Work near the copyright notice of each file or by 407 | using a line such as: 408 | 409 | % This work consists of all files listed in manifest.txt. 410 | 411 | in that place. In the absence of an unequivocal list it might be 412 | impossible for the licensee to determine what is considered by you 413 | to comprise the Work and, in such a case, the licensee would be 414 | entitled to make reasonable conjectures as to which files comprise 415 | the Work. 416 | 417 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # newxeCJK 2 | 3 | 用 XeLaTeX 排版中文,首推使用 4 | [`xeCJK`](https://github.com/CTeX-org/ctex-kit/tree/master/xeCJK) 5 | 宏包。`xeCJK` 最早由孙文昌教授开发,历史可以追溯到 2007 年。`xeCJK` 6 | 功能丰富,对简体中文横排的支持比较完善。但 `xeCJK` 7 | 对直排的支持,或者对标点习惯不同的繁体中文、日文排版的支持都很有限。 8 | 9 | `newxeCJK` 尝试重构 `xeCJK` 中的 inter-character token 10 | 机制,将中文/日文使用的「全形/全角」标点符号细分为 11 | 5 类,并试图同时支持简中、繁中、日文的横排与直排。 12 | 13 | 目前 `newxeCJK` 处于研发阶段,不自动检测 XeTeX 14 | 引擎的版本是否最新,也不考虑向后兼容 `xeCJK`。希望 15 | `newxeCJK` 提供的思路能在不久的将来成为 `xeCJK` 的一部分。 16 | 17 | ## 向用户公开的命令 / Public commands 18 | 19 | ### 字体的设置与使用 20 | 21 | - [x] `\setCJKmainfont`, `\setCJKsansfont`, `\setCJKmonofont` 22 | - [x] `\CJKrmfamily`, `\CJKsffamily`, `\CJKttfamily` 23 | - [x] `\newCJKfontfamily`, `\renewCJKfontfamily`, `\provideCJKfontfamily`, `\setCJKfontfamily` 24 | - [x] `\newCJKfontface`, `\renewCJKfontface`, `\provideCJKfontface`, `\setCJKfontface` 25 | 26 | ### 标点符号的排版样式 27 | 28 | - [x] 全角样式:`\quanjiaostyle` 29 | - [x] 半角样式:`\banjiaostyle` 30 | - [x] 开明样式:`\kaimingstyle` 31 | - [x] 不作调整:`\plainstyle` 32 | 33 | ### 本地化 34 | 35 | - [x] 简中横排:`\ChineseSimplifiedH` 36 | - [x] 简中直排:`\ChineseSimplifiedV` 37 | - [x] 繁中横排:`\ChineseTraditionalH` 38 | - [x] 繁中直排:`\ChineseTraditionalV` 39 | - [x] 日文横排:`\JapaneseH` 40 | - [x] 日文直排:`\JapaneseV` 41 | 42 | ### 细节控制 43 | 44 | - [x] `\SetPunctWidthRatio{}` 45 | - [x] `\SetEndSentencePunctWidthRatio{}` 46 | - [x] `\SetPunctMinWidthRatio{}` 47 | - [x] `\SetMiddlePunctMinWidthRatio{}` 48 | - [x] `\SetPunctKernWidthRatio{}` 49 | - [x] `\SetPunctOffsetDim{}` 50 | - [x] `\SetCJKCondensedRatio{}` 51 | 52 | ## 效果展示 / Demo 53 | 54 |
55 | License notice 56 | 57 | The text samples in the demo files were adapted from: 58 | 59 | - https://zh.wikipedia.org/zh-cn/TeX 60 | - https://zh.wikipedia.org/zh-tw/TeX 61 | - https://ja.wikipedia.org/wiki/TeX 62 | - https://dict.revised.moe.edu.tw/ 63 | 64 | which were licensed under various terms ([details](demo/README.md)). 65 | Modifications to some of the text were made in order to exhibit 66 | typographic adjustments when typesetting East Asian languages. 67 | The demo files themselves (in SVG format) are licensed under 68 | CC BY‑SA 4.0. 69 | 70 |
71 | 72 |
73 | 本地化 / Language localization 74 | 75 | ![demo-language](demo/demo-language.svg) 76 | 77 |
78 | 79 |
80 | 疏排、紧排 / Tracking for CJK 81 | 82 | Positive tracking in horizontal typesetting: 83 | 84 | ![demo-tracking](demo/demo-tracking.svg) 85 | 86 | Negative tracking in vertical typesetting 87 | (锦华明朝体, −18% tracking): 88 | 89 | ![demo-tracking-2](demo/demo-tracking-2.svg) 90 | 91 |
92 | 93 |
94 | 标点符号一律半宽 / Half-width CJK punctuation marks 95 | 96 | ![demo-halfwidth](demo/demo-halfwidth.svg) 97 | 98 |
99 | 100 | ## 等待实现的功能 / TODO 101 | 102 | - 完善 Boundary 类别和其它字符类别之间插入的 tokens 103 | - 支持独立设置标点符号字体、日语假名字体、韩语谚文字体 104 | 105 | ## Copyright and License 106 | 107 | The [demo files](demo), which are the non-software parts of this project, 108 | are licensed under CC BY‑SA 4.0. 109 | The software parts of this project are licensed under LPPL 1.3c. 110 | 111 | Copyright 2020-2023 Ruixi Zhang 112 | 113 | This work may be distributed and/or modified under the 114 | conditions of the LaTeX Project Public License, either version 1.3c 115 | of this license or (at your option) any later version. 116 | The latest version of this license is in 117 | https://www.latex-project.org/lppl.txt 118 | and version 1.3c or later is part of all distributions of LaTeX 119 | version 2005/12/01 or later. 120 | 121 | This work has the LPPL maintenance status `maintained'. 122 | 123 | The Current Maintainer of this work is Ruixi Zhang. 124 | 125 | This work consists of the files newxeCJK.tex, 126 | README.md (this file) -------------------------------------------------------------------------------- /demo/LICENSE: -------------------------------------------------------------------------------- 1 | Attribution-ShareAlike 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-ShareAlike 4.0 International Public 58 | License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-ShareAlike 4.0 International Public License ("Public 63 | License"). To the extent this Public License may be interpreted as a 64 | contract, You are granted the Licensed Rights in consideration of Your 65 | acceptance of these terms and conditions, and the Licensor grants You 66 | such rights in consideration of benefits the Licensor receives from 67 | making the Licensed Material available under these terms and 68 | conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. BY-SA Compatible License means a license listed at 88 | creativecommons.org/compatiblelicenses, approved by Creative 89 | Commons as essentially the equivalent of this Public License. 90 | 91 | d. Copyright and Similar Rights means copyright and/or similar rights 92 | closely related to copyright including, without limitation, 93 | performance, broadcast, sound recording, and Sui Generis Database 94 | Rights, without regard to how the rights are labeled or 95 | categorized. For purposes of this Public License, the rights 96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 97 | Rights. 98 | 99 | e. Effective Technological Measures means those measures that, in the 100 | absence of proper authority, may not be circumvented under laws 101 | fulfilling obligations under Article 11 of the WIPO Copyright 102 | Treaty adopted on December 20, 1996, and/or similar international 103 | agreements. 104 | 105 | f. Exceptions and Limitations means fair use, fair dealing, and/or 106 | any other exception or limitation to Copyright and Similar Rights 107 | that applies to Your use of the Licensed Material. 108 | 109 | g. License Elements means the license attributes listed in the name 110 | of a Creative Commons Public License. The License Elements of this 111 | Public License are Attribution and ShareAlike. 112 | 113 | h. Licensed Material means the artistic or literary work, database, 114 | or other material to which the Licensor applied this Public 115 | License. 116 | 117 | i. Licensed Rights means the rights granted to You subject to the 118 | terms and conditions of this Public License, which are limited to 119 | all Copyright and Similar Rights that apply to Your use of the 120 | Licensed Material and that the Licensor has authority to license. 121 | 122 | j. Licensor means the individual(s) or entity(ies) granting rights 123 | under this Public License. 124 | 125 | k. Share means to provide material to the public by any means or 126 | process that requires permission under the Licensed Rights, such 127 | as reproduction, public display, public performance, distribution, 128 | dissemination, communication, or importation, and to make material 129 | available to the public including in ways that members of the 130 | public may access the material from a place and at a time 131 | individually chosen by them. 132 | 133 | l. Sui Generis Database Rights means rights other than copyright 134 | resulting from Directive 96/9/EC of the European Parliament and of 135 | the Council of 11 March 1996 on the legal protection of databases, 136 | as amended and/or succeeded, as well as other essentially 137 | equivalent rights anywhere in the world. 138 | 139 | m. You means the individual or entity exercising the Licensed Rights 140 | under this Public License. Your has a corresponding meaning. 141 | 142 | 143 | Section 2 -- Scope. 144 | 145 | a. License grant. 146 | 147 | 1. Subject to the terms and conditions of this Public License, 148 | the Licensor hereby grants You a worldwide, royalty-free, 149 | non-sublicensable, non-exclusive, irrevocable license to 150 | exercise the Licensed Rights in the Licensed Material to: 151 | 152 | a. reproduce and Share the Licensed Material, in whole or 153 | in part; and 154 | 155 | b. produce, reproduce, and Share Adapted Material. 156 | 157 | 2. Exceptions and Limitations. For the avoidance of doubt, where 158 | Exceptions and Limitations apply to Your use, this Public 159 | License does not apply, and You do not need to comply with 160 | its terms and conditions. 161 | 162 | 3. Term. The term of this Public License is specified in Section 163 | 6(a). 164 | 165 | 4. Media and formats; technical modifications allowed. The 166 | Licensor authorizes You to exercise the Licensed Rights in 167 | all media and formats whether now known or hereafter created, 168 | and to make technical modifications necessary to do so. The 169 | Licensor waives and/or agrees not to assert any right or 170 | authority to forbid You from making technical modifications 171 | necessary to exercise the Licensed Rights, including 172 | technical modifications necessary to circumvent Effective 173 | Technological Measures. For purposes of this Public License, 174 | simply making modifications authorized by this Section 2(a) 175 | (4) never produces Adapted Material. 176 | 177 | 5. Downstream recipients. 178 | 179 | a. Offer from the Licensor -- Licensed Material. Every 180 | recipient of the Licensed Material automatically 181 | receives an offer from the Licensor to exercise the 182 | Licensed Rights under the terms and conditions of this 183 | Public License. 184 | 185 | b. Additional offer from the Licensor -- Adapted Material. 186 | Every recipient of Adapted Material from You 187 | automatically receives an offer from the Licensor to 188 | exercise the Licensed Rights in the Adapted Material 189 | under the conditions of the Adapter's License You apply. 190 | 191 | c. No downstream restrictions. You may not offer or impose 192 | any additional or different terms or conditions on, or 193 | apply any Effective Technological Measures to, the 194 | Licensed Material if doing so restricts exercise of the 195 | Licensed Rights by any recipient of the Licensed 196 | Material. 197 | 198 | 6. No endorsement. Nothing in this Public License constitutes or 199 | may be construed as permission to assert or imply that You 200 | are, or that Your use of the Licensed Material is, connected 201 | with, or sponsored, endorsed, or granted official status by, 202 | the Licensor or others designated to receive attribution as 203 | provided in Section 3(a)(1)(A)(i). 204 | 205 | b. Other rights. 206 | 207 | 1. Moral rights, such as the right of integrity, are not 208 | licensed under this Public License, nor are publicity, 209 | privacy, and/or other similar personality rights; however, to 210 | the extent possible, the Licensor waives and/or agrees not to 211 | assert any such rights held by the Licensor to the limited 212 | extent necessary to allow You to exercise the Licensed 213 | Rights, but not otherwise. 214 | 215 | 2. Patent and trademark rights are not licensed under this 216 | Public License. 217 | 218 | 3. To the extent possible, the Licensor waives any right to 219 | collect royalties from You for the exercise of the Licensed 220 | Rights, whether directly or through a collecting society 221 | under any voluntary or waivable statutory or compulsory 222 | licensing scheme. In all other cases the Licensor expressly 223 | reserves any right to collect such royalties. 224 | 225 | 226 | Section 3 -- License Conditions. 227 | 228 | Your exercise of the Licensed Rights is expressly made subject to the 229 | following conditions. 230 | 231 | a. Attribution. 232 | 233 | 1. If You Share the Licensed Material (including in modified 234 | form), You must: 235 | 236 | a. retain the following if it is supplied by the Licensor 237 | with the Licensed Material: 238 | 239 | i. identification of the creator(s) of the Licensed 240 | Material and any others designated to receive 241 | attribution, in any reasonable manner requested by 242 | the Licensor (including by pseudonym if 243 | designated); 244 | 245 | ii. a copyright notice; 246 | 247 | iii. a notice that refers to this Public License; 248 | 249 | iv. a notice that refers to the disclaimer of 250 | warranties; 251 | 252 | v. a URI or hyperlink to the Licensed Material to the 253 | extent reasonably practicable; 254 | 255 | b. indicate if You modified the Licensed Material and 256 | retain an indication of any previous modifications; and 257 | 258 | c. indicate the Licensed Material is licensed under this 259 | Public License, and include the text of, or the URI or 260 | hyperlink to, this Public License. 261 | 262 | 2. You may satisfy the conditions in Section 3(a)(1) in any 263 | reasonable manner based on the medium, means, and context in 264 | which You Share the Licensed Material. For example, it may be 265 | reasonable to satisfy the conditions by providing a URI or 266 | hyperlink to a resource that includes the required 267 | information. 268 | 269 | 3. If requested by the Licensor, You must remove any of the 270 | information required by Section 3(a)(1)(A) to the extent 271 | reasonably practicable. 272 | 273 | b. ShareAlike. 274 | 275 | In addition to the conditions in Section 3(a), if You Share 276 | Adapted Material You produce, the following conditions also apply. 277 | 278 | 1. The Adapter's License You apply must be a Creative Commons 279 | license with the same License Elements, this version or 280 | later, or a BY-SA Compatible License. 281 | 282 | 2. You must include the text of, or the URI or hyperlink to, the 283 | Adapter's License You apply. You may satisfy this condition 284 | in any reasonable manner based on the medium, means, and 285 | context in which You Share Adapted Material. 286 | 287 | 3. You may not offer or impose any additional or different terms 288 | or conditions on, or apply any Effective Technological 289 | Measures to, Adapted Material that restrict exercise of the 290 | rights granted under the Adapter's License You apply. 291 | 292 | 293 | Section 4 -- Sui Generis Database Rights. 294 | 295 | Where the Licensed Rights include Sui Generis Database Rights that 296 | apply to Your use of the Licensed Material: 297 | 298 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 299 | to extract, reuse, reproduce, and Share all or a substantial 300 | portion of the contents of the database; 301 | 302 | b. if You include all or a substantial portion of the database 303 | contents in a database in which You have Sui Generis Database 304 | Rights, then the database in which You have Sui Generis Database 305 | Rights (but not its individual contents) is Adapted Material, 306 | 307 | including for purposes of Section 3(b); and 308 | c. You must comply with the conditions in Section 3(a) if You Share 309 | all or a substantial portion of the contents of the database. 310 | 311 | For the avoidance of doubt, this Section 4 supplements and does not 312 | replace Your obligations under this Public License where the Licensed 313 | Rights include other Copyright and Similar Rights. 314 | 315 | 316 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 317 | 318 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 319 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 320 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 321 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 322 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 323 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 324 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 325 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 326 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 327 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 328 | 329 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 330 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 331 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 332 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 333 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 334 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 335 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 336 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 337 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 338 | 339 | c. The disclaimer of warranties and limitation of liability provided 340 | above shall be interpreted in a manner that, to the extent 341 | possible, most closely approximates an absolute disclaimer and 342 | waiver of all liability. 343 | 344 | 345 | Section 6 -- Term and Termination. 346 | 347 | a. This Public License applies for the term of the Copyright and 348 | Similar Rights licensed here. However, if You fail to comply with 349 | this Public License, then Your rights under this Public License 350 | terminate automatically. 351 | 352 | b. Where Your right to use the Licensed Material has terminated under 353 | Section 6(a), it reinstates: 354 | 355 | 1. automatically as of the date the violation is cured, provided 356 | it is cured within 30 days of Your discovery of the 357 | violation; or 358 | 359 | 2. upon express reinstatement by the Licensor. 360 | 361 | For the avoidance of doubt, this Section 6(b) does not affect any 362 | right the Licensor may have to seek remedies for Your violations 363 | of this Public License. 364 | 365 | c. For the avoidance of doubt, the Licensor may also offer the 366 | Licensed Material under separate terms or conditions or stop 367 | distributing the Licensed Material at any time; however, doing so 368 | will not terminate this Public License. 369 | 370 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 371 | License. 372 | 373 | 374 | Section 7 -- Other Terms and Conditions. 375 | 376 | a. The Licensor shall not be bound by any additional or different 377 | terms or conditions communicated by You unless expressly agreed. 378 | 379 | b. Any arrangements, understandings, or agreements regarding the 380 | Licensed Material not stated herein are separate from and 381 | independent of the terms and conditions of this Public License. 382 | 383 | 384 | Section 8 -- Interpretation. 385 | 386 | a. For the avoidance of doubt, this Public License does not, and 387 | shall not be interpreted to, reduce, limit, restrict, or impose 388 | conditions on any use of the Licensed Material that could lawfully 389 | be made without permission under this Public License. 390 | 391 | b. To the extent possible, if any provision of this Public License is 392 | deemed unenforceable, it shall be automatically reformed to the 393 | minimum extent necessary to make it enforceable. If the provision 394 | cannot be reformed, it shall be severed from this Public License 395 | without affecting the enforceability of the remaining terms and 396 | conditions. 397 | 398 | c. No term or condition of this Public License will be waived and no 399 | failure to comply consented to unless expressly agreed to by the 400 | Licensor. 401 | 402 | d. Nothing in this Public License constitutes or may be interpreted 403 | as a limitation upon, or waiver of, any privileges and immunities 404 | that apply to the Licensor or You, including from the legal 405 | processes of any jurisdiction or authority. 406 | 407 | 408 | ======================================================================= 409 | 410 | Creative Commons is not a party to its public 411 | licenses. Notwithstanding, Creative Commons may elect to apply one of 412 | its public licenses to material it publishes and in those instances 413 | will be considered the “Licensor.” The text of the Creative Commons 414 | public licenses is dedicated to the public domain under the CC0 Public 415 | Domain Dedication. Except for the limited purpose of indicating that 416 | material is shared under a Creative Commons public license or as 417 | otherwise permitted by the Creative Commons policies published at 418 | creativecommons.org/policies, Creative Commons does not authorize the 419 | use of the trademark "Creative Commons" or any other trademark or logo 420 | of Creative Commons without its prior written consent including, 421 | without limitation, in connection with any unauthorized modifications 422 | to any of its public licenses or any other arrangements, 423 | understandings, or agreements concerning use of licensed material. For 424 | the avoidance of doubt, this paragraph does not form part of the 425 | public licenses. 426 | 427 | Creative Commons may be contacted at creativecommons.org. 428 | 429 | -------------------------------------------------------------------------------- /demo/README.md: -------------------------------------------------------------------------------- 1 | The text samples in the demo files were adapted from 2 | the following sources: 3 | 4 | - For `demo-language` and `demo-tracking` 5 | (text licensed under CC BY‑SA 3.0): 6 | - https://zh.wikipedia.org/zh-cn/TeX 7 | - https://zh.wikipedia.org/zh-tw/TeX 8 | - https://ja.wikipedia.org/wiki/TeX 9 | - For `demo-halfwidth` 10 | (text licensed under CC BY‑ND 3.0 TW): 11 | - https://dict.revised.moe.edu.tw/ 12 | 13 | Modifications to some of the text were made in order to exhibit 14 | typographic adjustments when typesetting East Asian languages. 15 | The demo files themselves (in SVG format) are licensed under 16 | CC BY‑SA 4.0. -------------------------------------------------------------------------------- /newxeCJK.tex: -------------------------------------------------------------------------------- 1 | \makeatletter 2 | \ExplSyntaxOn 3 | 4 | \tl_new:N \l_@@_CJK_fontfamily_tl 5 | 6 | \cs_new:Npn \@@_tmp:w #1 ; #2 \q_stop 7 | { 8 | \tl_new:c { l_@@_CJK_ #1 family _tl } 9 | \exp_args:Nc \NewDocumentCommand { setCJK #2 font } 10 | { O{} m O{} } 11 | { 12 | \exp_args:Nc \setfontfamily { l_@@_CJK_ #1 family _tl } 13 | [ Script = CJK~Ideographic , ##1 ] {##2} [##3] 14 | \tex_ignorespaces:D 15 | } 16 | \exp_args:Nc \NewDocumentCommand { CJK #1 family } 17 | { } 18 | { 19 | \tl_set_eq:Nc \l_@@_CJK_fontfamily_tl 20 | { l_@@_CJK_ #1 family _tl } 21 | } 22 | % For ltfssini.dtx 2020/01/11 v3.1f or later, until 2020/08/24 v3.2c 23 | \tl_put_right:co { @ #1 familyhook } 24 | { \cs:w CJK #1 family \cs_end: } 25 | % For ltfssini.dtx 2020/08/24 v3.2c or later 26 | % \exp_args:Nno \AddToHook { #1 family } 27 | % { \cs:w CJK #1 family \cs_end: } 28 | } 29 | 30 | \clist_map_inline:nn 31 | { 32 | rm ; main , 33 | sf ; sans , 34 | tt ; mono 35 | } 36 | { \@@_tmp:w #1 \q_stop } 37 | 38 | \cs_set:Npn \@@_tmp:w #1 ; #2 \q_stop 39 | { 40 | \exp_args:Nc \NewDocumentCommand { #1 CJKfontfamily } 41 | { m O{} m O{} } 42 | { 43 | #2 ##1 44 | { } 45 | { 46 | \tl_set_eq:Nc \l_@@_CJK_fontfamily_tl 47 | { l_@@_CJK_! \cs_to_str:N ##1 !_tl } 48 | } 49 | \tl_clear_new:c { l_@@_CJK_! \cs_to_str:N ##1 !_tl } 50 | \exp_args:Nc \setfontfamily 51 | { l_@@_CJK_! \cs_to_str:N ##1 !_tl } 52 | [ Script = CJK~Ideographic , ##2 ] {##3} [##4] 53 | \tex_ignorespaces:D 54 | } 55 | \exp_args:Nc \NewDocumentCommand { #1 CJKfontface } 56 | { m O{} m O{} } 57 | { 58 | \cs:w #1 CJKfontfamily \cs_end: ##1 59 | [ 60 | ItalicFont = { } , 61 | BoldFont = { } , 62 | SmallCapsFont = { } , 63 | ##2 64 | ] {##3} [##4] 65 | } 66 | } 67 | 68 | \clist_map_inline:nn 69 | { 70 | new ; \NewDocumentCommand , 71 | renew ; \RenewDocumentCommand , 72 | provide ; \ProvideDocumentCommand , 73 | set ; \DeclareDocumentCommand 74 | } 75 | { \@@_tmp:w #1 \q_stop } 76 | 77 | \msg_new:nnnn { newxeCJK } { charclass-already-defined } 78 | { XeTeX~charclass~#1~already~defined. } 79 | { 80 | newxeCJK~has~been~asked~to~create~a~new~charclass~'#1',\\ 81 | but~this~name~has~already~been~used~elsewhere. 82 | } 83 | \msg_new:nnnn { newxeCJK } { charclass-not-defined } 84 | { XeTeX~charclass~#1~undefined. } 85 | { 86 | newxeCJK~has~been~asked~to~use~a~charclass~'#1',\\ 87 | but~this~has~not~been~defined~yet. 88 | } 89 | \cs_new_protected:Npn \@@_chk_if_exist_charclass:n #1 90 | { 91 | \cs_if_exist:cF { g_@@_ #1 _class } 92 | { 93 | \msg_error:nnx { newxeCJK } { charclass-not-defined } 94 | { \tl_to_str:n {#1} } 95 | } 96 | } 97 | 98 | % Creating new charclasses 99 | 100 | \cs_new_protected:Npn \@@_charclass_new:n #1 101 | { 102 | \cs_if_exist:cTF { g_@@_ #1 _class } 103 | { 104 | \msg_error:nnx { newxeCJK } { charclass-already-defined } 105 | { \tl_to_str:n {#1} } 106 | } 107 | { 108 | \exp_args:Nc \newXeTeXintercharclass 109 | { g_@@_ #1 _class } 110 | } 111 | } 112 | \@@_charclass_new:n { CJK } 113 | \@@_charclass_new:n { Closing_LeftHalf } 114 | \@@_charclass_new:n { Closing_MiddleHalf } 115 | \@@_charclass_new:n { Closing_Full } 116 | \@@_charclass_new:n { Opening_RightHalf } 117 | \@@_charclass_new:n { Opening_Full } 118 | \@@_charclass_new:n { non_CJK_Punct } 119 | 120 | % Manipulating inter-char token registers 121 | 122 | \cs_new_eq:NN \@@_interchartoks_set:NNn 123 | \tex_XeTeXinterchartoks:D 124 | \cs_new_protected:Npn \@@_interchartoks_set:nNn #1 125 | { 126 | \@@_chk_if_exist_charclass:n {#1} 127 | \tex_XeTeXinterchartoks:D 128 | \cs:w g_@@_ #1 _class \cs_end: 129 | } 130 | \cs_new_protected:Npn \@@_interchartoks_set:Nnn #1#2 131 | { 132 | \@@_chk_if_exist_charclass:n {#2} 133 | \tex_XeTeXinterchartoks:D 134 | \exp_after:wN #1 135 | \cs:w g_@@_ #2 _class \cs_end: 136 | } 137 | \cs_new_protected:Npn \@@_interchartoks_set:nnn #1#2 138 | { 139 | \@@_chk_if_exist_charclass:n {#1} 140 | \@@_chk_if_exist_charclass:n {#2} 141 | \tex_XeTeXinterchartoks:D 142 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 143 | \cs:w g_@@_ #2 _class \cs_end: 144 | } 145 | 146 | \cs_new_protected:Npn \@@_interchartoks_set_eq:NNNN #1#2 147 | { 148 | \tex_XeTeXinterchartoks:D #1 #2 149 | \tex_XeTeXinterchartoks:D 150 | } 151 | \cs_new_protected:Npn \@@_interchartoks_set_eq:NNnN #1#2#3 152 | { 153 | \@@_chk_if_exist_charclass:n {#3} 154 | \tex_XeTeXinterchartoks:D #1 #2 155 | \tex_XeTeXinterchartoks:D 156 | \cs:w g_@@_ #3 _class \cs_end: 157 | } 158 | \cs_new_protected:Npn \@@_interchartoks_set_eq:NNNn #1#2#3#4 159 | { 160 | \@@_chk_if_exist_charclass:n {#4} 161 | \tex_XeTeXinterchartoks:D #1 #2 162 | \tex_XeTeXinterchartoks:D 163 | \exp_after:wN #3 164 | \cs:w g_@@_ #4 _class \cs_end: 165 | } 166 | \cs_new_protected:Npn \@@_interchartoks_set_eq:NNnn #1#2#3#4 167 | { 168 | \@@_chk_if_exist_charclass:n {#3} 169 | \@@_chk_if_exist_charclass:n {#4} 170 | \tex_XeTeXinterchartoks:D #1 #2 171 | \tex_XeTeXinterchartoks:D 172 | \cs:w g_@@_ #3 _class \exp_after:wN \cs_end: 173 | \cs:w g_@@_ #4 _class \cs_end: 174 | } 175 | \cs_new_protected:Npn \@@_interchartoks_set_eq:nNNN #1#2 176 | { 177 | \@@_chk_if_exist_charclass:n {#1} 178 | \tex_XeTeXinterchartoks:D 179 | \cs:w g_@@_ #1 _class \cs_end: 180 | #2 181 | \tex_XeTeXinterchartoks:D 182 | } 183 | \cs_new_protected:Npn \@@_interchartoks_set_eq:nNnN #1#2#3 184 | { 185 | \@@_chk_if_exist_charclass:n {#1} 186 | \@@_chk_if_exist_charclass:n {#3} 187 | \tex_XeTeXinterchartoks:D 188 | \cs:w g_@@_ #1 _class \cs_end: 189 | #2 190 | \tex_XeTeXinterchartoks:D 191 | \cs:w g_@@_ #3 _class \cs_end: 192 | } 193 | \cs_new_protected:Npn \@@_interchartoks_set_eq:nNNn #1#2#3#4 194 | { 195 | \@@_chk_if_exist_charclass:n {#1} 196 | \@@_chk_if_exist_charclass:n {#4} 197 | \tex_XeTeXinterchartoks:D 198 | \cs:w g_@@_ #1 _class \cs_end: 199 | #2 200 | \tex_XeTeXinterchartoks:D 201 | \exp_after:wN #3 202 | \cs:w g_@@_ #4 _class \cs_end: 203 | } 204 | \cs_new_protected:Npn \@@_interchartoks_set_eq:nNnn #1#2#3#4 205 | { 206 | \@@_chk_if_exist_charclass:n {#1} 207 | \@@_chk_if_exist_charclass:n {#3} 208 | \@@_chk_if_exist_charclass:n {#4} 209 | \tex_XeTeXinterchartoks:D 210 | \cs:w g_@@_ #1 _class \cs_end: 211 | #2 212 | \tex_XeTeXinterchartoks:D 213 | \cs:w g_@@_ #3 _class \exp_after:wN \cs_end: 214 | \cs:w g_@@_ #4 _class \cs_end: 215 | } 216 | \cs_new_protected:Npn \@@_interchartoks_set_eq:NnNN #1#2 217 | { 218 | \@@_chk_if_exist_charclass:n {#2} 219 | \tex_XeTeXinterchartoks:D 220 | \exp_after:wN #1 221 | \cs:w g_@@_ #2 _class \cs_end: 222 | \tex_XeTeXinterchartoks:D 223 | } 224 | \cs_new_protected:Npn \@@_interchartoks_set_eq:NnnN #1#2#3 225 | { 226 | \@@_chk_if_exist_charclass:n {#2} 227 | \@@_chk_if_exist_charclass:n {#3} 228 | \tex_XeTeXinterchartoks:D 229 | \exp_after:wN #1 230 | \cs:w g_@@_ #2 _class \cs_end: 231 | \tex_XeTeXinterchartoks:D 232 | \cs:w g_@@_ #3 _class \cs_end: 233 | } 234 | \cs_new_protected:Npn \@@_interchartoks_set_eq:NnNn #1#2#3#4 235 | { 236 | \@@_chk_if_exist_charclass:n {#2} 237 | \@@_chk_if_exist_charclass:n {#4} 238 | \tex_XeTeXinterchartoks:D 239 | \exp_after:wN #1 240 | \cs:w g_@@_ #2 _class \cs_end: 241 | \tex_XeTeXinterchartoks:D 242 | \exp_after:wN #3 243 | \cs:w g_@@_ #4 _class \cs_end: 244 | } 245 | \cs_new_protected:Npn \@@_interchartoks_set_eq:Nnnn #1#2#3#4 246 | { 247 | \@@_chk_if_exist_charclass:n {#2} 248 | \@@_chk_if_exist_charclass:n {#3} 249 | \@@_chk_if_exist_charclass:n {#4} 250 | \tex_XeTeXinterchartoks:D 251 | \exp_after:wN #1 252 | \cs:w g_@@_ #2 _class \cs_end: 253 | \tex_XeTeXinterchartoks:D 254 | \cs:w g_@@_ #3 _class \exp_after:wN \cs_end: 255 | \cs:w g_@@_ #4 _class \cs_end: 256 | } 257 | \cs_new_protected:Npn \@@_interchartoks_set_eq:nnNN #1#2 258 | { 259 | \@@_chk_if_exist_charclass:n {#1} 260 | \@@_chk_if_exist_charclass:n {#2} 261 | \tex_XeTeXinterchartoks:D 262 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 263 | \cs:w g_@@_ #2 _class \cs_end: 264 | \tex_XeTeXinterchartoks:D 265 | } 266 | \cs_new_protected:Npn \@@_interchartoks_set_eq:nnnN #1#2#3 267 | { 268 | \@@_chk_if_exist_charclass:n {#1} 269 | \@@_chk_if_exist_charclass:n {#2} 270 | \@@_chk_if_exist_charclass:n {#3} 271 | \tex_XeTeXinterchartoks:D 272 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 273 | \cs:w g_@@_ #2 _class \cs_end: 274 | \tex_XeTeXinterchartoks:D 275 | \cs:w g_@@_ #3 _class \cs_end: 276 | } 277 | \cs_new_protected:Npn \@@_interchartoks_set_eq:nnNn #1#2#3#4 278 | { 279 | \@@_chk_if_exist_charclass:n {#1} 280 | \@@_chk_if_exist_charclass:n {#2} 281 | \@@_chk_if_exist_charclass:n {#4} 282 | \tex_XeTeXinterchartoks:D 283 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 284 | \cs:w g_@@_ #2 _class \cs_end: 285 | \tex_XeTeXinterchartoks:D 286 | \exp_after:wN #3 287 | \cs:w g_@@_ #4 _class \cs_end: 288 | } 289 | \cs_new_protected:Npn \@@_interchartoks_set_eq:nnnn #1#2#3#4 290 | { 291 | \@@_chk_if_exist_charclass:n {#1} 292 | \@@_chk_if_exist_charclass:n {#2} 293 | \@@_chk_if_exist_charclass:n {#3} 294 | \@@_chk_if_exist_charclass:n {#4} 295 | \tex_XeTeXinterchartoks:D 296 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 297 | \cs:w g_@@_ #2 _class \cs_end: 298 | \tex_XeTeXinterchartoks:D 299 | \cs:w g_@@_ #3 _class \exp_after:wN \cs_end: 300 | \cs:w g_@@_ #4 _class \cs_end: 301 | } 302 | 303 | \cs_new_protected:Npn \@@_interchartoks_clear:NN #1#2 304 | { 305 | \tex_XeTeXinterchartoks:D #1 #2 { } 306 | } 307 | \cs_new_protected:Npn \@@_interchartoks_clear:nN #1#2 308 | { 309 | \@@_chk_if_exist_charclass:n {#1} 310 | \tex_XeTeXinterchartoks:D 311 | \cs:w g_@@_ #1 _class \cs_end: 312 | #2 313 | { } 314 | } 315 | \cs_new_protected:Npn \@@_interchartoks_clear:Nn #1#2 316 | { 317 | \@@_chk_if_exist_charclass:n {#2} 318 | \tex_XeTeXinterchartoks:D 319 | \exp_after:wN #1 320 | \cs:w g_@@_ #2 _class \cs_end: 321 | { } 322 | } 323 | \cs_new_protected:Npn \@@_interchartoks_clear:nn #1#2 324 | { 325 | \@@_chk_if_exist_charclass:n {#1} 326 | \@@_chk_if_exist_charclass:n {#2} 327 | \tex_XeTeXinterchartoks:D 328 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 329 | \cs:w g_@@_ #2 _class \cs_end: 330 | { } 331 | } 332 | 333 | \cs_new_protected:Npn \@@_interchartoks_put_left:NNn #1#2 334 | { 335 | \exp_after:wN \@@_interchartoks_put_left_aux:NNw 336 | \exp_after:wN #1 337 | \exp_after:wN #2 338 | \exp_after:wN \q_nil 339 | \tex_the:D \tex_XeTeXinterchartoks:D #1 #2 \q_stop 340 | } 341 | \cs_new_protected:Npn \@@_interchartoks_put_left:nNn #1#2 342 | { 343 | \@@_chk_if_exist_charclass:n {#1} 344 | \exp_after:wN \@@_interchartoks_put_left_aux:NNw 345 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 346 | \exp_after:wN #2 347 | \exp_after:wN \q_nil 348 | \tex_the:D \tex_XeTeXinterchartoks:D 349 | \cs:w g_@@_ #1 _class \cs_end: 350 | #2 351 | \q_stop 352 | } 353 | \cs_new_protected:Npn \@@_interchartoks_put_left:Nnn #1#2 354 | { 355 | \@@_chk_if_exist_charclass:n {#2} 356 | \exp_after:wN \@@_interchartoks_put_left_aux:NNw 357 | \exp_after:wN #1 358 | \cs:w g_@@_ #2 _class \exp_after:wN \cs_end: 359 | \exp_after:wN \q_nil 360 | \tex_the:D \tex_XeTeXinterchartoks:D 361 | \exp_after:wN #1 362 | \cs:w g_@@_ #2 _class \cs_end: 363 | \q_stop 364 | } 365 | \cs_new_protected:Npn \@@_interchartoks_put_left:nnn #1#2 366 | { 367 | \@@_chk_if_exist_charclass:n {#1} 368 | \@@_chk_if_exist_charclass:n {#2} 369 | \exp_after:wN \@@_interchartoks_put_left_aux:NNw 370 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 371 | \cs:w g_@@_ #2 _class \exp_after:wN \cs_end: 372 | \exp_after:wN \q_nil 373 | \tex_the:D \tex_XeTeXinterchartoks:D 374 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 375 | \cs:w g_@@_ #2 _class \cs_end: 376 | \q_stop 377 | } 378 | \cs_new_protected:Npn \@@_interchartoks_put_left_aux:NNw 379 | #1#2 #3 \q_stop #4 380 | { 381 | \tex_XeTeXinterchartoks:D #1 #2 382 | \exp_after:wN { \use_i:nn {#4} #3 } 383 | } 384 | 385 | \cs_new_protected:Npn \@@_interchartoks_put_right:NNn #1#2#3 386 | { 387 | \tex_XeTeXinterchartoks:D #1 #2 388 | \exp_after:wN { 389 | \tex_the:D \tex_XeTeXinterchartoks:D #1 #2 390 | #3 391 | } 392 | } 393 | \cs_new_protected:Npn \@@_interchartoks_put_right:nNn #1#2#3 394 | { 395 | \@@_chk_if_exist_charclass:n {#1} 396 | \tex_XeTeXinterchartoks:D 397 | \cs:w g_@@_ #1 _class \cs_end: 398 | #2 399 | \exp_after:wN { 400 | \tex_the:D \tex_XeTeXinterchartoks:D 401 | \cs:w g_@@_ #1 _class \cs_end: 402 | #2 403 | #3 404 | } 405 | } 406 | \cs_new_protected:Npn \@@_interchartoks_put_right:Nnn #1#2#3 407 | { 408 | \@@_chk_if_exist_charclass:n {#2} 409 | \tex_XeTeXinterchartoks:D 410 | \exp_after:wN #1 411 | \cs:w g_@@_ #2 _class \cs_end: 412 | \exp_after:wN { 413 | \tex_the:D \tex_XeTeXinterchartoks:D 414 | \exp_after:wN #1 415 | \cs:w g_@@_ #2 _class \cs_end: 416 | #3 417 | } 418 | } 419 | \cs_new_protected:Npn \@@_interchartoks_put_right:nnn #1#2#3 420 | { 421 | \@@_chk_if_exist_charclass:n {#1} 422 | \@@_chk_if_exist_charclass:n {#2} 423 | \tex_XeTeXinterchartoks:D 424 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 425 | \cs:w g_@@_ #2 _class \cs_end: 426 | \exp_after:wN { 427 | \tex_the:D \tex_XeTeXinterchartoks:D 428 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 429 | \cs:w g_@@_ #2 _class \cs_end: 430 | #3 431 | } 432 | } 433 | 434 | \tl_new:N \l_@@_CJKglue_tl 435 | \tl_set:Nn \l_@@_CJKglue_tl { 0em plus 1em / 16 } 436 | 437 | \tl_new:N \l_@@_CJKecglue_tl 438 | \tl_set:Nn \l_@@_CJKecglue_tl { 2em plus 1em minus 1em / 10 } 439 | 440 | \fp_new:N \l_@@_punct_width_ratio_fp 441 | \cs_new_protected:Npn \SetPunctWidthRatio #1 442 | { 443 | \fp_set:Nn \l_@@_punct_width_ratio_fp {#1} 444 | } 445 | 446 | \fp_new:N \l_@@_end_sentence_punct_width_ratio_fp 447 | \clist_new:N \l_@@_end_sentence_punct_clist 448 | \cs_new_protected:Npn \SetEndSentencePunctWidthRatio #1 449 | { 450 | \fp_set:Nn \l_@@_end_sentence_punct_width_ratio_fp {#1} 451 | } 452 | 453 | \fp_new:N \l_@@_punct_min_width_ratio_fp 454 | \fp_new:N \l_@@_punct_removable_width_ratio_fp 455 | \cs_new_protected:Npn \SetPunctMinWidthRatio #1 456 | { 457 | \fp_set:Nn \l_@@_punct_min_width_ratio_fp {#1} 458 | \fp_set:Nn \l_@@_punct_removable_width_ratio_fp 459 | { 1 - (#1) } 460 | } 461 | 462 | \fp_new:N \l_@@_mid_punct_min_width_ratio_fp 463 | \fp_new:N \l_@@_mid_punct_removable_width_ratio_fp 464 | \cs_new_protected:Npn \SetMiddlePunctMinWidthRatio #1 465 | { 466 | \fp_set:Nn \l_@@_mid_punct_min_width_ratio_fp {#1} 467 | \fp_set:Nn \l_@@_mid_punct_removable_width_ratio_fp 468 | { ( 1 - (#1) ) / 2 } 469 | } 470 | 471 | \fp_new:N \l_@@_punct_kern_width_ratio_fp 472 | \cs_new_protected:Npn \SetPunctKernWidthRatio #1 473 | { 474 | \fp_set:Nn \l_@@_punct_kern_width_ratio_fp {#1} 475 | } 476 | 477 | \cs_new_protected:Npn \quanjiaostyle 478 | { 479 | \SetPunctWidthRatio { 1 } 480 | \SetEndSentencePunctWidthRatio { 1 } 481 | \SetPunctMinWidthRatio { 0.5 } 482 | \SetMiddlePunctMinWidthRatio { 0.5 } 483 | \SetPunctKernWidthRatio { -0.5 } 484 | } 485 | \quanjiaostyle 486 | \cs_new_protected:Npn \banjiaostyle 487 | { 488 | \SetPunctWidthRatio { 0.5 } 489 | \SetEndSentencePunctWidthRatio { 0.5 } 490 | \SetPunctMinWidthRatio { 0.5 } 491 | \SetMiddlePunctMinWidthRatio { 0.5 } 492 | \SetPunctKernWidthRatio { -0.5 } 493 | } 494 | \cs_new_protected:Npn \kaimingstyle 495 | { 496 | \SetPunctWidthRatio { 0.5 } 497 | \SetEndSentencePunctWidthRatio { 1 } 498 | \SetPunctMinWidthRatio { 0.5 } 499 | \SetMiddlePunctMinWidthRatio { 0.5 } 500 | \SetPunctKernWidthRatio { -0.5 } 501 | } 502 | \cs_new_protected:Npn \plainstyle 503 | { 504 | \SetPunctWidthRatio { 1 } 505 | \SetEndSentencePunctWidthRatio { 1 } 506 | \SetPunctMinWidthRatio { 1 } 507 | \SetMiddlePunctMinWidthRatio { 1 } 508 | \SetPunctKernWidthRatio { 0 } 509 | } 510 | 511 | \tl_new:N \l_@@_punct_offset_dim_tl 512 | \cs_new_protected:Npn \SetPunctOffsetDim #1 513 | { 514 | \tl_set:Nn \l_@@_punct_offset_dim_tl {#1} 515 | } 516 | \SetPunctOffsetDim { 0em } 517 | 518 | \tl_new:N \l_@@_CJK_condensed_ratio_tl 519 | \msg_new:nnnn { newxeCJK } { decimal-not-allowed } 520 | { The~expression~'#1'~must~be~converted~into~a~fraction. } 521 | { 522 | For~example,~if~you~want~'0.8',~ 523 | then~you~should~write~'8/10'~or~'4/5'. 524 | } 525 | \cs_new_protected:Npn \SetCJKCondensedRatio #1 526 | { 527 | \str_if_in:nnTF {#1} { . } 528 | { 529 | \msg_error:nnx { newxeCJK } { decimal-not-allowed } 530 | { \tl_to_str:n {#1} } 531 | } 532 | { 533 | \tl_set:Nn \l_@@_CJK_condensed_ratio_tl {#1} 534 | } 535 | } 536 | \SetCJKCondensedRatio { 1 } 537 | 538 | \bool_new:N \l_@@_enable_hanging_punct_bool 539 | \bool_set_false:N \l_@@_enable_hanging_punct_bool 540 | %\bool_set_true:N \l_@@_enable_hanging_punct_bool 541 | \clist_new:N \l_@@_hangable_punct_clist 542 | 543 | \clist_new:N \l_@@_keep_blank_punct_clist 544 | 545 | \cs_new_protected:Npn \@@_nobreak: 546 | { \tex_penalty:D 10 000 ~ } 547 | 548 | \cs_new_protected:Npn \@@_allowbreak: 549 | { \tex_penalty:D 0 ~ } 550 | 551 | \cs_new_protected:Npn \@@_insert_CJKglue: 552 | { \skip_horizontal:n { \l_@@_CJKglue_tl } } 553 | 554 | \cs_new_protected:Npn \@@_insert_nobreak_CJKglue: 555 | { \@@_nobreak: \skip_horizontal:n { \l_@@_CJKglue_tl } } 556 | 557 | \cs_new_protected:Npn \@@_insert_CJKecglue: 558 | { \skip_horizontal:n { \l_@@_CJKecglue_tl } } 559 | 560 | \cs_new_protected:Npn \@@_insert_nobreak_CJKecglue: 561 | { \@@_nobreak: \skip_horizontal:n { \l_@@_CJKecglue_tl } } 562 | 563 | \cs_new_protected:Npn \@@_remove_blank:n #1 564 | { 565 | \tex_vrule:D 566 | height \c_zero_dim 567 | depth \c_zero_dim 568 | width 569 | - \tex_dimexpr:D 570 | (#1) * \l_@@_CJK_condensed_ratio_tl 571 | \tex_relax:D 572 | \scan_stop: 573 | } 574 | 575 | \cs_new_protected:Npn \@@_remove_blank_add_glue:n #1 576 | { 577 | \@@_remove_blank:n {#1} 578 | \skip_horizontal:n 579 | { #1 * \l_@@_CJK_condensed_ratio_tl } 580 | } 581 | 582 | \cs_new_protected:Npn \@@_add_shrinkable_glue:n #1 583 | { 584 | \skip_horizontal:n 585 | { #1 minus #1 * \l_@@_CJK_condensed_ratio_tl } 586 | } 587 | 588 | \bool_new:N \l_@@_keep_current_punct_blank_bool 589 | \bool_new:N \l_@@_hang_current_punct_bool 590 | \fp_new:N \l_@@_current_punct_width_ratio_fp 591 | 592 | \cs_new_protected:Npn \@@_preprocess_closing_punct:nN #1#2 593 | { 594 | \bool_set_false:N \l_@@_keep_current_punct_blank_bool 595 | \@@_if_in_setup:Nnn 596 | \l_@@_keep_blank_punct_clist 597 | { `#2 } 598 | { \bool_set_true:N \l_@@_keep_current_punct_blank_bool } 599 | \bool_set_false:N \l_@@_hang_current_punct_bool 600 | \bool_if:NT \l_@@_enable_hanging_punct_bool 601 | { 602 | \@@_if_in_setup:Nnn 603 | \l_@@_hangable_punct_clist 604 | { `#2 } 605 | { \bool_set_true:N \l_@@_hang_current_punct_bool } 606 | } 607 | \fp_compare:nNnT 608 | \l_@@_current_punct_width_ratio_fp 609 | < \l_@@_end_sentence_punct_width_ratio_fp 610 | { 611 | \@@_if_in_setup:Nnn 612 | \l_@@_end_sentence_punct_clist 613 | { `#2 } 614 | \@@_set_current_punct_width_ratio_end: 615 | } 616 | #1 617 | #2 618 | } 619 | 620 | \cs_new_protected:Npn \@@_if_in_setup:Nnn #1#2#3 621 | { 622 | \clist_map_inline:Nn #1 623 | { 624 | \int_compare:nNnT {##1} = {#2} 625 | { \clist_map_break:n {#3} } 626 | } 627 | } 628 | 629 | \cs_new_protected:Npn \@@_set_current_punct_width_ratio: 630 | { 631 | \fp_set_eq:NN \l_@@_current_punct_width_ratio_fp 632 | \l_@@_punct_width_ratio_fp 633 | } 634 | 635 | \cs_new_protected:Npn \@@_set_current_punct_width_ratio_end: 636 | { 637 | \fp_set_eq:NN \l_@@_current_punct_width_ratio_fp 638 | \l_@@_end_sentence_punct_width_ratio_fp 639 | } 640 | 641 | % CJK 与 CJK 642 | 643 | \XeTeXinterchartoks \g_@@_CJK_class \g_@@_CJK_class 644 | { \@@_insert_CJKglue: } 645 | 646 | % CJK 与 closing 647 | 648 | \XeTeXinterchartoks \g_@@_CJK_class \g_@@_Closing_LeftHalf_class 649 | { 650 | \@@_insert_nobreak_CJKglue: 651 | \@@_set_current_punct_width_ratio: 652 | \@@_preprocess_closing_punct:nN 653 | { 654 | \bool_if:NT \l_@@_hang_current_punct_bool 655 | \tex_unskip:D 656 | \@@_remove_blank:n 657 | { \l_@@_punct_offset_dim_tl } 658 | } 659 | } 660 | 661 | \XeTeXinterchartoks \g_@@_Closing_LeftHalf_class \g_@@_CJK_class 662 | { 663 | \@@_remove_blank:n 664 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 665 | \@@_remove_blank:n 666 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 667 | \bool_if:NT \l_@@_hang_current_punct_bool 668 | { 669 | \exp_args:Nx \@@_remove_blank_add_glue:n 670 | { \fp_use:N \l_@@_punct_min_width_ratio_fp em } 671 | \bool_if:NF \l_@@_keep_current_punct_blank_bool 672 | { \@@_allowbreak: } 673 | } 674 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 675 | { \@@_nobreak: } 676 | \exp_args:Nx \@@_add_shrinkable_glue:n 677 | { 678 | \fp_max:nn 679 | { 680 | \l_@@_current_punct_width_ratio_fp 681 | - \l_@@_punct_min_width_ratio_fp 682 | } 683 | \c_zero_fp em 684 | } 685 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 686 | { \@@_allowbreak: } 687 | \@@_insert_CJKglue: 688 | } 689 | 690 | \XeTeXinterchartoks \g_@@_CJK_class \g_@@_Closing_MiddleHalf_class 691 | { 692 | \@@_insert_nobreak_CJKglue: 693 | \@@_set_current_punct_width_ratio: 694 | \@@_preprocess_closing_punct:nN 695 | { 696 | % \@@_nobreak: 697 | \exp_args:Nx \@@_add_shrinkable_glue:n 698 | { 699 | \fp_max:nn 700 | { 701 | ( \l_@@_current_punct_width_ratio_fp 702 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 703 | } 704 | \c_zero_fp em 705 | } 706 | \@@_remove_blank:n 707 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 708 | } 709 | } 710 | 711 | \XeTeXinterchartoks \g_@@_Closing_MiddleHalf_class \g_@@_CJK_class 712 | { 713 | \@@_remove_blank:n 714 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 715 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 716 | { \@@_nobreak: } 717 | \exp_args:Nx \@@_add_shrinkable_glue:n 718 | { 719 | \fp_max:nn 720 | { 721 | ( \l_@@_current_punct_width_ratio_fp 722 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 723 | } 724 | \c_zero_fp em 725 | } 726 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 727 | { \@@_allowbreak: } 728 | \@@_insert_CJKglue: 729 | } 730 | 731 | \XeTeXinterchartoks \g_@@_CJK_class \g_@@_Closing_Full_class 732 | { \@@_insert_nobreak_CJKglue: } 733 | 734 | \XeTeXinterchartoks \g_@@_Closing_Full_class \g_@@_CJK_class 735 | { \@@_insert_CJKglue: } 736 | 737 | % CJK 与 opening 738 | 739 | \XeTeXinterchartoks \g_@@_CJK_class \g_@@_Opening_RightHalf_class 740 | { 741 | \@@_insert_CJKglue: 742 | \exp_args:Nx \@@_add_shrinkable_glue:n 743 | { 744 | \fp_max:nn 745 | { 746 | \l_@@_punct_width_ratio_fp 747 | - \l_@@_punct_min_width_ratio_fp 748 | } 749 | \c_zero_fp em 750 | } 751 | \@@_remove_blank:n 752 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 753 | \@@_remove_blank:n 754 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 755 | } 756 | 757 | \XeTeXinterchartoks \g_@@_Opening_RightHalf_class \g_@@_CJK_class 758 | { 759 | \@@_remove_blank:n 760 | { \l_@@_punct_offset_dim_tl } 761 | \@@_insert_nobreak_CJKglue: 762 | } 763 | 764 | \XeTeXinterchartoks \g_@@_CJK_class \g_@@_Opening_Full_class 765 | { \@@_insert_CJKglue: } 766 | 767 | \XeTeXinterchartoks \g_@@_Opening_Full_class \g_@@_CJK_class 768 | { \@@_insert_nobreak_CJKglue: } 769 | 770 | % closing 到 opening 771 | 772 | \XeTeXinterchartoks \g_@@_Closing_LeftHalf_class \g_@@_Opening_RightHalf_class 773 | { 774 | \@@_remove_blank:n 775 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 776 | \@@_remove_blank:n 777 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 778 | \bool_if:NT \l_@@_hang_current_punct_bool 779 | { 780 | \exp_args:Nx \@@_remove_blank_add_glue:n 781 | { \fp_use:N \l_@@_punct_min_width_ratio_fp em } 782 | \bool_if:NF \l_@@_keep_current_punct_blank_bool 783 | { \@@_allowbreak: } 784 | } 785 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 786 | { \@@_nobreak: } 787 | \exp_args:Nx \@@_add_shrinkable_glue:n 788 | { 789 | \fp_max:nn 790 | { 791 | \l_@@_current_punct_width_ratio_fp 792 | - \l_@@_punct_min_width_ratio_fp 793 | } 794 | \c_zero_fp em 795 | } 796 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 797 | { \@@_allowbreak: } 798 | \@@_remove_blank:n 799 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 800 | \@@_remove_blank:n 801 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 802 | } 803 | 804 | \XeTeXinterchartoks \g_@@_Closing_MiddleHalf_class \g_@@_Opening_RightHalf_class 805 | { 806 | \@@_remove_blank:n 807 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 808 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 809 | { \@@_nobreak: } 810 | \exp_args:Nx \@@_add_shrinkable_glue:n 811 | { 812 | \fp_max:nn 813 | { 814 | ( \l_@@_current_punct_width_ratio_fp 815 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 816 | } 817 | \c_zero_fp em 818 | } 819 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 820 | { \@@_allowbreak: } 821 | \@@_remove_blank:n 822 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 823 | \@@_remove_blank:n 824 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 825 | } 826 | 827 | \XeTeXinterchartoks \g_@@_Closing_Full_class \g_@@_Opening_RightHalf_class 828 | { 829 | \@@_allowbreak: 830 | \@@_remove_blank:n 831 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 832 | \@@_remove_blank:n 833 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 834 | } 835 | 836 | \XeTeXinterchartoks \g_@@_Closing_LeftHalf_class \g_@@_Opening_Full_class 837 | { 838 | \@@_remove_blank:n 839 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 840 | \@@_remove_blank:n 841 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 842 | \bool_if:NT \l_@@_hang_current_punct_bool 843 | { 844 | \exp_args:Nx \@@_remove_blank_add_glue:n 845 | { \fp_use:N \l_@@_punct_min_width_ratio_fp em } 846 | \bool_if:NF \l_@@_keep_current_punct_blank_bool 847 | { \@@_allowbreak: } 848 | } 849 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 850 | { \@@_nobreak: } 851 | \exp_args:Nx \@@_add_shrinkable_glue:n 852 | { 853 | \fp_max:nn 854 | { 855 | \l_@@_current_punct_width_ratio_fp 856 | - \l_@@_punct_min_width_ratio_fp 857 | } 858 | \c_zero_fp em 859 | } 860 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 861 | { \@@_allowbreak: } 862 | } 863 | 864 | \XeTeXinterchartoks \g_@@_Closing_MiddleHalf_class \g_@@_Opening_Full_class 865 | { 866 | \@@_remove_blank:n 867 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 868 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 869 | { \@@_nobreak: } 870 | \exp_args:Nx \@@_add_shrinkable_glue:n 871 | { 872 | \fp_max:nn 873 | { 874 | ( \l_@@_current_punct_width_ratio_fp 875 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 876 | } 877 | \c_zero_fp em 878 | } 879 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 880 | { \@@_allowbreak: } 881 | } 882 | 883 | \XeTeXinterchartoks \g_@@_Closing_Full_class \g_@@_Opening_Full_class 884 | { \@@_allowbreak: } 885 | 886 | % opening 到 opening 887 | 888 | \XeTeXinterchartoks \g_@@_Opening_RightHalf_class \g_@@_Opening_RightHalf_class 889 | { 890 | \@@_remove_blank:n 891 | { - \fp_use:N \l_@@_punct_kern_width_ratio_fp em } 892 | } 893 | 894 | \XeTeXinterchartoks \g_@@_Opening_Full_class \g_@@_Opening_RightHalf_class 895 | { 896 | \@@_remove_blank:n 897 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 898 | \@@_remove_blank:n 899 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 900 | } 901 | 902 | \XeTeXinterchartoks \g_@@_Opening_RightHalf_class \g_@@_Opening_Full_class 903 | { 904 | \@@_remove_blank:n 905 | { \l_@@_punct_offset_dim_tl } 906 | } 907 | 908 | \XeTeXinterchartoks \g_@@_Opening_Full_class \g_@@_Opening_Full_class 909 | { } 910 | 911 | % closing 到 closing 912 | 913 | \XeTeXinterchartoks \g_@@_Closing_LeftHalf_class \g_@@_Closing_LeftHalf_class 914 | { 915 | \@@_remove_blank:n 916 | { - \fp_use:N \l_@@_punct_kern_width_ratio_fp em } 917 | \@@_preprocess_closing_punct:nN { } 918 | } 919 | 920 | \XeTeXinterchartoks \g_@@_Closing_MiddleHalf_class \g_@@_Closing_LeftHalf_class 921 | { 922 | \@@_remove_blank:n 923 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 924 | \@@_nobreak: 925 | \exp_args:Nx \@@_add_shrinkable_glue:n 926 | { 927 | \fp_max:nn 928 | { 929 | ( \l_@@_current_punct_width_ratio_fp 930 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 931 | } 932 | \c_zero_fp em 933 | } 934 | \@@_set_current_punct_width_ratio: 935 | \@@_preprocess_closing_punct:nN 936 | { 937 | \@@_remove_blank:n 938 | { \l_@@_punct_offset_dim_tl } 939 | } 940 | } 941 | 942 | \XeTeXinterchartoks \g_@@_Closing_Full_class \g_@@_Closing_LeftHalf_class 943 | { 944 | \@@_set_current_punct_width_ratio: 945 | \@@_preprocess_closing_punct:nN 946 | { 947 | \@@_remove_blank:n 948 | { \l_@@_punct_offset_dim_tl } 949 | } 950 | } 951 | 952 | \XeTeXinterchartoks \g_@@_Closing_LeftHalf_class \g_@@_Closing_MiddleHalf_class 953 | { 954 | \@@_remove_blank:n 955 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 956 | \@@_remove_blank:n 957 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 958 | \@@_preprocess_closing_punct:nN 959 | { 960 | \@@_nobreak: 961 | \exp_args:Nx \@@_add_shrinkable_glue:n 962 | { 963 | \fp_max:nn 964 | { 965 | ( \l_@@_current_punct_width_ratio_fp 966 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 967 | } 968 | \c_zero_fp em 969 | } 970 | \@@_remove_blank:n 971 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 972 | } 973 | } 974 | 975 | \XeTeXinterchartoks \g_@@_Closing_MiddleHalf_class \g_@@_Closing_MiddleHalf_class 976 | { 977 | \@@_remove_blank:n 978 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 979 | \@@_preprocess_closing_punct:nN 980 | { 981 | \@@_nobreak: 982 | \exp_args:Nx \@@_add_shrinkable_glue:n 983 | { 984 | \fp_max:nn 985 | { 986 | ( \l_@@_current_punct_width_ratio_fp 987 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 988 | } 989 | \c_zero_fp em 990 | } 991 | \@@_remove_blank:n 992 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 993 | } 994 | } 995 | 996 | \XeTeXinterchartoks \g_@@_Closing_Full_class \g_@@_Closing_MiddleHalf_class 997 | { 998 | \@@_set_current_punct_width_ratio: 999 | \@@_preprocess_closing_punct:nN 1000 | { 1001 | \@@_nobreak: 1002 | \exp_args:Nx \@@_add_shrinkable_glue:n 1003 | { 1004 | \fp_max:nn 1005 | { 1006 | ( \l_@@_current_punct_width_ratio_fp 1007 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 1008 | } 1009 | \c_zero_fp em 1010 | } 1011 | \@@_remove_blank:n 1012 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 1013 | } 1014 | } 1015 | 1016 | \XeTeXinterchartoks \g_@@_Closing_LeftHalf_class \g_@@_Closing_Full_class 1017 | { 1018 | \@@_remove_blank:n 1019 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 1020 | \@@_remove_blank:n 1021 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 1022 | } 1023 | 1024 | \XeTeXinterchartoks \g_@@_Closing_MiddleHalf_class \g_@@_Closing_Full_class 1025 | { 1026 | \@@_remove_blank:n 1027 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 1028 | \@@_nobreak: 1029 | \exp_args:Nx \@@_add_shrinkable_glue:n 1030 | { 1031 | \fp_max:nn 1032 | { 1033 | ( \l_@@_current_punct_width_ratio_fp 1034 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 1035 | } 1036 | \c_zero_fp em 1037 | } 1038 | } 1039 | 1040 | \XeTeXinterchartoks \g_@@_Closing_Full_class \g_@@_Closing_Full_class 1041 | { } 1042 | 1043 | % opening 到 closing 1044 | 1045 | \XeTeXinterchartoks \g_@@_Opening_RightHalf_class \g_@@_Closing_LeftHalf_class 1046 | { 1047 | \@@_remove_blank:n 1048 | { \l_@@_punct_offset_dim_tl } 1049 | \@@_set_current_punct_width_ratio: 1050 | \@@_preprocess_closing_punct:nN 1051 | { 1052 | \@@_remove_blank:n 1053 | { \l_@@_punct_offset_dim_tl } 1054 | } 1055 | } 1056 | 1057 | \XeTeXinterchartoks \g_@@_Opening_Full_class \g_@@_Closing_LeftHalf_class 1058 | { 1059 | \@@_set_current_punct_width_ratio: 1060 | \@@_preprocess_closing_punct:nN 1061 | { 1062 | \@@_remove_blank:n 1063 | { \l_@@_punct_offset_dim_tl } 1064 | } 1065 | } 1066 | 1067 | \XeTeXinterchartoks \g_@@_Opening_RightHalf_class \g_@@_Closing_MiddleHalf_class 1068 | { 1069 | \@@_remove_blank:n 1070 | { \l_@@_punct_offset_dim_tl } 1071 | \@@_set_current_punct_width_ratio: 1072 | \@@_preprocess_closing_punct:nN 1073 | { 1074 | \@@_nobreak: 1075 | \exp_args:Nx \@@_add_shrinkable_glue:n 1076 | { 1077 | \fp_max:nn 1078 | { 1079 | ( \l_@@_current_punct_width_ratio_fp 1080 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 1081 | } 1082 | \c_zero_fp em 1083 | } 1084 | \@@_remove_blank:n 1085 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 1086 | } 1087 | } 1088 | 1089 | \XeTeXinterchartoks \g_@@_Opening_Full_class \g_@@_Closing_MiddleHalf_class 1090 | { 1091 | \@@_set_current_punct_width_ratio: 1092 | \@@_preprocess_closing_punct:nN 1093 | { 1094 | \@@_nobreak: 1095 | \exp_args:Nx \@@_add_shrinkable_glue:n 1096 | { 1097 | \fp_max:nn 1098 | { 1099 | ( \l_@@_current_punct_width_ratio_fp 1100 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 1101 | } 1102 | \c_zero_fp em 1103 | } 1104 | \@@_remove_blank:n 1105 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 1106 | } 1107 | } 1108 | 1109 | \XeTeXinterchartoks \g_@@_Opening_RightHalf_class \g_@@_Closing_Full_class 1110 | { 1111 | \@@_remove_blank:n 1112 | { \l_@@_punct_offset_dim_tl } 1113 | } 1114 | 1115 | \XeTeXinterchartoks \g_@@_Opening_Full_class \g_@@_Closing_Full_class 1116 | { } 1117 | 1118 | % 消除 boundary 到 CJK 插入的 tokens 1119 | 1120 | \cs_new_protected:Npn \@@_clear_Boundary_to_CJK_interchartoks: 1121 | { 1122 | \clist_map_inline:nn 1123 | { 1124 | \g_@@_CJK_class , 1125 | \g_@@_Closing_LeftHalf_class , 1126 | \g_@@_Closing_MiddleHalf_class , 1127 | \g_@@_Closing_Full_class , 1128 | \g_@@_Opening_RightHalf_class , 1129 | \g_@@_Opening_Full_class 1130 | } 1131 | { 1132 | \tex_XeTeXinterchartoks:D 1133 | \e@alloc@intercharclass@top ##1 { } 1134 | } 1135 | } 1136 | 1137 | % class 0 1138 | 1139 | \XeTeXinterchartoks \c_zero_int \g_@@_CJK_class 1140 | { 1141 | \@@_insert_CJKecglue: 1142 | \c_group_begin_token 1143 | \l_@@_CJK_fontfamily_tl 1144 | \@@_clear_Boundary_to_CJK_interchartoks: 1145 | } 1146 | 1147 | \XeTeXinterchartoks \g_@@_CJK_class \c_zero_int 1148 | { 1149 | \c_group_end_token 1150 | \@@_insert_CJKecglue: 1151 | } 1152 | 1153 | \XeTeXinterchartoks \c_zero_int \g_@@_Closing_LeftHalf_class 1154 | { 1155 | \c_group_begin_token 1156 | \l_@@_CJK_fontfamily_tl 1157 | \@@_clear_Boundary_to_CJK_interchartoks: 1158 | \@@_set_current_punct_width_ratio: 1159 | \@@_preprocess_closing_punct:nN 1160 | { 1161 | \@@_remove_blank:n 1162 | { \l_@@_punct_offset_dim_tl } 1163 | } 1164 | } 1165 | 1166 | \XeTeXinterchartoks \g_@@_Closing_LeftHalf_class \c_zero_int 1167 | { 1168 | \@@_remove_blank:n 1169 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 1170 | \@@_remove_blank:n 1171 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 1172 | \bool_if:NT \l_@@_hang_current_punct_bool 1173 | { 1174 | \exp_args:Nx \@@_remove_blank_add_glue:n 1175 | { \fp_use:N \l_@@_punct_min_width_ratio_fp em } 1176 | \bool_if:NF \l_@@_keep_current_punct_blank_bool 1177 | { \@@_allowbreak: } 1178 | } 1179 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 1180 | { \@@_nobreak: } 1181 | \exp_args:Nx \@@_add_shrinkable_glue:n 1182 | { 1183 | \fp_max:nn 1184 | { 1185 | \l_@@_current_punct_width_ratio_fp 1186 | - \l_@@_punct_min_width_ratio_fp 1187 | } 1188 | \c_zero_fp em 1189 | } 1190 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 1191 | { \@@_allowbreak: } 1192 | \c_group_end_token 1193 | \skip_horizontal:N \c_zero_skip 1194 | } 1195 | 1196 | \XeTeXinterchartoks \c_zero_int \g_@@_Closing_MiddleHalf_class 1197 | { 1198 | \c_group_begin_token 1199 | \l_@@_CJK_fontfamily_tl 1200 | \@@_clear_Boundary_to_CJK_interchartoks: 1201 | \@@_set_current_punct_width_ratio: 1202 | \@@_preprocess_closing_punct:nN 1203 | { 1204 | \@@_nobreak: 1205 | \exp_args:Nx \@@_add_shrinkable_glue:n 1206 | { 1207 | \fp_max:nn 1208 | { 1209 | ( \l_@@_current_punct_width_ratio_fp 1210 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 1211 | } 1212 | \c_zero_fp em 1213 | } 1214 | \@@_remove_blank:n 1215 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 1216 | } 1217 | } 1218 | 1219 | \XeTeXinterchartoks \g_@@_Closing_MiddleHalf_class \c_zero_int 1220 | { 1221 | \@@_remove_blank:n 1222 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 1223 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 1224 | { \@@_nobreak: } 1225 | \exp_args:Nx \@@_add_shrinkable_glue:n 1226 | { 1227 | \fp_max:nn 1228 | { 1229 | ( \l_@@_current_punct_width_ratio_fp 1230 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 1231 | } 1232 | \c_zero_fp em 1233 | } 1234 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 1235 | { \@@_allowbreak: } 1236 | \c_group_end_token 1237 | \skip_horizontal:N \c_zero_skip 1238 | } 1239 | 1240 | \XeTeXinterchartoks \c_zero_int \g_@@_Closing_Full_class 1241 | { 1242 | \c_group_begin_token 1243 | \l_@@_CJK_fontfamily_tl 1244 | \@@_clear_Boundary_to_CJK_interchartoks: 1245 | } 1246 | 1247 | \XeTeXinterchartoks \g_@@_Closing_Full_class \c_zero_int 1248 | { 1249 | \c_group_end_token 1250 | \skip_horizontal:N \c_zero_skip 1251 | } 1252 | 1253 | \XeTeXinterchartoks \c_zero_int \g_@@_Opening_RightHalf_class 1254 | { 1255 | \c_group_begin_token 1256 | \l_@@_CJK_fontfamily_tl 1257 | \@@_clear_Boundary_to_CJK_interchartoks: 1258 | \exp_args:Nx \@@_add_shrinkable_glue:n 1259 | { 1260 | \fp_max:nn 1261 | { 1262 | \l_@@_punct_width_ratio_fp 1263 | - \l_@@_punct_min_width_ratio_fp 1264 | } 1265 | \c_zero_fp em 1266 | } 1267 | \@@_remove_blank:n 1268 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 1269 | \@@_remove_blank:n 1270 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 1271 | } 1272 | 1273 | \XeTeXinterchartoks \g_@@_Opening_RightHalf_class \c_zero_int 1274 | { 1275 | \@@_remove_blank:n 1276 | { \l_@@_punct_offset_dim_tl } 1277 | \c_group_end_token 1278 | \@@_nobreak: \skip_horizontal:N \c_zero_skip 1279 | } 1280 | 1281 | \XeTeXinterchartoks \c_zero_int \g_@@_Opening_Full_class 1282 | { 1283 | \@@_allowbreak: 1284 | \c_group_begin_token 1285 | \l_@@_CJK_fontfamily_tl 1286 | \@@_clear_Boundary_to_CJK_interchartoks: 1287 | } 1288 | 1289 | \XeTeXinterchartoks \g_@@_Opening_Full_class \c_zero_int 1290 | { 1291 | \c_group_end_token 1292 | \@@_nobreak: \skip_horizontal:N \c_zero_skip 1293 | } 1294 | 1295 | % class non-CJK punctuation 1296 | 1297 | \XeTeXinterchartoks \g_@@_non_CJK_Punct_class \g_@@_CJK_class 1298 | { 1299 | \c_group_begin_token 1300 | \l_@@_CJK_fontfamily_tl 1301 | \@@_clear_Boundary_to_CJK_interchartoks: 1302 | } 1303 | 1304 | \XeTeXinterchartoks \g_@@_CJK_class \g_@@_non_CJK_Punct_class 1305 | { 1306 | \c_group_end_token 1307 | } 1308 | 1309 | \XeTeXinterchartoks \g_@@_non_CJK_Punct_class \g_@@_Closing_LeftHalf_class 1310 | { 1311 | \c_group_begin_token 1312 | \l_@@_CJK_fontfamily_tl 1313 | \@@_clear_Boundary_to_CJK_interchartoks: 1314 | \@@_set_current_punct_width_ratio: 1315 | \@@_preprocess_closing_punct:nN 1316 | { 1317 | \@@_remove_blank:n 1318 | { \l_@@_punct_offset_dim_tl } 1319 | } 1320 | } 1321 | 1322 | \XeTeXinterchartoks \g_@@_Closing_LeftHalf_class \g_@@_non_CJK_Punct_class 1323 | { 1324 | \@@_remove_blank:n 1325 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 1326 | \@@_remove_blank:n 1327 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 1328 | \bool_if:NT \l_@@_hang_current_punct_bool 1329 | { 1330 | \exp_args:Nx \@@_remove_blank_add_glue:n 1331 | { \fp_use:N \l_@@_punct_min_width_ratio_fp em } 1332 | \bool_if:NF \l_@@_keep_current_punct_blank_bool 1333 | { \@@_allowbreak: } 1334 | } 1335 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 1336 | { \@@_nobreak: } 1337 | \exp_args:Nx \@@_add_shrinkable_glue:n 1338 | { 1339 | \fp_max:nn 1340 | { 1341 | \l_@@_current_punct_width_ratio_fp 1342 | - \l_@@_punct_min_width_ratio_fp 1343 | } 1344 | \c_zero_fp em 1345 | } 1346 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 1347 | { \@@_allowbreak: } 1348 | \c_group_end_token 1349 | \skip_horizontal:N \c_zero_skip 1350 | } 1351 | 1352 | \XeTeXinterchartoks \g_@@_non_CJK_Punct_class \g_@@_Closing_MiddleHalf_class 1353 | { 1354 | \c_group_begin_token 1355 | \l_@@_CJK_fontfamily_tl 1356 | \@@_clear_Boundary_to_CJK_interchartoks: 1357 | \@@_set_current_punct_width_ratio: 1358 | \@@_preprocess_closing_punct:nN 1359 | { 1360 | \@@_nobreak: 1361 | \exp_args:Nx \@@_add_shrinkable_glue:n 1362 | { 1363 | \fp_max:nn 1364 | { 1365 | ( \l_@@_current_punct_width_ratio_fp 1366 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 1367 | } 1368 | \c_zero_fp em 1369 | } 1370 | \@@_remove_blank:n 1371 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 1372 | } 1373 | } 1374 | 1375 | \XeTeXinterchartoks \g_@@_Closing_MiddleHalf_class \g_@@_non_CJK_Punct_class 1376 | { 1377 | \@@_remove_blank:n 1378 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 1379 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 1380 | { \@@_nobreak: } 1381 | \exp_args:Nx \@@_add_shrinkable_glue:n 1382 | { 1383 | \fp_max:nn 1384 | { 1385 | ( \l_@@_current_punct_width_ratio_fp 1386 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 1387 | } 1388 | \c_zero_fp em 1389 | } 1390 | \bool_if:NT \l_@@_keep_current_punct_blank_bool 1391 | { \@@_allowbreak: } 1392 | \c_group_end_token 1393 | \skip_horizontal:N \c_zero_skip 1394 | } 1395 | 1396 | \XeTeXinterchartoks \g_@@_non_CJK_Punct_class \g_@@_Closing_Full_class 1397 | { 1398 | \c_group_begin_token 1399 | \l_@@_CJK_fontfamily_tl 1400 | \@@_clear_Boundary_to_CJK_interchartoks: 1401 | } 1402 | 1403 | \XeTeXinterchartoks \g_@@_Closing_Full_class \g_@@_non_CJK_Punct_class 1404 | { 1405 | \c_group_end_token 1406 | \skip_horizontal:N \c_zero_skip 1407 | } 1408 | 1409 | \XeTeXinterchartoks \g_@@_non_CJK_Punct_class \g_@@_Opening_RightHalf_class 1410 | { 1411 | \c_group_begin_token 1412 | \l_@@_CJK_fontfamily_tl 1413 | \@@_clear_Boundary_to_CJK_interchartoks: 1414 | \exp_args:Nx \@@_add_shrinkable_glue:n 1415 | { 1416 | \fp_max:nn 1417 | { 1418 | \l_@@_punct_width_ratio_fp 1419 | - \l_@@_punct_min_width_ratio_fp 1420 | } 1421 | \c_zero_fp em 1422 | } 1423 | \@@_remove_blank:n 1424 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 1425 | \@@_remove_blank:n 1426 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 1427 | } 1428 | 1429 | \XeTeXinterchartoks \g_@@_Opening_RightHalf_class \g_@@_non_CJK_Punct_class 1430 | { 1431 | \@@_remove_blank:n 1432 | { \l_@@_punct_offset_dim_tl } 1433 | \c_group_end_token 1434 | \@@_nobreak: \skip_horizontal:N \c_zero_skip 1435 | } 1436 | 1437 | \XeTeXinterchartoks \g_@@_non_CJK_Punct_class \g_@@_Opening_Full_class 1438 | { 1439 | \@@_allowbreak: 1440 | \c_group_begin_token 1441 | \l_@@_CJK_fontfamily_tl 1442 | \@@_clear_Boundary_to_CJK_interchartoks: 1443 | } 1444 | 1445 | \XeTeXinterchartoks \g_@@_Opening_Full_class \g_@@_non_CJK_Punct_class 1446 | { 1447 | \c_group_end_token 1448 | \@@_nobreak: \skip_horizontal:N \c_zero_skip 1449 | } 1450 | 1451 | % class boundary 1452 | 1453 | \XeTeXinterchartoks \e@alloc@intercharclass@top \g_@@_CJK_class 1454 | { 1455 | \c_group_begin_token 1456 | \l_@@_CJK_fontfamily_tl 1457 | \@@_clear_Boundary_to_CJK_interchartoks: 1458 | } 1459 | 1460 | \XeTeXinterchartoks \g_@@_CJK_class \e@alloc@intercharclass@top 1461 | { 1462 | \c_group_end_token 1463 | } 1464 | 1465 | \XeTeXinterchartoks \e@alloc@intercharclass@top \g_@@_Closing_LeftHalf_class 1466 | { 1467 | \c_group_begin_token 1468 | \l_@@_CJK_fontfamily_tl 1469 | \@@_clear_Boundary_to_CJK_interchartoks: 1470 | \@@_set_current_punct_width_ratio: 1471 | \@@_preprocess_closing_punct:nN 1472 | { 1473 | \@@_remove_blank:n 1474 | { \l_@@_punct_offset_dim_tl } 1475 | } 1476 | } 1477 | 1478 | \XeTeXinterchartoks \g_@@_Closing_LeftHalf_class \e@alloc@intercharclass@top 1479 | { 1480 | \@@_remove_blank:n 1481 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 1482 | \c_group_end_token 1483 | } 1484 | 1485 | \XeTeXinterchartoks \e@alloc@intercharclass@top \g_@@_Closing_MiddleHalf_class 1486 | { 1487 | \c_group_begin_token 1488 | \l_@@_CJK_fontfamily_tl 1489 | \@@_clear_Boundary_to_CJK_interchartoks: 1490 | \@@_set_current_punct_width_ratio: 1491 | \@@_preprocess_closing_punct:nN 1492 | { 1493 | \@@_nobreak: 1494 | \exp_args:Nx \@@_add_shrinkable_glue:n 1495 | { 1496 | \fp_max:nn 1497 | { 1498 | ( \l_@@_current_punct_width_ratio_fp 1499 | - \l_@@_mid_punct_min_width_ratio_fp ) / 2 1500 | } 1501 | \c_zero_fp em 1502 | } 1503 | \@@_remove_blank:n 1504 | { \fp_use:N \l_@@_mid_punct_removable_width_ratio_fp em } 1505 | } 1506 | } 1507 | 1508 | \XeTeXinterchartoks \g_@@_Closing_MiddleHalf_class \e@alloc@intercharclass@top 1509 | { 1510 | \c_group_end_token 1511 | } 1512 | 1513 | \XeTeXinterchartoks \e@alloc@intercharclass@top \g_@@_Closing_Full_class 1514 | { 1515 | \c_group_begin_token 1516 | \l_@@_CJK_fontfamily_tl 1517 | \@@_clear_Boundary_to_CJK_interchartoks: 1518 | } 1519 | 1520 | \XeTeXinterchartoks \g_@@_Closing_Full_class \e@alloc@intercharclass@top 1521 | { 1522 | \c_group_end_token 1523 | } 1524 | 1525 | \XeTeXinterchartoks \e@alloc@intercharclass@top \g_@@_Opening_RightHalf_class 1526 | { 1527 | \c_group_begin_token 1528 | \l_@@_CJK_fontfamily_tl 1529 | \@@_clear_Boundary_to_CJK_interchartoks: 1530 | \group_begin: \exp_args:Nc \group_end: 1531 | { 1532 | @@_Boundary_ 1533 | \int_use:N \tex_lastnodetype:D 1534 | _to_Opening_RightHalf: 1535 | } 1536 | \@@_remove_blank:n 1537 | { ( \l_@@_punct_offset_dim_tl ) * -1 } 1538 | } 1539 | 1540 | \XeTeXinterchartoks \g_@@_Opening_RightHalf_class \e@alloc@intercharclass@top 1541 | { 1542 | \@@_remove_blank:n 1543 | { \l_@@_punct_offset_dim_tl } 1544 | \c_group_end_token 1545 | } 1546 | 1547 | \XeTeXinterchartoks \e@alloc@intercharclass@top \g_@@_Opening_Full_class 1548 | { 1549 | \c_group_begin_token 1550 | \l_@@_CJK_fontfamily_tl 1551 | \@@_clear_Boundary_to_CJK_interchartoks: 1552 | } 1553 | 1554 | \XeTeXinterchartoks \g_@@_Opening_Full_class \e@alloc@intercharclass@top 1555 | { 1556 | \c_group_end_token 1557 | } 1558 | 1559 | % empty list 1560 | \cs_new_protected:cpn { @@_Boundary_-1_to_Opening_RightHalf: } 1561 | { 1562 | \@@_remove_blank:n 1563 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 1564 | } 1565 | 1566 | % hlist node 1567 | \box_new:N \l_@@_tmp_box 1568 | \cs_new_protected:cpn { @@_Boundary_ 1_to_Opening_RightHalf: } 1569 | { 1570 | \box_set_to_last:N \l_@@_tmp_box 1571 | \int_compare:nNnTF \tex_lastnodetype:D = { -1 } 1572 | { 1573 | \dim_compare:nNnTF 1574 | { \box_wd:N \l_@@_tmp_box } = \tex_parindent:D 1575 | { 1576 | \dim_compare:nNnTF 1577 | { \box_ht:N \l_@@_tmp_box } = \c_zero_dim 1578 | { 1579 | \dim_compare:nNnTF 1580 | { \box_dp:N \l_@@_tmp_box } = \c_zero_dim 1581 | { \use_i:nn } 1582 | { \use:nn } 1583 | } 1584 | { \use:nn } 1585 | } 1586 | { \use:nn } 1587 | } 1588 | { \use:nn } 1589 | { \box_use_drop:N \l_@@_tmp_box } 1590 | { 1591 | \exp_args:Nx \@@_add_shrinkable_glue:n 1592 | { 1593 | \fp_max:nn 1594 | { 1595 | \l_@@_punct_width_ratio_fp 1596 | - \l_@@_punct_min_width_ratio_fp 1597 | } 1598 | \c_zero_fp em 1599 | } 1600 | } 1601 | \@@_remove_blank:n 1602 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 1603 | } 1604 | 1605 | % rule node 1606 | \cs_new_protected:cpn { @@_Boundary_ 3_to_Opening_RightHalf: } 1607 | { 1608 | \@@_remove_blank:n 1609 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 1610 | } 1611 | 1612 | % glue node 1613 | \cs_new_protected:cpn { @@_Boundary_11_to_Opening_RightHalf: } 1614 | { 1615 | \@@_remove_blank:n 1616 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 1617 | } 1618 | 1619 | % kern node 1620 | \cs_new_protected:cpn { @@_Boundary_12_to_Opening_RightHalf: } 1621 | { 1622 | \@@_remove_blank:n 1623 | { \fp_use:N \l_@@_punct_removable_width_ratio_fp em } 1624 | } 1625 | 1626 | % 字符分类 1627 | 1628 | \cs_new_protected:Npn \@@_assign_charclass_to_charcode:Nn #1#2 1629 | { 1630 | \clist_map_inline:nn {#2} 1631 | { 1632 | \exp_after:wN \@@_assign_charclass_to_charcode_aux:Nw 1633 | \exp_after:wN #1 1634 | \tl_to_str:n {##1} - - \q_stop 1635 | } 1636 | } 1637 | \cs_new_protected:Npn \@@_assign_charclass_to_charcode:nn #1#2 1638 | { 1639 | \@@_chk_if_exist_charclass:n {#1} 1640 | \clist_map_inline:nn {#2} 1641 | { 1642 | \exp_after:wN \@@_assign_charclass_to_charcode_aux:Nw 1643 | \cs:w g_@@_ #1 _class \exp_after:wN \cs_end: 1644 | \tl_to_str:n {##1} - - \q_stop 1645 | } 1646 | } 1647 | 1648 | \msg_new:nnnn { newxeCJK } { invalid-range } 1649 | { The~start~index~#1~is~greater~than~the~end~index~#2. } 1650 | { 1651 | A~valid~range~should~have~its~start~index~ 1652 | less~than~or~equal~to~its~end~index. 1653 | } 1654 | \cs_new_protected:Npn \@@_assign_charclass_to_charcode_aux:Nw 1655 | #1 #2 - #3 - #4 \q_stop 1656 | { 1657 | \int_set:Nn \l_tmpa_int {#2} 1658 | \tl_if_empty:nTF {#3} 1659 | { \tex_XeTeXcharclass:D \l_tmpa_int = #1 } 1660 | { 1661 | \int_compare:nNnTF \l_tmpa_int > {#3} 1662 | { 1663 | \msg_error:nnxx { newxeCJK } { invalid-range } 1664 | { \tl_to_str:n {#2} } { \tl_to_str:n {#3} } 1665 | } 1666 | { 1667 | \int_do_until:nNnn \l_tmpa_int > {#3} 1668 | { 1669 | \tex_XeTeXcharclass:D \l_tmpa_int = #1 1670 | \int_incr:N \l_tmpa_int 1671 | } 1672 | } 1673 | } 1674 | } 1675 | 1676 | \@@_assign_charclass_to_charcode:nn { CJK } 1677 | { 1678 | % Spacing Modifier Letters (only U+02EA and U+02EB) 1679 | % "02C9 , "02CA , "02C7 , "02CB , "02D9 , 1680 | "02EA - "02EB , 1681 | % Hangul Jamo 1682 | "1100 - "11FF , 1683 | % Miscellaneous Technical (only U+23DA and U+23DB) 1684 | "23DA - "23DB , 1685 | % Enclosed Alphanumerics 1686 | "2460 - "24FF , 1687 | % Miscellaneous Symbols (U+2616..U+2617, U+2630..U+2637, U+268A..U+268F) 1688 | "2616 - "2617 , 1689 | "2630 - "2637 , 1690 | "268A - "268F , 1691 | % Dingbats (only U+2776 through U+2793) 1692 | "2776 - "2793 , 1693 | % CJK Radicals Supplement 1694 | "2E80 - "2EFF , 1695 | % Kangxi Radicals 1696 | "2F00 - "2FDF , 1697 | % Ideographic Description Characters 1698 | "2FF0 - "2FFF , 1699 | % CJK Symbols and Punctuation 1700 | "3000 - "303F , 1701 | % Hiragana (U+3099 and U+309A are combining marks) 1702 | "3040 - "309F , 1703 | % Katakana 1704 | "30A0 - "30FF , 1705 | % Bopomofo 1706 | "3100 - "312F , 1707 | % Hangul Compatibility Jamo 1708 | "3130 - "318F , 1709 | % Kanbun 1710 | "3190 - "319F , 1711 | % Bopomofo Extended 1712 | "31A0 - "31BF , 1713 | % CJK Strokes 1714 | "31C0 - "31EF , 1715 | % Katakana Phonetic Extensions 1716 | "31F0 - "31FF , 1717 | % Enclosed CJK Letters and Months 1718 | "3200 - "32FF , 1719 | % CJK Compatibility 1720 | "3300 - "33FF , 1721 | % CJK Unified Ideographs Extension A 1722 | "3400 - "4DBF , 1723 | % Yijing Hexagram Symbols 1724 | "4DC0 - "4DFF , 1725 | % CJK Unified Ideographs 1726 | "4E00 - "9FFF , 1727 | % Yi Syllables 1728 | "A000 - "A48F , 1729 | % Yi Radicals 1730 | "A490 - "A4CF , 1731 | % Lisu 1732 | % "A4D0 - "A4FF , 1733 | % Modifier Tone Letters 1734 | "A700 - "A71F , 1735 | % Hangul Jamo Extended-A 1736 | "A960 - "A97F , 1737 | % Hangul Syllables 1738 | "AC00 - "D7AF , 1739 | % Hangul Jamo Extended-B 1740 | "D7B0 - "D7FF , 1741 | % CJK Compatibility Ideographs 1742 | "F900 - "FAFF , 1743 | % Vertical Forms 1744 | "FE10 - "FE1F , 1745 | % CJK Compatibility Forms 1746 | "FE30 - "FE4F , 1747 | % Small Form Variants 1748 | "FE50 - "FE6F , 1749 | % Halfwidth and Fullwidth Forms 1750 | "FF00 - "FFEF , 1751 | % Lisu Supplement 1752 | % "11FB0 - "11FBF , 1753 | % Miao 1754 | % "16F00 - "16F9F , 1755 | % Ideographic Symbols and Punctuation 1756 | "16FE0 - "16FFF , 1757 | % Tangut 1758 | "17000 - "187FF , 1759 | % Tangut Components 1760 | "18800 - "18AFF , 1761 | % Khitan Small Script 1762 | "18B00 - "18CFF , 1763 | % Tangut Supplement 1764 | "18D00 - "18D7F , 1765 | % Kana Extended-B 1766 | "1AFF0 - "1AFFF , 1767 | % Kana Supplement 1768 | "1B000 - "1B0FF , 1769 | % Kana Extended-A 1770 | "1B100 - "1B12F , 1771 | % Small Kana Extension 1772 | "1B130 - "1B16F , 1773 | % Nushu 1774 | "1B170 - "1B2FF , 1775 | % Tai Xuan Jing Symbols 1776 | "1D300 - "1D35F , 1777 | % Counting Rod Numerals (only U+1D360 through U+1D376) 1778 | "1D360 - "1D376 , 1779 | % Mahjong Tiles 1780 | "1F000 - "1F02F , 1781 | % Enclosed Alphanumeric Supplement 1782 | "1F100 - "1F1FF , 1783 | % Enclosed Ideographic Supplement 1784 | "1F200 - "1F2FF , 1785 | % Chess Symbols (only U+1FA60 through U+1FA6D) 1786 | "1FA60 - "1FA6D , 1787 | % CJK Unified Ideographs Extension B 1788 | "20000 - "2A6DF , 1789 | % CJK Unified Ideographs Extension C 1790 | "2A700 - "2B73F , 1791 | % CJK Unified Ideographs Extension D 1792 | "2B740 - "2B81F , 1793 | % CJK Unified Ideographs Extension E 1794 | "2B820 - "2CEAF , 1795 | % CJK Unified Ideographs Extension F 1796 | "2CEB0 - "2EBEF , 1797 | % CJK Compatibility Ideographs Supplement 1798 | "2F800 - "2FA1F , 1799 | % CJK Unified Ideographs Extension G 1800 | "30000 - "3134F 1801 | } 1802 | 1803 | \@@_assign_charclass_to_charcode:nn { non_CJK_Punct } 1804 | { 1805 | "21 - "2F , 1806 | "3A - "40 , 1807 | "5B - "60 , 1808 | "7B - "7E 1809 | } 1810 | 1811 | \clist_set:Nn \l_@@_end_sentence_punct_clist 1812 | { 1813 | "3002 , "FF01 , "FF0E , "FF1F , "FE12 1814 | } 1815 | 1816 | \clist_set:Nn \l_@@_hangable_punct_clist 1817 | { 1818 | "3001 , "3002 , "FF0C , "FF0E , 1819 | "FE10 , "FE11 , "FE12 1820 | } 1821 | 1822 | \cs_new_protected:Npn \ChineseSimplifiedH 1823 | { 1824 | \clist_clear:N \l_@@_keep_blank_punct_clist 1825 | \@@_assign_charclass_to_charcode:nn { Closing_LeftHalf } 1826 | { 1827 | % 简体中文与英文共用的引号 1828 | "2019 , "201D , 1829 | % 简体中文横排 1830 | "3001 , "3002 , "FF01 , "FF0C , "FF0E , 1831 | "FF1A , "FF1B , "FF1F , 1832 | % 通用横排 1833 | "3009 , "300B , "300D , "300F , "3011 , 1834 | "3015 , "3017 , "3019 , "301B , "301E , 1835 | "301F , "FF09 , "FF3D , "FF5D , "FF60 , 1836 | % 简体中文直排 1837 | "FE10 , "FE11 , "FE12 , 1838 | % 通用直排 1839 | "FE18 , "FE36 , "FE38 , "FE3A , "FE3C , 1840 | "FE3E , "FE40 , "FE42 , "FE44 , "FE48 , 1841 | % 日文音调符号,不允许出现在行首 1842 | "309B , "309C 1843 | } 1844 | \@@_assign_charclass_to_charcode:nn { Closing_MiddleHalf } 1845 | { 1846 | % 港台间隔号 1847 | "2027 , 1848 | % 日文间隔号 1849 | "30A0 , "30FB , 1850 | % 不太确定 1851 | "FF5C , "FFE4 , 1852 | % "FF02 , "FF07 , "FF3E , "FF40 , 1853 | % 直排 En Dash 1854 | "FE32 1855 | } 1856 | \@@_assign_charclass_to_charcode:nn { Closing_Full } 1857 | { 1858 | % 中西共用的标点 1859 | "2014 , "2015 , "2025 , "2026 , 1860 | % 通用横排 1861 | "301C , "3030 , "FF05 , "FF5E , "FFE0 , 1862 | % 数学符号 1863 | "FF0A , "FF0B , "FF0D , "FF0F , 1864 | "FF1C , "FF1D , "FF1E , "FF3C , 1865 | % 简体、繁体中文直排,日文的会旋转成水平的 1866 | "FE13 , 1867 | % 通用直排 1868 | "FE14 , "FE15 , "FE16 , "FE19 , "FE30 , 1869 | "FE31 , 1870 | % Small Form Variants 1871 | "FE50 , "FE51 , "FE52 , "FE54 , "FE55 , 1872 | "FE56 , "FE57 , "FE58 , "FE5A , "FE5C , 1873 | "FE5E , "FE61 , "FE62 , "FE63 , "FE64 , 1874 | "FE65 , "FE66 , "FE68 , "FE6A , 1875 | % 叠字符号、日文长音符,不允许出现在行首 1876 | "3005 , "3031 , "3032 , "3033 , "3034 , 1877 | "3035 , "303B , "309D , "309E , "30FC , 1878 | "30FD , "30FE , 1879 | % 日文小平假名 1880 | "3041 , "3043 , "3045 , "3047 , "3049 , 1881 | "3063 , "3083 , "3085 , "3087 , "308E , 1882 | "3095 , "3096 , 1883 | % 日文小片假名 1884 | "30A1 , "30A3 , "30A5 , "30A7 , "30A9 , 1885 | "30C3 , "30E3 , "30E5 , "30E7 , "30EE , 1886 | "30F5 , "30F6 , 1887 | % 日文小片假名扩展 1888 | "31F0 - "31FF , 1889 | % 变宽或半宽的标点,原则上是居中占满的,所以两端不做挤压调整 1890 | % 中西共用的标点 1891 | "00B7 , "2013 , "2E3A , "2E3B , 1892 | % 半宽标点 1893 | "FF61 , "FF63 , "FF64 , "FF65 , "FFE8 , 1894 | % 半宽日文音调符号,不允许出现在行首 1895 | "FF70 , "FF9E , "FF9F 1896 | } 1897 | \@@_assign_charclass_to_charcode:nn { Opening_RightHalf } 1898 | { 1899 | % 简体中文与英文共用的引号 1900 | "2018 , "201C , 1901 | % 通用横排 1902 | "3008 , "300A , "300C , "300E , "3010 , 1903 | "3014 , "3016 , "3018 , "301A , "301D , 1904 | "FF08 , "FF3B , "FF5B , "FF5F , 1905 | % 通用直排 1906 | "FE17 , "FE35 , "FE37 , "FE39 , "FE3B , 1907 | "FE3D , "FE3F , "FE41 , "FE43 , "FE47 1908 | } 1909 | \@@_assign_charclass_to_charcode:nn { Opening_Full } 1910 | { 1911 | "FF03 , "FF04 , "FFE1 , "FFE5 , "FFE6 , 1912 | % Small Form Variants 1913 | "FE59 , "FE5B , "FE5D , "FE5F , "FE69 , 1914 | % 日文邮编/邮局记号、日文庵点,不允许出现在行末 1915 | "3012 , "3020 , "3036 , "303D , 1916 | % 半宽标点 1917 | "FF62 1918 | } 1919 | } 1920 | \ChineseSimplifiedH 1921 | 1922 | \cs_new_protected:Npn \ChineseSimplifiedV 1923 | { 1924 | \ChineseSimplifiedH 1925 | \@@_assign_charclass_to_charcode:nn { Closing_Full } 1926 | { 1927 | "FF01 , "FF1A , "FF1B , "FF1F 1928 | } 1929 | } 1930 | 1931 | % 繁体中文/日文的这些标点可以来自英文字体 1932 | \cs_new_protected:Npn \@@_assign_non_CJK_Punct_class: 1933 | { 1934 | \@@_assign_charclass_to_charcode:nn { non_CJK_Punct } 1935 | { 1936 | "2019 , "201D , 1937 | "00B7 , 1938 | "2018 , "201C 1939 | } 1940 | } 1941 | 1942 | \cs_new_protected:Npn \ChineseTraditionalH 1943 | { 1944 | \ChineseSimplifiedH 1945 | \clist_set:Nn \l_@@_keep_blank_punct_clist 1946 | { 1947 | "2027 , 1948 | "3001 , "3002 , "FF01 , "FF0C , "FF0E , 1949 | "FF1A , "FF1B , 1950 | "FE10 , "FE11 , "FE12 1951 | } 1952 | \@@_assign_charclass_to_charcode:nn { Closing_MiddleHalf } 1953 | { 1954 | "3001 , "3002 , "FF01 , "FF0C , "FF0E , 1955 | "FF1A , "FF1B , 1956 | "FE10 , "FE11 , "FE12 1957 | } 1958 | \@@_assign_charclass_to_charcode:nn { Closing_Full } 1959 | { 1960 | "FF1F 1961 | } 1962 | \@@_assign_non_CJK_Punct_class: 1963 | } 1964 | 1965 | \cs_new_protected:Npn \ChineseTraditionalV 1966 | { 1967 | \ChineseSimplifiedH 1968 | \clist_set:Nn \l_@@_keep_blank_punct_clist 1969 | { 1970 | "2027 , 1971 | "3001 , "3002 , "FF0C , "FF0E , 1972 | "FE10 , "FE11 , "FE12 1973 | } 1974 | \@@_assign_charclass_to_charcode:nn { Closing_MiddleHalf } 1975 | { 1976 | "3001 , "3002 , "FF0C , "FF0E , 1977 | "FE10 , "FE11 , "FE12 1978 | } 1979 | \@@_assign_charclass_to_charcode:nn { Closing_Full } 1980 | { 1981 | "FF01 , "FF1A , "FF1B , "FF1F 1982 | } 1983 | \@@_assign_non_CJK_Punct_class: 1984 | } 1985 | 1986 | \cs_new_protected:Npn \JapaneseH 1987 | { 1988 | \ChineseSimplifiedH 1989 | \clist_set:Nn \l_@@_keep_blank_punct_clist 1990 | { 1991 | "3002 , "FF0E , "FE12 1992 | } 1993 | \@@_assign_charclass_to_charcode:nn { Closing_MiddleHalf } 1994 | { 1995 | "FF1A , "FF1B 1996 | } 1997 | \@@_assign_charclass_to_charcode:nn { Closing_Full } 1998 | { 1999 | "FF01 , "FF1F 2000 | } 2001 | \@@_assign_non_CJK_Punct_class: 2002 | } 2003 | 2004 | \cs_new_protected:Npn \JapaneseV 2005 | { 2006 | \JapaneseH 2007 | \@@_assign_charclass_to_charcode:nn { Closing_Full } 2008 | { 2009 | "FF1B 2010 | } 2011 | } 2012 | 2013 | % Turning on the inter-char token mechanism. Enjoy! 2014 | 2015 | \tex_XeTeXinterchartokenstate:D \c_one_int 2016 | 2017 | \ExplSyntaxOff 2018 | \makeatother --------------------------------------------------------------------------------