Skip to content

Commit

Permalink
Fix #32 (division by zero)
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaRGB committed Nov 15, 2022
1 parent fabaaf1 commit 6eb4d3b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ private static final MaxpTable makeMaxpTable(ThingsToKeepTrackOf a) {
private static final Os2Table makeOs2Table(BitmapFont bf, ThingsToKeepTrackOf a, int xsize, int ysize, boolean extendWinMetrics) {
Collection<Integer> chars = bf.characters(false).keySet();
Os2Table os2Table = new Os2Table();
os2Table.averageCharWidth = a.averageWidth / a.numAverages;
if (a.numAverages > 0) os2Table.averageCharWidth = a.averageWidth / a.numAverages;
os2Table.weightClass = bf.isBoldStyle() ? Os2Table.WEIGHT_CLASS_BOLD : Os2Table.WEIGHT_CLASS_MEDIUM;
os2Table.widthClass = bf.isCondensedStyle() ? Os2Table.WIDTH_CLASS_CONDENSED : bf.isExtendedStyle() ? Os2Table.WIDTH_CLASS_EXPANDED : Os2Table.WIDTH_CLASS_MEDIUM;
os2Table.subscriptXSize = (bf.getEmAscent() + bf.getEmDescent()) * xsize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private static final MaxpTable makeMaxpTable(ThingsToKeepTrackOf a) {
private static final Os2Table makeOs2Table(BitmapFont bf, ThingsToKeepTrackOf a, int xsize, int ysize, boolean extendWinMetrics) {
Collection<Integer> chars = bf.characters(false).keySet();
Os2Table os2Table = new Os2Table();
os2Table.averageCharWidth = a.averageWidth / a.numAverages;
if (a.numAverages > 0) os2Table.averageCharWidth = a.averageWidth / a.numAverages;
os2Table.weightClass = bf.isBoldStyle() ? Os2Table.WEIGHT_CLASS_BOLD : Os2Table.WEIGHT_CLASS_MEDIUM;
os2Table.widthClass = bf.isCondensedStyle() ? Os2Table.WIDTH_CLASS_CONDENSED : bf.isExtendedStyle() ? Os2Table.WIDTH_CLASS_EXPANDED : Os2Table.WIDTH_CLASS_MEDIUM;
os2Table.subscriptXSize = (bf.getEmAscent() + bf.getEmDescent()) * xsize;
Expand Down

0 comments on commit 6eb4d3b

Please sign in to comment.