Commit graph

29 commits

Author SHA1 Message Date
bunnie
13041ad043 add cramium-soc target for fonts 2024-01-29 03:33:20 +08:00
bunnie
ce78a24e10 add small font directory for loader 2024-01-29 03:32:54 +08:00
bunnie
2cb295ccf0 add switches for smaller memory targets for the loader side 2024-01-29 03:32:12 +08:00
bunnie
c20f6af52d add small and regular font options
doesn't break the mapping, makes code porting easier because
the character resolution macros don't require adjustment.
2024-01-29 03:31:29 +08:00
bunnie
334495aaec add target hooks to font generation (part I)
a "small" memory target is created, which maps only a subset
of fonts to memory for targets that have extremely limited amounts
of on-chip storage.

the main thing I'm not happy about with this change is that the
origin offset of the font table is hard-coded into the template,
but also, I'm not quite sure if there's a better way to do this
that doesn't make things unnecessarily complicated. The origin
offset *is* target specific, and the templates already
reference targets specifically in the config lists...so if this
were to be made more generic, the path you'd end up on is something
like parsing link.x files out of various configurations which seems
like an extreme amount of work for a constant that rarely changes.

So, it's a footgun, but one where mending the foot is several times
less effort than putting a safety on the footgun.
2024-01-28 02:11:09 +08:00
bunnie
454ecac95a fix rustfmt::skip warning
turns out, stackoverflow has out of date info. woohoo!
2024-01-14 23:12:52 +08:00
bunnie
f1e04f189c format services/graphics-server 2024-01-14 22:13:56 +08:00
bunnie
3d6ba05c95 ok...@generated is useless, let's try a different approach.
@generated "marker" needs to be a naked comment on a line by
itself. I'm not quite sure how this is meant to be used, tbh.
2024-01-14 22:01:03 +08:00
bunnie
ee6190a12a prepare for format 2024-01-14 21:51:11 +08:00
Sean Cross
409b50b85e blitstr2: regenerate files after template changes
Regenerate the font files after adjusting the template to generate files
that will not get changed by rustfmt.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-27 14:13:16 +08:00
Sean Cross
22546710df blitstr2: codegen: generate rustfmt-compatible code
Generate code that can be put through rustfmt without being altered.
This removes an issue where the font tables can be rearraged by simply
running `rustfmt` on the repository.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-12-27 14:12:26 +08:00
bunnie
dee4871f91 fix truncated "l" in some cases on wide fonts
minimum width should not be truncated to 0 during layout!
2023-07-06 16:15:49 +08:00
bunnie
ec3fc70a66 rework the font rendering engine and style macros to support Tall
this reworks the necessary routines on the font rendering engine
and within the style selection macros to support the new Tall font.
2023-07-05 13:37:41 +08:00
bunnie
aab25f2d53 add Tall font face and support for 32x32 bitmaps
Thanks to @samblenny for getting the ball rolling on this.

This commit adds a "tall" font face which is somewhere in betwee
the Regular size (12 pts) and 2x Small size (18 pts). This is
a compromise between text density and readability that has been
missing for some time from the UI.

The 32x32 glyph support is "hacked in", in that an extra flag
has been added to support this special case, rather than either
(a) making the library more generic (e.g. supporting 8x, 16x, 32x, 64x
glyphs) or (b) adding more metadata to the font libraries so that
the bitmap pattern is automatically associated with the font (right
now the parameters are set by hand in blitstr2/fonts.rs).

This is a violation of the "zero, one, many" principle in coding,
but I'm waiving that because (a) 64x glyphs don't make sense on
our system...you're not going to be creating posters and headlines
on this device (ha ha I say this today, tomorrow I will get a PR
for a poster editor app that absolutely needs 64x glyphs) and (b)
the font subsystem is, at least for now, a fairly mature and
well-tested code base so a minor futzing seems more appropriate
than ripping everything out.

