fix(renderer): Small gaps when rendering emojis (#2802)
If any rendered text uses a non-integer number of pixels (often emojis), rendering of subsequent text blocks will start between pixels which results in small gaps in the background and over/underline colors caused by cairo only rendering at fractional-intensity in the beginning and end pixel. Simply rounding up text width can solve this. Fixes #2785
This commit is contained in:
parent
7838241a77
commit
d817080ee8
@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Waiting for double click interval on modules that don't have a double click action ([`#2663`](https://github.com/polybar/polybar/issues/2663), [`#2695`](https://github.com/polybar/polybar/pull/2695))
|
- Waiting for double click interval on modules that don't have a double click action ([`#2663`](https://github.com/polybar/polybar/issues/2663), [`#2695`](https://github.com/polybar/polybar/pull/2695))
|
||||||
|
- renderer: Small gaps when rendering emojis ([`#2785`](https://github.com/polybar/polybar/issues/2785), [`#2802`](https://github.com/polybar/polybar/pull/2802))
|
||||||
- config:
|
- config:
|
||||||
- Error reporting for deprecated config values ([`#2724`](https://github.com/polybar/polybar/issues/2724))
|
- Error reporting for deprecated config values ([`#2724`](https://github.com/polybar/polybar/issues/2724))
|
||||||
- Also monitor include-files for changes when --reload is set ([`#675`](https://github.com/polybar/polybar/issues/675), [`#2759`](https://github.com/polybar/polybar/pull/2759))
|
- Also monitor include-files for changes when --reload is set ([`#675`](https://github.com/polybar/polybar/issues/675), [`#2759`](https://github.com/polybar/polybar/pull/2759))
|
||||||
|
@ -196,6 +196,12 @@ namespace cairo {
|
|||||||
cairo_text_extents_t extents;
|
cairo_text_extents_t extents;
|
||||||
f->textwidth(subset, &extents);
|
f->textwidth(subset, &extents);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure we don't advance partial pixels, this can cause problems
|
||||||
|
* later when cairo renders background colors over half-pixels.
|
||||||
|
*/
|
||||||
|
extents.x_advance = std::ceil(extents.x_advance);
|
||||||
|
|
||||||
// Draw the background
|
// Draw the background
|
||||||
if (t.bg_rect.h != 0.0) {
|
if (t.bg_rect.h != 0.0) {
|
||||||
save();
|
save();
|
||||||
|
Loading…
Reference in New Issue
Block a user