<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/box-drawing.c, branch 1.13.1</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.13.1</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.13.1'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2022-04-03T16:49:47Z</updated>
<entry>
<title>Use circles for rendering light arc box-drawing characters.</title>
<updated>2022-04-03T16:49:47Z</updated>
<author>
<name>L3MON4D3</name>
<email>Simljk@outlook.de</email>
</author>
<published>2022-03-23T10:55:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=d6dab2f2ba8c82cc9a3eb1eb40cb836a2fc2806b'/>
<id>urn:sha1:d6dab2f2ba8c82cc9a3eb1eb40cb836a2fc2806b</id>
<content type='text'>
Ellipses can look weird when the font is narrow.

Closes #988
</content>
</entry>
<entry>
<title>fcft: adapt to API changes in fcft-3.x</title>
<updated>2022-02-05T16:00:54Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-21T12:50:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e0227266cabc015c282774ac898e3f52dce943df'/>
<id>urn:sha1:e0227266cabc015c282774ac898e3f52dce943df</id>
<content type='text'>
Fcft no longer uses wchar_t, but plain uint32_t to represent
codepoints.

Since we do a fair amount of string operations in foot, it still makes
sense to use something that actually _is_ a string (or character),
rather than an array of uint32_t.

For this reason, we switch out all wchar_t usage in foot to
char32_t. We also verify, at compile-time, that char32_t used
UTF-32 (which is what fcft expects).

Unfortunately, there are no string functions for char32_t. To avoid
having to re-implement all wcs*() functions, we add a small wrapper
layer of c32*() functions.

These wrapper functions take char32_t arguments, but then simply call
the corresponding wcs*() function.

For this to work, wcs*() must _also_ be UTF-32 compatible. We can
check for the presence of the  __STDC_ISO_10646__ macro. If set,
wchar_t is at least 4 bytes and its internal representation is UTF-32.

FreeBSD does *not* define this macro, because its internal wchar_t
representation depends on the current locale. It _does_ use UTF-32
_if_ the current locale is UTF-8.

Since foot enforces UTF-8, we simply need to check if __FreeBSD__ is
defined.

Other fcft API changes:

* fcft_glyph_rasterize() -&gt; fcft_codepoint_rasterize()
* font.space_advance has been removed
* ‘tags’ have been removed from fcft_grapheme_rasterize()
* ‘fcft_log_init()’ removed
* ‘fcft_init()’ and ‘fcft_fini()’ must be explicitly called
</content>
</entry>
<entry>
<title>box-drawing: LIGHT ARC: check for sqrt() failures</title>
<updated>2022-02-04T17:15:35Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-02-03T21:17:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e97e873b9ef448aa2796667ba1d0a69ffe2e07e0'/>
<id>urn:sha1:e97e873b9ef448aa2796667ba1d0a69ffe2e07e0</id>
<content type='text'>
Closes #914
</content>
</entry>
<entry>
<title>term: only scale using DPI if *all* monitors have a scaling factor or one</title>
<updated>2021-09-24T20:07:47Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-19T09:58:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=fb77637eb96a71de48b49e40fbe7dd71ec85bcbf'/>
<id>urn:sha1:fb77637eb96a71de48b49e40fbe7dd71ec85bcbf</id>
<content type='text'>
With dpi-aware=auto (the default), scale fonts using DPI *only*
if *all* available monitors have a scaling factor of one.

The idea is this: if a user, with multiple monitors, have enabled
scaling on *at least* one monitor, he/she has most likely done so to
match the size of his/hers other monitors.

For example, if the user has one monitor with a scaling factor of one,
and another one with a scaling factor of two, he/she expects things to
be twice as large on the second monitor.

If we (foot) scale using DPI on the first monitor, and using the
scaling factor on the second monitor, foot will *not* look twice as
big on the second monitor (this was the old behavior of
dpi-aware=auto).

Part of #714
</content>
</entry>
<entry>
<title>box-drawing: repair debug logs</title>
<updated>2021-09-19T09:49:49Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-19T09:49:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=705b5d786ca369f8c9d9ea2186ac77dffec6e809'/>
<id>urn:sha1:705b5d786ca369f8c9d9ea2186ac77dffec6e809</id>
<content type='text'>
</content>
</entry>
<entry>
<title>box-drawing: braille: prefer increasing spacing over dot width</title>
<updated>2021-09-14T08:20:07Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-14T08:20:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e426e77b1d3640868b521b65617525f76ab3b35c'/>
<id>urn:sha1:e426e77b1d3640868b521b65617525f76ab3b35c</id>
<content type='text'>
Too large dots make them harder to distinguish, when the spacing
between them is small.

