Fonts: - fonts/hack: Hack 3.003 (Expat + Bitstream Vera, from Debian fonts-hack), installed to dt/fonts; config/fonts.conf (the system's fontconfig plus that directory) exported by Xsession.d/0070.dtfonts and Dtlogin*environment. - sys.resources and dtlogin Xresources: Xft render tables in Hack 10 for renderTable, textRenderTable, labelRenderTable, buttonRenderTable (a render table wins over sys.font's *FontList; dtterm and text fields read the text table). dtterm (ported from MakroDE -- setlocale and the Xft renderer -- then fixed): - configure: Xft on by default, --disable-xft for machines without it. - TermPrimRenderXft.c: reads wchar_t in multibyte locales (it read the buffer as UTF-8 bytes: three boxes after every character), places every character in its cell on the baseline, fills the background, draws underline/overstrike/secure, wcwidth for wide and combining characters, borrows glyphs from fontconfig fallbacks (check mark, CJK), and makes its XftDraw at the first drawing (made in Initialize it was window 0, and the first string a BadDrawable that ended dtterm). - TermPrim.c AdjustWindowUnits: the cell from the renderer's extents when there is no XFontStruct (crashed with Xft); _DtTermPrimRenderFontExtents. - TermPrimRenderFont.c: with setlocale the buffer is wchar_t in UTF-8, the single-font renderer draws it as XChar2b (it drew boxes too). Screenshots: build/mcde-shots/dtterm-utf8b-crop.png, dtterm-classic-crop.png. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.5 KiB
C
34 lines
1.5 KiB
C
/*
|
|
* TermPrimRenderXft.h -- the Xft renderer, behind the same TermFont interface as the others.
|
|
*
|
|
* MakroDE addition. SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright 2026 Konrad Lother
|
|
*
|
|
* WHY A THIRD RENDERER RATHER THAN A BRANCH INSIDE THE FONTSET ONE. dtterm already chooses between
|
|
* TermPrimRenderFontSet (a font set) and TermPrimRenderFont (a single struct) when it builds its
|
|
* TermFont. Xft is a third kind of font with a third way of drawing, so it is a third renderer --
|
|
* everything above it is unchanged, which is the whole point of that interface existing.
|
|
*
|
|
* WHY THE DRAWABLE IS IN THE RECORD. XftDraw is bound to a Drawable and a visual; creating one per
|
|
* painted string would re-resolve the glyph cache every time. The whole performance question of Xft
|
|
* in a terminal is answered right here: ONE XftDraw per TermFont, for the life of the terminal.
|
|
*
|
|
* WHY XftDrawStringUtf8 AND NOT XftDrawString32. The render interface hands over BYTES, and
|
|
* since area 13 those bytes are UTF-8. XftDrawString32 would take FcChar32 and interpret the
|
|
* same buffer a second time -- a second reading of one buffer, not a better one. (An earlier
|
|
* draft of this comment claimed String32; the code and the measurement say otherwise.)
|
|
*/
|
|
|
|
#ifndef _Dt_TermPrimRenderXft_h
|
|
#define _Dt_TermPrimRenderXft_h
|
|
|
|
#include "TermPrim.h"
|
|
#include <X11/Xft/Xft.h>
|
|
|
|
extern TermFont _DtTermPrimRenderXftCreate(
|
|
Widget w,
|
|
XftFont *font
|
|
);
|
|
|
|
#endif /* _Dt_TermPrimRenderXft_h */
|