how to add a new font or style?

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
javascript
领域
backend

调研方向

先阅读 pdffont.js 中 _stdFonts、_kFontFaces 和 _kFontStyles 附近的代码,以了解现有字体面和样式是如何表示的。该 issue 没有说明测试、这些数组之外的入口点或验收条件,因此在进行更改前,请先与维护者确认受支持的实现方式和预期结果。

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

描述

I'm having problems with fonts in the pdffont.js file.
The font I need to add is times new roman. I couldn't add it and in the main sources I didn't find any serif
`
let _stdFonts = ["arial", "helvetica", "sans-serif ", "courier ", "monospace ", "ocr "];

let _kFontFaces = [
    "quicktype,arial,helvetica,sans-serif",							// 00 - QuickType - sans-serif variable font
    "quicktype condensed,arial narrow,arial,helvetica,sans-serif",	// 01 - QuickType Condensed - thin sans-serif variable font
    "quicktypepi,quicktypeiipi",										// 02 - QuickType Pi
    "quicktype mono,courier new,courier,monospace",					// 03 - QuickType Mono - san-serif fixed font
    "ocr-a,courier new,courier,monospace",							// 04 - OCR-A - OCR readable san-serif fixed font
    "ocr b mt,courier new,courier,monospace"							// 05 - OCR-B MT - OCR readable san-serif fixed font
];

let _kFontStyles = [
    // Face		Size	Bold	Italic		StyleID(Comment)
    // -----	----	----	-----		-----------------
    [0, 6, 0, 0],			//00
    [0, 8, 0, 0],			//01
    [0, 10, 0, 0],			//02
    [0, 12, 0, 0],			//03
    [0, 14, 0, 0],			//04
    [0, 18, 0, 0],			//05
    [0, 6, 1, 0],			//06
    [0, 8, 1, 0],			//07
    [0, 10, 1, 0],			//08
    [0, 12, 1, 0],			//09
    [0, 14, 1, 0],			//10
    [0, 18, 1, 0],			//11
    [0, 6, 0, 1],			//12
    [0, 8, 0, 1],			//13
    [0, 10, 0, 1],			//14
    [0, 12, 0, 1],			//15
    [0, 14, 0, 1],			//16
    [0, 18, 0, 1],			//17
    [0, 6, 1, 1],			//18
    [0, 8, 1, 1],			//19
    [0, 10, 1, 1],			//20
    [0, 12, 1, 1],			//21
    [0, 14, 1, 1],			//22
    [0, 18, 1, 1],			//23
    [1, 6, 0, 0],			//24
    [1, 8, 0, 0],			//25
    [1, 10, 0, 0],			//26
    [1, 12, 0, 0],			//27
    [1, 14, 0, 0],			//28
    [1, 18, 0, 0],			//29
    [1, 6, 1, 0],			//30
    [1, 8, 1, 0],			//31
    [1, 10, 1, 0],			//32
    [1, 12, 1, 0],			//33
    [1, 14, 1, 0],			//34
    [1, 18, 1, 0],			//35
    [1, 6, 0, 1],			//36
    [1, 8, 0, 1],			//37
    [1, 10, 0, 1],			//38
    [1, 12, 0, 1],			//39
    [1, 14, 0, 1],			//40
    [1, 18, 0, 1],			//41
    [2, 8, 0, 0],			//42
    [2, 10, 0, 0],			//43
    [2, 12, 0, 0],			//44
    [2, 14, 0, 0],			//45
    [2, 18, 0, 0],			//46
    [3, 8, 0, 0],			//47
    [3, 10, 0, 0],			//48
    [3, 12, 0, 0],			//49
    [4, 12, 0, 0],			//50
    [0, 9, 0, 0],			//51
    [0, 9, 1, 0],			//52
    [0, 9, 0, 1],			//53
    [0, 9, 1, 1],			//54
    [1, 9, 0, 0],			//55
    [1, 9, 1, 0],			//56
    [1, 9, 1, 1],			//57
    [4, 10, 0, 0],			//58
    [5, 10, 0, 0],			//59
    [5, 12, 0, 0]			//60
];

`Is this where I add? Like?

主要语言
Java
星标
2.2k
派生
396
平均合并
9 天 19 小时
30 天内合并 PR
3

环境准备

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

从这里开始

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

modesty/pdf2json 的其他 Issue

查看 modesty/pdf2json 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

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