Reverts UI font change and adds setting for AA sd fonts
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+2132
-1832
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+2604
-2026
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -99,12 +99,3 @@ ruby -rdigest -e 'puts [
|
||||
"./notosans_8_regular.h",
|
||||
].map{|f| Digest::SHA256.hexdigest(File.read(f)).to_i(16) }.sum % (2 ** 32) - (2 ** 31)'
|
||||
))"
|
||||
|
||||
echo ""
|
||||
echo "// Font ID 0 is reserved as the \"not found\" sentinel."
|
||||
echo "// Guard against any hash accidentally producing 0."
|
||||
for id in NOTOSERIF_12 NOTOSERIF_14 NOTOSERIF_16 NOTOSERIF_18 \
|
||||
NOTOSANS_12 NOTOSANS_14 NOTOSANS_16 NOTOSANS_18 \
|
||||
UI_10 UI_12 SMALL; do
|
||||
echo "static_assert(${id}_FONT_ID != 0, \"Font ID collision with sentinel\");"
|
||||
done
|
||||
|
||||
@@ -42,11 +42,8 @@ for size in ${UI_FONT_SIZES[@]}; do
|
||||
# (fontstack is ordered by descending priority).
|
||||
viet_path="../builtinFonts/source/Ubuntu/Ubuntu-Vietnamese-${style}.ttf"
|
||||
output_path="../builtinFonts/${font_name}.h"
|
||||
# 2-bit like the reader fonts: full coverage renders solid in BW mode and
|
||||
# partial edge coverage dithers (GfxRenderer renderCharImpl), so UI text is
|
||||
# anti-aliased on 1-bit panels and blends properly in grayscale passes.
|
||||
python fontconvert.py $font_name $size $font_path $hebrew_path $viet_path \
|
||||
--2bit --compress --additional-intervals 0x05D0,0x05EA > $output_path
|
||||
--additional-intervals 0x05D0,0x05EA > $output_path
|
||||
echo "Generated $output_path"
|
||||
done
|
||||
done
|
||||
@@ -54,7 +51,7 @@ done
|
||||
python fontconvert.py notosans_8_regular 8 \
|
||||
../builtinFonts/source/NotoSans/NotoSans-Regular.ttf \
|
||||
../builtinFonts/source/NotoSansHebrew/NotoSansHebrew-Regular.ttf \
|
||||
--2bit --compress --additional-intervals 0x05D0,0x05EA > ../builtinFonts/notosans_8_regular.h
|
||||
--additional-intervals 0x05D0,0x05EA > ../builtinFonts/notosans_8_regular.h
|
||||
|
||||
echo ""
|
||||
echo "Running compression verification..."
|
||||
|
||||
@@ -282,12 +282,15 @@ static void renderCharImpl(const GfxRenderer& renderer, GfxRenderer::RenderMode
|
||||
const uint8_t bmpVal = 3 - ((byte >> bit_index) & 0x3);
|
||||
|
||||
if (renderMode == GfxRenderer::BW && bmpVal < 3) {
|
||||
// Full coverage is solid ink; partial (anti-aliased edge) coverage
|
||||
// dithers with the same period-2 patterns as fillRectDither
|
||||
// (dark grey = 50% checkerboard, light grey = 25%), so 2-bit fonts
|
||||
// render anti-aliased on BW passes instead of bolding every edge
|
||||
// pixel to black. Skipped pixels leave the background untouched.
|
||||
if (bmpVal == 0 || (bmpVal == 1 && ((screenX + screenY) & 1) == 0) ||
|
||||
// Default: gray pixels paint solid black. Required when grayscale
|
||||
// passes follow (their LUT lightens pixels it assumes were just
|
||||
// driven solid black), and it is the plain non-AA look otherwise.
|
||||
// Fast AA: partial (anti-aliased edge) coverage dithers with the
|
||||
// same period-2 patterns as fillRectDither (dark grey = 50%
|
||||
// checkerboard, light grey = 25%), approximating AA in a single
|
||||
// BW pass. Skipped pixels leave the background untouched.
|
||||
if (!renderer.isFastAntiAliasing() || bmpVal == 0 ||
|
||||
(bmpVal == 1 && ((screenX + screenY) & 1) == 0) ||
|
||||
(bmpVal == 2 && (screenX & 1) == 0 && (screenY & 1) == 0)) {
|
||||
renderer.drawPixel(screenX, screenY, pixelState);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,13 @@ class GfxRenderer {
|
||||
RenderMode renderMode;
|
||||
Orientation orientation;
|
||||
bool fadingFix;
|
||||
// Fast text anti-aliasing: when set, BW-mode rendering of 2-bit glyphs
|
||||
// dithers partial-coverage (gray) pixels instead of painting them solid
|
||||
// black, approximating AA in a single BW pass with no grayscale refresh.
|
||||
// Must stay false when grayscale LSB/MSB passes follow the BW render: the
|
||||
// gray LUT lightens pixels it assumes were just driven solid black, and
|
||||
// dither-skipped white pixels would take its white-drive frames unopposed.
|
||||
bool fastAntiAliasing = false;
|
||||
uint8_t* frameBuffer = nullptr;
|
||||
uint16_t panelWidth = HalDisplay::DISPLAY_WIDTH;
|
||||
uint16_t panelHeight = HalDisplay::DISPLAY_HEIGHT;
|
||||
@@ -224,6 +231,8 @@ class GfxRenderer {
|
||||
// Grayscale functions
|
||||
void setRenderMode(const RenderMode mode) { this->renderMode = mode; }
|
||||
RenderMode getRenderMode() const { return renderMode; }
|
||||
void setFastAntiAliasing(const bool enabled) { this->fastAntiAliasing = enabled; }
|
||||
bool isFastAntiAliasing() const { return fastAntiAliasing; }
|
||||
// Grayscale preconditioning settle pass (no-op on X4). The rect overload
|
||||
// takes the gray region in LOGICAL screen coordinates and rotates it to the
|
||||
// panel; the no-arg overload settles the full frame. Call after the BW base
|
||||
|
||||
@@ -66,6 +66,8 @@ STR_SLEEP_COVER_MODE: "Sleep Screen Cover Mode"
|
||||
STR_HIDE_BATTERY: "Hide Battery %"
|
||||
STR_EXTRA_SPACING: "Extra Paragraph Spacing"
|
||||
STR_TEXT_AA: "Text Anti-Aliasing"
|
||||
STR_TEXT_AA_FULL: "Full"
|
||||
STR_TEXT_AA_FAST: "Fast"
|
||||
STR_IMAGES: "Images"
|
||||
STR_IMAGES_DISPLAY: "Display"
|
||||
STR_IMAGES_PLACEHOLDER: "Placeholder"
|
||||
|
||||
Reference in New Issue
Block a user