Prefer increasing the spacing, instead of increasing the dot
size. This looks better at small font sizes in particular.
</content>
</entry>
<entry>
<title>box-drawing: NOINLINE braille</title>
<updated>2021-09-12T17:22:14Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-05T08:05:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ac2091f107cbcca546d9f62fc81c5a519aec67dc'/>
<id>urn:sha1:ac2091f107cbcca546d9f62fc81c5a519aec67dc</id>
<content type='text'>
</content>
</entry>
<entry>
<title>box-drawing: add braille characters</title>
<updated>2021-09-12T17:22:12Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-09-02T12:55:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=b4c759e2de429c20bf07c9e16162d154152014d9'/>
<id>urn:sha1:b4c759e2de429c20bf07c9e16162d154152014d9</id>
<content type='text'>
Render braille ourselves, instead of using font glyphs. Decoding a
braille character is easy enough; there are 256 codepoints,
represented by an 8-bit integer (i.e. subtract the Unicode codepoint
offset, 0x2800, and you’re left with an integer in the range 0-255).

Each bit corresponds to a dot. The first 6 bits represent the upper 6
dots, while the two last bits represent the fourth (and last) row of
dots.

The hard part is sizing the dots and the spacing between them.

The aim is to have the spacing between the dots be the same size as
the dots themselves, and to have the margins on each side be half the
size of the dots.

In a perfectly sized cell, this means two braille characters next to
each other will be evenly spaced.

This is however almost never the case. The layout logic currently:

* Set dot size to either the width / 4, or height / 8, depending on
  which one is smallest.

* Horizontal spacing is initialized to the width / 4

* Vertical spacing is initialized to the height / 8

* Horizontal margins are initialized to the horizontal spacing / 2

* Vertical margins are initialized to the vertical spacing / 2.

Next, we calculate the number of “remaining” pixels. That is, if we
add the left margin, two dots and the spacing between, how many pixels
are left on the horizontal axis?

These pixels are distributed in the following order (we “stop” as soon
as we run out of pixels):

* If the dot size is 0 (happens for very small font sizes), increase
  it to 1.
* If the margins are 0, increase them to 1.
* If we have enough pixels (need at 2 horizontal and 4 vertical),
  increase the dot size.
* Increase spacing.
* Increase margins.

Closes #702
</content>
</entry>
<entry>
<title>pt-or-px: heed the dpi-aware setting</title>
<updated>2021-08-13T15:38:56Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-13T15:38:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=f6f8f2b35ec10eb09f2c7c5b8214b62fa87b59e5'/>
<id>urn:sha1:f6f8f2b35ec10eb09f2c7c5b8214b62fa87b59e5</id>
<content type='text'>
Before this patch, pt-or-px values, like letter-spacing, were *always*
scaled using the current DPI value.

This is wrong; if the fonts are scaled using the output’s scaling
factor, then so should all other point values.

This also fixes an issue where e.g. letter-spacing would use one DPI
value at startup, but then when increasing/decreasing or resetting the
font size, would be re-calculated using a different DPI value, leading
to completely different spacing.

This happened when there were multiple monitors, with different DPI
values, and foot guessed the initial DPI value wrong. Normally, foot
would correct itself as soon as the window was mapped, and the
“correct” DPI value known. But if the fonts were scaled using the
scaling factor, it was possible that the font reload never happened.

This patch also updates the thickness calculation (for LIGHT and HEAVY
box drawing characters) to use the scaling factor when appropriate.

Closes #680
</content>
</entry>
<entry>
<title>box-drawing: fix compiler warning</title>
<updated>2021-08-06T20:29:33Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-06T20:29:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=22b280b3558710e622c76723e7bb0ca6783807a6'/>
<id>urn:sha1:22b280b3558710e622c76723e7bb0ca6783807a6</id>
<content type='text'>
../../box-drawing.c: In function 'box_drawing':
../../box-drawing.c:2774:13: error: 'y1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 2774 |     int y0, y1;
      |             ^~
../../box-drawing.c:2774:9: error: 'y0' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 2774 |     int y0, y1;
      |         ^~
