mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 23:27:38 +03:00
Smaller fonts
This commit is contained in:
parent
04ad4e5aa4
commit
ae5c96dbbb
BIN
firmware.bin
Normal file
BIN
firmware.bin
Normal file
Binary file not shown.
70
get-platformio.py
Normal file
70
get-platformio.py
Normal file
File diff suppressed because one or more lines are too long
@ -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>
|
||||
|
||||
2995
lib/EpdFont/builtinFonts/bookerly_10_bold.h
Normal file
2995
lib/EpdFont/builtinFonts/bookerly_10_bold.h
Normal file
File diff suppressed because it is too large
Load Diff
3030
lib/EpdFont/builtinFonts/bookerly_10_bolditalic.h
Normal file
3030
lib/EpdFont/builtinFonts/bookerly_10_bolditalic.h
Normal file
File diff suppressed because it is too large
Load Diff
2925
lib/EpdFont/builtinFonts/bookerly_10_italic.h
Normal file
2925
lib/EpdFont/builtinFonts/bookerly_10_italic.h
Normal file
File diff suppressed because it is too large
Load Diff
2877
lib/EpdFont/builtinFonts/bookerly_10_regular.h
Normal file
2877
lib/EpdFont/builtinFonts/bookerly_10_regular.h
Normal file
File diff suppressed because it is too large
Load Diff
3119
lib/EpdFont/builtinFonts/notosans_10_bold.h
Normal file
3119
lib/EpdFont/builtinFonts/notosans_10_bold.h
Normal file
File diff suppressed because it is too large
Load Diff
3246
lib/EpdFont/builtinFonts/notosans_10_bolditalic.h
Normal file
3246
lib/EpdFont/builtinFonts/notosans_10_bolditalic.h
Normal file
File diff suppressed because it is too large
Load Diff
3038
lib/EpdFont/builtinFonts/notosans_10_italic.h
Normal file
3038
lib/EpdFont/builtinFonts/notosans_10_italic.h
Normal file
File diff suppressed because it is too large
Load Diff
2898
lib/EpdFont/builtinFonts/notosans_10_regular.h
Normal file
2898
lib/EpdFont/builtinFonts/notosans_10_regular.h
Normal file
File diff suppressed because it is too large
Load Diff
2170
lib/EpdFont/builtinFonts/opendyslexic_7_bold.h
Normal file
2170
lib/EpdFont/builtinFonts/opendyslexic_7_bold.h
Normal file
File diff suppressed because it is too large
Load Diff
2427
lib/EpdFont/builtinFonts/opendyslexic_7_bolditalic.h
Normal file
2427
lib/EpdFont/builtinFonts/opendyslexic_7_bolditalic.h
Normal file
File diff suppressed because it is too large
Load Diff
2226
lib/EpdFont/builtinFonts/opendyslexic_7_italic.h
Normal file
2226
lib/EpdFont/builtinFonts/opendyslexic_7_italic.h
Normal file
File diff suppressed because it is too large
Load Diff
1988
lib/EpdFont/builtinFonts/opendyslexic_7_regular.h
Normal file
1988
lib/EpdFont/builtinFonts/opendyslexic_7_regular.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -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",
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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, {}},
|
||||
};
|
||||
|
||||
@ -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)
|
||||
|
||||
21
src/main.cpp
21
src/main.cpp
@ -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(¬osans_10_regular);
|
||||
EpdFont notosans10BoldFont(¬osans_10_bold);
|
||||
EpdFont notosans10ItalicFont(¬osans_10_italic);
|
||||
EpdFont notosans10BoldItalicFont(¬osans_10_bolditalic);
|
||||
EpdFontFamily notosans10FontFamily(¬osans10RegularFont, ¬osans10BoldFont, ¬osans10ItalicFont,
|
||||
¬osans10BoldItalicFont);
|
||||
EpdFont notosans12RegularFont(¬osans_12_regular);
|
||||
EpdFont notosans12BoldFont(¬osans_12_bold);
|
||||
EpdFont notosans12ItalicFont(¬osans_12_italic);
|
||||
@ -90,6 +102,12 @@ EpdFont notosans18BoldItalicFont(¬osans_18_bolditalic);
|
||||
EpdFontFamily notosans18FontFamily(¬osans18RegularFont, ¬osans18BoldFont, ¬osans18ItalicFont,
|
||||
¬osans18BoldItalicFont);
|
||||
|
||||
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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user