Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

html: add a generic fallback family to font-family

未关闭
#1,186 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
74/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp
领域
frontend

调研方向

Start in src/odr/internal/html/document_document_style.cpp-adjacent code: src/odr/internal/html/document_style.cpp, functions translate_text_style and translate_block_font_style, where font-family:<name>; is emitted. Trace where font data comes from to find ODF style:font-family-generic and docx w:family (inside w:font), then add quoted-name-plus-generic output with a small well-known-fonts table defaulting to sans-serif. Done means every emitted font-family has a quoted name and generic fallback, checked against the reference-output comparison that flagged xlsx Calibri cells.

由索引模型根据 Issue 内容生成。

描述

enhancement formatting

The HTML output writes font-family:<name>; with the font name of the document only (translate_text_style and translate_block_font_style in src/odr/internal/html/document_style.cpp). The value has no generic fallback family.

If the font is not installed, the browser uses its default font, which is usually a serif font. A spreadsheet in Calibri then renders in Times. Excel and LibreOffice replace a missing font with a font of the same kind.

Proposal:

  1. Add a generic family after the name, for example font-family:"Calibri",sans-serif.
  2. Pick serif, sans-serif or monospace from the font data if the document gives it (style:font-family-generic in ODF, w:family in w:font for docx). Else use a small table of well-known names, and use sans-serif as the default.
  3. Quote the name, so a name with special characters stays one family.

The v7.4.0 → v7.5.0 reference-output check found this on xlsx cells that now get their Calibri font from the row or column style. This is not a regression, because cells with their own Calibri style had the same problem before.

🤖 Generated with Claude Code

主要语言
C++
星标
41
派生
10
平均合并
12 小时 4 分钟
30 天内合并 PR
297

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

opendocument-app/OpenDocument.core 的其他 Issue

查看 opendocument-app/OpenDocument.core 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。