</content>
</entry>
<entry>
<title>box-drawing: re-align sextants and wedges</title>
<updated>2021-08-06T20:26:49Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-05T16:32:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=130cf791e9e841b590b8b173537089c125699744'/>
<id>urn:sha1:130cf791e9e841b590b8b173537089c125699744</id>
<content type='text'>
Improve the visual quality of sextants (and wedges) when the cell height isn’t a
multiple of three.
</content>
</entry>
<entry>
<title>box-drawing: don’t inline functions called for multiple codepoints</title>
<updated>2021-08-05T17:51:43Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-05T16:29:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6f591861937b333c09c2b6828ededeb405f305ae'/>
<id>urn:sha1:6f591861937b333c09c2b6828ededeb405f305ae</id>
<content type='text'>
In several cases, this expanded to multiple calls, and when inlined, resulted in
much larger code size.
</content>
</entry>
<entry>
<title>box-drawing: wedges: pre-load x_halfs[] and y_thirds[]</title>
<updated>2021-08-05T17:51:43Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-05T16:29:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=97e64e2cafed73fa665dfa5a5f8d20d0abff84c8'/>
<id>urn:sha1:97e64e2cafed73fa665dfa5a5f8d20d0abff84c8</id>
<content type='text'>
This reduces the number of loads in the rest of the function.
</content>
</entry>
<entry>
<title>box-drawing: wedges: avoid floating point math</title>
<updated>2021-08-05T17:51:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-05T16:27:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0e10d2b1a2320004e1609e2463e24aa1d04d845d'/>
<id>urn:sha1:0e10d2b1a2320004e1609e2463e24aa1d04d845d</id>
<content type='text'>
Re-use the pre-calculated offsets used by the sextants. This is the correct
thing to do since wedges *should* align with sextants.
</content>
</entry>
<entry>
<title>box-drawing: pre-calculate sextant x,y offsets</title>
<updated>2021-08-05T17:51:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-03T19:12:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=950c1b6010efe07a9a65116618a980179ed279a5'/>
<id>urn:sha1:950c1b6010efe07a9a65116618a980179ed279a5</id>
<content type='text'>
We’re using floating point math, as a way to ensure that sextant primitives
overlap, rather than leaving empty spaces, or being uneven, when the cell
width/height isn’t divisible with 2 (width) or 3 (height).

This gets rid of all floating point math from the sextant drawing functions.
</content>
</entry>
<entry>
<title>box-drawing: deal with quads in the same as sextants</title>
<updated>2021-08-05T17:51:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-03T18:55:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=469d5abc694e1b71310be7c7281dabd6380edfeb'/>
<id>urn:sha1:469d5abc694e1b71310be7c7281dabd6380edfeb</id>
<content type='text'>
That is, encode which “pieces” make up each quad in a static array, and use a
single function to draw all quads using the four primitives “upper left/right,
lower left/right”.
</content>
</entry>
<entry>
<title>box-drawing: don’t inline horizontal-one-eighth-block-N</title>
<updated>2021-08-05T17:51:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-03T18:54:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1dcdc42091024f9b47521a4d5133b7a58c673b4b'/>
<id>urn:sha1:1dcdc42091024f9b47521a4d5133b7a58c673b4b</id>
<content type='text'>
</content>
</entry>
<entry>
<title>box-drawing: don’t inline light diagional</title>
<updated>2021-08-05T17:51:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-03T18:53:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=67e285f16cdb1f0e85caa1c2921c022f2c9d5b03'/>
<id>urn:sha1:67e285f16cdb1f0e85caa1c2921c022f2c9d5b03</id>
<content type='text'>
</content>
</entry>
<entry>
<title>box-drawing: wedges: fix alignment of inverted wedges</title>
<updated>2021-08-05T16:25:01Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-05T16:21:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=36ecd0baede55c46d910b03273dff93a5db181ed'/>
<id>urn:sha1:36ecd0baede55c46d910b03273dff93a5db181ed</id>
<content type='text'>
We render the inverted wedges by first rendering a non-inverted triangle, and
then inverting it with PIXMAN_OP_OUT.

In cases where truncating and round():ing the triangle points have different
results, the final, inverted wedge ends up being unaligned with the
corresponding sixel(s).

This patch fixes that by handling the pre-inverted triangles
specifically. I.e. we don’t re-use the same triangle coordinates as the
corresponding non-inverted triangle.
</content>
</entry>
<entry>
<title>box-drawing: wedges: don’t group similar cases together</title>
<updated>2021-08-05T16:25:01Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-08-04T15:32:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=56d7a51d35fbb1f8c188dc1adf8730b3eb83f531'/>
<id>urn:sha1:56d7a51d35fbb1f8c188dc1adf8730b3eb83f531</id>
<content type='text'>
Since they’re not exactly alike, we still need branches within each case. Better
to split them up - one case per codepoint.
</content>
</entry>
</feed>
