summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvisvgm/dvisvgm-src/libs
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2022-08-29 13:52:14 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2022-08-29 13:52:14 +0000
commit4c5fc2acc23b0715c5cc5aa4adc87c8b998a0cab (patch)
treea9d9e4ade07bf8a5b82c2a582885324300040c90 /Build/source/texk/dvisvgm/dvisvgm-src/libs
parentd6b263980d8d5e05e039587454b7d30c438ff05c (diff)
dvisvgm 2.14
git-svn-id: svn://tug.org/texlive/trunk@64224 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/libs')
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in2
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/README.md11
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/include/woff2/encode.h4
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/include/woff2/output.h4
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/glyph.cc17
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/glyph.h12
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/normalize.cc2
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/transform.cc20
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/woff2_enc.cc8
-rw-r--r--Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/woff2_out.cc8
10 files changed, 63 insertions, 25 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in
index 3cd2af7d34b..f8e69f3dcbc 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/Makefile.in
@@ -267,7 +267,7 @@ am__define_uniq_tagged_files = \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in \
- $(top_srcdir)/../../build-aux/depcomp
+ $(top_srcdir)/../../build-aux/depcomp README.md
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/README.md b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/README.md
new file mode 100644
index 00000000000..28f094d9be6
--- /dev/null
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/ff-woff/README.md
@@ -0,0 +1,11 @@
+# Reduced FontForge library for dvisvgm
+
+This is a radically reduced version of the [FontForge](http://fontforge.org) library required to natively
+build [dvisvgm](https://dvisvgm.de) on Windows. Most of the code not needed to create autohinted
+TrueType and WOFF fonts from [SFD](https://fontforge.github.io/sfdformat.html) files has been removed.
+
+The reduced library depends on [zlib](http://www.zlib.net).
+
+---
+Thanks to George Williams and the FontForge project contributors for developing this great font editor and for
+providing it as open source.
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/include/woff2/encode.h b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/include/woff2/encode.h
index 34b77229749..2ac563032d1 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/include/woff2/encode.h
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/include/woff2/encode.h
@@ -26,8 +26,8 @@ struct WOFF2Params {
// Returns an upper bound on the size of the compressed file.
size_t MaxWOFF2CompressedSize(const uint8_t* data, size_t length);
-size_t MaxWOFF2CompressedSize(const uint8_t* data, size_t length,
- const std::string& extended_metadata);
+size_t MaxWOFF2CompressedSize(const uint8_t *data, size_t length,
+ const std::string &extended_metadata);
// Compresses the font into the target buffer. *result_length should be at least
// the value returned by MaxWOFF2CompressedSize(), upon return, it is set to the
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/include/woff2/output.h b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/include/woff2/output.h
index c325f67be72..dc78ccf8267 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/include/woff2/output.h
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/include/woff2/output.h
@@ -51,7 +51,7 @@ class WOFF2StringOut : public WOFF2Out {
// Create a writer that writes its data to buf.
// buf->size() will grow to at most max_size
// buf may be sized (e.g. using EstimateWOFF2FinalSize) or empty.
- explicit WOFF2StringOut(std::string* buf);
+ explicit WOFF2StringOut(std::string *buf);
bool Write(const void *buf, size_t n) override;
bool Write(const void *buf, size_t offset, size_t n) override;
@@ -59,7 +59,7 @@ class WOFF2StringOut : public WOFF2Out {
size_t MaxSize() { return max_size_; }
void SetMaxSize(size_t max_size);
private:
- std::string* buf_;
+ std::string *buf_;
size_t max_size_;
size_t offset_;
};
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/glyph.cc b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/glyph.cc
index 1b4408b924c..5b4948679c7 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/glyph.cc
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/glyph.cc
@@ -21,6 +21,7 @@ static const int32_t kFLAG_YSHORT = 1 << 2;
static const int32_t kFLAG_REPEAT = 1 << 3;
static const int32_t kFLAG_XREPEATSIGN = 1 << 4;
static const int32_t kFLAG_YREPEATSIGN = 1 << 5;
+static const int32_t kFLAG_OVERLAP_SIMPLE = 1 << 6;
static const int32_t kFLAG_ARG_1_AND_2_ARE_WORDS = 1 << 0;
static const int32_t kFLAG_WE_HAVE_A_SCALE = 1 << 3;
static const int32_t kFLAG_MORE_COMPONENTS = 1 << 5;
@@ -134,6 +135,10 @@ bool ReadGlyph(const uint8_t* data, size_t len, Glyph* glyph) {
}
}
+ if (!flags.empty() && !flags[0].empty()) {
+ glyph->overlap_simple_flag_set = (flags[0][0] & kFLAG_OVERLAP_SIMPLE);
+ }
+
// Read the x coordinates.
int prev_x = 0;
for (int i = 0; i < num_contours; ++i) {
@@ -239,7 +244,7 @@ bool StoreEndPtsOfContours(const Glyph& glyph, size_t* offset, uint8_t* dst) {
bool StorePoints(const Glyph& glyph, size_t* offset,
uint8_t* dst, size_t dst_size) {
- int last_flag = -1;
+ int previous_flag = -1;
int repeat_count = 0;
int last_x = 0;
int last_y = 0;
@@ -250,6 +255,10 @@ bool StorePoints(const Glyph& glyph, size_t* offset,
for (const auto& contour : glyph.contours) {
for (const auto& point : contour) {
int flag = point.on_curve ? kFLAG_ONCURVE : 0;
+ if (previous_flag == -1 && glyph.overlap_simple_flag_set) {
+ // First flag needs to have overlap simple bit set.
+ flag = flag | kFLAG_OVERLAP_SIMPLE;
+ }
int dx = point.x - last_x;
int dy = point.y - last_y;
if (dx == 0) {
@@ -268,7 +277,7 @@ bool StorePoints(const Glyph& glyph, size_t* offset,
} else {
y_bytes += 2;
}
- if (flag == last_flag && repeat_count != 255) {
+ if (flag == previous_flag && repeat_count != 255) {
dst[*offset - 1] |= kFLAG_REPEAT;
repeat_count++;
} else {
@@ -286,7 +295,7 @@ bool StorePoints(const Glyph& glyph, size_t* offset,
}
last_x = point.x;
last_y = point.y;
- last_flag = flag;
+ previous_flag = flag;
}
}
if (repeat_count != 0) {
@@ -350,7 +359,7 @@ bool StoreGlyph(const Glyph& glyph, uint8_t* dst, size_t* dst_size) {
}
} else if (glyph.contours.size() > 0) {
// Simple glyph.
- if (glyph.contours.size() > size_t(std::numeric_limits<int16_t>::max())) {
+ if (glyph.contours.size() > std::numeric_limits<int16_t>::max()) {
return FONT_COMPRESSION_FAILURE();
}
if (*dst_size < ((12ULL + 2 * glyph.contours.size()) +
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/glyph.h b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/glyph.h
index f24056f4c8c..c38eb5f2bc4 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/glyph.h
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/glyph.h
@@ -10,8 +10,10 @@
#ifndef WOFF2_GLYPH_H_
#define WOFF2_GLYPH_H_
-#include <stddef.h>
#include <inttypes.h>
+#include <stddef.h>
+
+#include <cstdint>
#include <vector>
namespace woff2 {
@@ -22,7 +24,10 @@ namespace woff2 {
// is around.
class Glyph {
public:
- Glyph() : instructions_size(0), composite_data_size(0) {}
+ Glyph()
+ : instructions_size(0),
+ overlap_simple_flag_set(false),
+ composite_data_size(0) {}
// Bounding box.
int16_t x_min;
@@ -34,6 +39,9 @@ class Glyph {
uint16_t instructions_size;
const uint8_t* instructions_data;
+ // Flags.
+ bool overlap_simple_flag_set;
+
// Data model for simple glyphs.
struct Point {
int x;
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/normalize.cc b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/normalize.cc
index dc4bfe6c5c7..f7538a1ef31 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/normalize.cc
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/normalize.cc
@@ -93,7 +93,7 @@ bool MakeEditableBuffer(Font* font, int tableTag) {
if (table->IsReused()) {
return true;
}
- uint32_t sz = Round4(table->length);
+ unsigned sz = Round4(table->length);
table->buffer.resize(sz);
uint8_t* buf = &table->buffer[0];
memcpy(buf, table->data, table->length);
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/transform.cc b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/transform.cc
index 999bef37458..1016efcd2bb 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/transform.cc
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/transform.cc
@@ -22,6 +22,7 @@ namespace {
const int FLAG_ARG_1_AND_2_ARE_WORDS = 1 << 0;
const int FLAG_WE_HAVE_INSTRUCTIONS = 1 << 8;
+const int FLAG_OVERLAP_SIMPLE_BITMAP = 1 << 0;
void WriteBytes(std::vector<uint8_t>* out, const uint8_t* data, size_t len) {
if (len == 0) return;
@@ -69,7 +70,10 @@ class GlyfEncoder {
}
void GetTransformedGlyfBytes(std::vector<uint8_t>* result) {
- WriteLong(result, 0); // version
+ WriteUShort(result, 0); // Version
+ WriteUShort(result, overlap_bitmap_.empty()
+ ? 0x00
+ : FLAG_OVERLAP_SIMPLE_BITMAP); // Flags
WriteUShort(result, n_glyphs_);
WriteUShort(result, 0); // index_format, will be set later
WriteLong(result, n_contour_stream_.size());
@@ -87,6 +91,9 @@ class GlyfEncoder {
WriteBytes(result, bbox_bitmap_);
WriteBytes(result, bbox_stream_);
WriteBytes(result, instruction_stream_);
+ if (!overlap_bitmap_.empty()) {
+ WriteBytes(result, overlap_bitmap_);
+ }
}
private:
@@ -127,6 +134,10 @@ class GlyfEncoder {
}
void WriteSimpleGlyph(int glyph_id, const Glyph& glyph) {
+ if (glyph.overlap_simple_flag_set) {
+ EnsureOverlapBitmap();
+ overlap_bitmap_[glyph_id >> 3] |= 0x80 >> (glyph_id & 7);
+ }
int num_contours = glyph.contours.size();
WriteUShort(&n_contour_stream_, num_contours);
if (ShouldWriteSimpleGlyphBbox(glyph)) {
@@ -214,6 +225,12 @@ class GlyfEncoder {
}
}
+ void EnsureOverlapBitmap() {
+ if (overlap_bitmap_.empty()) {
+ overlap_bitmap_.resize((n_glyphs_ + 7) >> 3);
+ }
+ }
+
std::vector<uint8_t> n_contour_stream_;
std::vector<uint8_t> n_points_stream_;
std::vector<uint8_t> flag_byte_stream_;
@@ -222,6 +239,7 @@ class GlyfEncoder {
std::vector<uint8_t> bbox_stream_;
std::vector<uint8_t> glyph_stream_;
std::vector<uint8_t> instruction_stream_;
+ std::vector<uint8_t> overlap_bitmap_;
int n_glyphs_;
};
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/woff2_enc.cc b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/woff2_enc.cc
index 9f32df90ee4..43c8bdc9d82 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/woff2_enc.cc
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/woff2_enc.cc
@@ -28,12 +28,8 @@
namespace woff2 {
-namespace {
-
-
-using std::string;
-using std::vector;
+namespace {
const size_t kWoff2HeaderSize = 48;
const size_t kWoff2EntrySize = 20;
@@ -183,7 +179,7 @@ size_t MaxWOFF2CompressedSize(const uint8_t* data, size_t length) {
}
size_t MaxWOFF2CompressedSize(const uint8_t* data, size_t length,
- const string& extended_metadata) {
+ const std::string& extended_metadata) {
// Except for the header size, which is 32 bytes larger in woff2 format,
// all other parts should be smaller (table header in short format,
// transformations and compression). Just to be sure, we will give some
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/woff2_out.cc b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/woff2_out.cc
index 8ab32681f1d..a22d3bf8bed 100644
--- a/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/woff2_out.cc
+++ b/Build/source/texk/dvisvgm/dvisvgm-src/libs/woff2/src/woff2_out.cc
@@ -8,14 +8,10 @@
#include <woff2/output.h>
-using std::string;
-
namespace woff2 {
-WOFF2StringOut::WOFF2StringOut(string* buf)
- : buf_(buf),
- max_size_(kDefaultMaxSize),
- offset_(0) {}
+WOFF2StringOut::WOFF2StringOut(std::string *buf)
+ : buf_(buf), max_size_(kDefaultMaxSize), offset_(0) {}
bool WOFF2StringOut::Write(const void *buf, size_t n) {
return Write(buf, offset_, n);