You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+43-14Lines changed: 43 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,17 +143,17 @@ You can modify `font-report.txt` to the file path of your choice.
143
143
144
144
#### Vertical Metrics Modifications
145
145
146
-
font-line supports automated line spacing modifications to a user-defined percentage of the TypoAscender to TypoDescender metric (often defined with the same value as the font units per em metric). This delta value will be abbreviated as TA:TD below.
146
+
font-line supports automated line spacing modifications to a user-defined percentage of the units per em metric. This value will be abbreviated as UPM below.
147
147
148
148
##### `percent` Sub-Command Usage
149
149
150
-
Enter the desired percentage of the TA:TD metric as the first argument to the command. This should be *entered as an integer value*. Then enter one or more font paths to which you would like to apply your font metrics changes.
150
+
Enter the desired percentage of the UPM as the first argument to the command. This should be *entered as an integer value*. Then enter one or more font paths to which you would like to apply your font metrics changes.
A common default value used by typeface designers is 20%. To modify a font on the path `TheFont.ttf` to 20% of the TA:TD metric, you would enter the following command:
156
+
A common default value used by typeface designers is 20% UPM. To modify a font on the path `TheFont.ttf` to 20% of the UPM metric, you would enter the following command:
157
157
158
158
```
159
159
$ font-line percent 20 TheFont.ttf
@@ -163,31 +163,60 @@ Increase or decrease the integer value to increase or decrease your line spacing
163
163
164
164
The original font file is preserved in an unmodified version and the modified file write takes place on a new path defined as `[original filename]-linegap[percent].[ttf|otf]`. The path to the file is reported to you in the standard output after the modification is completed. font-line does not modify the glyph set or hints applied to the font. See the Details section below for a description of the OpenType table modifications that occur when the application is used on a font file.
165
165
166
-
You can inspect the vertical metrics in the new font file with the `report`subcommand (see Usage above).
166
+
You can inspect the vertical metrics in the new font file with the `report`sub-command (see Usage above).
167
167
168
168
##### Details of Font Metrics Changes with `percent` Sub-Command
169
169
170
-
The interpretation of these multiple vertical metric values is platform and application dependent. This has led to [debate over the 'best' approach to cross-platform typeface line spacing](https://grahamwideman.wikispaces.com/Font+Vertical+Metrics). The line spacing modification approach used in font-line is defined with a slightly modified version of Karsten Lücke's approach that is described [here](http://www.kltf.de/downloads/FontMetrics-kltf.pdf).
170
+
The interpretation and display of these multiple vertical metrics values is platform and application dependent. [There is no broadly accepted "best" approach](https://github.com/source-foundry/font-line/issues/2). As such, font-line attempts to preserve the original metrics design in the font when modifications are made with the `percent` sub-command.
171
171
172
-
*The following values are preserved from the original font design*:
172
+
font-line currently supports three commonly used vertical metrics approaches.
font-line calculates a delta value for the total expected height based upon the % UPM value defined on the command line. The difference between this value and the observed number of units that span the [OS/2] winAscent to winDescent values is divided by half and then added to (for increased line spacing) or subtracted from (for decreased line spacing) each of the three sets of Ascender/Descender values in the font. The [OS/2] TypoLinegap and [hhea] linegap values are not modified.
184
+
185
+
**Vertical Metrics Approach 2**
176
186
177
-
We assume that the TypoAscender - TypoDescender delta value is equivalent to the UPM size, and therefore that the percent TA:TD value is equivalent to percent UPM when line spacing is defined.
187
+
Where metrics are defined as:
178
188
179
-
*Changes to OpenType metrics values in the font are defined as*:
189
+
-[OS/2] TypoLinegap = 0
190
+
-[hhea] linegap = 0
191
+
-[OS/2] TypoAscender + TypoDescender = UPM
192
+
-[OS/2] winAscent = [hhea] Ascent
193
+
-[OS/2] winDescent = [hhea] Descent
180
194
181
-
-[hhea] lineGap is always set to 0
182
-
-[OS/2] TypoLineGap = x% * TA:TD value
195
+
font-line calculates a delta value for the total expected height based upon the % UPM value defined on the command line. The difference between this value and the observed number of units that span the [OS/2] winAscent to winDescent values is divided by half and then added to (for increased line spacing) or subtracted from (for decreased line spacing) the [OS/2] winAsc/winDesc and [hhea] Asc/Desc values. The [OS/2] TypoAsc/TypoDesc values are not modified and maintain a definition of size = UPM value. The [OS/2] TypoLinegap and [hhea] linegap values are not modified.
196
+
197
+
**Vertical Metrics Approach 3**
198
+
199
+
Where metrics are defined as:
200
+
201
+
-[OS/2] TypoAscender + TypoDescender = UPM
202
+
-[OS/2] TypoLinegap is set to leading value
203
+
-[hhea] linegap = 0
204
+
-[OS/2] winAscent = [hhea] Ascent
205
+
-[OS/2] winDescent = [hhea] Descent
206
+
207
+
*Changes to the metrics values in the font are defined as*:
Note that the internal leading modifications are split evenly across [hhea] Ascent & Descent values, and across [OS/2] WinAscent & WinDescent values. We add half of the new [OS/2] TypoLineGap value to the original [OS/2] TypoAscender or TypoDescender in order to define these new metrics properties.
215
+
Note that the internal leading modifications are split evenly across [hhea] Ascent & Descent values, and across [OS/2] WinAscent & WinDescent values. We add half of the new [OS/2] TypoLineGap value to the original [OS/2] TypoAscender or TypoDescender in order to define these new metrics properties. The [hhea] linegap value is always defined as zero.
216
+
217
+
#### Important
189
218
190
-
These newly defined properties can lead to clipping of glyph components if not properly defined. There are no tests in font-line to provide assurance that this does not occur. We assume that the user is versed in these issues before use of the application and leave this testing to the designer / user before the modified fonts are used in a production setting.
219
+
The newly defined vertical metrics values can lead to clipping of glyph components if not properly defined. There are no tests in font-line to provide assurance that this does not occur. We assume that the user is versed in these issues before use of the application and leave this testing to the designer / user before the modified fonts are used in a production setting.
0 commit comments