{"id":13337430,"url":"https://github.com/Fusyong/zhpunc","last_synced_at":"2025-03-11T06:32:21.196Z","repository":{"id":63182951,"uuid":"547044924","full_name":"Fusyong/zhpunc","owner":"Fusyong","description":"a ConTeXt LMTX module to support Chinese punctuation","archived":false,"fork":false,"pushed_at":"2024-11-13T10:35:56.000Z","size":1815,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-13T11:31:53.674Z","etag":null,"topics":["chinese","cjk","context","luatex","punctuation","tex","typesetting"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Fusyong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-07T03:47:35.000Z","updated_at":"2024-11-13T10:36:00.000Z","dependencies_parsed_at":"2024-10-22T12:03:41.398Z","dependency_job_id":null,"html_url":"https://github.com/Fusyong/zhpunc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fusyong%2Fzhpunc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fusyong%2Fzhpunc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fusyong%2Fzhpunc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fusyong%2Fzhpunc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fusyong","download_url":"https://codeload.github.com/Fusyong/zhpunc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242987032,"owners_count":20217523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chinese","cjk","context","luatex","punctuation","tex","typesetting"],"created_at":"2024-07-29T19:14:20.660Z","updated_at":"2025-03-11T06:32:20.869Z","avatar_url":"https://github.com/Fusyong.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nConTeXt中文标点支持插件，支持常用的标点压缩/标点挤压方案，行端标点对齐，以及其他一些功能补强；兼容竖排[vtypeset](https://github.com/Fusyong/vertical-typesetting)插件。\n\nzhpunc项目是对[zhfonts](https://github.com/Fusyong/zhfonts)项目的重构，而二者都基于[liyanrui/zhfonts项目](https://github.com/liyanrui/zhfonts)，谨致谢忱。\n\n## 安装和使用方法\n\n* 两种安装方法：\n    1. 按[ConTeXt官方指南](https://wiki.contextgarden.net/Modules)安装模块文件：`t-zhpunc.mkiv`（入口）和`t-zhpunc.lua`，然后使用`context --generate`命令更新文件索引\n    1. 将上述文件直接放在编译时的当前路径（通常即排版脚本所在的目录，在vscode环境中即项目根目录）；直接使用lua模块时不限定存放位置，但需要自行确保导入位置正确\n* 使用时在排版脚本前言中设置如下：\n\n```latex\n%%%%%%%%%%%%% 使用模块(保持顺序) %%%%%%%%%%%%%\n% 竖排\n\\usemodule[vtypeset]\n\n\n% 标点压缩与支持\n\\usemodule[zhpunc][pattern=kaiming, spacequad=0.5, hangjian=false]\n% \n% 四种标点压缩方案：全角、开明、半角、原样：\n%   pattern: quanjiao(default), kaiming, banjiao, yuanyang\n% 行间标点（转换`、，。．：！；？`到行间，pattern建议用banjiao）：\n%   hangjian: false(default), true\n% 加空宽度（角）：\n%   spacequad: 0.5(default)\n% \n% 行间书名号和专名号（\\bar实例）：\n%   \\zhuanmh{专名}\n%   \\shumh{书名}\n\n\n% 夹注\n\\usemodule[jiazhu][fontname=tf, fontsize=10.5pt, interlinespace=0.2em]\n% default: fontname=tf, fontsize=10.5pt, interlinespace=0.08em(行间标点时约0.2em)\n% fontname和fontsize与\\switchtobodyfont的对应参数一致\n% 夹注命令：\n%   \\jiazh{夹注}\n\n```\n\n可参考test文件夹下样例脚本中的设置（可能使用了夹注[jiazhu](https://github.com/Fusyong/jiazhu)、竖排[vtypeset](https://github.com/Fusyong/vertical-typesetting)、标点挤压[zhpunc](https://github.com/Fusyong/zhpunc)三个模块）。\n\n### 编译脚本\n\n1. 仅在[ConTeXt LMTX](https://wiki.contextgarden.net/Installation)环境测试。ConTeXt LMTX是与LuaMetaTeX(LuaTeX的后继者)配合使用的、最新的ConTeXt版本。调整后当可用于LuaTeX。可以使用`context --version \u0026\u0026 luametatex --version`命令查看你的环境版本。\n1. 如下编译排版脚本：\n    \u003e```shell\n    \u003e\u003e context 大学章句.lmtx\n    \u003e```\n1. 如果控制台显示中文时有乱码，可用命令临时改变代码页：\n    \u003e```shell\n    \u003e\u003e chcp 65001\n    \u003e```\n\n## 效果\n\n\n![plot](https://blog.xiiigame.com/img/2022-11-20-ConTeXt简介和中文排版效果/竖开明大学.jpg)\n\n![plot](https://blog.xiiigame.com/img/2022-11-20-ConTeXt简介和中文排版效果/横全角庄子.jpg)\n\n\n## TODO \u0026 bugs\n\n* [x] 全部缓存、使用实测的标点字模数据，而不是使用预设的比例，以适应不同字体的实际；\n    * [x] 缓存标点数据\n    * [x] 用于标点压缩\n    * [x] 用于行首尾对齐版心（原用预制数据设置字体凸排属性）\n    * [ ] 用于盒子/夹注首尾对齐版心（**待定**，对窄盒子不利）\n* [x] 变“全角标点压缩/挤压”为“半角标点加空”，预制常见的标点加空规则：\n    * [x] 全角（默认）\n    * [x] 半角\n    * [x] 开明\n    * [x] 原样\n* [x] 用户可自定加空宽度（默认0.5角）\n    * [ ] 可收缩一半（**待定**）\n* [x] 支持[直排模块](https://github.com/Fusyong/vertical-typesetting)\n* [x] 模块化\n* [x] 行间标点\n    * [x] 支持`、，。．：！；？`\n* [x] 优化行间书名号和专名号\n    * [x] 相对字号\n    * [x] 间断问题\n    * [x] 自制metapost，头尾留空\n* [ ] 检查标点压缩与夹注两个模块的加载顺序\n    * [x] 标题夹注中的标点挤压有误（竖排逗号后的收缩胶未正确调整）\n* [ ] 新制分行算法，替代官方的`hanzi`\n    * [ ] 据条件确定两侧拉伸胶的幅度\n* [ ] 拓展、校正或覆盖系统的`hanzi`脚本的行为（**待定**）\n    * [x] 修正两侧收缩胶收缩幅度为实有空白，以防重叠\n* [ ] 允许用户扩展符号类别（**待定**），如：\n    * ☆★○●◎◇◆□\n    * ㈠㈡㈢⑴⑵⑶⒈⒉⒊ⅠⅡⅢ……\n\n## 符号分类与定义\n\n| 《标点符号用法》     |              |                | 重定义   |                  |          |                                                                 | 配置加空     |              |      |      |      |\n| -------------------- | ------------ | -------------- | -------- | ---------------- | -------- | --------------------------------------------------------------- | ------------ | ------------ | ---- | ---- | ---- |\n| 分类                 | 独用占位(角) | 形式           | 补充符号 | 语义单元中的位置 | 禁排     | 备注                                                            | 开明（默认） | 全角（国标） | 半角 | 原样^**^ | 行间 |\n| 句末点号             | 1            | 。？！         | ．       | 后               | 行首禁排 | 忽略`？！` `双用占一，三用占二`的规定，重制统一的标点组占位规则 | 后0.5        | 后0.5        |      |      |      |\n| 句内点号             | 1            | ，、；：       |          | 后               | 行首禁排 |                                                                 |              | 后0.5        |      |      |      |\n| 后半标号             | 1            | ”’）］〕】》〉 | 」』〗｝ | 后               | 行首禁排 |                                                                 |              | 后0.5        |      |      |      |\n| 前半标号             | 1            | “‘（［〔【《〈 | 「『〖｛ | 前               | 行尾禁排 |                                                                 |              | 前0.5        |      |      |      |\n| 省略号               | 2            | `……`           |          | 中^*^            |          | 作为整体                                                        |              |              |      |      |      |\n| 破折号（中后标号）   | 2            | `——`           |          | 中^*^            |          | 作为整体                                                        |              |              |      |      |      |\n| 全角连接号（中标号） | 1            | —～            |          | 中               | 行首禁排 |                                                                 |              |              |      |      |      |\n| 半角连间分（中标号）^***^ | 0.5          | ·-/            | ／       | 中               | 行首禁排 | `/`由`首尾禁排`改为`行首禁排`                                   |              |              |      |      |      |\n\n^*^ 实际上，省略号、破折号可出现在语义单元的前、中、后各处，但字模占位已经足够宽，两侧不再加空，与“连间分”地位相当。  \n^**^ 原样：仅处理不合规的标点（不处理字体本身的问题），如破折号不连续。  \n^***^ 暂不处理`-/`（通常不影响使用）\n\n## 标点占位/加空（挤压、压缩）规则\n\n* **标点字模的占位**\n    * **所有字模均预先调小占位，且居中放置。** 除横势标点（`……` `——` `—` `～` `-`）按《标点符号用法》规定占位，**其余标点一律占0.5角（quad，下同）。** 原因是：\n        * 字模占位窄对断行算法、行尾标点对齐有利；\n        * 居中可简化连用时的定位；\n* **标点组与加空**\n    * 各类标点加空配置见上表中的“配置加空”列；\n    * 语义位置相同的相邻几个标点为一个标点组。如`”〉》`为一个后标点组；\n    * 前标点组，根据最前一个标点，在组前加空。如：\n        * 全角配置：`囗囗␣《〈“囗囗`\n        * 开明配置：`囗囗《〈“囗囗`\n    * 后标点组，根据最后一个标点，在组后加空。如\n        * 全角配置：`囗囗”〉》␣囗囗` `囗囗！〉》␣囗囗` `囗囗〉》！␣囗囗` `囗囗？！␣囗` `囗囗？！！␣囗`\n        * 开明配置：`囗囗”〉》囗囗` `囗囗！〉》囗囗` `囗囗〉》！␣囗囗` `囗囗？！␣囗` `囗囗？！！␣囗`\n    * 中标点组（通常是单个），根据最前一个标点，在组前加空；根据最后一个标点，在组后加空。如：\n        * 全角配置：`囗囗·囗囗` `囗囗/囗囗` `囗囗～囗囗` `囗囗——囗囗`\n        * 开明配置：`囗囗·囗囗` `囗囗/囗囗` `囗囗～囗囗` `囗囗——囗囗`\n    * 同一个位置（如前标点组与后标点组之间）只加空一次（取最大值）。如：\n        * 全角配置：`囗囗”〉》␣《〈“囗囗` `囗囗”〉》！␣《〈“囗囗`  `囗囗”〉》，␣《〈“囗囗`\n        * 开明设置：`囗囗”〉》《〈“囗囗` `囗囗”〉》！␣《〈“囗囗`  `囗囗”〉》，《〈“囗囗`\n    * 中标点组，前后有标点组时，直接附着与前后的标点组，其间不加空。如：\n        * 全角配置：`囗囗”·“囗囗` `囗囗”·囗囗` `囗囗·“囗囗`\n        * 开明设置：`囗囗”·“囗囗` `囗囗”·囗囗` `囗囗·“囗囗`\n* 默认标准空（固定宽度的胶）占位0.5，**可通过设置比例统一调整实际宽度。**\n* 标点前后加扩展胶，与系统给汉字后加扩展胶的规则一致。\n\n## 行首行尾禁排规则\n\n只有行首禁排（禁止符号前断行）、行尾禁排（禁止符号后断行）、不禁排三种（前后可断行）。见上表“禁排”列。\n尽量通过官方的scrp-cjk.lua实现。\n\n## 行首行尾对齐/凸排/悬挂规则\n\n一律对齐字母实际边界与预设文字边界（盒子边界再刨除缩进）。\n尽量通过官方模块实现。\n\n## 调整标点前后伸缩胶\n\n尽量通过官方的scrp-cjk.lua实现。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFusyong%2Fzhpunc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFusyong%2Fzhpunc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFusyong%2Fzhpunc/lists"}