Smaller fonts

This commit is contained in:
Irene Ying 2025-12-31 20:49:20 -08:00
parent 04ad4e5aa4
commit ae5c96dbbb
22 changed files with 33088 additions and 10 deletions

BIN
firmware.bin Normal file

Binary file not shown.

70
get-platformio.py Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,9 @@
#pragma once
#include <builtinFonts/bookerly_10_bold.h>
#include <builtinFonts/bookerly_10_bolditalic.h>
#include <builtinFonts/bookerly_10_italic.h>
#include <builtinFonts/bookerly_10_regular.h>
#include <builtinFonts/bookerly_12_bold.h>
#include <builtinFonts/bookerly_12_bolditalic.h>
#include <builtinFonts/bookerly_12_italic.h>
@ -17,6 +21,10 @@
#include <builtinFonts/bookerly_18_italic.h>
#include <builtinFonts/bookerly_18_regular.h>
#include <builtinFonts/notosans_8_regular.h>
#include <builtinFonts/notosans_10_bold.h>
#include <builtinFonts/notosans_10_bolditalic.h>
#include <builtinFonts/notosans_10_italic.h>
#include <builtinFonts/notosans_10_regular.h>
#include <builtinFonts/notosans_12_bold.h>
#include <builtinFonts/notosans_12_bolditalic.h>
#include <builtinFonts/notosans_12_italic.h>
@ -45,6 +53,10 @@
#include <builtinFonts/opendyslexic_14_bolditalic.h>
#include <builtinFonts/opendyslexic_14_italic.h>
#include <builtinFonts/opendyslexic_14_regular.h>
#include <builtinFonts/opendyslexic_7_bold.h>
#include <builtinFonts/opendyslexic_7_bolditalic.h>
#include <builtinFonts/opendyslexic_7_italic.h>
#include <builtinFonts/opendyslexic_7_regular.h>
#include <builtinFonts/opendyslexic_8_bold.h>
#include <builtinFonts/opendyslexic_8_bolditalic.h>
#include <builtinFonts/opendyslexic_8_italic.h>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,15 @@ echo "// The contents of this file are generated by ./lib/EpdFont/scripts/build-
echo "#pragma once"
echo ""
echo "#define BOOKERLY_10_FONT_ID ($(
ruby -rdigest -e 'puts [
"./bookerly_10_regular.h",
"./bookerly_10_bold.h",
"./bookerly_10_bolditalic.h",
"./bookerly_10_italic.h",
].map{|f| Digest::SHA256.hexdigest(File.read(f)).to_i(16) }.sum % (2 ** 32) - (2 ** 31)'
))"
echo "#define BOOKERLY_12_FONT_ID ($(
ruby -rdigest -e 'puts [
"./bookerly_12_regular.h",
@ -44,6 +53,15 @@ ruby -rdigest -e 'puts [
].map{|f| Digest::SHA256.hexdigest(File.read(f)).to_i(16) }.sum % (2 ** 32) - (2 ** 31)'
))"
echo "#define NOTOSANS_10_FONT_ID ($(
ruby -rdigest -e 'puts [
"./notosans_10_regular.h",
"./notosans_10_bold.h",
"./notosans_10_bolditalic.h",
"./notosans_10_italic.h",
].map{|f| Digest::SHA256.hexdigest(File.read(f)).to_i(16) }.sum % (2 ** 32) - (2 ** 31)'
))"
echo "#define NOTOSANS_12_FONT_ID ($(
ruby -rdigest -e 'puts [
"./notosans_12_regular.h",
@ -80,6 +98,15 @@ ruby -rdigest -e 'puts [
].map{|f| Digest::SHA256.hexdigest(File.read(f)).to_i(16) }.sum % (2 ** 32) - (2 ** 31)'
))"
echo "#define OPENDYSLEXIC_7_FONT_ID ($(
ruby -rdigest -e 'puts [
"./opendyslexic_7_regular.h",
"./opendyslexic_7_bold.h",
"./opendyslexic_7_bolditalic.h",
"./opendyslexic_7_italic.h",
].map{|f| Digest::SHA256.hexdigest(File.read(f)).to_i(16) }.sum % (2 ** 32) - (2 ** 31)'
))"
echo "#define OPENDYSLEXIC_8_FONT_ID ($(
ruby -rdigest -e 'puts [
"./opendyslexic_8_regular.h",

View File

