Skip to content

Commit 1874bcf

Browse files
committed
Version 1.13
1 parent 594e9ba commit 1874bcf

File tree

7 files changed

+23
-15
lines changed

7 files changed

+23
-15
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11

2+
## Version 1.13 (2025-11-30)
3+
4+
- Improved BMP file output - support for BGRA (`mtsdf` mode), optimized size of grayscale files
5+
- For builds without PNG support, BMP replaces TIFF as the default output format
6+
- Fixed incorrect output with asymmetrical distance range when inversion occurs due to winding correction (`-guesswinding` / `-reversewinding`) or scanline pass (`-scanline`)
7+
- The library now operates on bitmap section references (instead of contiguous bitmap references), which makes it possible to generate a distance field directly into a subsection of a larger bitmap or a bitmap with the opposite row ordering
8+
- Improved semantics of specifying Y-axis orientation (upward / downward)
9+
- Improved precision of cubic curve distance computation
10+
- Fixed a bug incorrectly adjusting convergent edge segments in shape normalization
11+
- Renamed options `-guesswinding`, `-reversewinding`, `-keepwinding` from `-guessorder`, ... for clarity (old names kept for compatibility)
12+
- Adjusted the Readme example shader to improve anti-aliasing in a rotated frame
13+
- Minor CMake fixes
14+
215
### Version 1.12.1 (2025-05-31)
316

417
- Fixed a bug applying error correction incorrectly if shape's Y-axis is inverted (mainly affected SVG input)

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,13 @@ I would suggest precomputing `unitRange` as a uniform variable instead of `pxRan
184184
```glsl
185185
uniform float pxRange; // set to distance field's pixel range
186186
187+
vec2 sqr(vec2 x) { return x*x; } // squares vector components
188+
187189
float screenPxRange() {
188190
vec2 unitRange = vec2(pxRange)/vec2(textureSize(msdf, 0));
189-
vec2 screenTexSize = vec2(1.0)/fwidth(texCoord);
191+
// If inversesqrt is not available, use vec2(1.0)/sqrt
192+
vec2 screenTexSize = inversesqrt(sqr(dFdx(texCoord))+sqr(dFdy(texCoord)));
193+
// Can also be approximated as screenTexSize = vec2(1.0)/fwidth(texCoord);
190194
return max(0.5*dot(unitRange, screenTexSize), 1.0);
191195
}
192196
```

core/MSDFErrorCorrection.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,6 @@ static float interpolatedMedian(const float *a, const float *l, const float *q,
274274
));
275275
}
276276

277-
/// Determines if the interpolated median xm is an artifact.
278-
static bool isArtifact(bool isProtected, double axSpan, double bxSpan, float am, float bm, float xm) {
279-
return (
280-
// For protected texels, only report an artifact if it would cause fill inversion (change between positive and negative distance).
281-
(!isProtected || (am > .5f && bm > .5f && xm <= .5f) || (am < .5f && bm < .5f && xm >= .5f)) &&
282-
// This is an artifact if the interpolated median is outside the range of possible values based on its distance from a, b.
283-
!(xm >= am-axSpan && xm <= am+axSpan && xm >= bm-bxSpan && xm <= bm+bxSpan)
284-
);
285-
}
286-
287277
/// Checks if a linear interpolation artifact will occur at a point where two specific color channels are equal - such points have extreme median values.
288278
template <class ArtifactClassifier>
289279
static bool hasLinearArtifactInner(const ArtifactClassifier &artifactClassifier, float am, float bm, const float *a, const float *b, float dA, float dB) {

core/contour-combiners.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static double resolveDistance(const MultiDistance &distance) {
3232
}
3333

3434
template <class EdgeSelector>
35-
SimpleContourCombiner<EdgeSelector>::SimpleContourCombiner(const Shape &shape) { }
35+
SimpleContourCombiner<EdgeSelector>::SimpleContourCombiner(const Shape &) { }
3636

3737
template <class EdgeSelector>
3838
void SimpleContourCombiner<EdgeSelector>::reset(const Point2 &p) {

core/edge-selectors.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ TrueDistanceSelector::EdgeCache::EdgeCache() : absDistance(0) { }
1111

1212
void TrueDistanceSelector::reset(const Point2 &p) {
1313
double delta = DISTANCE_DELTA_FACTOR*(p-this->p).length();
14+
// Since minDistance.distance is initialized to -DBL_MAX, at first glance this seems like it could make it underflow to -infinity, but in practice delta would have to be extremely high for this to happen (above 9e291)
1415
minDistance.distance += nonZeroSign(minDistance.distance)*delta;
1516
this->p = p;
1617
}
@@ -60,7 +61,7 @@ void PerpendicularDistanceSelectorBase::reset(double delta) {
6061
nearEdgeParam = 0;
6162
}
6263

63-
bool PerpendicularDistanceSelectorBase::isEdgeRelevant(const EdgeCache &cache, const EdgeSegment *edge, const Point2 &p) const {
64+
bool PerpendicularDistanceSelectorBase::isEdgeRelevant(const EdgeCache &cache, const EdgeSegment *, const Point2 &p) const {
6465
double delta = DISTANCE_DELTA_FACTOR*(p-cache.point).length();
6566
return (
6667
cache.absDistance-delta <= fabs(minTrueDistance.distance) ||

main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static const char *writeOutput(const BitmapConstSection<float, N> &bitmap, const
361361

362362
static const char *const versionText =
363363
"MSDFgen v" MSDFGEN_VERSION_STRING TITLE_SUFFIX "\n"
364-
"(c) 2016 - " STRINGIZE(MSDFGEN_COPYRIGHT_YEAR) " Viktor Chlumsky";
364+
"(c) 2014 - " STRINGIZE(MSDFGEN_COPYRIGHT_YEAR) " Viktor Chlumsky";
365365

366366
static const char *const helpText =
367367
"\n"

vcpkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/master/docs/vcpkg.schema.json",
33
"name": "msdfgen",
4-
"version": "1.12.1",
4+
"version": "1.13.0",
55
"default-features": [
66
"extensions",
77
"geometry-preprocessing",

0 commit comments

Comments
 (0)