Files
MeowOS-For-R3P2/patch_v2/reader_app/app/progress.h
T
MeowOS 553a7d5d9e reader R1: os.meow.reader 书架+TXT 垂直链路骨架
- core: 编码检测(BOM→UTF-8严格→GB18030/Big5统计, Big5与GB重叠按GB18030兜底, §3.5风险注明)
  + GB18030双字节码表(uint16[126][190]=47880B, tools/gen_gb18030_table.py 生成, 生成物入仓)
  + 流式排版器(贪心断行+Kinsoku避头尾+分页+重排锚定, rd_meas_fn 测量回调替 FreeType, 宿主可测)
  + TXT 流式加载器(按段读, 不整文件入内存, \n 恒独立换行可安全分段)
- engine: FreeType 封装(FT_New_Face 按需读文件, NO_HINTING/LIGHT 灰阶, LRU 512 key=码点+字号,
  blend565, rdft_advance 只测宽不栅格化)
- app: 书架(扫 Books/ 识别 5 后缀, 最近读置顶, 空态提示) + 阅读页(W_CUSTOM 画布 3 栏翻页
  +中央菜单占位(字号±/行距±/返回) +顶栏进度%/章节名) + 书桥(段表+flat 页索引, 渲染, 重排回锚)
  + 进度持久化(MeowData/os.meow.reader/progress/, path hash→seg/ch/fs/ls/ts)
- 取舍: 正文字体 FreeType 直读 TF MeowOS/fonts/ TTF/OTF; 无字体回退 SDK 位图字库(meow_ui_text,
  未打包字体(许可/体积), 全 glyph 兜底 R2); 页位图缓存当前+前后各1页(3×691KB), 翻页动画默认无
- 内存实测(宿主 --wrap malloc, 73页书): 书结构 130KB + 当前段刮擦~1.6MB(行/页容量按 n 偏高,R2 收紧)
  + 字形缓存~650KB + 3页位图 2.07MB ≈ 4.45MB 动态, 在 ≤8MB 阅读态预算内
- 测试: 宿主 core 58/58(enc/gb18030金标准/kinsoku/page/reflow/txt); qemu-mipsel ft_smoke PASS
  + book_smoke(12页/渲染有墨/翻页/重排回锚) PASS; reader 交叉 -Wall -Wextra 0 warning
- 产物: reader(mipsel 静态1.2MB)+build_reader.sh(vendor FreeType 可复现); vendor/二进制 gitignore
2026-09-01 23:26:42 +08:00

43 lines
1.4 KiB
C
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.
/* app/progress.h — 进度持久化:`MeowData/os.meow.reader/progress/`(每书 = path hash 文件)。
*
* 内容(文本,可读可调):v=1 / seg=<段> / ch=<字符偏移> / fs=<字号> / ls=<行距%> / ts=<unix>。
* 锚定是(段,字符偏移),与字号无关 → 换字号书签不失效(READER_ENGINE_NOTES §6.3)。
* 无 SDK 之外依赖;目录推导:MEOW_DATA_DIR(launcher 注入 <TF>/MeowData/<pkg>/data)去皮 /data →
* <TF>/MeowData/<pkg>,接 "progress";无 env(宿主/无卡)回退 /tmp/meowcfg_<pid>/progress。
*/
#ifndef RDPROG_H
#define RDPROG_H
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct rdprog {
int valid; /* 1=有档 */
int seg;
int32_t ch;
int fs;
int ls;
uint64_t ts; /* 最近阅读 unix 秒 */
} rdprog;
/* 组装 progress 目录路径并 mkdir -p。成功 0(out 填目录绝对路径);负值错误。 */
int rdprog_dir(char *out, int outsz);
/* 由书路径算 hash 文件名(FNV-1a 32bit hex)写 out(≥20 字节)。 */
void rdprog_hash(const char *book_path, char *out, int outsz);
/* 读进度:1=有档(填 p);0=无/不存在;负值=IO 错。 */
int rdprog_load(const char *book_path, rdprog *p);
/* 写进度。0=成功;负值=IO/无法建目录(不崩)。 */
int rdprog_save(const char *book_path, const rdprog *p);
#ifdef __cplusplus
}
#endif
#endif /* RDPROG_H */