@ -5,16 +5,16 @@ set -e
cd "$(dirname "$0")"
READER_FONT_STYLES=("Regular" "Italic" "Bold" "BoldItalic")
BOOKERLY_FONT_SIZES=(12 14 16 18)
NOTOSANS_FONT_SIZES=(12 14 16 18)
OPENDYSLEXIC_FONT_SIZES=(8 10 12 14)
BOOKERLY_FONT_SIZES=(10 12 14 16 18)
NOTOSANS_FONT_SIZES=(10 12 14 16 18)
OPENDYSLEXIC_FONT_SIZES=(7 8 10 12 14)
for size in ${BOOKERLY_FONT_SIZES[@]}; do
for style in ${READER_FONT_STYLES[@]}; do
font_name="bookerly_${size}_$(echo $style | tr '[:upper:]' '[:lower:]')"
font_path="../builtinFonts/source/Bookerly/Bookerly-${style}.ttf"
output_path="../builtinFonts/${font_name}.h"
python fontconvert.py $font_name $size $font_path --2bit > $output_path
python3 fontconvert.py $font_name $size $font_path --2bit > $output_path
echo "Generated $output_path"
done
done
@ -24,7 +24,7 @@ for size in ${NOTOSANS_FONT_SIZES[@]}; do
font_name="notosans_${size}_$(echo $style | tr '[:upper:]' '[:lower:]')"
font_path="../builtinFonts/source/NotoSans/NotoSans-${style}.ttf"
output_path="../builtinFonts/${font_name}.h"
python fontconvert.py $font_name $size $font_path --2bit > $output_path
python3 fontconvert.py $font_name $size $font_path --2bit > $output_path
echo "Generated $output_path"
done
done
@ -34,7 +34,7 @@ for size in ${OPENDYSLEXIC_FONT_SIZES[@]}; do
font_name="opendyslexic_${size}_$(echo $style | tr '[:upper:]' '[:lower:]')"
font_path="../builtinFonts/source/OpenDyslexic/OpenDyslexic-${style}.otf"
output_path="../builtinFonts/${font_name}.h"
python fontconvert.py $font_name $size $font_path --2bit > $output_path
python3 fontconvert.py $font_name $size $font_path --2bit > $output_path
echo "Generated $output_path"
done
done
@ -47,9 +47,9 @@ for size in ${UI_FONT_SIZES[@]}; do
font_name="ubuntu_${size}_$(echo $style | tr '[:upper:]' '[:lower:]')"
font_path="../builtinFonts/source/Ubuntu/Ubuntu-${style}.ttf"
output_path="../builtinFonts/${font_name}.h"
python fontconvert.py $font_name $size $font_path > $output_path
python3 fontconvert.py $font_name $size $font_path > $output_path
echo "Generated $output_path"
done
done
python fontconvert.py notosans_8_regular 8 ../builtinFonts/source/NotoSans/NotoSans-Regular.ttf > ../builtinFonts/notosans_8_regular.h
python3 fontconvert.py notosans_8_regular 8 ../builtinFonts/source/NotoSans/NotoSans-Regular.ttf > ../builtinFonts/notosans_8_regular.h

View File

