Skip to content

Commit e6133ff

Browse files
authored
Font for pTAdvance (#24)
* add ubuntu font, update docs, add licenses * detect pTAdvance & use matching font needed to update to newer webserial pkg for this in order to be able to detect ptAdvance by it vendor&product usb ids * better customise font for advance
1 parent 9410fd9 commit e6133ff

13 files changed

Lines changed: 334 additions & 31 deletions

LICENSE

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2024, 2025 xiphonics, inc.
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
31+
-------------------------------------------------------------------------------
32+
Third-Party Software and Licenses
33+
-------------------------------------------------------------------------------
34+
35+
This project includes third-party software components. Each component is
36+
subject to its own license. Below is a summary of included external code:
37+
38+
1. Ubuntu Mono font
39+
Path: assets/fonts/UbuntuMono-Regular.ttf
40+
SPDX-License-Identifier: Ubuntu-font-1.0
41+
License file: docs/Ubuntu-Font-Licence-1.0.txt
42+
43+
2. ZX-Origins fonts
44+
Path: sources/Adapters/picoTracker/display/font.h
45+
SPDX-License-Identifier: custom
46+
License file: docs/FONT-LICENSE.md
47+
48+
The license texts for the above components are available in their respective
49+
folders. This project does not relicense or modify the terms of those licenses.

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ The webapp [is available here](https://xiphonics.github.io/picotracker_client/).
88

99
## Getting Started
1010

11-
Connect picotracker to usb port. On linux this will probably be `/dev/ttyACM0`
12-
You will need to switch between any 2 screens on the picotracker to "initialise" the display on the app.
11+
Connect picotracker to a usb port.
12+
13+
Run the Flutter web app using:
14+
`flutter run -d web lib/main.dart`
15+
16+
In VSCode, with Flutter extension installed just press `F5` to run udner a debugger.
17+
18+
The production application is deployed to: https://ui.xiphonics.com/ via GitHub Actions.
1319

1420
## Supported Platforms
1521

@@ -21,10 +27,10 @@ You will need to switch between any 2 screens on the picotracker to "initialise"
2127

2228
- [X] display fg/bg colours
2329
- [X] webapp version
24-
- [ ] use palette (custom colours) send from picotracker ([once supported by remoteui protocol](https://github.com/xiphonics/picoTracker/issues/263))
30+
- [X] use palette (custom colours) send from picotracker ([once supported by remoteui protocol](https://github.com/xiphonics/picoTracker/issues/263))
2531
- [X] implement notes blank *background* display of Song screen
2632
- [ ] reconnect port on picotracker reset (on load new project)
2733
- [ ] set initial window size
2834
- [ ] show usb port connection status
2935
- [X] app setting for USB port device name
30-
- [ ] request refresh on connect ([once supported by remoteui protocol](https://github.com/xiphonics/picoTracker/issues/263))
36+
- [X] request refresh on connect ([once supported by remoteui protocol](https://github.com/xiphonics/picoTracker/issues/263))
185 KB
Binary file not shown.

docs/FONT-LICENSE.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# A ZX-Origins Typeface
2+
3+
Thank you for downloading one of the fonts in my ZX Origins collection. You will see a number of files in this download for the various formats this font is supplied in. They are as follows:
4+
5+
## Formats
6+
7+
### Sinclair ZX Spectrum
8+
9+
Inside the **Spectrum** folder you will find each font has a `.ch8` file that is a RAW 768-byte file that can be loaded directly into BASIN, AGD or other Spectrum environments. Alternatively you can load it into any available RAM address and then `POKE 23606` and `23607` with the appropriate RAM address minus 256 bytes.
10+
11+
Each font also has a `.fzx` file containing a proportional conversion of the font for use with the [FZX Proportional Font Renderer](https://github.com/z88dk/z88dk/tree/master/libsrc/_DEVELOPMENT/font/fzx) available for the ZX Spectrum. Z80 assembler-compatible files containing `defb` statements can be found in the `source` folder with the suffix `.z80.asm`.
12+
13+
A `.tap` tape image is provided which can be either written to a physical tape, loaded in via a DivMMC or mounted in an emulator. It contains all the fonts for the given typeface complete with a built-in demonstration program that will allow all the fonts to be previewed in any color combination.
14+
15+
### Acorn BBC Micro/Electron
16+
17+
Inside the **BBC** folder you will find each font has a `.bbc` file that can be copied to your own discs and `*EXEC`'ed once you have set `*FX 20,7` and carved out space for them with `PAGE=&1F00`. It is recommended you `*EXEC` them from your `!BOOT` file. If you need to execute them from your own BASIC then instead you should use the [BFont](http://mdfs.net/Apps/Font/) load routine by J.G.Harston in 0/VDU mode.
18+
19+
Additionally a DFS-formatted `.ssd` disk image is provided for use with emulators contains a demonstration program showing the fonts available for this typeface in any color combination in low, medium or high-resolution modes.
20+
21+
### Commodore 64
22+
23+
The **C64** folder contains two `.64c` files (raw in PETSCI order with a 2 byte extra header) - one with upper-case only and more line drawing characters (`.upper`) - and the other containing both upper and lower case (`.both`).
24+
25+
Additionally there is a combined `.bin` file containing both the fonts in a raw format that can be used as a character ROM in an emulator or otherwise imported into your dev system.
26+
27+
### Amstrad CPC
28+
29+
The **CPC** folder contains a `.bas` file representing ASCII BASIC versions of the font definition for Amstrad BASIC starting at line 9000. You can use a tool such as WinAPE's "Auto Type" feature to paste this into your BASIC program. When run this code will redefine the current character set to match. Note that ZX Origins is a subset of the Amstrad CPC character set and so will not include various symbols and non-Latin characters.
30+
31+
Alternatively a `.dsk` file is also included which contains a CPC 664/6128 DATA disk image that is ready to use. Either run them directly or `MERGE` them with your BASIC program. Ensure lines 9000-9980 are free in your program as they will be overwritten by the MERGE.
32+
33+
### Game Boy
34+
35+
The **GameBoy** folder contains multiple `.png` files that can be loaded into a Game Boy Studio for developing games for the Nintendo Game Boy. Each font has a regular (light), a `-dark` (inverse), and a `-var` proportional/variable-width versions. Right now only the standard Spectrum character set is represented so ASCII plus pound and copyright symbols.
36+
37+
### Atari 8-bit
38+
39+
The **Atari8** folder contains a `.fnt` file for each font which is the RAW font data with ATASCII ordering with line-drawing characters from the original machine set.
40+
41+
### CoCo (Tandy Color Computer/TRS-80)
42+
43+
Files are included ready for use with the [CoCoVGA board](http://www.cocovga.com/) which allows redefined characters. Each `.CHR` file contains a single font in RS-DOS binary format complete with standard 5-byte header and trailer configured to load at `$E00`.
44+
45+
A `.dsk` disk image is also included containing copies of each of the fonts in the family within a 35-track Disk Basic image file produced by [CMOC](http://perso.b2b2c.ca/~sarrazip/dev/cmoc-manual.html).
46+
47+
### PC
48+
49+
### BDF (Glyph Bitmap Distribution Format)
50+
51+
Standard bitmap font format used by many Windows and Mac tools. If you need to extend the character set out I would start here as it allows for large character sets etc and is still purely bitmap.
52+
53+
### PSF (PC Screen Font)
54+
55+
Font file capable of being used by Linux as console fonts.
56+
57+
### TTF (TrueType font)
58+
59+
A Windows, Mac and Linux friendly scalable version of the font. It is very hard to preserve the original bitmap sharply across platforms in a TrueType container but I've done what I can. This looks best at multiples of 8px on Windows. Experiment with other sizes or metrics as you need depending on your OS.
60+
61+
### WOFF (Web font)
62+
63+
A web font for older browsers and the Godot game engine.
64+
65+
### WOFF2 (Web font)
66+
67+
A web font for modern browsers containing a fully Brotli compressed web-friendly version of the TrueType font for use within web pages.
68+
69+
## Other systems
70+
71+
In the `Source` folder you will find:
72+
73+
- C-style headers containing `static const` arrays with the suffix `.h`
74+
- Motorola 68000 assembler files containing `DC.B` statements with the suffix `.68000.asm`
75+
- Intel x86 assembler files containing `db` statements with the suffix `.x86.asm`
76+
- Zilog Z80 assembler files containing `defb` statements with the suffix `.z80.asm`
77+
- MOS 6502 assembler files containing `.byte` statements with the suffix `.6502.asm`
78+
79+
Please note that all these files contain the raw glyphs in ASCII order with Sinclair-specific modifications:
80+
81+
- ↑ (up-arrow) at 0x5E instead of ^ (caret) except where I've drawn them as a caret
82+
- £ (UK pound sign) at 0x60 instead of ` (grave accent)
83+
- © (copyright sign) at 0x7F instead of the DEL control code
84+
85+
## Further conversion
86+
87+
If you wish to convert this font to other formats the BDF file is a good starting point.
88+
89+
Alternatively check out John Elliot's PSFTOOLS which can turn the .psf file included into BBC, Wyse, C code, FNT and others formats. I would recommend however sticking with the TTF and WOFF2 for scalable versions as they have been carefully optimized to reduce smoothing at specific sizes.
90+
91+
Many of the conversions are achieved using my open-source [PixelWorld tool](https://github.com/damieng/pixelworld).
92+
93+
I may include additional formats in future updates of ZX Origins if there is demand.
94+
95+
## Thanks
96+
97+
My sincere thanks to:
98+
99+
- [John Elliot](https://www.seasip.info/) for his amazing [psftools](https://www.seasip.info/Unix/PSF/) which helped streamline the process.
100+
- [Paul van der Laan](http://type-invaders.com) for lending his expertise and research into how to make 8x8 bitmap fonts perfect in [FontLab Studio 5](https://www.fontlab.com/font-editor/fontlab-studio-5/).
101+
- [Paul Dunn](https://github.com/ZXDunny) for the BASIN editor that is my 8x8 bitmap font designer of choice
102+
- [Arda Erdikmen](https://github.com/ref-xx) for improvements to [BASIN](https://github.com/ref-xx/basinc)
103+
- [Santiago Crespo](https://gameboys.es/) for all his help in getting the GameBoy Studio versions right
104+
- [J.G.Harston](https://mdfs.net/) for the BBC font-loading routines [BFont](https://mdfs.net/Apps/Font/) and the [mkimg tool](https://mdfs.net/Apps/DiskTools/) used to automate .ssd creation
105+
- The team behind [iDSK](https://github.com/cpcsdk/idsk) used to prepare the Amstrad CPC disk images
106+
- To Brendan Donahe for the [CoCoVGA](http://cocovga.com/about/) scripts and conversion tool
107+
108+
## Licence
109+
110+
This font is part of the ZX Origins font collection Copyright (c) 1988-2023 Damien Guard.
111+
112+
Formal licenses are complicated and burdensome so here's the deal. These are some acceptable use examples:
113+
114+
1. Use it in your game (commercial or non-commercial)
115+
2. Print something on a t-shirt
116+
3. Use the embedded font file on your site
117+
4. Set your favorite terminal or OS to use it
118+
119+
Ideally with a credit like "<fontname> font by DamienG https://damieng.com/zx-origins" _if_ you have a credits section. If you don't that's fine. Either way dropping me an email at damieng@gmail.com to let me know what you used it for **is appreciated**.
120+
121+
The only prohibited use is redistributing this font as a font. i.e. re-hosting the files on your own site or bundling it with other art assets or using it to create assets. I have put a lot of time into these and my only reward is seeing download counts on my site which is ad-free so it seems unfair other people would re-host these files on their site and make $ from Google AdWords etc.
122+
123+
If you need to modify the font for your usage - either to add characters (this collection is pure ASCII + copyright + UK pound sign right now) or if a few are bothering you just change the credit to "Font based on <fontname> by DamienG" or something.
124+
125+
Thanks and enjoy!
126+
127+
[)amien
128+
https://damieng.com/zx-origins/

docs/UFL.txt

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
-------------------------------
2+
UBUNTU FONT LICENCE Version 1.0
3+
-------------------------------
4+
5+
PREAMBLE
6+
This licence allows the licensed fonts to be used, studied, modified and
7+
redistributed freely. The fonts, including any derivative works, can be
8+
bundled, embedded, and redistributed provided the terms of this licence
9+
are met. The fonts and derivatives, however, cannot be released under
10+
any other licence. The requirement for fonts to remain under this
11+
licence does not require any document created using the fonts or their
12+
derivatives to be published under this licence, as long as the primary
13+
purpose of the document is not to be a vehicle for the distribution of
14+
the fonts.
15+
16+
DEFINITIONS
17+
"Font Software" refers to the set of files released by the Copyright
18+
Holder(s) under this licence and clearly marked as such. This may
19+
include source files, build scripts and documentation.
20+
21+
"Original Version" refers to the collection of Font Software components
22+
as received under this licence.
23+
24+
"Modified Version" refers to any derivative made by adding to, deleting,
25+
or substituting -- in part or in whole -- any of the components of the
26+
Original Version, by changing formats or by porting the Font Software to
27+
a new environment.
28+
29+
"Copyright Holder(s)" refers to all individuals and companies who have a
30+
copyright ownership of the Font Software.
31+
32+
"Substantially Changed" refers to Modified Versions which can be easily
33+
identified as dissimilar to the Font Software by users of the Font
34+
Software comparing the Original Version with the Modified Version.
35+
36+
To "Propagate" a work means to do anything with it that, without
37+
permission, would make you directly or secondarily liable for
38+
infringement under applicable copyright law, except executing it on a
39+
computer or modifying a private copy. Propagation includes copying,
40+
distribution (with or without modification and with or without charging
41+
a redistribution fee), making available to the public, and in some
42+
countries other activities as well.
43+
44+
PERMISSION & CONDITIONS
45+
This licence does not grant any rights under trademark law and all such
46+
rights are reserved.
47+
48+
Permission is hereby granted, free of charge, to any person obtaining a
49+
copy of the Font Software, to propagate the Font Software, subject to
50+
the below conditions:
51+
52+
1) Each copy of the Font Software must contain the above copyright
53+
notice and this licence. These can be included either as stand-alone
54+
text files, human-readable headers or in the appropriate machine-
55+
readable metadata fields within text or binary files as long as those
56+
fields can be easily viewed by the user.
57+
58+
2) The font name complies with the following:
59+
(a) The Original Version must retain its name, unmodified.
60+
(b) Modified Versions which are Substantially Changed must be renamed to
61+
avoid use of the name of the Original Version or similar names entirely.
62+
(c) Modified Versions which are not Substantially Changed must be
63+
renamed to both (i) retain the name of the Original Version and (ii) add
64+
additional naming elements to distinguish the Modified Version from the
65+
Original Version. The name of such Modified Versions must be the name of
66+
the Original Version, with "derivative X" where X represents the name of
67+
the new work, appended to that name.
68+
69+
3) The name(s) of the Copyright Holder(s) and any contributor to the
70+
Font Software shall not be used to promote, endorse or advertise any
71+
Modified Version, except (i) as required by this licence, (ii) to
72+
acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with
73+
their explicit written permission.
74+
75+
4) The Font Software, modified or unmodified, in part or in whole, must
76+
be distributed entirely under this licence, and must not be distributed
77+
under any other licence. The requirement for fonts to remain under this
78+
licence does not affect any document created using the Font Software,
79+
except any version of the Font Software extracted from a document
80+
created using the Font Software may only be distributed under this
81+
licence.
82+
83+
TERMINATION
84+
This licence becomes null and void if any of the above conditions are
85+
not met.
86+
87+
DISCLAIMER
88+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
89+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
90+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
91+
COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
92+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
93+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
94+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
95+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
96+
DEALINGS IN THE FONT SOFTWARE.

lib/main_screen.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import 'commands.dart';
1111
import 'pico_app.dart';
1212
import 'widgets/pico_screen.dart';
1313

14+
// just simple global for now
15+
late final SerialPortHandler serialHandler;
16+
1417
class MainScreen extends StatefulWidget {
1518
const MainScreen({super.key});
1619

@@ -25,7 +28,6 @@ class _MainScreenState extends State<MainScreen> {
2528
StreamSubscription? cmdStreamSubscription;
2629
final _grid = ScreenCharGrid();
2730
final cmdBuilder = CmdBuilder();
28-
late final SerialPortHandler serialHandler;
2931

3032
StreamSubscription? usbUdevStream;
3133

@@ -49,7 +51,8 @@ class _MainScreenState extends State<MainScreen> {
4951
_grid.setColor(cmd.r, cmd.g, cmd.b);
5052
break;
5153
case FontCmd():
52-
fontNotifier.value = PtFont.values[cmd.index];
54+
final offset = serialHandler.isAdvance() ? AdvFontOffSet : 0;
55+
fontNotifier.value = PtFont.values[cmd.index + offset];
5356
break;
5457
}
5558
});

lib/pico_app.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
import 'package:flutter/material.dart';
44
import 'package:picotracker_client/main_screen.dart';
55

6+
const AdvFontOffSet = 2;
7+
68
enum PtFont {
79
Hourglass,
810
YouSquared,
11+
Ubuntu_Mono,
912
}
1013

1114
final fontNotifier = ValueNotifier<PtFont>(PtFont.Hourglass);
@@ -23,7 +26,7 @@ class PicoApp extends StatelessWidget {
2326
theme: ThemeData(
2427
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
2528
useMaterial3: true,
26-
fontFamily: fontNotifier.value.name,
29+
fontFamily: fontNotifier.value.name.replaceAll("_", " "),
2730
),
2831
home: const MainScreen(),
2932
);

lib/serialport_native.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class SerialPortHandler {
3737
}
3838
}
3939

40+
// TODO:
41+
bool isAdvance() => false;
42+
4043
void _initPort() {
4144
debugPrint("Init Port");
4245
try {

lib/serialport_none.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ class SerialPortHandler {
66
void chooseSerialDevice() async {}
77

88
bool isConnected() => false;
9+
10+
bool isAdvance() => false;
911
}

0 commit comments

Comments
 (0)