[roll] Roll fuchsia [carnelian] Improve text alignment features

This CL modifies the way that the text facet implements its alignment
options to better support using it to implement labels in UI features
like menus and buttons.

For those uses, it is necessary to align just the visible portions of
the text and disregard things like ascent, descent and advance width at
the end of the text.

Added a measure_text_size function, which calculates the size based on
the bounding boxes of the individual glyphs and interior advance width.
The height of text is also calculated from the maximum vertical extent
of the text.

Added a visual option to TextFacetOptions to choose between visual and
line-oriented alignment.

Added a background-color option to TextFacetOptions as it is common to
want to draw a background behind text. Also added a SetBackgroundColor
message.

TextFacet now uses the alignment options and the size passed to its
update_layers method to render the text. When using visual alignment,
it subtracts the origin of the bounding box of the render text's raster
so that white space around the text isn't included in alignment
calculations.

Modified the layout_gallery example to demonstrate the new text
alignment features.

Modified the font_metrics example to use layout work correctly with the
new alignment implementation, fixing a number of stack layout bugs
exposed in the process.

Modified Recovery UI to work correctly with the new alignment
implementation. Took out the leading zero on the countdown as it caused
subtle horizontal shifts due to the varying width of the digits. With
the visual alignment feature it looks better without the leading zero.

The Chromebook I am using for testing doesn't have function keys, so I
changed the fake volume control keys to the brackets.

Also updated Fargo.toml for development purposes.

Testing: manual, plus existing unit tests.

Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/606787
Original-Revision: fa5a089cc706f3a51954bf037a35c5623da7f1c7
GitOrigin-RevId: 25ba62e17b991cde9345e99f1ff2764a30db755c
Change-Id: I03832b7e9a305c9bb65f9a205582e222d660950c
1 file changed
tree: 584f93bb67918e3a7deaaba5e3cbc452d3219bcb
  1. infra/
  2. third_party/
  3. cts
  4. firmware
  5. flower
  6. jiri.lock
  7. minimal
  8. prebuilts
  9. README.md
  10. stem
  11. test_durations
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.