-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We're adding a 1 pixel border around all icons when adding them to the image atlas texture to avoid having neighboring icons bleed into the current image when using linear texture interpolation. When stretching icons to fit the text's dimensions with `icon-text-fit`, however, we didn't account for this correctly: We didn't add the border in this case, resulting in stretched icons that didn't quite cover the whole text. When the difference between the icon's original size and the stretched size was small, this wasn't really noticeable, especially in cases where we were using nearest neighbor texture interpolation instead of linear interpolation. When accounting for the 1 pixel border, have to to take into account that there's no longer a 1:1 mapping between vertex units and pixel units, and expand the vertices adequately.
- Loading branch information
Showing
28 changed files
with
230 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+132 Bytes
(110%)
test/integration/render-tests/icon-text-fit/both-padding/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+27 Bytes
(100%)
test/integration/render-tests/icon-text-fit/both/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.75 KB
test/integration/render-tests/icon-text-fit/enlargen-both-padding/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions
41
test/integration/render-tests/icon-text-fit/enlargen-both-padding/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 150, | ||
"height": 64 | ||
} | ||
}, | ||
"sources": { | ||
"geojson": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "Point", | ||
"coordinates": [ | ||
0, | ||
0 | ||
] | ||
} | ||
} | ||
}, | ||
"sprite": "local://sprites/icon-text-fit", | ||
"glyphs": "local://glyphs/{fontstack}/{range}.pbf", | ||
"layers": [ | ||
{ | ||
"id": "symbol", | ||
"type": "symbol", | ||
"source": "geojson", | ||
"layout": { | ||
"text-field": "ABCD efgh", | ||
"text-size": 24, | ||
"text-font": [ | ||
"Open Sans Semibold", | ||
"Arial Unicode MS Bold" | ||
], | ||
"icon-image": "small-box", | ||
"icon-text-fit": "both", | ||
"icon-text-fit-padding": [ 12, 8, 4, 2 ] | ||
} | ||
} | ||
] | ||
} |
Binary file added
BIN
+3.67 KB
test/integration/render-tests/icon-text-fit/enlargen-both/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions
40
test/integration/render-tests/icon-text-fit/enlargen-both/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 128, | ||
"height": 64 | ||
} | ||
}, | ||
"sources": { | ||
"geojson": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "Point", | ||
"coordinates": [ | ||
0, | ||
0 | ||
] | ||
} | ||
} | ||
}, | ||
"sprite": "local://sprites/icon-text-fit", | ||
"glyphs": "local://glyphs/{fontstack}/{range}.pbf", | ||
"layers": [ | ||
{ | ||
"id": "symbol", | ||
"type": "symbol", | ||
"source": "geojson", | ||
"layout": { | ||
"text-field": "ABCD efgh", | ||
"text-size": 24, | ||
"text-font": [ | ||
"Open Sans Semibold", | ||
"Arial Unicode MS Bold" | ||
], | ||
"icon-image": "small-box", | ||
"icon-text-fit": "both" | ||
} | ||
} | ||
] | ||
} |
Binary file added
BIN
+2.38 KB
test/integration/render-tests/icon-text-fit/enlargen-height/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions
40
test/integration/render-tests/icon-text-fit/enlargen-height/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 128, | ||
"height": 64 | ||
} | ||
}, | ||
"sources": { | ||
"geojson": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "Point", | ||
"coordinates": [ | ||
0, | ||
0 | ||
] | ||
} | ||
} | ||
}, | ||
"sprite": "local://sprites/icon-text-fit", | ||
"glyphs": "local://glyphs/{fontstack}/{range}.pbf", | ||
"layers": [ | ||
{ | ||
"id": "symbol", | ||
"type": "symbol", | ||
"source": "geojson", | ||
"layout": { | ||
"text-field": "ABCD efgh", | ||
"text-size": 24, | ||
"text-font": [ | ||
"Open Sans Semibold", | ||
"Arial Unicode MS Bold" | ||
], | ||
"icon-image": "small-box", | ||
"icon-text-fit": "height" | ||
} | ||
} | ||
] | ||
} |
Binary file added
BIN
+3.17 KB
test/integration/render-tests/icon-text-fit/enlargen-width/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions
40
test/integration/render-tests/icon-text-fit/enlargen-width/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 128, | ||
"height": 64 | ||
} | ||
}, | ||
"sources": { | ||
"geojson": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "Point", | ||
"coordinates": [ | ||
0, | ||
0 | ||
] | ||
} | ||
} | ||
}, | ||
"sprite": "local://sprites/icon-text-fit", | ||
"glyphs": "local://glyphs/{fontstack}/{range}.pbf", | ||
"layers": [ | ||
{ | ||
"id": "symbol", | ||
"type": "symbol", | ||
"source": "geojson", | ||
"layout": { | ||
"text-field": "ABCD efgh", | ||
"text-size": 24, | ||
"text-font": [ | ||
"Open Sans Semibold", | ||
"Arial Unicode MS Bold" | ||
], | ||
"icon-image": "small-box", | ||
"icon-text-fit": "width" | ||
} | ||
} | ||
] | ||
} |
Binary file modified
BIN
+526 Bytes
(140%)
test/integration/render-tests/icon-text-fit/height-padding/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 64, | ||
"width": 96, | ||
"height": 64 | ||
} | ||
}, | ||
|
Binary file modified
BIN
+406 Bytes
(130%)
test/integration/render-tests/icon-text-fit/height/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 64, | ||
"width": 96, | ||
"height": 64 | ||
} | ||
}, | ||
|
Binary file modified
BIN
+705 Bytes
(160%)
test/integration/render-tests/icon-text-fit/none/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"width": 64, | ||
"width": 96, | ||
"height": 64 | ||
} | ||
}, | ||
|
Binary file modified
BIN
+4.82 KB
(110%)
test/integration/render-tests/icon-text-fit/placement-line/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+205 Bytes
(110%)
test/integration/render-tests/icon-text-fit/width-padding/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+72 Bytes
(110%)
test/integration/render-tests/icon-text-fit/width/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+51 Bytes
(100%)
...ration/render-tests/text-variable-anchor/all-anchors-icon-text-fit/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-4 Bytes
(100%)
...tion/render-tests/text-variable-anchor/icon-text-fit-collision-box/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+54 Bytes
(100%)
..._label/cjk-variable-anchors-vertical-horizontal-mode-icon-text-fit/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-15 Bytes
(100%)
...point_label/mixed-multiline-vertical-horizontal-mode-icon-text-fit/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.