@ -131,6 +131,8 @@ int CrossPointSettings::getReaderFontId() const {
case BOOKERLY:
default:
switch (fontSize) {
case EXTRA_SMALL:
return BOOKERLY_10_FONT_ID;
case SMALL:
return BOOKERLY_12_FONT_ID;
case MEDIUM:
@ -143,6 +145,8 @@ int CrossPointSettings::getReaderFontId() const {
}
case NOTOSANS:
switch (fontSize) {
case EXTRA_SMALL:
return NOTOSANS_10_FONT_ID;
case SMALL:
return NOTOSANS_12_FONT_ID;
case MEDIUM:
@ -155,6 +159,8 @@ int CrossPointSettings::getReaderFontId() const {
}
case OPENDYSLEXIC:
switch (fontSize) {
case EXTRA_SMALL:
return OPENDYSLEXIC_7_FONT_ID;
case SMALL:
return OPENDYSLEXIC_8_FONT_ID;
case MEDIUM:

View File

@ -41,7 +41,7 @@ class CrossPointSettings {
// Font family options
enum FONT_FAMILY { BOOKERLY = 0, NOTOSANS = 1, OPENDYSLEXIC = 2 };
// Font size options
enum FONT_SIZE { SMALL = 0, MEDIUM = 1, LARGE = 2, EXTRA_LARGE = 3 };
enum FONT_SIZE { SMALL = 0, MEDIUM = 1, LARGE = 2, EXTRA_LARGE = 3, EXTRA_SMALL = 4 };
enum LINE_COMPRESSION { TIGHT = 0, NORMAL = 1, WIDE = 2 };
// Sleep screen settings

View File

@ -32,7 +32,7 @@ const SettingInfo settingsList[settingsCount] = {
SettingType::ENUM,
&CrossPointSettings::fontFamily,
{"Bookerly", "Noto Sans", "Open Dyslexic"}},
{"Reader Font Size", SettingType::ENUM, &CrossPointSettings::fontSize, {"Small", "Medium", "Large", "X Large"}},
{"Reader Font Size", SettingType::ENUM, &CrossPointSettings::fontSize, {"Small", "Medium", "Large", "X Large", "X Small"}},
{"Reader Line Spacing", SettingType::ENUM, &CrossPointSettings::lineSpacing, {"Tight", "Normal", "Wide"}},
{"Check for updates", SettingType::ACTION, nullptr, {}},
};

View File

@ -1,14 +1,17 @@
// The contents of this file are generated by ./lib/EpdFont/scripts/build-font-ids.sh
#pragma once
#define BOOKERLY_10_FONT_ID (1682775559)
#define BOOKERLY_12_FONT_ID (-142329172)
#define BOOKERLY_14_FONT_ID (104246423)
#define BOOKERLY_16_FONT_ID (1909382491)
#define BOOKERLY_18_FONT_ID (2056549737)
#define NOTOSANS_10_FONT_ID (191539796)
#define NOTOSANS_12_FONT_ID (-1646794343)
#define NOTOSANS_14_FONT_ID (-890242897)
#define NOTOSANS_16_FONT_ID (241925189)
#define NOTOSANS_18_FONT_ID (1503221336)
#define OPENDYSLEXIC_7_FONT_ID (-196215919)
#define OPENDYSLEXIC_8_FONT_ID (875216341)
#define OPENDYSLEXIC_10_FONT_ID (-1234231183)
#define OPENDYSLEXIC_12_FONT_ID (1682200414)

View File

@ -40,6 +40,12 @@ GfxRenderer renderer(einkDisplay);
Activity* currentActivity;
// Fonts
EpdFont bookerly10RegularFont(&bookerly_10_regular);
EpdFont bookerly10BoldFont(&bookerly_10_bold);
EpdFont bookerly10ItalicFont(&bookerly_10_italic);
EpdFont bookerly10BoldItalicFont(&bookerly_10_bolditalic);
EpdFontFamily bookerly10FontFamily(&bookerly10RegularFont, &bookerly10BoldFont, &bookerly10ItalicFont,
&bookerly10BoldItalicFont);
EpdFont bookerly12RegularFont(&bookerly_12_regular);
EpdFont bookerly12BoldFont(&bookerly_12_bold);
EpdFont bookerly12ItalicFont(&bookerly_12_italic);
@ -65,6 +71,12 @@ EpdFont bookerly18BoldItalicFont(&bookerly_18_bolditalic);
EpdFontFamily bookerly18FontFamily(&bookerly18RegularFont, &bookerly18BoldFont, &bookerly18ItalicFont,
&bookerly18BoldItalicFont);
EpdFont notosans10RegularFont(&notosans_10_regular);
EpdFont notosans10BoldFont(&notosans_10_bold);
EpdFont notosans10ItalicFont(&notosans_10_italic);
EpdFont notosans10BoldItalicFont(&notosans_10_bolditalic);
EpdFontFamily notosans10FontFamily(&notosans10RegularFont, &notosans10BoldFont, &notosans10ItalicFont,
&notosans10BoldItalicFont);
EpdFont notosans12RegularFont(&notosans_12_regular);
EpdFont notosans12BoldFont(&notosans_12_bold);
EpdFont notosans12ItalicFont(&notosans_12_italic);
@ -90,6 +102,12 @@ EpdFont notosans18BoldItalicFont(&notosans_18_bolditalic);
EpdFontFamily notosans18FontFamily(&notosans18RegularFont, &notosans18BoldFont, &notosans18ItalicFont,
&notosans18BoldItalicFont);
EpdFont opendyslexic7RegularFont(&opendyslexic_7_regular);
EpdFont opendyslexic7BoldFont(&opendyslexic_7_bold);
EpdFont opendyslexic7ItalicFont(&opendyslexic_7_italic);
EpdFont opendyslexic7BoldItalicFont(&opendyslexic_7_bolditalic);
EpdFontFamily opendyslexic7FontFamily(&opendyslexic7RegularFont, &opendyslexic7BoldFont, &opendyslexic7ItalicFont,
&opendyslexic7BoldItalicFont);
EpdFont opendyslexic8RegularFont(&opendyslexic_8_regular);
EpdFont opendyslexic8BoldFont(&opendyslexic_8_bold);
EpdFont opendyslexic8ItalicFont(&opendyslexic_8_italic);
@ -231,14 +249,17 @@ void onGoHome() {
void setupDisplayAndFonts() {
einkDisplay.begin();
Serial.printf("[%lu] [ ] Display initialized\n", millis());
renderer.insertFont(BOOKERLY_10_FONT_ID, bookerly10FontFamily);
renderer.insertFont(BOOKERLY_12_FONT_ID, bookerly12FontFamily);
renderer.insertFont(BOOKERLY_14_FONT_ID, bookerly14FontFamily);
renderer.insertFont(BOOKERLY_16_FONT_ID, bookerly16FontFamily);
renderer.insertFont(BOOKERLY_18_FONT_ID, bookerly18FontFamily);
renderer.insertFont(NOTOSANS_10_FONT_ID, notosans10FontFamily);
renderer.insertFont(NOTOSANS_12_FONT_ID, notosans12FontFamily);
renderer.insertFont(NOTOSANS_14_FONT_ID, notosans14FontFamily);
renderer.insertFont(NOTOSANS_16_FONT_ID, notosans16FontFamily);
renderer.insertFont(NOTOSANS_18_FONT_ID, notosans18FontFamily);
renderer.insertFont(OPENDYSLEXIC_7_FONT_ID, opendyslexic7FontFamily);
renderer.insertFont(OPENDYSLEXIC_8_FONT_ID, opendyslexic8FontFamily);
renderer.insertFont(OPENDYSLEXIC_10_FONT_ID, opendyslexic10FontFamily);
renderer.insertFont(OPENDYSLEXIC_12_FONT_ID, opendyslexic12FontFamily);