mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
coretext: do not treat color diffs special for offset
This commit is contained in:
@ -258,18 +258,6 @@ pub const Face = struct {
|
|||||||
atlas.set(region, buf);
|
atlas.set(region, buf);
|
||||||
|
|
||||||
const offset_y: i32 = offset_y: {
|
const offset_y: i32 = offset_y: {
|
||||||
// For non-scalable colorized fonts, we assume they are pictographic
|
|
||||||
// and just center the glyph. So far this has only applied to emoji
|
|
||||||
// fonts. Emoji fonts don't always report a correct ascender/descender
|
|
||||||
// (mainly Apple Emoji) so we just center them. Also, since emoji font
|
|
||||||
// aren't scalable, cell_baseline is incorrect anyways.
|
|
||||||
//
|
|
||||||
// NOTE(mitchellh): I don't know if this is right, this doesn't
|
|
||||||
// _feel_ right, but it makes all my limited test cases work.
|
|
||||||
if (color.color) {
|
|
||||||
break :offset_y @intFromFloat(self.metrics.cell_height);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Our Y coordinate in 3D is (0, 0) bottom left, +y is UP.
|
// Our Y coordinate in 3D is (0, 0) bottom left, +y is UP.
|
||||||
// We need to calculate our baseline from the bottom of a cell.
|
// We need to calculate our baseline from the bottom of a cell.
|
||||||
const baseline_from_bottom = self.metrics.cell_height - self.metrics.cell_baseline;
|
const baseline_from_bottom = self.metrics.cell_height - self.metrics.cell_baseline;
|
||||||
@ -281,17 +269,17 @@ pub const Face = struct {
|
|||||||
break :offset_y @intFromFloat(@ceil(baseline_with_offset));
|
break :offset_y @intFromFloat(@ceil(baseline_with_offset));
|
||||||
};
|
};
|
||||||
|
|
||||||
log.warn("FONT FONT FONT rect={} width={} height={} render_x={} render_y={} offset_y={} ascent={} cell_height={} cell_baseline={}", .{
|
// log.warn("renderGlyph rect={} width={} height={} render_x={} render_y={} offset_y={} ascent={} cell_height={} cell_baseline={}", .{
|
||||||
rect,
|
// rect,
|
||||||
width,
|
// width,
|
||||||
height,
|
// height,
|
||||||
render_x,
|
// render_x,
|
||||||
render_y,
|
// render_y,
|
||||||
offset_y,
|
// offset_y,
|
||||||
glyph_ascent,
|
// glyph_ascent,
|
||||||
self.metrics.cell_height,
|
// self.metrics.cell_height,
|
||||||
self.metrics.cell_baseline,
|
// self.metrics.cell_baseline,
|
||||||
});
|
// });
|
||||||
|
|
||||||
return .{
|
return .{
|
||||||
.width = width,
|
.width = width,
|
||||||
|
@ -328,6 +328,14 @@ pub const Face = struct {
|
|||||||
break :offset_y glyph_metrics.bitmap_top + @as(c_int, @intFromFloat(self.metrics.cell_baseline));
|
break :offset_y glyph_metrics.bitmap_top + @as(c_int, @intFromFloat(self.metrics.cell_baseline));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// log.warn("renderGlyph width={} height={} offset_x={} offset_y={} glyph_metrics={}", .{
|
||||||
|
// tgt_w,
|
||||||
|
// tgt_h,
|
||||||
|
// glyph_metrics.bitmap_left,
|
||||||
|
// offset_y,
|
||||||
|
// glyph_metrics,
|
||||||
|
// });
|
||||||
|
|
||||||
// Store glyph metadata
|
// Store glyph metadata
|
||||||
return Glyph{
|
return Glyph{
|
||||||
.width = tgt_w,
|
.width = tgt_w,
|
||||||
|
Reference in New Issue
Block a user