[unicode] Clean typography (accents, non present glyphs...)

This commit is contained in:
Léa Saviot
2019-01-31 17:24:33 +01:00
committed by Émilie Feral
parent 2034103f54
commit 693d7e0976
9 changed files with 15 additions and 11 deletions

View File

@@ -121,8 +121,8 @@ void GraphController::reloadBannerView() {
double x = m_cursor->x();
// Display a specific legend if the mean dot is selected
if (*m_selectedDotIndex == m_store->numberOfPairsOfSeries(*m_selectedSeriesIndex)) {
// \xCC\x84 represents the combining bar ' ̄'
legend = "x\xCC\x84=";
// \xCC\x85 represents the combining overline ' ̅'
legend = "x\xCC\x85=";
x = m_store->meanOfColumn(*m_selectedSeriesIndex, 0);
}
numberOfChar += strlcpy(buffer, legend, bufferSize);
@@ -139,8 +139,8 @@ void GraphController::reloadBannerView() {
legend = "y=";
double y = m_cursor->y();
if (*m_selectedDotIndex == m_store->numberOfPairsOfSeries(*m_selectedSeriesIndex)) {
// \xCC\x84 represents the combining bar ' ̄'
legend = "y\xCC\x84=";
// \xCC\x85 represents the combining overline ' ̅'
legend = "y\xCC\x85=";
y = m_store->meanOfColumn(*m_selectedSeriesIndex, 1);
}
numberOfChar += strlcpy(buffer, legend, bufferSize);

View File

@@ -47,13 +47,13 @@ RASTERIZER := $(BUILD_DIR)/kandinsky/fonts/rasterizer
$(eval $(call rule_for, \
RASTER, \
kandinsky/fonts/SmallSourcePixel.cpp, \
kandinsky/fonts/SmallSourcePixel.ttf $$(RASTERIZER), \
kandinsky/fonts/SmallSourcePixel.otf $$(RASTERIZER), \
$$(RASTERIZER) $$< 12 12 SmallFont $$@ \
))
$(eval $(call rule_for, \
RASTER, \
kandinsky/fonts/LargeSourcePixel.cpp, \
kandinsky/fonts/LargeSourcePixel.ttf $$(RASTERIZER), \
kandinsky/fonts/LargeSourcePixel.otf $$(RASTERIZER), \
$$(RASTERIZER) $$< 16 16 LargeFont $$@ \
))

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -122,7 +122,7 @@ uint32_t CodePoints[] = {
0x301, // ́ // COMBINING ACUTE ACCENT
0x302, // ̂ // COMBINING CIRCUMFLEX ACCENT
0x303, // ̃ // COMBINING TILDE
0x304, // ̄ // COMBINING MACRON
0x305, // ̅ // COMBINING OVERLINE
0x308, // ̈ // COMBINING DIAERESIS
0x30a, // ̊ // COMBINING RING ABOVE
0x327, // ̧ // COMBINING CEDILLA
@@ -142,6 +142,7 @@ uint32_t CodePoints[] = {
0x2248, // ≈ // ALMOST EQUAL TO
0x2264, // ≤ // LESS-THAN OR EQUAL TO
0x2265, // ≥ // GREATER-THAN OR EQUAL TO
0xFFFD, // <20> // REPLACEMENT CHARACTER
0x1d422, // 𝐢 // MATHEMATICAL BOLD SMALL I"
};

View File

@@ -21,7 +21,7 @@
* kandinsky/fonts/code_points.h). To easily compute the index of a code point in
* the CodePoints table, we use the m_table matching table: it contains the
* CodePointIndexPairs of the first code point of each series of consecutive
* code points in the CodePoints table. */
* code points in the CodePoints table. This table is create in rasterizer.c. */
class KDFont {
private:

View File

@@ -1,5 +1,6 @@
#include <assert.h>
#include <kandinsky/font.h>
#include <kandinsky/fonts/code_points.h>
#include <ion.h>
#include <ion/unicode/utf8_decoder.h>
@@ -80,6 +81,8 @@ void KDFont::colorizeGlyphBuffer(const RenderPalette * renderPalette, GlyphBuffe
}
KDFont::GlyphIndex KDFont::indexForCodePoint(CodePoint c) const {
int defaultIndex = NumberOfCodePoints - 2;
assert(CodePoints[defaultIndex] == 0xFFFD);
#define USE_BINARY_SEARCH 0
#if USE_BINARY_SEARCH
int lowerBound = 0;
@@ -133,7 +136,7 @@ KDFont::GlyphIndex KDFont::indexForCodePoint(CodePoint c) const {
#else
const CodePointIndexPair * currentPair = m_table;
if (c < currentPair->codePoint()) {
return 0;
return defaultIndex;
}
const CodePointIndexPair * endPair = m_table + m_tableLength - 1;
while (currentPair < endPair) {
@@ -141,7 +144,7 @@ KDFont::GlyphIndex KDFont::indexForCodePoint(CodePoint c) const {
if (c < nextPair->codePoint()) {
CodePoint lastCodePointOfCurrentPair = currentPair->codePoint() + (nextPair->glyphIndex() - currentPair->glyphIndex() - 1);
if (c > lastCodePointOfCurrentPair) {
return 0;
return defaultIndex;
}
return currentPair->glyphIndex() + (c - currentPair->codePoint());
}
@@ -150,6 +153,6 @@ KDFont::GlyphIndex KDFont::indexForCodePoint(CodePoint c) const {
if (endPair->codePoint() == c) {
return endPair->glyphIndex();
}
return 0;
return defaultIndex;
#endif
}