Skip to content

Commit

Permalink
For #148 #136 #143 - Fix incorrect use of Float.MIN_VALUE and update …
Browse files Browse the repository at this point in the history
…README with strikethrough fix.
  • Loading branch information
danfickle committed Nov 25, 2017
1 parent 870d326 commit 48b089f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ CHANGELOG

head - 0.0.1-RC12-SNAPSHOT
========
+ [Fix incorrect strikethrough offset](https://github.com/danfickle/openhtmltopdf/issues/136) Thanks @alebar, @backslash47, @izhenka
+ Allow percentages for max-width and max-height of images Thanks @backslash47
+ [Better sizing system for inline SVG images](https://github.com/danfickle/openhtmltopdf/issues/128) Thanks @harbulot
+ [Allow uri resolver to resolve uri before checking if a data uri](https://github.com/danfickle/openhtmltopdf/pull/132) Thanks @AlbanSeurat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public LineMetricsAdapter(List<Font> fonts, String str, FontRenderContext ctx) {
}

public float getAscent() {
float maxAscent = Float.MIN_VALUE;
float maxAscent = -Float.MAX_VALUE;

for (LineMetrics met : _lineMetrics) {
maxAscent = Math.max(maxAscent, met.getAscent());
Expand All @@ -55,7 +55,7 @@ public float getAscent() {
}

public float getDescent() {
float maxDescent = Float.MIN_VALUE;
float maxDescent = -Float.MAX_VALUE;

for (LineMetrics met : _lineMetrics) {
maxDescent = Math.max(maxDescent, met.getDescent());
Expand All @@ -75,7 +75,7 @@ public float getStrikethroughOffset() {
}

public float getStrikethroughThickness() {
float max = Float.MIN_VALUE;
float max = -Float.MAX_VALUE;

for (LineMetrics met : _lineMetrics) {
max = Math.max(max, met.getStrikethroughThickness());
Expand All @@ -85,7 +85,7 @@ public float getStrikethroughThickness() {
}

public float getUnderlineOffset() {
float max = Float.MIN_VALUE;
float max = -Float.MAX_VALUE;

for (LineMetrics met : _lineMetrics) {
max = Math.max(max, met.getUnderlineOffset());
Expand All @@ -95,7 +95,7 @@ public float getUnderlineOffset() {
}

public float getUnderlineThickness() {
float max = Float.MIN_VALUE;
float max = -Float.MAX_VALUE;

for (LineMetrics met : _lineMetrics) {
max = Math.max(max, met.getUnderlineThickness());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ public FSFontMetrics getFSFontMetrics(FontContext context, FSFont font, String s
PdfBoxFSFontMetrics result = new PdfBoxFSFontMetrics();

try {
float largestAscent = Float.MIN_VALUE;
float largestDescent = Float.MIN_VALUE;
float largestAscent = -Float.MAX_VALUE;
float largestDescent = -Float.MAX_VALUE;
float largestStrikethroughOffset = -Float.MAX_VALUE;
float largestStrikethroughThickness = Float.MIN_VALUE;
float largestUnderlinePosition = Float.MIN_VALUE;
float largestUnderlineThickness = Float.MIN_VALUE;
float largestStrikethroughThickness = -Float.MAX_VALUE;
float largestUnderlinePosition = -Float.MAX_VALUE;
float largestUnderlineThickness = -Float.MAX_VALUE;

for (FontDescription des : descrs) {
float loopAscent = des.getFont().getBoundingBox().getUpperRightY();
Expand Down

0 comments on commit 48b089f

Please sign in to comment.