Reduce Windows desktop format, opening and edit latency

This commit is contained in:
gloamxun committed 2026-12-03 00:02:37 +08:00
1 parent 4655f8a3c9
commit 830292b9b6
15 files changed
+1006 -167

No files matched your search

+6 -4
View File
@@ -29,8 +29,9 @@ Unicode 与 pdfLaTeX 兼容项目。
xeCJK 或 fontspec。线索不足时使用 pdfLaTeX,以保留常见旧模板的排版。
可以在「重新编译」旁按项目选择「自动」「Unicode」或「pdfLaTeX」。
切换会保留当前编辑和上次成功预览。首次使用对应模式时会生成格式,
后续重开时复用。若要在已打开的旧模板里添加中文,可以切到「Unicode」,
切换会保留当前编辑和上次成功预览。0.1.11 安装包预先生成两份格式。
打开项目时加载所选格式,后续在同一程序中复用。要在现有模板里添加中文,
可以切到「Unicode」,
并在导言区加入 `\usepackage[UTF8,scheme=plain]{ctex}`。
[CTeX 宏集手册](https://tug.ctan.org/language/chinese/ctex/ctex.pdf)
@@ -50,8 +51,9 @@ cargo build --locked --release --target x86_64-pc-windows-msvc --example native_
zhnumber、fandol、xetex、ctex.doc、xecjk.doc、zhnumber.doc、
fandol.doc 的 `.tar.xz` 归档,放在同一下载目录。脚本用包索引校验
归档,再将 Unicode 资源和许可文件纳入安装包清单。使用已核验的
WSL 发布版作为基础 TeX 资源和 Web 界面的来源,在能访问该参考包
资源树的构建机运行。
WSL 发布版作为基础 TeX 资源和 Web 界面的来源。准备脚本会运行同版
Windows 内核,生成并校验安装包内的两份编译格式。构建机需能访问
参考资源并运行 Windows 程序,可以使用 Windows 或启用互操作的 WSL。
```sh
python3 desktop/build-windows-backend.py desktop/src-tauri/backend \
+29 -1
View File
@@ -5,9 +5,12 @@ import argparse
import hashlib
import json
import lzma
import os
from pathlib import Path, PurePosixPath
import shutil
import stat
import struct
import subprocess
import tarfile
import tempfile
@@ -18,6 +21,7 @@ TOOLS = {
"bibtex.windows": ("bibtex.exe",),
"kpathsea.windows": ("kpsewhich.exe", "kpathsealibw64.dll", "msvcr100.dll"),
}
FORMAT_MODES = ("pdflatex", "xelatex")
UNICODE_PACKAGES = ("ctex", "xecjk", "zhnumber", "fandol", "xetex")
UNICODE_NOTICES = {
"ctex": {"doc/latex/ctex/README.md": "ctex-README.md"},
@@ -145,6 +149,28 @@ def copy_texmf(source, target, skip_generated):
shutil.copy2(path, staged)
def prepare_formats(output):
output = output.resolve(strict=True)
editor = output / "bin/native_editor.exe"
if os.name == "nt":
backend = str(output)
else:
backend = subprocess.check_output(["wslpath", "-w", str(output)], text=True).strip()
editor.chmod(editor.stat().st_mode | stat.S_IXUSR)
subprocess.run(
[str(editor), "--prepare-windows-formats", backend],
stdin=subprocess.DEVNULL,
check=True,
)
for name in FORMAT_MODES:
directory = output / "formats" / name
for filename in ("latex.tfx", "texsys.aux"):
path = directory / filename
if not path.is_file() or not path.stat().st_size:
raise ValueError(f"Missing generated {name} format input: {filename}")
(directory / "latex.log").unlink(missing_ok=True)
def stage(args, output):
reference = json.loads((args.reference / "bundle.json").read_text())
desktop = json.loads((args.reference / "desktop-bundle.json").read_text())
@@ -158,7 +184,8 @@ def stage(args, output):
font_maps = Path(reference["environment"]["TEXFONTMAPS"].rstrip(":"))
(texmf / "fonts").mkdir()
shutil.copy2(font_maps / "pdftex.map", texmf / "fonts")
for entry in ("pdflatex.ini", "xelatex.ini"):
for mode in FORMAT_MODES:
entry = f"{mode}.ini"
if not (texmf / "dist/tex/latex/tex-ini-files" / entry).is_file():
raise ValueError(f"Missing LaTeX initialization source: {entry}")
@@ -189,6 +216,7 @@ def stage(args, output):
texmf / "overlay", licenses / "texlive", args.downloads, database
)
prepare_formats(output)
files = {
path.relative_to(output).as_posix(): digest(path)
for path in sorted(output.rglob("*")) if path.is_file()
+1 -1
View File
@@ -3237,7 +3237,7 @@ dependencies = [
[[package]]
name = "texrra-desktop"
version = "0.1.10"
version = "0.1.11"
dependencies = [
"serde_json",
"tauri",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "texrra-desktop"
version = "0.1.10"
version = "0.1.11"
edition = "2024"
rust-version = "1.92"
license = "MIT OR Apache-2.0"
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Texrra",
"version": "0.1.10",
"version": "0.1.11",
"identifier": "org.texrra.desktop",
"build": {
"frontendDist": "../startup"