Commit graph

266 commits

Author SHA1 Message Date
bunnie
fdf10f369e fix default font settings
there's something....weird....going on in the initializers
here and ... something about configurations not being
applicable to expressions??

i'm a little confused, but, the original work-around I had to
this isuse somehow side-effected things in some way that I didn't
expect. this reverts those side effects.
2024-01-30 00:02:42 +08:00
bunnie
fb7fccce6b susres not yet active in cramium target, make opcode conditional 2024-01-29 03:39:11 +08:00
bunnie
d58ef8c1df improve debug output on graphics-server 2024-01-29 03:38:43 +08:00
bunnie
1c9e2e16e7 add generated fontmap file 2024-01-29 03:38:01 +08:00
bunnie
39fb11457f cjk is not in the small font set, substitute Tall for that target 2024-01-29 03:37:25 +08:00
bunnie
f06ceea5e1 bug fixes to frame buffer driver for cramium target
now works, and works pretty well.
2024-01-29 03:34:41 +08:00
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
be8c78a0db add font_map target for cramium 2024-01-28 02:17:31 +08:00
bunnie
70708671fe flesh out the SPIM driver back-end for the graphics driver 2024-01-28 02:16:28 +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
c7c384bb85 intermediate work checkin before swapping to sigchat branch 2024-01-26 22:51:13 +08:00
bunnie
13122663f3 intermediate progress, have to switch branch 2024-01-26 01:21:06 +08:00
bunnie
f23e2ee3de start fleshing out a gfx driver for the cramium target
far from complete, lots of warnings, but a good start.
most of the io setup and FB manipulation is done.

The main thing left is to puzzle through the UDMA block and
setup the SPIM accordingly.
2024-01-23 04:01:20 +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
d844c4306c reduce size of chat status bar to match status bars above 2023-10-28 22:50:23 +08:00
bunnie
8f549b3031 pick a more "happens to be aesthetic" setting for the XOR op defacing
XOR op should not be usable to create fake security boxes

but it also looks really ugly to have it defaced.

This small tweak makes the XOR function look decent for the initial
purpose of the function (chat status bar wait indicator).

Eventually, this will be a controversial decision, but I'll kick
that down the road.
2023-10-28 22:48:52 +08:00
bunnie
e2594a3000 fix visibility of default font 2023-10-20 00:39:03 +08:00
bunnie
006530a1f5 make the default style for the text box something API-level accessible
this allows other functions to lay out based on the default style
without having to guess it.
2023-10-19 22:39:06 +08:00
bunnie
64346522b3 make the vertical stripe smaller relative to the overall height
this ratio should be enough to spoil the XOR effect for any
forging application but small enough that it's not as visually distracting.
2023-10-18 15:08:05 +08:00
bunnie
50ef03e319 alternate XOR pattern for busy-bar
this it to avoid abusing the primitive to create inverted text
(for secure UI elements only). It does degrade from the aesthetics
of a busy bar but it is a computationally efficient way to patch
around the concern.
2023-10-18 14:13:25 +08:00
bunnie
2d13e7c2a7 implement an underlying graphics primitive for a busy bar animation
This is just the TextView primitive with a "state" variable added
that controls how far the strips should march across the screen.

Users can specify with or without a bounding box.

The exact location of the text within the bar depends on the
BoundingBox option picked.

The primitive computes the total region to animate based upon
the typesetting engine's output. Thus it is not recommended
to "compress" the amount of whitespace allocated to the animation,
because it can cause the animation to have artifacts due to
whitespace overflow of typesetting.
2023-10-16 14:25:47 +08:00
bunnie
9f57ad96fd
Merge pull request #408 from nworbnhoj/chat
mtxchat app and chat library
2023-09-19 19:09:56 +08:00
Sean Cross
5dfad296ae xous: mark MemoryRange::as_slice and friends as unsafe
Mark `MemoryRange::as_slice()` and `MemoryRange::as_slice_mut()` as
unsafe.

This is due to the fact that not all representable types can be cast to
an arbitrary value. For example, if Process A sends random values to
Process B, then Process B casts the memory to a slice of `bool`, then
any values that are not 0 or 1 are undefined.

Because these functions can leak UB into the program, they are marked as
unsafe.

This patch adds `unsafe {}` blocks to all instances where this function
is called. Additionally, all instances have been checked to verify that
they do not cast to any invalid types -- most use `u8` or `u32`.

