Skip to content

Commit

Permalink
Revert "Add new custom font library module"
Browse files Browse the repository at this point in the history
This reverts commit 4922e13.
  • Loading branch information
stweedo committed Jun 22, 2023
1 parent 83981d4 commit e5e6b22
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 76 deletions.
2 changes: 1 addition & 1 deletion apps/boxclk/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
0.01: New App!
0.02: New config options such as step, meridian, short/long formats, custom prefix/suffix
0.03: New Font Library Module! Also allows short or long month.
0.03: Allows showing the month in short or long format by setting `"shortMonth"` to true or false
4 changes: 2 additions & 2 deletions apps/boxclk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Here's an example of what a configuration might contain:
{
"customBox": {
"string": "Your text here",
"font": "CustomFont", // Add custom fonts to "boxclk.lib"
"font": "CustomFont", // Custom fonts must be removed in setUI
"fontSize": 1,
"outline": 2,
"color": "#FF9900", // Use 6 or 3 digit hex color codes
Expand Down Expand Up @@ -54,7 +54,7 @@ __Breakdown of Parameters:__

* **string:** The text string to be displayed inside the box. This is only required for custom Box Names.

* **font:** The font name given to g.setFont(). To use a custom font, use the Espruino Font Converter and add it to "boxclk.lib" next to the other custom fonts. Use the font name beginning after "setFont" in your JSON config.
* **font:** The font name given to g.setFont().

* **fontSize:** The size of the font.

Expand Down
35 changes: 26 additions & 9 deletions apps/boxclk/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
let storage = require("Storage");
let locale = require("locale");
let widgets = require("widget_utils");
let customFonts = require("boxclk.lib");
let date = new Date();
let bgImage;
let configNumber = (storage.readJSON("boxclk.json", 1) || {}).selectedConfig || 0;
Expand Down Expand Up @@ -47,7 +46,24 @@

/**
* ---------------------------------------------------------------
* 4. Initial settings of boxes and their positions
* 4. Font loading function
* ---------------------------------------------------------------
*/
let loadCustomFont = function() {
Graphics.prototype.setFontBrunoAce = function() {
// Actual height 23 (24 - 2)
return this.setFontCustom(
E.toString(require('heatshrink').decompress(atob('ABMHwADBh4DKg4bKgIPDAYUfAYV/AYX/AQMD/gmC+ADBn/AByE/GIU8AYUwLxcfAYX/8AnB//4JIP/FgMP4F+CQQBBjwJBFYRbBAd43DHoJpBh/g/xPEK4ZfDgEEORKDDAY8////wADLfZrTCgITBnhEBAYJMBAYMPw4DCM4QDjhwDCjwDBn0+AYMf/gDBh/4AYMH+ADBLpc4ToK/NGYZfnAYcfL4U/x5fBW4LvB/7vC+LvBgHAsBfIn76Cn4WBcYQDFEgJ+CQQYDyH4L/BAZbHLNYjjCAZc8ngDunycBZ4KkBa4KwBnEHY4UB+BfMgf/ZgMH/4XBc4cf4F/gE+ZgRjwAYcfj5jBM4U4M4RQBM4UA8BjIngDFEYJ8BAYUDAYQvCM4ZxBC4V+AYQvBnkBQ4M8gabBJQPAI4WAAYM/GYQaBAYJKCnqyCn5OCn4aBAYIaBAYJPCU4IABnBhIuDXCFAMD+Z/BY4IDBQwOPwEfv6TDAYUPAcwrDAYQ7BAYY/BI4cD8bLCK4RfEAA0BRYTeDcwIrFn0Pw43Bg4DugYDBjxBBU4SvDMYMH/5QBgP/LAQAP8EHN4UPwADHB4YAHA'))),
46,
atob("CBEdChgYGhgaGBsaCQ=="),
32|65536
);
};
};

/**
* ---------------------------------------------------------------
* 5. Initial settings of boxes and their positions
* ---------------------------------------------------------------
*/
for (let key in boxesConfig) {
Expand All @@ -72,7 +88,7 @@

/**
* ---------------------------------------------------------------
* 5. Text and drawing functions
* 6. Text and drawing functions
* ---------------------------------------------------------------
*/

Expand Down Expand Up @@ -148,7 +164,7 @@

/**
* ---------------------------------------------------------------
* 6. String forming helper functions
* 7. String forming helper functions
* ---------------------------------------------------------------
*/
let isBool = function(val, defaultVal) {
Expand Down Expand Up @@ -192,7 +208,7 @@

/**
* ---------------------------------------------------------------
* 7. Main draw function
* 8. Main draw function
* ---------------------------------------------------------------
*/
let draw = (function() {
Expand Down Expand Up @@ -253,7 +269,7 @@

/**
* ---------------------------------------------------------------
* 8. Helper function for touch event
* 9. Helper function for touch event
* ---------------------------------------------------------------
*/
let touchInText = function(e, boxItem, boxKey) {
Expand All @@ -277,7 +293,7 @@

/**
* ---------------------------------------------------------------
* 9. Setup function to configure event handlers
* 10. Setup function to configure event handlers
* ---------------------------------------------------------------
*/
let setup = function() {
Expand Down Expand Up @@ -364,19 +380,20 @@
Bangle.removeListener('drag', dragHandler);
if (drawTimeout) clearTimeout(drawTimeout);
drawTimeout = undefined;
unloadCustomBoxclkFonts(); // Remove custom fonts
delete Graphics.prototype.setFontBrunoAce;
// Restore original drawString function (no outlines)
g.drawString = g_drawString;
restoreSetColor();
widgets.show();
}
});
loadCustomFont();
draw(boxes);
};

/**
* ---------------------------------------------------------------
* 10. Main execution part
* 11. Main execution part
* ---------------------------------------------------------------
*/
Bangle.loadWidgets();
Expand Down
18 changes: 9 additions & 9 deletions apps/boxclk/boxclk-1.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"time": {
"font": "Orbitron",
"fontSize": 1,
"font": "6x8",
"fontSize": 3,
"outline": 2,
"color": "#0ff",
"outlineColor": "#00f",
"border": "#0f0",
"xPadding": 0,
"yPadding": -3.5,
"xOffset": 0,
"yOffset": 2,
"xPadding": -1,
"yPadding": -2.5,
"xOffset": 2,
"yOffset": 0,
"boxPos": {
"x": "0.33",
"y": "0.29"
Expand All @@ -35,7 +35,7 @@
"dow": {
"font": "6x8",
"fontSize": 2,
"outline": 2,
"outline": 1,
"color": "#000",
"outlineColor": "#fff",
"border": "#0f0",
Expand All @@ -45,13 +45,13 @@
"yOffset": 1,
"boxPos": {
"x": "0.5",
"y": "0.83"
"y": "0.82"
}
},
"step": {
"font": "6x8",
"fontSize": 2,
"outline": 2,
"outline": 1,
"color": "#000",
"outlineColor": "#fff",
"border": "#0f0",
Expand Down
53 changes: 0 additions & 53 deletions apps/boxclk/lib.js

This file was deleted.

2 changes: 0 additions & 2 deletions apps/boxclk/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
"type": "clock",
"tags": "clock",
"supports": ["BANGLEJS2"],
"provides_modules" : ["boxclk.lib"],
"readme": "README.md",
"allow_emulator": true,
"storage": [
{"name":"boxclk.app.js","url":"app.js"},
{"name":"boxclk.settings.js","url":"settings.js"},
{"name":"boxclk.lib","url":"lib.js"},
{"name":"boxclk.img","url":"icon.js","evaluate":true},
{"name":"boxclk.beachhouse.img","url":"beachhouse.js","evaluate":true}
],
Expand Down
Binary file modified apps/boxclk/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e5e6b22

Please sign in to comment.