diff options
| author | Lenni <[email protected]> | 2021-03-09 17:55:27 +0100 |
|---|---|---|
| committer | Lenni <[email protected]> | 2021-03-09 17:55:36 +0100 |
| commit | cee3f874a09094a7a4ed493adf80fc7976746727 (patch) | |
| tree | 4a4e54533faa3d4a1404f56a4733d5bdcd27fa23 /examples/shapes/main.go | |
| parent | cf4da220d97996f1eaa893432ee74f546ab40fde (diff) | |
load unicode font
Diffstat (limited to 'examples/shapes/main.go')
| -rw-r--r-- | examples/shapes/main.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/examples/shapes/main.go b/examples/shapes/main.go index 3f2390c..5137f0b 100644 --- a/examples/shapes/main.go +++ b/examples/shapes/main.go @@ -121,14 +121,28 @@ func main() { // Writing text needs a bit more setup -- we first have // to open the required font. - // For all available fonts, install and run xfontsel. font, err := xproto.NewFontId(X) if err != nil { fmt.Println("error creating font id:", err) return } - fontname := "-gnu-unifont-*-*-*-*-16-*-*-*-*-*-*-*" + // The font identifier that has to be passed to X for opening the font + // sets all font properties: + // publisher-family-weight-slant-width-adstyl-pxlsz-ptSz-resx-resy-spc-avgWidth-registry-encoding + // For all available fonts, install and run xfontsel. + // + // To load any available font, set all fields to an asterisk. + // To specify a font, set one or multiple fields. + // This can also be seen in xfontsel -- initially every field is set to *, + // however, the more fields are set, the fewer fonts match. + // + // Using a specific font (e.g. Gnu Unifont) can be as easy as + // "-gnu-unifont-*-*-*-*-16-*-*-*-*-*-*-*" + // + // For this example we simply want to load any font of size 14 which is capable + // of displaying Unicode characters: + fontname := "-*-*-*-*-*-*-14-*-*-*-*-*-iso10646-1" err = xproto.OpenFontChecked(X, font, uint16(len(fontname)), fontname).Check() if err != nil { fmt.Println("failed opening the font:", err) |