Additionally, the long-deprecated `MemoryRange::from_parts()` call was
removed, since that causes UB without being marked as unsafe.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-09-12 10:07:38 +08:00
nworbnhoj
a7d3b34563 Merge branch 'main' into chat 2023-09-08 13:48:45 +10:00
nworbnhoj
6362ff9e4d capture typesetting overflow in ComposedType and pass thru to gam.post_textview() 2023-08-26 03:42:05 +10: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
17fb590d9a fix typsetter overflow check
got the axes inverted. oops.
2023-07-05 15:38:49 +08:00
bunnie
b2c64eb61a aesthetic cleanup; change default font for all modals
I decided to go back on the idea of not changing the modals
and now all modals use the new larger font as well.

This creates issue #396, which I will deal with later once
I have the time to do some more testing. I'm pretty sure
some other dialog boxes are broken now too.
2023-07-05 15:13:38 +08:00
bunnie
4454dffe4e generate loader files for the new font
also sort the font files in alphabetical order now,
instead of relying on arbitrary ordering of os.listdir() :P
2023-07-05 14:44:30 +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
Jean-Pierre De Jesus DIAZ
2af737b57e
xous-rs: move LANG variable to locales
This change is made with the intention of making the xous-rs crate a bit
more freestanding without depending on the xtask build system.

Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-06-15 18:23:12 +02:00
bunnie
5a2df4432c technical debt: cleanup UTRA package
- make the "base" field no longer public. It is accessible, but only
through an `unsafe` method, because, it is unsafe.
- add accessors to offest/mask fields. Because, it's not at all
unsafe to access these, and it can be useful for bit-ops that are
not part of the generic set of UTRA.
- add Arc to AtomicCSR, and require `std` for AtomicCSR types.
This should not break anything, I checked inside @foundation-devices
keyOS and they don't seem to be using AtomicCSR anywhere.

The Arc makes it a bit safer to clone the AtomicCSR base pointer
and share it between threads, but it will have an impact on performance.
The USB stack (which requires AtomicCSR) was regression testing and the
impact seems minimal.

Recall that the main purpose of AtomicCSR is to provide a CSR accessor
that does not require a mutable reference to the base object. This
can make certain Rust idioms a bit cleaner. We wrap the base accessor
in Arc+Atomic to try and improve the safety of throwing the borrow
checker under the bus, but it's still not perfect because hardware
mutable state can have side-effects within hardware itself that cannot
be modeled or checked by Rust's borrow checker.
2023-05-23 18:11:24 +08:00
Sean Cross
6eb6fae061 graphics-server: apply macos patch to fix build
This fixes the build of `graphics-server` on macos.
This is recommended by @bunnie in
https://github.com/betrusted-io/xous-core/issues/373#issuecomment-1526015174

Signed-off-by: Sean Cross <sean@xobs.io>
2023-04-28 00:05:28 +07:00
bunnie
9022fe6827 revert change to patch over macos 2023-04-28 00:31:48 +08:00
yvt
8504b6fc6b fix(graphics-server): convert "never" types
Fixes build failure due to a type mismatch between `Never` and `!`
in `claim_main_thread`.
2023-04-28 01:23:49 +09:00
bunnie
0522cf9c93
Merge pull request #374 from yvt/patch/fix-minifb-on-main-thread
graphics-server: Run `minifb` event loop on main thread
2023-04-28 00:05:23 +08:00
yvt
c9fd805da2 fix(graphics-server): run minifb event loop on main thread
Fixes crashes on macOS.

Some operating systems and GUI frameworks, in particular Cocoa, don't
allow creating an event loop from a thread other than the main thread
(TID 1) and will abort a program on violation.
2023-04-28 00:43:39 +09:00
bunnie
b2475e47ca provide a workaround for #373
I can't test it, but, it basically just takes the code pre #372
and provides it to macos targets.

I think the update() method is ok to just remove, but, if something
doesn't work there that would probably be the root cause.
2023-04-27 23:27:29 +08:00
yvt
e8aba2810a refactor(graphics-server): remove backend::XousDisplay::update
It's no longer necessary because the `minifb` backend now automatically
calls `minifb::Window::update_with_buffer` in a dedicated thread.
2023-04-26 00:13:58 +09:00