Files
epub-read/README.md

97 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ePub Reader
基于 Rust + egui 的 Windows ePub 阅读器,单 exe 文件,无需额外依赖。
## 截图
![主界面](main.png)
启动页 → 选择 ePub 文件 → Kindle 风格阅读界面。
## 功能
- 📂 打开 .epub 文件(原生文件对话框)
- 📖 Kindle 风格阅读界面(顶部工具栏 + 中央正文 + 底部进度条)
- 🖱️ 点击左右区域翻页(左 30% 上一页、右 30% 下一页)
- ⌨️ 键盘 ← → 翻页
- 📋 目录侧栏(可展开/收起)
- 🔖 书签功能
- 🔍 字体大小调节A⁺ / A⁻
- 🌓 日间/夜间/棕褐色模式切换
- 🎨 多种背景纹理(牛皮纸/稿纸/作文纸/自定义图片)
- 📏 响应式分页引擎(基于 egui Galley 精确测量)
- 🔗 内容锚点定位(字体/窗口大小变化后自动恢复阅读位置)
- 📊 底部进度条可拖动跳转
- 💾 自动保存阅读位置
- 📅 最近文件列表
- ⚙️ 设置持久化settings.json
## 项目结构
```
epub-read/
├── src/
│ ├── main.rs # 程序入口 + 字体初始化
│ ├── app.rs # App 状态管理 + 事件循环
│ ├── book.rs # ePub 解析 + 章节数据结构
│ ├── reader.rs # 响应式分页引擎 + 阅读视图渲染
│ ├── theme.rs # 主题/配色/设置/书签/阅读位置
│ ├── style.rs # 排版样式配置(对齐/行高/缩进)
│ ├── texture.rs # 背景纹理生成
│ ├── font.rs # 中文字体设置
│ └── persistence.rs # 配置文件读写
├── fonts/
│ └── NotoSansSC-Regular.ttf # 内嵌中文字体
├── Cargo.toml
└── .cargo/config.toml # 静态链接配置
```
## 系统要求
- Windows 7+
- 无需安装任何运行时
## 下载
从 [Releases](https://github.com/xiaji/epub-read/releases) 下载最新版本 `epub-read.exe`,直接运行。
## 构建
### 环境要求
- MSYS2 + MinGW64
- Rust 工具链 `x86_64-pc-windows-gnu`
```bash
# 在 MINGW64 终端中
cargo build --release
# 输出: target/release/epub-read.exe
```
### 静态链接说明
已配置 `.cargo/config.toml` 启用 `+crt-static`,编译出的 exe 不依赖 MinGW 运行时 DLL。
内嵌 Noto Sans SC 中文字体(约 17MB确保中文正常显示。
## 技术栈
| 层 | 选型 |
|---|---|
| GUI | [egui](https://github.com/emilk/egui) / [eframe](https://crates.io/crates/eframe) |
| ePub 解析 | [epub](https://crates.io/crates/epub) |
| 文件对话框 | [rfd](https://crates.io/crates/rfd) |
| 序列化 | [serde](https://crates.io/crates/serde) / [serde_json](https://crates.io/crates/serde_json) |
| 中文字体 | [Noto Sans SC](https://fonts.google.com/specimen/Noto+Sans+SC) |
## 开发
```bash
cargo test # 运行测试32 个)
cargo check # 编译检查
cargo run # 调试运行
```
## 许可
MIT