The point at which things should be greatly refactored is when
we consider supporting right-to-left scripts or scripts that
require complex ligatures. But I think for now the system as
writ covers 80% of humanity's language needs acceptably
(but not perfectly).
2023-07-05 12:43:44 +08:00
bunnie
ae1adbfedd fix template to match manual patch-ups on config flags 2023-07-04 10:32:15 +08:00
bunnie
22e0e06625 check in inital artifacts, but leave the system inert
more hacking is necessary before we can really run these scripts
2023-07-04 10:29:43 +08:00
bunnie
67fc21fbdd harmonize hosted mode selection, but retain an explicit hosted flag
In general, hosted mode is assumed "by default" if the target
is not Xous. This allows packages to be built cleanly on command
lines that don't know to pass a --feature flag to specify a target.

However, an explicit "hosted" flag is still retained so that we
can confirm the build system intent. This saves us from the failure
mode that we thought we were building for target A, but accidentally
ommitted the flag, and instead we've been silently building for
"hosted" mode without any warning. The main consumer of the "hosted"
flag is now just the build.rs script inside of the utralib.
2022-10-25 17:21:02 +08:00
bunnie
4e40ae6c5d move from target selectors to feature selectors for back-ends
This will allow for e.g. xous on riscv32-imac but not a precursor
target, for example: by using feature selectors we get to have
a bigger range of targets that we support, such as for implementations
that haven't been upstreamed or have official target-triples.

The downsides are:

- patch override libraries don't absorb feature flags. so, for
example, the AES crate that is used to patch other crates won't
be aware of the target features without modifying the referencing
crates.

- features are normally meant to be additive, but target features
are mutually exclusive. The mutex is enforced by a check in
utralib that throws a panic on build if two targets are accidentally
selected at the same time.
2022-10-02 02:56:44 +08:00
bunnie
5452fae33c harmonize blitstr2 and graphics-server to an i16 pixel representation
previously blitstr2 is using usize for x/y coords, which means that
for layout purposes points could not go to the top or left boundary
without causing arithmetic overflow. Of course, you want to render
everything on-screen, but, as we have multi-line text with overflow
possibility, it's reasonable to be able to use negative coordinates
to locate text boxes that flow into the visible region.

This of course means that occassionally you can come out with
things like "negative widths", but even then, there can be reasonable
uses for this as an intermediate in calculations that ultimately
arrive at a positive result.
2022-03-28 23:17:18 +08:00
bunnie
ce12d96e16 some documentation and maintenance notes 2022-01-23 13:21:36 +08:00
bunnie
2b46f21ae8 remove dependency on blitstr v1 entirely 2022-01-23 04:08:32 +08:00
bunnie
afd525002d initial attempt to move the font resources into the loader 2022-01-23 03:23:06 +08:00
bunnie
001b07ac74 clean up password modal box 2022-01-22 01:41:55 +08:00
bunnie
9455f11ff1 incorporate 2x blitstr fonts and sizes; fix some corner cases 2022-01-21 17:28:23 +08:00
bunnie
7277b7bc1d start to refactor out the old blitstr v1 apis 2022-01-21 15:01:56 +08:00
bunnie
13b7d73ce9 word wrapping seems to work and is tested now. 2022-01-21 02:30:58 +08:00
bunnie
7961dbddee word wrapping take 2 - this time with ~~tests~~ 2022-01-21 00:34:12 +08:00
bunnie
356d95a266 yet another refactor of the word wrapping
Really clear up the roles and structures of word wrapping.

Significantly, we have now figured out that the word wrapper
should be the word wrapper, and that the text bounds should
be computed by a text bounds computation.

Conflating flexible text bounds with word wrapping makes
the math really hard.

So, the word wrapper always works with a bounding area starting
at 0,0, and will wrap until it hits a Point designated as its
absolute max bounds.

The returned typeset block is referenced to 0,0, and then it
is shifted to the correct location by the rendering function.

This externalizes the computation of the final location plus
the rendering bounds to the outer functions that need to care
about this, thus simplifying the word wrapper significantly.
2022-01-20 18:30:13 +08:00
bunnie
a46c07b4be initial attempt to integrate blitstr2
this just grafts in the new crate, while leaving the old crate
unscathed. once this is somewhat functional we'll excise the old
crate and reformat the loader for the "hard binary" image of
the fonts.
2022-01-19 03:29:53 +08:00