| Commit message (Collapse) | Author | Age | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
Currently, architecture using soft-floats doesn't support instructions
FE_INVALID, FE_DIVBYZERO, FE_OVERFLOW and FE_UNDERFLOW and so building
on those architectures results with a build error.
As the sqrt math function should set errno to EDOM if an error occurs,
fetestexcept shouldn't be mandatory.
This commit removes the float environment error handling.
Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
|
| | |
|
| | |
|
| |
|
|
|
| |
No need to redo the calculation for every single cell we render,
every frame...
|
| |
|
|
|
|
|
|
| |
* URL jump labels
* Scrollback position indicator
* Line/box drawings characters
Closes #1430
|
| |
|
|
|
|
| |
Ellipses can look weird when the font is narrow.
Closes #988
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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() -> 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
|
| |
|
|
| |
Closes #914
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| | |
|
| |
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
| |
../../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;
| ^~
|
| |
|
|
|
| |
Improve the visual quality of sextants (and wedges) when the cell height isn’t a
multiple of three.
|
| |
|
|
|
| |
In several cases, this expanded to multiple calls, and when inlined, resulted in
much larger code size.
|
| |
|
|
| |
This reduces the number of loads in the rest of the function.
|
| |
|
|
|
| |
Re-use the pre-calculated offsets used by the sextants. This is the correct
thing to do since wedges *should* align with sextants.
|
| |
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
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”.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
Since they’re not exactly alike, we still need branches within each case. Better
to split them up - one case per codepoint.
|
| |
|
|
|
|
| |
These are the “wedges” from the Unicode 13 “Legacy Computing” symbols.
Closes #474
|
| | |
|
| | |
|
| |
|
|
|
| |
This way, the compiler doesn’t have to waste instructions on
re-ordering the parameters
|
| |
|
|
|
| |
It results in quite a lot of floating point instructions being emitted
in almost every box drawing function we have...
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
When enabled, shades are rendered as solid blocks, using a darker
variant of the current foreground color.
When disabled, shades are instead rendered in a checker box pattern,
using the foreground color unmodified.
Default is enabled.
|
| |
|
|
|
| |
This causes relevant box drawing characters (diagonals, arcs etc) to
be antialiased as well.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When drawing on an a8 buffer, apply antialiasing to LIGHT ARCs. This
is done by supersampling; draw to a 4 times bigger buffer, then
downsample, where each downsampled pixel is the average of the
corresponding 4x4 pixel from the supersampled buffer.
We also need to take supersampling into account while adjusting the row
and col when pixel aligning the arcs with the regular
horizontal/vertical lines.
The shape of the ARCs can still be improved. Still, this is a much
needed improvement over the current implementation.
Closes #279
|
| | |
|
| | |
|
| |
|
|
|
| |
For now, switching is done using a static variable. In the future,
this could be a user option.
|
| |
|
|
|
|
| |
We don’t have a method to draw the arcs using pixman yet. Work around
this by replacing the a8 buffer with an a1 buffer, and render the arcs
using our old, non-antialiased, way.
|
| |
|
|
|
| |
The DARK shade is the one most dense, and thus the one that looks
brightest.
|
| |
|
|
|
|
|
|
| |
When rendering to an a8 surface, render shades using “transparent”
pixman rectangles.
When these glyphs are composited with a color, the resulting look is
the color, but darkened.
|
| | |
|
| |
|
|
| |
Use trapezoids to rasterize the diagonal lines.
|
| |
|
|
| |
Use pixman_image_fill_rectangles() to render rectangles. Duh!
|
| |
|
|
|
|
|
|
| |
Use pixman_image_fill_rectangles() to render horizontal and vertical
lines.
Despite the name, this *is* the appropriate function to use, since our
lines *do* have a thickness, and thus *are* rectangles.
|
| |
|
|
| |
The inner corner, where the upper/left lines meet, were missing
|
| | |
|
| |
|
|
| |
Part of #471
|
| | |
|
| |
|
|
|
| |
Both are functionally equivalent here, but the former is also properly
scoped, can be naturally indented and has a less repetitive syntax.
|
| |
|
|
| |
Cell size is defined as the length of the diagonal of the cell.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
If the value is specified without a unit, then the value is assumed to
be in points, subject to DPI scaling.
The value can optionally have a ‘px’ suffix, in which case the value
is treated as a raw pixel count.
|
| |
|
|
|
| |
Box drawing characters should always cover the entire cell. No more,
no less.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
“The optimize attribute should be used for debugging purposes
only. It is not suitable in production code.”
Luckily, it seems it really isn’t needed anymore; with all the other
size optimizations that has been done since this was introduced, there
is no longer any difference with or without this pragma.
|
| | |
|
| |
|
|
|
|
| |
Mixed here refers to mixed thickness - the lines thickness doesn’t
match the thickness of an abstract, orthogonal line going through the
middle of the cell.
|
| |
|
|
|
|
|
|
|
|
|
| |
When mirroring an arc, we need to adjust the mirrored position if the
arc’s position in the cell is asymmetrical. This happens when *either*
the line is odd sized, *or* the cell is. But not when both are.
Thus, we can simply do a ‘thickness % 2 ^ width % 2’ when adjusting
the position.
Describe this in a comment.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
This greatly reduces the size of the foot binary
|
| |
|
|
| |
While this doesn’t really reduce foot’s size, it is cleaner
|
| |
|
|
|
|
|
|
|
| |
This reduces the size of the foot binary by ~4K; all the quad
macros called ceil() and floor() twice per macro, which caused many
float -> int -> float conversions in the expanded code.
By using functions instead, there’s no expansion - the conversion only
happens in one (well, four) places.
|
| |
|
|
|
|
|
|
|
| |
We were using so many function arguments that a lot of the emitted
code was just stack push and pops to pass around arguments.
Bundle the buffer data, width, height, stride, and current DPI, into a
single ‘buf’ argument. This greatly reduces the number of arguments to
all functions.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
* U+2571
* U+2572
* U+2573
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
Also combine the HORIZONTAL versions into a single draw function.
* U+2506
* U+2507
* U+250A
* U+250B
* U+254E
* U+254F
|
| |
|
|
|
|
|
|
|
| |
*U+2504
*U+2505
*U+2508
*U+2509
*U+254C
*U+254D
|
| | |
|
| | |
|
| |
|
|
| |
At least in odd-sized cells, with a thickness of 1 pixel.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
Rename the *function* {h,v}line() to _{h,v}line(), and add two new
macros: hline() and vline().
This allows us to shorten the argument list by removing the ‘buf’ and
‘stride’ arguments.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
thickness() is a static function and thus ‘const’ is not necessary.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
* U+2591
* U+2592
* U+2593
|
| |
|
|
|
| |
If the cell width/height is odd, the previous implementation would
result in uneven quads.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* U+2596
* U+2597
* U+2598
* U+2599
* U+259A
* U+259B
* U+259C
* U+259D
* U+259E
* U+259F
|
| |
|
|
|
|
| |
* U+2590
* U+2594
* U+2595
|
| |
|
|
|
| |
This is especially important for the LEFT xxx BLOCK characters, since
cells can be quite narrow, and one eighth is not a lot...
|
| | |
|
| |
|
|
|
|
|
| |
* U+257C
* U+257D
* U+257E
* U+257F
|