diff options
Diffstat (limited to 'lib/libXft')
103 files changed, 3279 insertions, 772 deletions
diff --git a/lib/libXft/ChangeLog b/lib/libXft/ChangeLog index b1581e479..641e8cc3c 100644 --- a/lib/libXft/ChangeLog +++ b/lib/libXft/ChangeLog @@ -1,3 +1,535 @@ +commit 7d3bcd3b9ae3ffbfcd4f31c8f1db2254df90bc33 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sat Sep 10 09:59:49 2022 -0400 + + libXft 2.3.6 + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 5e0ed11a43e37e50ba0937beaa40851c2d864981 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Sep 7 19:25:06 2022 -0400 + + fix gcc12 warning about malloc size + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit ab2df0af3dc7c594d44ccccfa0e7ddeeefb1e70e +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Sep 7 19:21:38 2022 -0400 + + revised fix for gcc 12 compiler warnings in xftextent.c + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 95284856783b824a714b7506762f4adce3bb17ce +Author: Adam Sampson <ats@offog.org> +Date: Wed Sep 7 00:31:10 2022 +0100 + + Fix length check in XftTextExtents*. + + Commit 06a3c0ab6520e368ac936cb1ef172f19957db0fa added length checks of + the form "if (len <= 0) return;" to various Xft functions. However, + while rendering an empty string is equivalent to doing nothing, asking + for the extents of an empty string isn't -- it still needs to fill in + the extents structure. This broke text rendering in some applications + (e.g. xpdf's Motif GUI). + + Check for len < 0 in XftTextExtents* instead. + +commit c6309d4c8fcb5f4879cc25cf81b649f5eb665413 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Sep 5 15:23:18 2022 -0400 + + libXft 2.3.5 + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 4356b583f8c23575a9ac25d49e7d224930107ef5 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sat Jul 9 12:25:28 2022 -0400 + + update copyright notice + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 1f610967afc221b296036849d0c17aea495ab50c +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sat Jul 9 12:23:57 2022 -0400 + + add a null-pointer check + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 16b87600d545b7c0e8f4b6629f553eb235f19f0c +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sat Jul 9 09:58:58 2022 -0400 + + fix new gcc warnings + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit a87be5ae94148f163a7b009df3d41a26a478d800 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sat Jul 9 09:28:29 2022 -0400 + + build-fix + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 3ca7a7c375a8c022c068e2534c5a6861e547eaef +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sat Jul 9 09:04:18 2022 -0400 + + merge changes by Christian Werner + + see note in libXft merge-request #1 at #note_1222314 + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit c53a1bc27c11e0c3cdf54e2beffd6cc220703a0b +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon May 30 20:11:14 2022 -0400 + + cleanup new compiler warnings + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 68c6a862409028d9b62ca601df02f345d60f969e +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon May 30 18:30:55 2022 -0400 + + build-fix for c89 + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 6a08279ee80dbd1a226592d7f18c862c2e4a7d3a +Author: Maxime Coste <mawww@kakoune.org> +Date: Tue Oct 22 22:46:49 2019 +1100 + + Add support for BGRA glyphs display and scaling + + Display is done using an XRender Picture, as XRender + glyphs are incompatible with BGRA rendering due to + their use of the glyph bitmap as a mask. + + Scaling is done by averaging all relevant pixel, which gives + much better result than nearest pixel sampling while staying + simple enough and not too computationally expensive. + + This enables color emoji rendering support. + + Fixes: #6 + + Signed-off-by: Maxime Coste <mawww@kakoune.org> + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 2cbb9597e0b10d87fa9fc506910f69b9199320f0 +Author: Maxime Coste <mawww@kakoune.org> +Date: Thu Jan 28 20:05:13 2021 +1100 + + Introduce a _XftCompositeText helper function + + Dispatch to XRenderCompositeText{8,16,32} based off the given width. + + Signed-off-by: Maxime Coste <mawww@kakoune.org> + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit cac2fd528dd0ba9ed2308f6dda4598993c51cf64 +Author: Maxime Coste <mawww@kakoune.org> +Date: Thu Jan 28 19:59:10 2021 +1100 + + Introduce a _XftCompositeString helper function + + Dispatch to XRenderCompositeString{8,16,32} based off the given width. + + Signed-off-by: Maxime Coste <mawww@kakoune.org> + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 10b53d1fa37615e81d1e3b6e4d2d2e25e4342c15 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Jul 5 20:13:42 2022 -0400 + + errata (cppcheck, clang --analyze, manpage credit) + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 6fc03611ed2b103b6b5a2f0c6b610087879325e4 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Jul 5 04:14:07 2022 -0400 + + document new features for glyph memory-tracking + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 36a8474813aba2be263f9de88ad9adfe85c0daf1 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Jul 4 20:08:58 2022 -0400 + + improve glyph management by relinking to unload least-recently used glyphs + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 01d44d70e9bd770ac365c88e09c5e432d2e517ad +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Jul 4 18:31:24 2022 -0400 + + when tracking glyph memory usage, unload the oldest glyph rather than randomly + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 698e205b657f9192df07962e7823a2eae80e1c17 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Jul 4 18:10:32 2022 -0400 + + cppcheck/gcc-stricter warnings about printf-formats and operator precedence + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 949295d665b030eb451fa590940293ada84c9bfe +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Jul 4 15:30:24 2022 -0400 + + fix delinkage of last glyph in font, improve debug-trace + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 058d7237068b2a698098c68c171bbbfd04a51b48 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Jul 4 07:56:46 2022 -0400 + + add asserts (to help with debugging), update copyright notices + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 318c6984baba0ea02147dc72a97e331234b6baf7 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Jul 4 07:41:12 2022 -0400 + + refactor _XftFontUncacheGlyph, separate the two types of loop for readability + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 33c1e1e3a5c08b690e145cc193d52fc13869af7b +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun Jul 3 20:53:23 2022 -0400 + + validate linked-list updates with _XftValidateGlyphUsage + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 114db90eac2c0f32f6b662d916a5af6a8990bf36 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Jul 1 04:25:10 2022 -0400 + + add option for tracking glyph memory-usage on a linked list + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 442bbb084a1316aa6b25b29e17889bc71c1e4235 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Jun 27 03:54:58 2022 -0400 + + add "trackmemusage" property to use in improved _XftFontUncacheGlyph + + The linear search used for randomly selecting a glyph to discard is + inefficient. This commit provides for a doubly-linked list which + could be maintained by the library to quickly discard the least + recently used glyph. + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit d4a554c9795b109085ec31eedacba6532c18d802 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Jun 24 20:26:31 2022 -0400 + + reduce clutter with macros for allocating arrays + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 42c6616499e6ca193a0b764576a6ed8650dd3d7b +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Jun 21 20:29:05 2022 -0400 + + add debugging trace for XftDefaultSet() + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 908a5e43bc37ea3b80985683369a27b4e607aecf +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Jun 13 15:59:12 2022 -0400 + + add section of functions managing XftColor + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 5f809521ad2d1080710670602619582de8fd6b0c +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sat Jun 11 10:55:40 2022 -0400 + + add a section on the XFT_DEBUG environment variable + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 5a1768ac1071bd05a731d9e744dbf8bb20ccf2b0 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sat Jun 11 10:24:26 2022 -0400 + + add a table of the "families" of functions + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 936bbafb612c5fb2ac838e94fb4e9a92da1d600c +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sat Jun 11 09:50:28 2022 -0400 + + document XftGlyphFontSpecRender() and related functions. + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit c76339229144ab6342315a27ee67a7ade1f43464 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Jun 10 10:08:10 2022 -0400 + + reduce clutter for external data-types by documenting them one time + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 58b1fed139c6dfd1a20a8b6090181f43aaffcc59 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Jun 10 09:27:36 2022 -0400 + + document the clipping-functions + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 73e1c4dc886079e87b0aaa6e3b6fa468b9ba2af2 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Jun 8 20:11:25 2022 -0400 + + add section on manipulating font data + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 5ac7ca85151515f5f03f5c0389f96f202e9cd6bb +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Jun 8 04:27:48 2022 -0400 + + add section on manipulating font patterns + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 57892d1b735dcb5e019790b271df79d7a4b89e61 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Jun 8 04:01:50 2022 -0400 + + remove remaining internal prototypes for obsolete xftcompat.c + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 81944f3796dc1cc1a9529233cec3f3b2c2d546b3 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Jun 8 03:52:47 2022 -0400 + + move prototype for XftNameUnparse to Xft.h + + This entrypoint has "always" been exported, but not declared publicly. + It is used for debugging in xterm. + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 5b191b7db9e6a785ed566c82419b11540c240423 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Jun 7 18:45:55 2022 -0400 + + document XftFontOpenXlfd and XftXlfdParse + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit b22b2b73ed1c9ed216b98ec33c3258030a34d0d2 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Tue Jun 7 04:18:48 2022 -0400 + + add overview for text-extents section + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit c3fc93be50d2f7e5c197afd47928d9338fca1618 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Jun 6 20:18:07 2022 -0400 + + change data-types to subsections to help with readability + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 04d5b339f42d90f51b9294552558fae181bc48d8 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon Jun 6 04:14:55 2022 -0400 + + consistently bold "Xft" + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 18c74d39dd202e385d57415007ba6e803ac6f89a +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun Jun 5 20:28:07 2022 -0400 + + initial draft of initialization-functions documentation + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 48eb5a7cb0a7aaacfcb77eba035c5c47d082ab88 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun Jun 5 12:25:38 2022 -0400 + + amend rule for creating manpage aliases + + eliminate too-specific gzip step, rely upon packaging system to do this. + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 765e2d2154946a6a9422c0470d6e57fbaf64182b +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sat Jun 4 06:15:39 2022 -0400 + + cleanup manpage comments + + cleanup comments used as reminders to mention functions, + leaving comments used as reminders to add new paragraphs. + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 48d2353317db2b16b68633c88d5ecd4a583b234e +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Jun 2 20:35:28 2022 -0400 + + install man-aliases for all of the exported symbols + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 724978961ff3b6e4f5043be07160487bc681fda1 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Jun 2 18:37:09 2022 -0400 + + corrected prototypes in manpage, matching Xft.h + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 4591cdd1c0f0c8afb8eac9cc908aa7c7d141dc6d +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Jun 2 18:28:07 2022 -0400 + + reuse macros from Xcursor.man to fix ragged layout of typedefs and prototypes + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 06a3c0ab6520e368ac936cb1ef172f19957db0fa +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon May 30 15:15:11 2022 -0400 + + fix warnings by gcc 11; check if length <= zero + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 4342ea4b4b87790004f6883a0d5b36fdff7c0443 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon May 30 10:39:39 2022 -0400 + + formatting fix, for clarity (no object change) + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit b4ed18f1dc398ea39d9f76da556306fe02f26c97 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon May 30 09:23:37 2022 -0400 + + quiet compiler warning with cast + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit f2583758d3e5c65f372387d1c67433856682c3fb +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Mon May 30 09:21:28 2022 -0400 + + quiet compiler warning with cast + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit c3ad9cf5b11772fbc9ff4dd793f0a7e897b5df5a +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun May 29 20:37:26 2022 -0400 + + change the internal memory-allocator to use size_t + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit a9ce40d7f51dd20533d25e2a252afb1d09194d3f +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun May 29 19:44:16 2022 -0400 + + quiet warnings with casts + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 4edfca0cb839e51bca29f5c382c311c08db49b33 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun May 29 18:26:13 2022 -0400 + + promote font->num_glyphs to FT_UInt or Glyph to fix warnings + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit ef896b2106fa171707a4087be506259f578ff3a5 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun May 29 18:05:10 2022 -0400 + + fix missing-initializer warning + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 768f43c04b5587d3b49ccd2d2f0133630c6a093b +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun May 29 17:51:07 2022 -0400 + + cleanup warnings about discarding const + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 4dadf0ed93624a09b4a2f7403b79103b50681391 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun May 29 17:40:25 2022 -0400 + + quiet unused-parameter warnings with _X_UNUSED + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit bafdc86cf32af60448db28ed03aa8230e7a14019 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Fri Jun 3 11:32:55 2022 -0700 + + gitlab CI: add a basic build test + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 6cf073c11705cf576c3b7618a32ae121eaf14579 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Fri Jun 3 11:24:18 2022 -0700 + + Fix spelling/wording issues + + Found by using: + codespell --builtin clear,rare,usage,informal,code,names + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 0dd423a89305e040ed20a8f449203ef091507790 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Fri Jun 3 11:22:22 2022 -0700 + + Build xz tarballs instead of bzip2 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + commit 98b121f22c3477b508dd17aa5db99f2ebf36ade4 Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Sun Aug 1 17:49:42 2021 -0700 @@ -888,7 +1420,7 @@ Date: Fri Jul 29 21:22:51 2005 +0000 - Update modular Xorg version commit 0dd89a9e7ba09ed0c3f90a415b506a4ed89b91bb -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Wed Jul 27 21:48:38 2005 +0000 Build system for Xft @@ -927,14 +1459,14 @@ Date: Tue May 17 08:10:10 2005 +0000 which however is not visible outside the DDX) (Bugzilla #3268). commit 0161d08ecd543c80e5625bf63d0091dbccd95f4e -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Fri Aug 13 19:03:15 2004 +0000 Fri Aug 13 21:01:34 2004 Soeren Sandmann <sandmann@daimi.au.dk> Fix the build commit 0641e99b21eead5aaee0c1136dd2d640028f6783 -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Fri Aug 13 18:24:06 2004 +0000 Fri Aug 13 19:53:10 2004 Soeren Sandmann <sandmann@redhat.com> diff --git a/lib/libXft/Makefile.in b/lib/libXft/Makefile.in index ae090fe49..3e1c3530a 100644 --- a/lib/libXft/Makefile.in +++ b/lib/libXft/Makefile.in @@ -187,9 +187,9 @@ am__relativize = \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" -DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.xz GZIP_ENV = --best -DIST_TARGETS = dist-bzip2 dist-gzip +DIST_TARGETS = dist-xz dist-gzip distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -644,6 +644,7 @@ distdir: $(DISTFILES) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) + dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) @@ -651,7 +652,6 @@ dist-bzip2: distdir dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) - dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) diff --git a/lib/libXft/NEWS b/lib/libXft/NEWS index 54ef96bd8..3dded132b 100644 --- a/lib/libXft/NEWS +++ b/lib/libXft/NEWS @@ -1,12 +1,22 @@ Xft X FreeType library - Version 2.3.4 - 2021-08-01 + Version 2.3.6 + 2022-09-10 Xft version 2.1 was the first stand alone release of Xft, a library that connects X applications with the FreeType font rasterization library. Xft uses fontconfig to locate fonts so it has no configuration files. +Version 2.3.6 + +Fixes a regression in 2.3.5 for XftTextExtents* length-checks. + +Version 2.3.5 + +Add support for BGRA glyphs display and scaling +Add "trackmemusage" property to use in improved _XftFontUncacheGlyph +Revised/completed manual page; all functions are documented. + Version 2.3.4 Handle deprecation of FcNameRegisterObjectTypes API by fontconfig. diff --git a/lib/libXft/README.md b/lib/libXft/README.md index 26edef1e9..08470d9b3 100644 --- a/lib/libXft/README.md +++ b/lib/libXft/README.md @@ -18,7 +18,7 @@ Xorg mailing list: https://lists.x.org/mailman/listinfo/xorg -The master development code repository can be found at: +The primary development code repository can be found at: https://gitlab.freedesktop.org/xorg/lib/libXft diff --git a/lib/libXft/compile b/lib/libXft/compile index df363c8fb..99e50524b 100644 --- a/lib/libXft/compile +++ b/lib/libXft/compile @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2021 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey <tromey@cygnus.com>. # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN* | MSYS*) + CYGWIN*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/* | msys/*) + cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) diff --git a/lib/libXft/configure b/lib/libXft/configure index bf0a7069d..eb1201e23 100644 --- a/lib/libXft/configure +++ b/lib/libXft/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libXft 2.3.4. +# Generated by GNU Autoconf 2.69 for libXft 2.3.5. # # Report bugs to <https://gitlab.freedesktop.org/xorg/lib/libXft/issues>. # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libXft' PACKAGE_TARNAME='libXft' -PACKAGE_VERSION='2.3.4' -PACKAGE_STRING='libXft 2.3.4' +PACKAGE_VERSION='2.3.5' +PACKAGE_STRING='libXft 2.3.5' PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/lib/libXft/issues' PACKAGE_URL='' @@ -1366,7 +1366,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libXft 2.3.4 to adapt to many kinds of systems. +\`configure' configures libXft 2.3.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1437,7 +1437,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libXft 2.3.4:";; + short | recursive ) echo "Configuration of libXft 2.3.5:";; esac cat <<\_ACEOF @@ -1568,7 +1568,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libXft configure 2.3.4 +libXft configure 2.3.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1892,7 +1892,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libXft $as_me 2.3.4, which was +It was created by libXft $as_me 2.3.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2721,7 +2721,7 @@ fi # Define the identity of the package. PACKAGE='libXft' - VERSION='2.3.4' + VERSION='2.3.5' cat >>confdefs.h <<_ACEOF @@ -18436,7 +18436,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libXft $as_me 2.3.4, which was +This file was extended by libXft $as_me 2.3.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18502,7 +18502,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libXft config.status 2.3.4 +libXft config.status 2.3.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/lib/libXft/configure.ac b/lib/libXft/configure.ac index 8bfe3d7c7..016cb88ec 100644 --- a/lib/libXft/configure.ac +++ b/lib/libXft/configure.ac @@ -27,13 +27,13 @@ AC_PREREQ([2.60]) # version. This version number will be substituted into Xft.h # Please bump the minor library number at each release as well. # -AC_INIT([libXft], [2.3.4], +AC_INIT([libXft], [2.3.6], [https://gitlab.freedesktop.org/xorg/lib/libXft/issues], [libXft]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) # Initialize Automake -AM_INIT_AUTOMAKE([foreign dist-bzip2]) +AM_INIT_AUTOMAKE([foreign dist-xz]) # Initialize libtool AC_PROG_LIBTOOL diff --git a/lib/libXft/include/X11/Xft/Xft.h.in b/lib/libXft/include/X11/Xft/Xft.h.in index 9b3b475c6..df0c2c055 100644 --- a/lib/libXft/include/X11/Xft/Xft.h.in +++ b/lib/libXft/include/X11/Xft/Xft.h.in @@ -1,23 +1,24 @@ /* + * Copyright © 2022 Thomas E. Dickey * Copyright © 2000 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the above copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The above copyright holders make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. + * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _XFT_H_ @@ -55,6 +56,7 @@ #define XFT_XLFD "xlfd" #define XFT_MAX_GLYPH_MEMORY "maxglyphmemory" #define XFT_MAX_UNREF_FONTS "maxunreffonts" +#define XFT_TRACK_MEM_USAGE "trackmemusage" extern FT_Library _XftFTlibrary; @@ -434,6 +436,9 @@ XftListFonts (Display *dpy, FcPattern *XftNameParse (_Xconst char *name); +FcBool +XftNameUnparse (FcPattern *pat, char *dest, int len); + /* xftrender.c */ void XftGlyphRender (Display *dpy, diff --git a/lib/libXft/man/Makefile.am b/lib/libXft/man/Makefile.am index 24e78d819..c5c90d43f 100644 --- a/lib/libXft/man/Makefile.am +++ b/lib/libXft/man/Makefile.am @@ -1,11 +1,101 @@ -libman_PRE = Xft.man libmandir = $(LIB_MAN_DIR) + +libman_PRE = \ + Xft.man \ + $(Xft_sources) + +Xft_sources = \ + $(Xft_shadows:=.man) + +Xft_shadows = \ + XftCharExists \ + XftCharFontSpecRender \ + XftCharIndex \ + XftCharSpecRender \ + XftColorAllocName \ + XftColorAllocValue \ + XftColorFree \ + XftDefaultHasRender \ + XftDefaultSet \ + XftDefaultSubstitute \ + XftDrawChange \ + XftDrawCharFontSpec \ + XftDrawCharSpec \ + XftDrawColormap \ + XftDrawCreate \ + XftDrawCreateAlpha \ + XftDrawCreateBitmap \ + XftDrawDestroy \ + XftDrawDisplay \ + XftDrawDrawable \ + XftDrawGlyphFontSpec \ + XftDrawGlyphSpec \ + XftDrawGlyphs \ + XftDrawPicture \ + XftDrawRect \ + XftDrawSetClip \ + XftDrawSetClipRectangles \ + XftDrawSetSubwindowMode \ + XftDrawSrcPicture \ + XftDrawString16 \ + XftDrawString32 \ + XftDrawString8 \ + XftDrawStringUtf16 \ + XftDrawStringUtf8 \ + XftDrawVisual \ + XftFontCheckGlyph \ + XftFontClose \ + XftFontCopy \ + XftFontInfoCreate \ + XftFontInfoDestroy \ + XftFontInfoEqual \ + XftFontInfoHash \ + XftFontLoadGlyphs \ + XftFontMatch \ + XftFontOpen \ + XftFontOpenInfo \ + XftFontOpenName \ + XftFontOpenPattern \ + XftFontOpenXlfd \ + XftFontUnloadGlyphs \ + XftGetVersion \ + XftGlyphExtents \ + XftGlyphFontSpecRender \ + XftGlyphRender \ + XftGlyphSpecRender \ + XftInit \ + XftInitFtLibrary \ + XftListFonts \ + XftLockFace \ + XftNameParse \ + XftNameUnparse \ + XftTextExtents16 \ + XftTextExtents32 \ + XftTextExtents8 \ + XftTextExtentsUtf16 \ + XftTextExtentsUtf8 \ + XftTextRender16 \ + XftTextRender16BE \ + XftTextRender16LE \ + XftTextRender32 \ + XftTextRender32BE \ + XftTextRender32LE \ + XftTextRender8 \ + XftTextRenderUtf16 \ + XftTextRenderUtf8 \ + XftUnlockFace \ + XftXlfdParse + libman_DATA = $(libman_PRE:man=$(LIB_MAN_SUFFIX)) EXTRA_DIST = $(libman_PRE) -CLEANFILES = $(libman_DATA) +CLEANFILES = $(libman_DATA) $(Xft_sources) + SUFFIXES = .$(LIB_MAN_SUFFIX) .man +$(Xft_sources) : + $(AM_V_GEN)echo ".so man__libmansuffix__/Xft.__libmansuffix__" > $@ + # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(LIB_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ diff --git a/lib/libXft/man/Makefile.in b/lib/libXft/man/Makefile.in index 262e36006..02bbc70fe 100644 --- a/lib/libXft/man/Makefile.in +++ b/lib/libXft/man/Makefile.in @@ -255,11 +255,96 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -libman_PRE = Xft.man libmandir = $(LIB_MAN_DIR) +libman_PRE = \ + Xft.man \ + $(Xft_sources) + +Xft_sources = \ + $(Xft_shadows:=.man) + +Xft_shadows = \ + XftCharExists \ + XftCharFontSpecRender \ + XftCharIndex \ + XftCharSpecRender \ + XftColorAllocName \ + XftColorAllocValue \ + XftColorFree \ + XftDefaultHasRender \ + XftDefaultSet \ + XftDefaultSubstitute \ + XftDrawChange \ + XftDrawCharFontSpec \ + XftDrawCharSpec \ + XftDrawColormap \ + XftDrawCreate \ + XftDrawCreateAlpha \ + XftDrawCreateBitmap \ + XftDrawDestroy \ + XftDrawDisplay \ + XftDrawDrawable \ + XftDrawGlyphFontSpec \ + XftDrawGlyphSpec \ + XftDrawGlyphs \ + XftDrawPicture \ + XftDrawRect \ + XftDrawSetClip \ + XftDrawSetClipRectangles \ + XftDrawSetSubwindowMode \ + XftDrawSrcPicture \ + XftDrawString16 \ + XftDrawString32 \ + XftDrawString8 \ + XftDrawStringUtf16 \ + XftDrawStringUtf8 \ + XftDrawVisual \ + XftFontCheckGlyph \ + XftFontClose \ + XftFontCopy \ + XftFontInfoCreate \ + XftFontInfoDestroy \ + XftFontInfoEqual \ + XftFontInfoHash \ + XftFontLoadGlyphs \ + XftFontMatch \ + XftFontOpen \ + XftFontOpenInfo \ + XftFontOpenName \ + XftFontOpenPattern \ + XftFontOpenXlfd \ + XftFontUnloadGlyphs \ + XftGetVersion \ + XftGlyphExtents \ + XftGlyphFontSpecRender \ + XftGlyphRender \ + XftGlyphSpecRender \ + XftInit \ + XftInitFtLibrary \ + XftListFonts \ + XftLockFace \ + XftNameParse \ + XftNameUnparse \ + XftTextExtents16 \ + XftTextExtents32 \ + XftTextExtents8 \ + XftTextExtentsUtf16 \ + XftTextExtentsUtf8 \ + XftTextRender16 \ + XftTextRender16BE \ + XftTextRender16LE \ + XftTextRender32 \ + XftTextRender32BE \ + XftTextRender32LE \ + XftTextRender8 \ + XftTextRenderUtf16 \ + XftTextRenderUtf8 \ + XftUnlockFace \ + XftXlfdParse + libman_DATA = $(libman_PRE:man=$(LIB_MAN_SUFFIX)) EXTRA_DIST = $(libman_PRE) -CLEANFILES = $(libman_DATA) +CLEANFILES = $(libman_DATA) $(Xft_sources) SUFFIXES = .$(LIB_MAN_SUFFIX) .man all: all-am @@ -480,6 +565,9 @@ uninstall-am: uninstall-libmanDATA uninstall uninstall-am uninstall-libmanDATA +$(Xft_sources) : + $(AM_V_GEN)echo ".so man__libmansuffix__/Xft.__libmansuffix__" > $@ + # String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure .man.$(LIB_MAN_SUFFIX): $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ diff --git a/lib/libXft/man/Xft.man b/lib/libXft/man/Xft.man index 205d2c388..879fe24b5 100644 --- a/lib/libXft/man/Xft.man +++ b/lib/libXft/man/Xft.man @@ -1,31 +1,87 @@ -.\" +'\" t +.\" Copyright © 2022 Thomas E. Dickey .\" Copyright © 2000 Keith Packard .\" .\" Permission to use, copy, modify, distribute, and sell this software and its .\" documentation for any purpose is hereby granted without fee, provided that .\" the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting -.\" documentation, and that the name of Keith Packard not be used in -.\" advertising or publicity pertaining to distribution of the software without -.\" specific, written prior permission. Keith Packard makes no -.\" representations about the suitability of this software for any purpose. It -.\" is provided "as is" without express or implied warranty. +.\" documentation, and that the name of the above copyright holders not be used +.\" in advertising or publicity pertaining to distribution of the software +.\" without specific, written prior permission. The above copyright holders +.\" make no representations about the suitability of this software for any +.\" purpose. It is provided "as is" without express or implied warranty. .\" -.\" KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -.\" EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR -.\" CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -.\" DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +.\" THE ABOVE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +.\" SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, +.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, +.\" INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +.\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.TH Xft __libmansuffix__ __vendorversion__ +.de TA +.ie n .ta 0.8i 1.6i 2.4i 3.2i +.el .ta 0.5i 1.0i 1.5i 2.0i +.. +.de PS +.sp +.ns +.TP \\$1 +.na +.nf +.ie n .ta 0.8i 3.0i +.el .ta 0.5i 2.0i +.. +.de PE +.br +.ad +.fi +.sp +.TA +.. +.de QS +.in +.2i +.nf +.na +.ie n .ta 1.0i 3.0i +.el .ta 0.6i 2.0i +.. +.de QC +.QS +.ie n .ta 2.0i 3.0i +.el .ta 1.6i 2.6i +.ft CR +.. +.de QE +.in -.2i +.ft +.fi +.ad +.TA +.. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. +.ie \n(.g .ds `` \(lq +.el .ds `` `` +.ie \n(.g .ds '' \(rq +.el .ds '' '' +.TH Xft __libmansuffix__ __vendorversion__ "X Version 11" .SH NAME - Xft \- X FreeType interface library +Xft \- X FreeType interface library .SH DESCRIPTION .B Xft -is a simple library designed to interface the FreeType rasterizer with the X -Rendering Extension. +is a simple library which draws text and graphics: +.bP +using information provided by the Fontconfig library, +.bP +.B Xft +converts font glyphs using the FreeType rasterizer, and +.bP +displays the converted font data using the X Rendering Extension. +.PP This manual page barely scratches the surface of this library. .SH "HEADER FILE" .B #include <X11/Xft/Xft.h> @@ -58,7 +114,7 @@ is an alias for The following example illustrates how .BR Xft 's version constants might be used: -.nf +.QS #if (XFT_VERSION >= 20107) (void) puts("Version 2.1.7 or later of the Xft library is in" " use."); @@ -68,41 +124,125 @@ version constants might be used: XFT_MINOR, XFT_REVISION); #endif -.fi +.QE .\" I don't understand what these are for. -- BR, 2005-04-02 -.\" XFT_CORE used in xftname.c -.\" XFT_RENDER used in xftdpy.c, xftfreetype.c, xftname.c -.\" XFT_XLFD used in xftname.c, xftxlfd.c -.\" XFT_MAX_GLYPH_MEMORY used in xftdpy.c, xftfreetype.c -.\" XFT_MAX_UNREF_FONTS used in xftdpy.c .\" XFT_NMISSING used in xftcore.c, xftextent.c, xftglyphs.c, .\" xftrender.c .SH "DATA TYPES" -.TP -.B XftFont -.nf +Xft datatypes follow a naming convention, +prefixing all names with \*(``Xft\*('' +.SS From Xlib... +Xlib datatypes do not follow a naming convention. +They are documented in +.IR "Xlib \- C Language Interface" . +.PP +.B Xft +uses these names: +Bool, +Colormap, +Display, +Drawable, +Pixmap, +Region, +Visual, and +XRectangle. +.PP +Some datatypes are especially relevant to +.BR Xft : +.TP 5 +.B Drawable +Declared in \fI<X11/X.h>\fP, +this is an X resource ID, +e.g., a window associated with a display. +Both windows and pixmaps can be used as sources and destinations +in graphics operations. +These windows and pixmaps are collectively known as drawables. +However, an +.B InputOnly +window cannot be used as a source or destination in a +graphics operation. +.TP 5 +.B Region +Declared in \fI<X11/Xutil.h>\fP and \fI<X11/Xregion.h>\fP, +a +.B Region +is an arbitrary set of pixel locations which Xlib can manipulate. +Internally, a +.B Region +is represented by the union of an arbitrary number of rectangles. +Xlib maintains a rectangle which tells it the extent of this union. +.TP 5 +.B Visual +Declared in \fI<X11/Xutil.h>\fP, +this structure contains information about the possible color mapping. +.SS From XRender... +The X Render Extension library +datatypes are inspired by Xlib, +but lack the corresponding documentation. +Refer to the header file for details: +.RS +.PP +.I <X11/extensions/Xrender.h> +.RE +.PP +or read the source code (which provides an outline of libXrender). +.PP +.B Xft +uses these names: +Picture, +XGlyphInfo, +XRenderColor. +.SS From Fontconfig... +Fontconfig datatypes follow a naming convention, +prefixing all names with \*(``Fc\*('' which are documented in +.IR "Fontconfig Developers Reference" . +.PP +.B Xft +uses these Fontconfig names: +FcBool, +FcChar8, +FcChar16, +FcChar32, +FcCharSet, +FcEndian, +FcFontSet, +FcPattern, and +FcResult. +.SS From FreeType 2... +FreeType 2 datatypes follow a naming convention, +prefixing all names with \*(``FT_\*('' which are documented in +.IR "FreeType API Reference" . +.PP +.B Xft +uses these names: +FT_Face, +FT_Library, and +FT_UInt. +.PP +FreeType 2 uses +.B FT_UInt +(an unsigned integer) +to represent +.IR glyphs . +.SS XftFont +.QS typedef struct _XftFont { - int ascent; - int descent; - int height; - int max_advance_width; - FcCharSet *charset; - FcPattern *pattern; + int ascent; + int descent; + int height; + int max_advance_width; + FcCharSet *charset; + FcPattern *pattern; } XftFont; -.fi +.QE +.PP An .B XftFont is the primary data structure of interest to programmers using .BR Xft ; it contains general font metrics and pointers to the Fontconfig character set and pattern associated with the font. -The -.B FcCharSet -and -.B FcPattern -data types are defined by the Fontconfig library. -.TP -.B "" +.PP .BR XftFont s are populated with any of .BR XftFontOpen (), @@ -124,8 +264,7 @@ are internally allocated, reference-counted, and freed by .BR Xft ; the programmer does not ordinarily need to allocate or free storage for them. -.TP -.B "" +.PP .BR XftDrawGlyphs (), the .BR XftDrawString *() @@ -139,15 +278,13 @@ to render text to an .B XftDraw object, which may correspond to either a core X drawable or an X Rendering Extension drawable. -.TP -.B "" +.PP .BR XftGlyphExtents () and the .BR XftTextExtents *() family are used to determine the extents (maximum dimensions) of an .BR XftFont . -.TP -.B "" +.PP An .BR XftFont 's glyph or character coverage can be determined with @@ -158,8 +295,7 @@ or returns the .BR XftFont -specific character index corresponding to a given Unicode codepoint. -.TP -.B "" +.PP .BR XftGlyphRender (), .BR XftGlyphSpecRender (), .BR XftCharSpecRender (), @@ -170,6 +306,7 @@ family use to draw into X Rendering Extension .B Picture structures. +.PP .B Note: .BR XftDrawGlyphs (), the @@ -180,11 +317,7 @@ and .BR XftDrawGlyphSpec () provide a means of rendering fonts that is independent of the availability of the X Rendering Extension on the X server. -.\" I'm not sure what these are for; they're used internally, but why -.\" would any external users want them? -- BR, 2005-04-02 -.\" .BR XftLockFace() -.\" .BR XftUnlockFace() -.TP +.SS .B XftFontInfo is an opaque object that stores information about a font. .B XftFontInfo @@ -199,8 +332,7 @@ objects are internally allocated and freed by .BR Xft ; the programmer does not ordinarily need to allocate or free storage for them. -.TP -.B "" +.PP Each .B XftFontInfo structure in use is associated with a unique identifier, which can be @@ -212,23 +344,20 @@ can be opened based on .B XftFontInfo data with .BR XftFontOpenInfo (). -.TP +.SS .B XftColor -.nf +.QS typedef struct _XftColor { - unsigned long pixel; - XRenderColor color; + unsigned long pixel; + XRenderColor color; } XftColor; -.fi +.QE +.PP An .B XftColor object permits text and other items to be rendered in a particular color (or the closest approximation offered by the X visual in use). -The -.B XRenderColor -data type is defined by the X Render Extension library. -.TP -.B "" +.PP .BR XftColorAllocName () and .BR XftColorAllocValue () @@ -238,9 +367,8 @@ initialize the members of .BR XftColorFree () instructs the X server to free the color currently allocated for an .BR XftColor . -.TP -.B "" -One an +.PP +Once an .B XftColor has been initialized, .BR XftDrawSrcPicture (), @@ -255,12 +383,11 @@ family, and .BR XftDrawRect () may be used to draw various objects using it. -.TP +.SS .B XftDraw is an opaque object which holds information used to render to an X drawable using either the core protocol or the X Rendering extension. -.TP -.B "" +.PP .B XftDraw objects are created with any of .BR XftDrawCreate () @@ -276,20 +403,19 @@ The X drawable associated with an .B XftDraw can be changed with .BR XftDrawChange (). -.BR XftDraw s -are internally allocated and freed by +.B XftDraw +objects are internally allocated and freed by .BR Xft ; the programmer does not ordinarily need to allocate or free storage for them. -.TP -.B "" +.PP The X .BR Display , .BR Drawable , .BR Colormap , and .B Visual -of an +properties of an .B XftDraw can be queried with .BR XftDrawDisplay (), @@ -298,97 +424,296 @@ can be queried with and .BR XftDrawVisual (), respectively. +.PP +Several functions use +.B XftDraw +objects: +.BR XftDrawCharFontSpec (), +.BR XftDrawCharSpec (), +.BR XftDrawGlyphFontSpec (), +.BR XftDrawGlyphSpec (), +.BR XftDrawGlyphs (), +.BR XftDrawRect (), +.BR XftDrawSetClip (), +.BR XftDrawSetClipRectangles (), +.BR XftDrawSetSubwindowMode (), +and the +.BR XftDrawString *() +family. +.PP The X Rendering Extension .B Picture associated with an .B XftDraw is returned by -.BR XftDrawPicture (). -.\" XftDrawSrcPicture -.\" XftDrawGlyphs -.\" XftDrawString* -.\" XftDrawCharSpec -.\" XftDrawCharFontSpec -.\" XftDrawGlyphSpec -.\" XftDrawGlyphFontSpec -.\" XftDrawRect -.\" XftDrawSetClip -.\" XftDrawSetClipRectangles -.\" XftDrawSetSubwindowMode -.TP +.BR XftDrawPicture (), +and +.BR XftDrawSrcPicture (). +It is used by +.BR XftCharFontSpecRender (), +.BR XftCharSpecRender (), +.BR XftGlyphFontSpecRender (), +.BR XftGlyphRender (), +.BR XftGlyphSpecRender (), +and the +.BR XftTextRender *() +family. +.SS .B XftCharSpec -.nf +.QS typedef struct _XftCharSpec { - FcChar32 ucs4; - short x; - short y; + FcChar32 ucs4; + short x; + short y; } XftCharSpec; -.fi -.TP -.B "" -The -.B FcChar32 -data type is defined by the Fontconfig library. -.\" XftDrawCharSpec -.\" XftCharSpecRender -.TP +.QE +.PP +.B XftCharSpec +is used by +.BR XftDrawCharSpec (), +and +.BR XftCharSpecRender (). +.SS .B XftCharFontSpec -.nf +.QS typedef struct _XftCharFontSpec { - XftFont *font; - FcChar32 ucs4; - short x; - short y; + XftFont *font; + FcChar32 ucs4; + short x; + short y; } XftCharFontSpec; -.fi -.TP -.B "" -The -.B FcChar32 -data type is defined by the Fontconfig library. -.\" XftDrawCharFontSpec -.\" XftCharFontSpecRender -.TP +.QE +.PP +.B XftCharFontSpec +is used by +.BR XftCharFontSpecRender (). +.SS .B XftGlyphSpec -.nf +.QS typedef struct _XftGlyphSpec { - FT_UInt glyph; - short x; - short y; + FT_UInt glyph; + short x; + short y; } XftGlyphSpec; -.fi -.TP -.B "" -The -.B FT_UInt -data type is defined by the FreeType library. -.\" XftDrawGlyphSpec -.\" XftGlyphSpecRender -.TP -.B XftGlyphFontSpec -.nf +.QE +.PP +.B XftGlyphSpec +is used by +.BR XftDrawGlyphSpec (). +.SS XftGlyphFontSpec +.QS typedef struct _XftGlyphFontSpec { - XftFont *font; - FT_UInt glyph; - short x; - short y; + XftFont *font; + FT_UInt glyph; + short x; + short y; } XftGlyphFontSpec; -.fi -.TP -.B "" -The -.B FT_UInt -data type is defined by the FreeType library. -.\" XftDrawGlyphFontSpec -.\" XftGlyphFontSpecRender +.QE +.PP +.B XftGlyphFontSpec +is used by +.BR XftDrawGlyphFontSpec (), +and +.BR XftGlyphFontSpecRender (). .SH FUNCTIONS +.\" ************************************************************************* +.SS "Initialization" +A typical application using +.B Xft +does not explicitly initialize the library. +That is usually done as a side-effect of opening a font. +.PP +When +.B Xft +initializes, it collects information about the display, +and stores some of that information in a Fontconfig pattern +(essentially a collection of properties with typed values). +The calling application can modify that pattern +to change the library's behavior. +.PP +Not all of the collected information is stored in a pattern. +The remainder is stored in internal data structures. +.B Xft +makes some of that available to the application via functions. +.PS +\fBBool\fP \fBXftDefaultHasRender\fP ( + \fBDisplay\fP *\fIdpy\fP); +.PE +Obtain information about the display +.I dpy +if not done already, and +return true if +.B Xft +found that the display supports the X Render extension, +and if it is able to find a suitable +.B XRenderPictFormat +(X Render's datatype which is analogous to Xlib's Visual) +on the display. +.PS +\fBBool\fP \fBXftDefaultSet\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBFcPattern\fP *\fIdefaults\fP); +.PE +Obtain information about the display +.I dpy +if not done already, and +set the Fontconfig pattern holding default properties +which +.B Xft +will use for this display. +.IP +.B Xft +uses those properties initially to obtain these limits: +.RS 10 +.TP 5 +XFT_MAX_GLYPH_MEMORY +(maxglyphmemory). +This is the maximum amount of glyph memory for all fonts used by +.B Xft +(default: 4*1024*1024). +.TP 5 +XFT_MAX_UNREF_FONTS +(maxunreffonts). +This is the maximum number of unreferenced fonts +(default: 16). +.TP 5 +XFT_TRACK_MEM_USAGE +(trackmemusage). +When true, +.B Xft +tracks usage of glyph memory to improve performance when +deciding which to unload when the maximum amount of glyph memory is reached +(default: false). +.RE +.IP +.B Xft +also uses these default properties in +.BR XftDefaultSubstitute (). +.PS +\fBvoid\fP \fBXftDefaultSubstitute\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBint\fP \fIscreen\fP, + \fBFcPattern\fP *\fIpattern\fP); +.PE +.B Xft +fills in missing properties in the given +.I pattern +using default properties for the specified display +.IR dpy , +e.g., as set in +.BR XftDefaultSet (). +.IP +Typical +.B Xft +applications use this function to help Fontconfig +choose a suitable font. +These properties are substituted before calling +.BR FcDefaultSubstitute (): +.RS 10 +.TP 5 +FC_ANTIALIAS +True if FreeType should use antialiasing +(default: False). +(default: True). +.TP 5 +FC_AUTOHINT +True if FreeType should use autohinting +(default: False). +.TP 5 +FC_DPI +Dots/inch used for resolution +(default: computed from the display height). +.TP 5 +FC_EMBOLDEN +True if +.BR FT_GlyphSlot_Embolden () +should be used to embolden a font +(default: False). +.TP 5 +FC_HINTING +True if hinting should be used when filling in properties to open a font +(default: True). +.TP 5 +FC_HINT_STYLE +Hinting style used when filling in properties to open a font +(default: FC_HINT_FULL). +.TP 5 +FC_LCD_FILTER +Parameter passed to +.BR FT_Library_SetLcdFilter () +when loading glyphs +(default: FC_LCD_DEFAULT). +.TP 5 +FC_MINSPACE +Minimum space value used when filling in properties to open a font +(default: False). +.TP 5 +FC_RGBA +RGBA value used when filling in properties to open a font +(default: computed by calling +.BR XRenderQuerySubpixelOrder ()). +.TP 5 +FC_SCALE +Scale used in Fontconfig +(default: 1.0). +.TP 5 +XFT_MAX_GLYPH_MEMORY +Maximum memory for one font +(default: 1024*1024). +.TP 5 +XFT_RENDER +True if the display supports X Render extension +(default: result from +.BR XftDefaultHasRender ()). +.RE +.PS +\fBFcBool\fP \fBXftInit\fP ( + \fB_Xconst char\fP *\fIconfig\fP); +.PE +Initializes the Fontconfig library (calling +.BR FcInit ()). +.IP +The \fIconfig\fP parameter is unused. +.IP +.B Xft +does not deinitialize the Fontconfig library when it is done. +.PS +\fBFcBool\fP \fBXftInitFtLibrary\fP (\fBvoid\fP); +.PE +Initializes the FreeType library +(calling +.BR FT_Init_FreeType () +to create a library object) +if it has not already been initialized. +This is needed before using the FreeType library to read font data from a file. +.IP +.B Xft +calls +.BR XftInitFtLibrary () +internally via +.BR XftFontInfoCreate "() and" +.BR XftFontOpenPattern (). +.IP +.B Xft +does not discard the library object +(e.g., using +.BR FT_Done_FreeType ()) +when it is done. +.PS +\fBint\fP \fBXftGetVersion\fP (\fBvoid\fP); +.PE +Return \fBXftVersion\fP, enabling an application to determine the +actual version of +.B Xft +which is in use. +.\" ************************************************************************* .SS "Opening and Matching Fonts" -.nf -\fBXftFont *\fR -\fBXftFontOpen (Display *\fIdpy\fB,\fR -\fB int \fIscreen\fB,\fR -\fB ...);\fR\fR -.fi +.PS +\fBXftFont\fP *\fBXftFontOpen\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBint\fP \fIscreen\fP, + ...); +.PE .B XftFontOpen takes a list of pattern element triples of the form .IR field , " type" , " value" @@ -397,28 +722,27 @@ and opens the matching font, sizing it correctly for screen number .I screen on display .IR dpy . -The -.B Display -data type is defined by the X11 library. -Returns NULL if no match is found. +Return the matched font, or +NULL if no match is found. .PP Example: -.nf +.QS font = XftFontOpen (dpy, screen, XFT_FAMILY, XftTypeString, "charter", XFT_SIZE, XftTypeDouble, 12.0, NULL); -.fi -This opens the \(lqcharter\(rq font at 12 points. +.QE +.IP +This opens the \*(``charter\*('' font at 12 points. The point size is automatically converted to the correct pixel size based on the resolution of the monitor. .PP -.nf -\fBXftFont *\fR -\fBXftFontOpenName (Display *\fIdpy\fB,\fR -\fB int \fIscreen\fB,\fR -\fB unsigned char *\fIname\fB);\fR -.fi +.PS +\fBXftFont\fP *\fBXftFontOpenName\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBint\fP \fIscreen\fP, + \fB_Xconst char\fP *\fIname\fP); +.PE .B XftFontOpenName behaves as .B XftFontOpen @@ -427,45 +751,139 @@ the Fontconfig library's .BR FcNameParse () function). .PP -.nf -\fBXftFont *\fR -\fBXftFontOpenXlfd (Display *\fIdpy\fB,\fR -\fB int \fIscreen\fB,\fR -\fB unsigned char *\fIxlfd\fB)\fR -.fi +.PS +\fBXftFont\fP *\fBXftFontOpenXlfd\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBint\fP \fIscreen\fP, + \fB_Xconst char\fP *\fIxlfd\fP) +.PE .B XftFontOpenXlfd behaves as .B XftFontOpen does, except that it takes a string containing an X Logical Font -Description (XLFD). +Description (XLFD), +and uses the +.BR XftXlfdParse () +function. .PP -.nf -\fBFcPattern *\fR -\fBXftFontMatch (Display *\fIdpy\fB,\fR -\fB int \fIscreen\fB,\fR -\fB FcPattern *\fIpattern\fB,\fR -\fB FcResult *\fIresult\fB);\fR -.fi +.PS +\fBFcPattern\fP *\fBXftFontMatch\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBint\fP \fIscreen\fP, + \fB_Xconst FcPattern\fP *\fIpattern\fP, + \fBFcResult\fP *\fIresult\fP); +.PE Also used internally by the .BR XftFontOpen * functions, .B XftFontMatch can also be used directly to determine the Fontconfig font pattern -resulting from an Xft font open request. -The -.B FcPattern +resulting from an +.B Xft +font open request. +.PS +\fBFcPattern\fP *\fBXftXlfdParse\fP ( + \fB_Xconst char\fP *\fIxlfd_orig\fP, + \fBBool\fP \fIignore_scalable\fP, + \fBBool\fP \fIcomplete\fP); +.PE +.B XftXlfdParse +parses the +.I xlfd_orig +parameter according to the +.I X Logical Font Description Conventions +document, but ignores +some of the fields: +.IR setwidth_name , +.IR add_style_name , +.IR spacing , and -.B FcResult -data types are defined by the Fontconfig library. -.SS "Determining the Pixel Extents of a Text String" -.nf -\fBvoid\fR -\fBXftTextExtents8 (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FcChar8 *\fIstring\fB,\fR -\fB int \fIlen\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi +.IR average_width . +.IP +.B XftXlfdParse +creates a Fontconfig pattern, +setting the property +.B XFT_XLFD +to the +.I xlfd_orig +value, +and +maps the collected information to Fontconfig properties. +Empty or \*(``*\*('' fields are ignored: +.RS 10 +.TP 5 +FC_FOUNDRY +from +.IR foundry . +.TP 5 +FC_FAMILY +from +.IR family . +.TP 5 +FC_WEIGHT +.IR weight_name , +defaulting to +FC_WEIGHT_MEDIUM. +.TP 5 +FC_SLANT +from +.IR slant , +defaulting to +FC_SLANT_ROMAN. +.TP 5 +FC_SIZE +from +.IR point_size . +.TP 5 +FC_PIXEL_SIZE +from +.IR pixel_size . +If +.I point_size +was set, as well as +.IR resolution_x and +.IR resolution_y , +then the value is scaled convert the font's height to points. +.RE +.\" ************************************************************************* +.SS "Families of Functions" +.B Xft +provides groups of drawing functions which differ according to the way +the data is encoded, e.g., 8-bit (ISO-8859-1) versus UTF-8. +Here is a summary of these related functions: +.TS +l l l l +_ _ _ _ +l l l l. +\fBEncoding\fP \fBXftDrawString*\fP \fBXftTextExtents*\fP \fBXftTextRender*\fP +8 XftDrawString8 XftTextExtents8 XftTextRender8 +16 XftDrawString16 XftTextExtents16 XftTextRender16 +16BE XftDrawString16 XftTextExtents16 XftTextRender16BE +16LE XftDrawString16 XftTextExtents16 XftTextRender16LE +32 XftDrawString32 XftTextExtents32 XftTextRender32 +32BE XftDrawString32 XftTextExtents32 XftTextRender32BE +32LE XftDrawString32 XftTextExtents32 XftTextRender32LE +UTF-8 XftDrawStringUtf8 XftTextExtentsUtf8 XftTextRenderUtf8 +UTF-16 XftDrawStringUtf16 XftTextExtentsUtf16 XftTextRenderUtf16 +.TE +.\" ************************************************************************* +.SS "Determining Text Extents" +.B Xft +provides several functions for determining the required height and width +for displaying a text-string. +After accounting for the +.IR offset , +in cases where the string will be shifted up, down, left or right, +these numbers are referred to as +.IR "text extents" . +.PS +\fBvoid\fP \fBXftTextExtents8\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBXftFont\fP *\fIfont\fP, + \fB_Xconst FcChar8\fP *\fIstring\fP, + \fBint\fP \fIlen\fP, + \fBXGlyphInfo\fP *\fIextents\fP); +.PE .B XftTextExtents8 computes the pixel extents on display .I dpy @@ -477,20 +895,15 @@ consisting of eight-bit characters when drawn with .IR font , storing them in .IR extents . -The -.B FcChar8 -data type is defined by the Fontconfig library, and the -.B XGlyphInfo -data type is defined by the X Rendering Extension library. .PP -.nf -\fBvoid\fR -\fBXftTextExtents16 (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FcChar16 *\fIstring\fB,\fR -\fB int \fIlen\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi +.PS +\fBvoid\fP \fBXftTextExtents16\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBXftFont\fP *\fIfont\fP, + \fB_Xconst FcChar16\fP *\fIstring\fP, + \fBint\fP \fIlen\fP, + \fBXGlyphInfo\fP *\fIextents\fP); +.PE .B XftTextExtents16 computes the pixel extents on display .I dpy @@ -502,20 +915,15 @@ consisting of sixteen-bit characters when drawn with .IR font , storing them in .IR extents . -The -.B FcChar16 -data type is defined by the Fontconfig library, and the -.B XGlyphInfo -data type is defined by the X Rendering Extension library. .PP -.nf -\fBvoid\fR -\fBXftTextExtents32 (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FcChar32 *\fIstring\fB,\fR -\fB int \fIlen\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi +.PS +\fBvoid\fP \fBXftTextExtents32\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBXftFont\fP *\fIfont\fP, + \fB_Xconst FcChar32\fP *\fIstring\fP, + \fBint\fP \fIlen\fP, + \fBXGlyphInfo\fP *\fIextents\fP); +.PE .B XftTextExtents32 computes the pixel extents on display .I dpy @@ -527,20 +935,15 @@ consisting of thirty-two-bit characters when drawn with .IR font , storing them in .IR extents . -The -.B FcChar32 -data type is defined by the Fontconfig library, and the -.B XGlyphInfo -data type is defined by the X Rendering Extension library. .PP -.nf -\fBvoid\fR -\fBXftTextExtentsUtf8 (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FcChar8 *\fIstring\fB,\fR -\fB int \fIlen\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi +.PS +\fBvoid\fP \fBXftTextExtentsUtf8\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBXftFont\fP *\fIfont\fP, + \fB_Xconst FcChar8\fP *\fIstring\fP, + \fBint\fP \fIlen\fP, + \fBXGlyphInfo\fP *\fIextents\fP); +.PE .B XftTextExtentsUtf8 computes the pixel extents on display .I dpy @@ -552,19 +955,16 @@ when drawn with .IR font , storing them in .IR extents . -The -.B XGlyphInfo -data type is defined by the X Rendering Extension library. .PP -.nf -\fBvoid\fR -\fBXftTextExtentsUtf16 (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FcChar8 *\fIstring\fB,\fR -\fB FcEndian \fIendian\fB,\fR -\fB int \fIlen\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi +.PS +\fBvoid\fR \fBXftTextExtentsUtf16\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBXftFont\fP *\fIfont\fP, + \fB_Xconst FcChar8\fP *\fIstring\fP, + \fBFcEndian\fP \fIendian\fP, + \fBint\fP \fIlen\fP, + \fBXGlyphInfo\fP *\fIextents\fP); +.PE .B XftTextExtentsUtf16 computes the pixel extents on display .I dpy @@ -580,22 +980,17 @@ The endianness of .I string must be specified in .IR endian . -The -.B FcEndian -data type is defined by the Fontconfig library, and the -.B XGlyphInfo -data type is defined by the X Rendering Extension library. .PP -.nf -\fBvoid\fR -\fBXftGlyphExtents (Display *\fIdpy\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB FT_UInt *\fIglyphs\fB,\fR -\fB int \fInglyphs\fB,\fR -\fB XGlyphInfo *\fIextents\fB);\fR -.fi +.PS +\fBvoid\fP \fBXftGlyphExtents\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBXftFont\fP *\fIfont\fP, + \fB_Xconst FT_UInt\fP *\fIglyphs\fP, + \fBint\fP \fInglyphs\fP, + \fBXGlyphInfo\fP *\fIextents\fP); +.PE Also used internally by the -.BR XftTextExtents * +.BR XftTextExtents *() functions, .B XftGlyphExtents computes the pixel extents on display @@ -608,19 +1003,136 @@ drawn with .IR font , storing them in .IR extents . +.IP +If any of the +.I glyphs +are missing (determined by a check with +.BR XftFontCheckGlyph ()), +the corresponding entry in +.I extents +is filled with zeroes. +.\" ************************************************************************* +.SS "Managing XftColor" +.PS +\fBBool\fP \fBXftColorAllocName\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fB_Xconst Visual\fP *\fIvisual\fP, + \fBColormap\fP \fIcmap\fP, + \fB_Xconst char\fP *\fIname\fP, + \fBXftColor\fP *\fIresult\fP); +.PE +Use +.BR XAllocNamedColor () +to look up the named color +.I name +for the screen associated with the colormap +.IR cmap . +.RS 7 +.bP +If +.BR XAllocNamedColor () +returns nonzero, +.BR XftColorAllocName () +fills in the resulting +.B XftColor +pixel field with the closest color supported by the screen, +as well as the exact red, green and blue fields from the database, +and returns True. +.bP +If +.BR XAllocNamedColor () +returns zero, +.BR XftColorAllocName () +returns False, and does not update the +.B XftColor +referenced by +.IR result . +.RE +.IP The -.B FT_UInt -data type is defined by the FreeType library, and the -.B XGlyphInfo -data type is defined by the X Rendering Extension library. -.SS "Drawing Strings (and Other Things)" -.nf -\fBXftDraw *\fR -\fBXftDrawCreate (Display *\fIdpy\fB,\fR -\fB Drawable \fIdrawable\fB,\fR -\fB Visual *\fIvisual\fB,\fR -\fB Colormap \fIcolormap\fB);\fR -.fi +.I visual +parameter is unused. +.PS +\fBBool\fP \fBXftColorAllocValue\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBVisual\fP *\fIvisual\fP, + \fBColormap\fP \fIcmap\fP, + \fB_Xconst XRenderColor\fP *\fIcolor\fP, + \fBXftColor\fP *\fIresult\fP); +.PE +Allocate a color value: +.RS 7 +.bP +If the +.I visual +class is TrueColor, +.BR XftColorAllocValue () +sets the +.I pixel +field in the +.B XftColor +referenced by +.I result +using the red, green and blue fields from the +.I color +parameter. +.bP +If the +.I visual +class is not TrueColor, +.BR XftColorAllocValue () +calls +.BR XAllocColor () +to allocate an entry in the colormap +.IR cmap . +which returns the +pixel value of the color closest to the specified RGB elements supported by the +hardware. +.IP +If +.BR XAllocColor () +succeeds +.BR XftColorAllocValue () +stores that pixel value in the +.B XRenderColor +referenced by +.I result +and returns True. +.IP +If +.BR XAllocColor () +fails, +.BR XftColorAllocValue () +returns False and does not modify the result. +.RE +.PS +\fBvoid\fP \fBXftColorFree\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBVisual\fP *\fIvisual\fP, + \fBColormap\fP \fIcmap\fP, + \fBXftColor\fP *\fIcolor\fP); +.PE +If the +.I visual +class is not TrueColor, +.B Xft +calls +.BR XFreeColors () +to free the entry from the colormap +.I cmap +whose pixel value in the +.I color +parameter was allocated by +.BR XftColorAllocName (). +.\" ************************************************************************* +.SS "Managing XftDraw" +.PS +\fBXftDraw\fP *\fBXftDrawCreate\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBDrawable\fP \fIdrawable\fP, + \fBVisual\fP *\fIvisual\fP, + \fBColormap\fP \fIcolormap\fP); +.PE .B XftDrawCreate creates a structure that can be used to render text and rectangles using the specified @@ -630,139 +1142,280 @@ and .I colormap on .IR display . -The -.BR Drawable , -.BR Visual , -and -.B Colormap -data types are defined by the X11 library. .PP -.nf -\fBXftDraw *\fR -\fBXftDrawCreateBitmap (Display *\fIdpy\fB,\fR -\fB Pixmap \fIbitmap\fB);\fR -.fi +.PS +\fBXftDraw\fP *\fBXftDrawCreateBitmap\fP ( + \fBDisplay\fP *\fIdpy\fB,\fR + \fBPixmap\fP \fIbitmap\fB);\fR +.PE .B XftDrawCreateBitmap behaves as -.BR XftDrawCreate , -except it uses an X pixmap of color depth 1 instead of an X drawable. -The -.B Pixmap -data type is defined by the X11 library. +.BR XftDrawCreate (), +except that it uses an X pixmap of color depth 1 instead of an X drawable. .PP -.nf -\fBXftDraw *\fR -\fBXftDrawCreateAlpha (Display *\fIdpy\fB,\fR -\fB Pixmap \fIpixmap\fB,\fR -\fB int \fIdepth\fB);\fR -.fi +.PS +\fBXftDraw *\fP \fBXftDrawCreateAlpha\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBPixmap\fP \fIpixmap\fP, + \fBint\fP \fIdepth\fP); +.PE .B XftDrawCreateAlpha behaves as -.BR XftDrawCreate , -except it uses an X pixmap of color depth +.BR XftDrawCreate (), +except that it uses an X pixmap of color depth .I depth instead of an X drawable. -The -.B Pixmap -data type is defined by the X11 library. .PP -.nf -\fBvoid\fR -\fBXftDrawChange (XftDraw *\fIdraw\fB,\fR -\fB Drawable \fIdrawable\fB);\fR -.fi +.PS +\fBvoid\fP \fBXftDrawChange\fP ( + \fBXftDraw\fP *\fIdraw\fP, + \fBDrawable\fP \fIdrawable\fP); +.PE .B XftDrawChange -changes the X drawable association of the existing Xft draw object +changes the X drawable association of the existing +.B Xft +draw object .I draw from its current value to .IR drawable . .PP -.nf -\fBDisplay *\fR -\fBXftDrawDisplay (XftDraw *\fIdraw\fB);\fR -.fi +.PS +\fBDisplay\fP *\fBXftDrawDisplay\fP ( + \fBXftDraw\fP *\fIdraw\fP); +.PE .B XftDrawDisplay -returns a pointer to the display associated with the Xft draw object +returns a pointer to the display associated with the +.B Xft +draw object .IR draw . .PP -.nf -\fBDrawable\fR -\fBXftDrawDrawable (XftDraw *\fIdraw\fB);\fR -.fi +.PS +\fBDrawable\fP \fBXftDrawDrawable\fP ( + \fBXftDraw\fP *\fIdraw\fP); +.PE .B XftDrawDrawable -returns the X drawable associated with the Xft draw object +returns the X drawable associated with the +.B Xft +draw object .IR draw . .PP -.nf -\fBColormap\fR -\fBXftDrawColormap (XftDraw *\fIdraw\fB);\fR -.fi -.B XftDrawColormap -returns the colormap associated with the Xft draw object +.PS +\fBColormap\fP \fBXftDrawColormap\fP ( + \fBXftDraw\fP *\fIdraw\fP); +.PE +.BR XftDrawColormap () +returns the colormap associated with the +.B Xft +draw object .IR draw . .PP -.nf -\fBVisual *\fR -\fBXftDrawVisual (XftDraw *\fIdraw\fB);\fR -.fi +.PS +\fBVisual\fR *\fBXftDrawVisual\fP ( + \fBXftDraw\fP *\fIdraw\fP); +.PE .B XftDrawVisual -returns a pointer to the visual associated with the Xft draw object +returns a pointer to the visual associated with the +.B Xft +draw object .IR draw . .PP -.nf -\fBPicture\fR -\fBXftDrawPicture (XftDraw *\fIdraw\fB);\fR -.fi +.PS +\fBPicture\fP \fBXftDrawPicture\fP ( + \fBXftDraw\fP *\fIdraw\fP); +.PE .B XftDrawPicture -returns the picture associated with the Xft draw object +returns the picture associated with the +.B Xft +draw object .IR draw . +.IP If the the X server does not support the X Rendering Extension, 0 is returned. .PP -.nf -\fBPicture\fR -\fBXftDrawSrcPicture (XftDraw *\fIdraw\fB,\fR -\fB XftColor *\fIcolor\fB);\fR -.fi -.\" Unfortunately, I'm not quite sure what this does. I think it is the gizmo -.\" that is used to create an Xrender Picture object so that glyphs can be -.\" drawn in the XftDraw object -.\" .I draw -.\" using the specified -.\" .IR color . -.\" -- BR, 2005-04-02 -This function is never called if the X server doesn't support the X -Rendering Extension; instead, -.B XftGlyphCore -is used. -.PP -.nf -\fBvoid\fR -\fBXftDrawDestroy (XftDraw *\fIdraw\fB);\fR -.fi +.PS +\fBPicture\fP \fBXftDrawSrcPicture\fP ( + \fBXftDraw\fP *\fIdraw\fP, + \fB_Xconst XftColor\fP *\fIcolor\fP); +.PE +Return an X Render Picture object, +which is used for rendering glyphs, +e.g., with +.BR XftGlyphRender (), +.BR XftGlyphSpecRender (), +or +.BR XftGlyphFontSpecRender (), +by +.BR XftDrawGlyphs (), +.BR XftDrawGlyphSpec (), +.BR XftDrawGlyphFontSpec (), +respectively. +.IP +If the X server does not support the X Render extension, +those functions use +.BR XftGlyphCore (), +.BR XftGlyphSpecCore (), +or +.BR XftGlyphFontSpecCore (). +.PS +\fBvoid\fP \fBXftDrawDestroy\fP ( + \fBXftDraw\fP *\fIdraw\fP); +.PE .B XftDrawDestroy destroys .I draw (created by one of the -.B XftCreate +.BR XftDrawCreate *() functions) and frees the memory that was allocated for it. -.PP -.nf -\fBvoid\fR -\fBXftDrawString8 (XftDraw *\fId\fB,\fR -\fB XftColor *\fIcolor\fB,\fR -\fB XftFont *\fIfont\fB,\fR -\fB int \fIx\fB,\fR -\fB int \fIy\fB,\fR -\fB unsigned char *\fIstring\fB,\fR -\fB int \fIlen\fB);\fR -.fi +.PS +\fBBool\fP \fBXftDrawSetClip\fP ( + \fBXftDraw\fP *\fIdraw\fP, + \fBRegion\fP \fIr\fP); +.PE +Set up clipping for the given +.B XftDraw +parameter +.I draw +starting with a +.BR Region : +.RS 7 +.bP +If the +.B Region +parameter +.I r +is not null, +.B Xft +creates a new +.B Region +(to copy the parameter), +.bP +.B Xft +destroys any existing clipping region. +.bP +.B Xft +sets the clip_type +for the +.I draw +parameter to +.B XftClipTypeRegion +if the +.I r +parameter was not null. +Otherwise it sets the clip_type to +.BR XftClipTypeNone . +.bP +Finally, +.B Xft +updates clipping for existing objects, +updates the clip_mask for its X Render +.B Picture +object +and sets the clipping-mask in the graphic context (GC) associated with the +.B XftDraw +parameter. +.RE +.IP +.BR XftDrawSetClip () +returns +.B True +if no change was necessary, or if the operation succeeded. +It returns +.B False +if it was unable to create the new +.BR Region (). +.PS +\fBBool\fP \fBXftDrawSetClipRectangles\fP ( + \fBXftDraw\fP *\fIdraw\fP, + \fBint\fP \fIxOrigin\fP, + \fBint\fP \fIyOrigin\fP, + \fB_Xconst XRectangle\fP *\fIrects\fP, + \fBint\fP \fIn\fP); +.PE +Like +.BR XftDrawSetClip (), +.B XftDrawSetClipRectangles() +sets up clipping for the given +.B XftDraw +parameter +.I draw +but uses a set of +.I n +rectangles (the +.I rects +parameter) +which could be used to construct a +.B Region . +.IP +.B Xft +sets the clip_type for +.I draw +to +XftClipTypeRectangles +and uses +.BR XSetClipRectangles () +for core (X11) clipping +and +.BR XRenderSetPictureClipRectangles () +for X Render clipping. +.PS +\fBvoid\fP \fBXftDrawSetSubwindowMode\fP ( + \fBXftDraw\fP *\fIdraw\fP, + \fBint\fP \fImode\fP); +.PE +Sets the subwindow-mode for the given +.B XftDraw +parameter +.IR draw . +The mode can be either +.B ClipByChildren +(the default), or +.BR IncludeInferiors : +.RS 7 +.bP +For +.BR ClipByChildren , +both source and destination windows are +additionally clipped by all viewable +.B InputOutput +children. +.bP +For +.BR IncludeInferiors , +neither source nor destination window is clipped by inferiors. +This will result in including subwindow contents in the source +and drawing through subwindow boundaries of the destination. +.RE +.IP +In addition to the subwindow-mode maintained by +.BR Xft , +it updates the subwindow mode for any associated graphics context +.B GC +using +.BR XSetSubwindowMode () +as well as for an X Render +.B Picture +using +.BR XRenderChangePicture (). +.\" ************************************************************************* +.SS "Drawing Strings" +.PS +\fBvoid\fP \fBXftDrawString8\fP ( + \fBXftDraw\fP *\fId\fP, + \fB_Xconst XftColor\fP *\fIcolor\fP, + \fBXftFont\fP *\fIfont\fP, + \fBint\fP \fIx\fP, + \fBint\fP \fIy\fP, + \fB_Xconst FcChar8\fP *\fIstring\fP, + \fBint\fP \fIlen\fP); +.PE .B XftDrawString8 draws no more than .I len glyphs of .I string -to Xft drawable +to +.B Xft +drawable .I d using .I font @@ -770,16 +1423,17 @@ in .I color at position .IR x , " y" . -.PP -.nf -\fBvoid\fR -\fBXftDrawRect (XftDraw *\fId\fB,\fR -\fB XftColor *\fIcolor\fB,\fR -\fB int \fIx\fB,\fR -\fB int \fIy\fB,\fR -\fB unsigned int \fIwidth\fB,\fR -\fB unsigned int \fIheight\fB);\fR -.fi +.\" ************************************************************************* +.SS "Drawing Other Things" +.PS +\fBvoid\fP \fBXftDrawRect\fP ( + \fBXftDraw\fP *\fId\fP, + \fB_Xconst XftColor\fP *\fIcolor\fP, + \fBint\fP \fIx\fP, + \fBint\fP \fIy\fP, + \fBunsigned int\fP \fIwidth\fP, + \fBunsigned int\fP \fIheight\fP); +.PE .B XftDrawRect draws a solid rectangle of the specified .IR color , @@ -788,23 +1442,354 @@ and .I height at position .IR x , " y" -to Xft drawable +to +.B Xft +drawable .IR d . +.PS +\fBvoid\fP \fBXftCharFontSpecRender\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBint\fP \fIop\fP, + \fBPicture\fP \fIsrc\fP, + \fBPicture\fP \fIdst\fP, + \fBint\fP \fIsrcx\fP, + \fBint\fP \fIsrcy\fP, + \fB_Xconst XftCharFontSpec\fP *\fIchars\fP, + \fBint\fP \fIlen\fP); +.PE +.BR XftCharFontSpecRender () +converts the +.I chars +parameter from +.B XftCharFontSpec +to +.BR XftGlyphFontSpec , +passing the converted array along with the other parameters unchanged to +.BR XftGlyphFontSpecRender () +to render the data. +.PS +\fBvoid\fP \fBXftDrawGlyphFontSpec\fP ( + \fBXftDraw\fP *\fIdraw\fP, + \fB_Xconst XftColor\fP *\fIcolor\fP, + \fB_Xconst XftGlyphFontSpec\fP *\fIglyphs\fP, + \fBint\fP \fIlen\fP); +.PE +Draw a list of glyphs associated with fonts at specified coordinates, +passed as an array of +.I len +.B XftGlyphFontSpec +structures via the parameter +.IR glyphs . +All of the glyphs are drawn using the color specified in the +.I color +parameter. +.IP +For each entry in the +.I glyphs +array: +.RS 7 +.bP +If the associated font uses the X Render extension, then +.B Xft +uses +.BR XftGlyphFontSpecRender () +to draw the glyph, +using a +.B Picture +obtained from calling +.B XftDrawSrcPicture () +with the +.I draw +and +.I color +parameters. +.bP +Otherwise, +.B Xft +provides an analogous feature using Xlib. +.RE +.PS +\fBvoid\fP \fBXftGlyphFontSpecRender\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBint\fP \fIop\fP, + \fBPicture\fP \fIsrc\fP, + \fBPicture\fP \fIdst\fP, + \fBint\fP \fIsrcx\fP, + \fBint\fP \fIsrcy\fP, + \fB_Xconst XftGlyphFontSpec\fP *\fIglyphs\fP, + \fBint\fP \fInglyphs\fP); +.PE +This involves several steps: +.RS 7 +.bP +First, +.B Xft +ensures that the +.I glyphs +array is complete using +.BR XftFontCheckGlyph () +and loading any missing glyphs with +.BR XftFontLoadGlyphs (). +.bP +Then +.B Xft +examines the glyphs to find the maximum Unicode value. +That determines the encoding size, i.e., the +.IR width . +.bP +Then, for each glyph, +.B Xft +checks if its Unicode value is handled by the corresponding font. +If not, the value is set to zero (0), to ignore it. +While doing this, +.B Xft +also remembers which was the first font used, +and computes the position at which each glyph will be drawn. +.bP +.B Xft +then constructs an equivalent array of glyphs in the format expected by +the X Render library. +.bP +Finally, +.BR XftGlyphFontSpecRender () +uses the X Render extension to draw the glyphs, +with the appropriate +.BR XRenderCompositeText *() +function according to the +.IR width , +and discards temporary data. +.IP +The +.IR op , +.IR dst , +.IR src , +.IR srcx , +and +.I srcy +parameters are used as described in the documentation for the X Render library. +.RE +.\" ************************************************************************* +.SS Manipulating patterns +.PS +\fBFcFontSet\fP *\fBXftListFonts\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBint\fP \fIscreen\fP, + ...); +.PE +.B Xft +uses +.BR FcPatternVapBuild () +and +.BR FcObjectSetVapBuild () +to process the variable-length parameter list, +and +.BR FcFontList () +to obtain a list of matching Fontconfig patterns, +which it returns to the caller. +The caller can dispose of the return value using +.BR FcPatternDestroy (). +.PS +\fBFcPattern\fP *\fBXftNameParse\fP ( + \fB_Xconst char\fP *\fIname\fP); +.PE +.B Xft +uses Fontconfig to parse the name, +passing the +.I name +to +.BR FcNameParse (), +returning the result. +.PS +\fBFcBool\fP \fBXftNameUnparse\fP ( + \fBFcPattern\fP *\fIpat\fP, + \fBchar\fP *\fIdest\fP, + \fBint\fP \fIlen\fP); +.PE +Like +.BR XfgNameParse (), +.B Xft +uses Fontconfig. +In this case, it uses +.BR FcNameUnparse (), +which converts the pattern +.I pat +back into a string that can be parsed. +.BR XftNameUnparse () +stores the result via the caller's pointer +.IR dest , +but checks first if it will fit, +using the +.I len +parameter. +If it fits, +.B Xft +copies the string and returns +.BR FcTrue , +otherwise it returns +.BR FcFalse . +.\" ************************************************************************* +.SS Manipulating Font data +.PS +\fBvoid\fP \fBXftFontLoadGlyphs\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBXftFont\fP *\fIpub\fP, + \fBFcBool\fP \fIneed_bitmaps\fP, + \fB_Xconst FT_UInt\fP *\fIglyphs\fP, + \fBint\fP \fInglyph\fP); +.PE +Using +.BR FT_Load_Glyph (), +load +.I nglyphs +for the glyph indices (Unicode values) +listed in the array +.I glyphs +from the given font +.IR pub . +.IP +Loading a glyph entails more than just reading data into memory. +.B Xft +uses the Fontconfig pattern associated with the display +.I dpy +(e.g., via +.BR XftDefaultSet ()) +to determine whether to use a bounding box, +clip the glyphs into those bounds, +scale the glyphs, +compute font metrics, and +add it to the +X Render extension using +.BR XRenderAddGlyphs (). +.PS +\fBvoid\fP \fBXftFontUnloadGlyphs\fP ( + \fBDisplay\fP *\fIdpy\fP, + \fBXftFont\fP *\fIpub\fP, + \fB_Xconst FT_UInt\fP *\fIglyphs\fP, + \fBint\fP \fInglyph\fP); +.PE +Discards data for up to +.I nglyph +glyphs whose glyph indices (Unicode values) +are listed in the array +.I glyphs +for the given font +.IR pub . +If the glyphs were added to the X Render extension, +.B Xft +removes those using +.BR XRenderFreeGlyphs (). +.B Xft +keeps track of the amount of memory used for glyphs, +and updates the usage associated with the display +.IR dpy . +.PS +\fBFT_Face\fP \fBXftLockFace\fP ( + \fBXftFont\fP *\fIpub\fP); +.PE +If no FreeType 2 \*(``face\*('' +(in-memory representation of a given typeface in a given style) +has been created for the +.I pub +font, create one using +.BR FT_New_Face (). +Face-locks are a reference count used by +.B Xft +to ensure that only one face is created, +and that it is retained until the font is no longer used. +.IP +Face-locking is used directly in +.BR XftCharIndex () +and +.BR XftFontLoadGlyphs (), +which in turn are used in many functions of +.BR Xft . +.IP +Face-locking was introduced in version 1 (October 2002). +A few applications, such as Gdk/Gimp relied upon these functions. +In version 2.1.9 (June 2006), +face-locking was retained as part of the public API +when improved shared-library configurations provided +for hiding private symbols. +.PS +\fBvoid\fP \fBXftUnlockFace\fP ( + \fBXftFont\fP *\fIpub\fP); +.PE +Decrements the reference count for the FreeType 2 \*(``face\*('' +associated with the font. +.IP +.B FT_Face +objects are deallocated using +.BR FT_Done_Face (). +.B Xft +does this in +.BR XftFontInfoDestroy () +and when cleaning up on failure in +.BR XftFontInfoCreate () +and +.BR XftFontOpenPattern (). +.\" ************************************************************************* +.SH DEBUGGING +.B Xft +reads the environment variable +.B XFT_DEBUG +and converts that to an integer. +Each bit in the resulting value tells +.B Xft +to print debugging information to the standard output: +.TP 5 +1 +font-opening +.TP 5 +2 +additional font-matching and opening (verbose) +.TP 5 +4 +shows details about the +.B XRenderPictFormat +which will be used. +.TP 5 +8 +shows the string which +.BR XftDrawString8 () +will draw. +.TP 5 +16 +shows which font-ids are matched. +.TP 5 +32 +shows useful information about the glyphs which will be drawn +.TP 5 +64 +shows an ASCII-art representation of the glyphs. +.TP 5 +128 +shows details about the memory-cache management +.TP 5 +256 +shows details about managing glyph cached-memory +.TP 5 +512 +shows a report on memory-usage +.TP 5 +1024 +shows details on extended management of glyph cached-memory +.\" ************************************************************************* .SH COMPATIBILITY -As of version 2, +As of version 2 (May 2002), .B Xft -has become relatively stable and is expected to retain source and binary -compatibility in future releases. +became relatively stable. +It is expected to retain source and binary compatibility in future releases. .PP .B Xft -does provide a compatibility interface to its previous major version, +provides a compatibility interface to its previous major version, Xft .RI 1. x , described below. -.SS "Xft 1.x Compatibility Header File" +.\" ************************************************************************* +.SS "Xft 1.x Header File" .B #include <X11/Xft/XftCompat.h> -.\" .SS "Xft 1.x Compatibility Constants" -.SS "Xft 1.x Compatibility Data Types" +.\" .SS "Xft 1.x Constants" +.SS "Xft 1.x Data Types" .TP .B XftPattern holds a set of names with associated value lists; each name refers to a @@ -826,15 +1811,19 @@ returns the results of listing fonts in this format. .B XftObjectSet holds a set of names and is used to specify which fields from fonts are placed in the the list of returned patterns when listing fonts. -.\" .SS "Xft 1.x Compatibility Functions" +.\" .SS "Xft 1.x Functions" .SH AUTHOR Keith Packard +.br +Thomas E. Dickey (performance improvements) .SH "SEE ALSO" .I Fontconfig Developers Reference .br .I FreeType API Reference .br .I Xlib \- C Language Interface +.br +.I X Logical Font Description Conventions .\" Set Vim modeline; textwidth is 70 to account for the extra margin .\" padding that man (on Debian GNU/Linux) does for output to .\" terminals (7 spaces on the left, 2 on the right), so that we don't diff --git a/lib/libXft/man/XftCharExists.man b/lib/libXft/man/XftCharExists.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftCharExists.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftCharFontSpecRender.man b/lib/libXft/man/XftCharFontSpecRender.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftCharFontSpecRender.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftCharIndex.man b/lib/libXft/man/XftCharIndex.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftCharIndex.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftCharSpecRender.man b/lib/libXft/man/XftCharSpecRender.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftCharSpecRender.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftColorAllocName.man b/lib/libXft/man/XftColorAllocName.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftColorAllocName.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftColorAllocValue.man b/lib/libXft/man/XftColorAllocValue.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftColorAllocValue.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftColorFree.man b/lib/libXft/man/XftColorFree.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftColorFree.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDefaultHasRender.man b/lib/libXft/man/XftDefaultHasRender.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDefaultHasRender.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDefaultSet.man b/lib/libXft/man/XftDefaultSet.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDefaultSet.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDefaultSubstitute.man b/lib/libXft/man/XftDefaultSubstitute.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDefaultSubstitute.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawChange.man b/lib/libXft/man/XftDrawChange.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawChange.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawCharFontSpec.man b/lib/libXft/man/XftDrawCharFontSpec.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawCharFontSpec.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawCharSpec.man b/lib/libXft/man/XftDrawCharSpec.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawCharSpec.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawColormap.man b/lib/libXft/man/XftDrawColormap.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawColormap.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawCreate.man b/lib/libXft/man/XftDrawCreate.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawCreate.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawCreateAlpha.man b/lib/libXft/man/XftDrawCreateAlpha.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawCreateAlpha.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawCreateBitmap.man b/lib/libXft/man/XftDrawCreateBitmap.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawCreateBitmap.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawDestroy.man b/lib/libXft/man/XftDrawDestroy.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawDestroy.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawDisplay.man b/lib/libXft/man/XftDrawDisplay.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawDisplay.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawDrawable.man b/lib/libXft/man/XftDrawDrawable.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawDrawable.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawGlyphFontSpec.man b/lib/libXft/man/XftDrawGlyphFontSpec.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawGlyphFontSpec.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawGlyphSpec.man b/lib/libXft/man/XftDrawGlyphSpec.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawGlyphSpec.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawGlyphs.man b/lib/libXft/man/XftDrawGlyphs.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawGlyphs.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawPicture.man b/lib/libXft/man/XftDrawPicture.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawPicture.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawRect.man b/lib/libXft/man/XftDrawRect.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawRect.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawSetClip.man b/lib/libXft/man/XftDrawSetClip.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawSetClip.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawSetClipRectangles.man b/lib/libXft/man/XftDrawSetClipRectangles.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawSetClipRectangles.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawSetSubwindowMode.man b/lib/libXft/man/XftDrawSetSubwindowMode.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawSetSubwindowMode.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawSrcPicture.man b/lib/libXft/man/XftDrawSrcPicture.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawSrcPicture.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawString16.man b/lib/libXft/man/XftDrawString16.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawString16.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawString32.man b/lib/libXft/man/XftDrawString32.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawString32.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawString8.man b/lib/libXft/man/XftDrawString8.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawString8.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawStringUtf16.man b/lib/libXft/man/XftDrawStringUtf16.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawStringUtf16.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawStringUtf8.man b/lib/libXft/man/XftDrawStringUtf8.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawStringUtf8.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftDrawVisual.man b/lib/libXft/man/XftDrawVisual.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftDrawVisual.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontCheckGlyph.man b/lib/libXft/man/XftFontCheckGlyph.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontCheckGlyph.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontClose.man b/lib/libXft/man/XftFontClose.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontClose.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontCopy.man b/lib/libXft/man/XftFontCopy.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontCopy.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontInfoCreate.man b/lib/libXft/man/XftFontInfoCreate.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontInfoCreate.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontInfoDestroy.man b/lib/libXft/man/XftFontInfoDestroy.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontInfoDestroy.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontInfoEqual.man b/lib/libXft/man/XftFontInfoEqual.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontInfoEqual.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontInfoHash.man b/lib/libXft/man/XftFontInfoHash.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontInfoHash.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontLoadGlyphs.man b/lib/libXft/man/XftFontLoadGlyphs.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontLoadGlyphs.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontMatch.man b/lib/libXft/man/XftFontMatch.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontMatch.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontOpen.man b/lib/libXft/man/XftFontOpen.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontOpen.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontOpenInfo.man b/lib/libXft/man/XftFontOpenInfo.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontOpenInfo.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontOpenName.man b/lib/libXft/man/XftFontOpenName.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontOpenName.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontOpenPattern.man b/lib/libXft/man/XftFontOpenPattern.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontOpenPattern.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontOpenXlfd.man b/lib/libXft/man/XftFontOpenXlfd.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontOpenXlfd.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftFontUnloadGlyphs.man b/lib/libXft/man/XftFontUnloadGlyphs.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftFontUnloadGlyphs.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftGetVersion.man b/lib/libXft/man/XftGetVersion.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftGetVersion.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftGlyphExtents.man b/lib/libXft/man/XftGlyphExtents.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftGlyphExtents.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftGlyphFontSpecRender.man b/lib/libXft/man/XftGlyphFontSpecRender.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftGlyphFontSpecRender.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftGlyphRender.man b/lib/libXft/man/XftGlyphRender.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftGlyphRender.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftGlyphSpecRender.man b/lib/libXft/man/XftGlyphSpecRender.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftGlyphSpecRender.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftInit.man b/lib/libXft/man/XftInit.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftInit.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftInitFtLibrary.man b/lib/libXft/man/XftInitFtLibrary.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftInitFtLibrary.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftListFonts.man b/lib/libXft/man/XftListFonts.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftListFonts.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftLockFace.man b/lib/libXft/man/XftLockFace.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftLockFace.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftNameParse.man b/lib/libXft/man/XftNameParse.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftNameParse.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftNameUnparse.man b/lib/libXft/man/XftNameUnparse.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftNameUnparse.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextExtents16.man b/lib/libXft/man/XftTextExtents16.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextExtents16.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextExtents32.man b/lib/libXft/man/XftTextExtents32.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextExtents32.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextExtents8.man b/lib/libXft/man/XftTextExtents8.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextExtents8.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextExtentsUtf16.man b/lib/libXft/man/XftTextExtentsUtf16.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextExtentsUtf16.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextExtentsUtf8.man b/lib/libXft/man/XftTextExtentsUtf8.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextExtentsUtf8.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextRender16.man b/lib/libXft/man/XftTextRender16.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextRender16.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextRender16BE.man b/lib/libXft/man/XftTextRender16BE.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextRender16BE.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextRender16LE.man b/lib/libXft/man/XftTextRender16LE.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextRender16LE.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextRender32.man b/lib/libXft/man/XftTextRender32.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextRender32.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextRender32BE.man b/lib/libXft/man/XftTextRender32BE.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextRender32BE.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextRender32LE.man b/lib/libXft/man/XftTextRender32LE.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextRender32LE.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextRender8.man b/lib/libXft/man/XftTextRender8.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextRender8.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextRenderUtf16.man b/lib/libXft/man/XftTextRenderUtf16.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextRenderUtf16.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftTextRenderUtf8.man b/lib/libXft/man/XftTextRenderUtf8.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftTextRenderUtf8.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftUnlockFace.man b/lib/libXft/man/XftUnlockFace.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftUnlockFace.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/man/XftXlfdParse.man b/lib/libXft/man/XftXlfdParse.man new file mode 100644 index 000000000..b68d07f2b --- /dev/null +++ b/lib/libXft/man/XftXlfdParse.man @@ -0,0 +1 @@ +.so man__libmansuffix__/Xft.__libmansuffix__ diff --git a/lib/libXft/src/xftcolor.c b/lib/libXft/src/xftcolor.c index 739dc2d35..23551c66e 100644 --- a/lib/libXft/src/xftcolor.c +++ b/lib/libXft/src/xftcolor.c @@ -23,11 +23,11 @@ #include "xftint.h" _X_EXPORT Bool -XftColorAllocName (Display *dpy, - _Xconst Visual *visual, - Colormap cmap, +XftColorAllocName (Display *dpy, + _Xconst Visual *visual _X_UNUSED, + Colormap cmap, _Xconst char *name, - XftColor *result) + XftColor *result) { XColor screen, exact; diff --git a/lib/libXft/src/xftcore.c b/lib/libXft/src/xftcore.c index 6cfa3bc76..b93dc5815 100644 --- a/lib/libXft/src/xftcore.c +++ b/lib/libXft/src/xftcore.c @@ -233,7 +233,7 @@ typedef void (*XftSharpGlyph) (XftDraw *draw, int y); static XftSharpGlyph -_XftSharpGlyphFind (XftDraw *draw, XftFont *public) +_XftSharpGlyphFind (XftDraw *draw _X_UNUSED, XftFont *public) { XftFontInt *font = (XftFontInt *) public; @@ -390,7 +390,10 @@ _XftSmoothGlyphMono (XImage *image, ((((s) << 9) & 0xf80000) | (((s) << 4) & 0x70000))) -#define XftIntMult(a,b,t,cast) ( ((t) = (cast)((a) * (b) + 0x80)), ( ( ( (t)>>8 ) + (t) )>>8 ) ) +#define XftIntMult(a,b,t,cast) \ + ( ((t) = (cast)((a) * (b) + 0x80)), \ + ( ( ( (t) >> 8 ) + (t) ) >> 8 ) ) + #define XftIntDiv(a,b) (((CARD16) (a) * 255) / (b)) #define XftGet8(v,i) ((CARD16) (CARD8) ((v) >> i)) @@ -403,30 +406,37 @@ _XftSmoothGlyphMono (XImage *image, * this difference will have two versions using the same convention. */ -#define XftOverU(x,y,i,a,t) ((t) = (CARD16) XftIntMult(XftGet8(y,i),(a),(t),CARD16) + XftGet8(x,i),\ - (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) +#define XftOverU(x,y,i,a,t) \ + ((t) = (CARD16) XftIntMult(XftGet8(y,i),(a),(t),CARD16) + \ + XftGet8(x,i),\ + (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) -#define XftOverC(x,y,i,a,t) ((t) = (CARD16) XftIntMult(XftGet8(y,i),XftGet8(a,i),(t),CARD16) + XftGet8(x,i),\ - (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) +#define XftOverC(x,y,i,a,t) \ + ((t) = (CARD16) XftIntMult(XftGet8(y,i),XftGet8(a,i),(t),CARD16) + \ + XftGet8(x,i),\ + (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) -#define XftInU(x,i,a,t) ((CARD32) XftIntMult(XftGet8(x,i),(a),(t),CARD16) << (i)) +#define XftInU(x,i,a,t) \ + ((CARD32) XftIntMult(XftGet8(x,i),(a),(t),CARD16) << (i)) -#define XftInC(x,i,a,t) ((CARD32) XftIntMult(XftGet8(x,i),XftGet8(a,i),(t),CARD32) << (i)) +#define XftInC(x,i,a,t) \ + ((CARD32) XftIntMult(XftGet8(x,i),XftGet8(a,i),(t),CARD32) << (i)) -#define XftGen(x,y,i,ax,ay,t,u,v) ((t) = (XftIntMult(XftGet8(y,i),ay,(u),CARD32) + \ - XftIntMult(XftGet8(x,i),ax,(v),CARD32)),\ - (CARD32) ((CARD8) ((t) | \ - (0 - ((t) >> 8)))) << (i)) +#define XftGen(x,y,i,ax,ay,t,u,v) \ + ((t) = (XftIntMult(XftGet8(y,i),ay,(u),CARD32) + \ + XftIntMult(XftGet8(x,i),ax,(v),CARD32)),\ + (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) -#define XftAdd(x,y,i,t) ((t) = XftGet8(x,i) + XftGet8(y,i), \ - (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) +#define XftAdd(x,y,i,t) \ + ((t) = XftGet8(x,i) + XftGet8(y,i), \ + (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) static CARD32 fbOver24 (CARD32 x, CARD32 y) { CARD16 a = (CARD16)(~x >> 24); - CARD16 t; + CARD16 t = 0; CARD32 m,n,o; m = XftOverU(x,y,0,a,t); @@ -923,7 +933,7 @@ _XftGlyphDefault (Display *dpy, XftFont *public) return font->glyphs[0]; } -static int XftGetImageErrorHandler (Display *dpy, XErrorEvent *error_event) +static int XftGetImageErrorHandler (Display *dpy _X_UNUSED, XErrorEvent *error_event _X_UNUSED) { return 0; } diff --git a/lib/libXft/src/xftdpy.c b/lib/libXft/src/xftdpy.c index 923fa6b66..2d3d0f615 100644 --- a/lib/libXft/src/xftdpy.c +++ b/lib/libXft/src/xftdpy.c @@ -22,10 +22,12 @@ #include "xftint.h" +#define BtoS(b) ((b) ? "true" : "false") + _X_HIDDEN XftDisplayInfo *_XftDisplayInfo; static int -_XftCloseDisplay (Display *dpy, XExtCodes *codes) +_XftCloseDisplay (Display *dpy, XExtCodes *codes _X_UNUSED) { XftDisplayInfo *info, **prev; @@ -51,7 +53,8 @@ _XftCloseDisplay (Display *dpy, XExtCodes *codes) for (prev = &_XftDisplayInfo; (info = *prev); prev = &(*prev)->next) if (info->display == dpy) break; - *prev = info->next; + if (info != NULL) + *prev = info->next; free (info); return 0; @@ -85,7 +88,7 @@ _XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary) if (!createIfNecessary) return NULL; - info = (XftDisplayInfo *) malloc (sizeof (XftDisplayInfo)); + info = malloc (sizeof (XftDisplayInfo)); if (!info) goto bail0; info->codes = XAddExtension (dpy); @@ -169,7 +172,7 @@ _XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary) XFT_MAX_GLYPH_MEMORY, 0, XFT_DPY_MAX_GLYPH_MEMORY); if (XftDebug () & XFT_DBG_CACHE) - printf ("global max cache memory %ld\n", info->max_glyph_memory); + printf ("global max cache memory %lu\n", info->max_glyph_memory); info->num_unref_fonts = 0; @@ -177,7 +180,14 @@ _XftDisplayInfoGet (Display *dpy, FcBool createIfNecessary) XFT_MAX_UNREF_FONTS, 0, XFT_DPY_MAX_UNREF_FONTS); if (XftDebug() & XFT_DBG_CACHE) - printf ("global max unref fonts %d\n", info->max_unref_fonts); + printf ("global max unref fonts %d\n", info->max_unref_fonts); + + info->track_mem_usage = FcFalse; + info->track_mem_usage = XftDefaultGetBool (dpy, + XFT_TRACK_MEM_USAGE, 0, + FcFalse); + if (XftDebug() & XFT_DBG_CACHE) + printf ("global track mem usage %s\n", BtoS(info->track_mem_usage)); memset (info->fontHash, '\0', sizeof (XftFont *) * XFT_NUM_FONT_HASH); return info; @@ -210,7 +220,7 @@ _XftDisplayValidateMemory (XftDisplayInfo *info) glyph_memory += font->glyph_memory; } if (glyph_memory != info->glyph_memory) - printf ("Display glyph cache incorrect has %ld bytes, should have %ld\n", + printf ("Display glyph cache incorrect has %lu bytes, should have %lu\n", info->glyph_memory, glyph_memory); } @@ -227,7 +237,7 @@ _XftDisplayManageMemory (Display *dpy) if (XftDebug () & XFT_DBG_CACHE) { if (info->glyph_memory > info->max_glyph_memory) - printf ("Reduce global memory from %ld to %ld\n", + printf ("Reduce global memory from %lu to %lu\n", info->glyph_memory, info->max_glyph_memory); _XftDisplayValidateMemory (info); } @@ -272,16 +282,29 @@ XftDefaultSet (Display *dpy, FcPattern *defaults) if (info->defaults) FcPatternDestroy (info->defaults); info->defaults = defaults; + if (!info->max_glyph_memory) info->max_glyph_memory = XFT_DPY_MAX_GLYPH_MEMORY; info->max_glyph_memory = (unsigned long)XftDefaultGetInteger (dpy, XFT_MAX_GLYPH_MEMORY, 0, (int)info->max_glyph_memory); + if (XftDebug () & XFT_DBG_CACHE) + printf ("update max cache memory %lu\n", info->max_glyph_memory); + if (!info->max_unref_fonts) info->max_unref_fonts = XFT_DPY_MAX_UNREF_FONTS; info->max_unref_fonts = XftDefaultGetInteger (dpy, XFT_MAX_UNREF_FONTS, 0, info->max_unref_fonts); + if (XftDebug() & XFT_DBG_CACHE) + printf ("update max unref fonts %d\n", info->max_unref_fonts); + + info->track_mem_usage = XftDefaultGetBool (dpy, + XFT_TRACK_MEM_USAGE, 0, + info->track_mem_usage); + if (XftDebug() & XFT_DBG_CACHE) + printf ("update track mem usage %s\n", BtoS(info->track_mem_usage)); + return True; } diff --git a/lib/libXft/src/xftdraw.c b/lib/libXft/src/xftdraw.c index c79f213c9..0914dfbdb 100644 --- a/lib/libXft/src/xftdraw.c +++ b/lib/libXft/src/xftdraw.c @@ -112,7 +112,7 @@ XftDrawBitsPerPixel (XftDraw *draw) for (i = 0; i < nformats; i++) { - if (formats[i].depth == depth) + if ((unsigned) formats[i].depth == depth) { draw->bits_per_pixel = (unsigned)formats[i].bits_per_pixel; break; @@ -132,7 +132,7 @@ XftDrawCreate (Display *dpy, { XftDraw *draw; - draw = (XftDraw *) malloc (sizeof (XftDraw)); + draw = malloc (sizeof (XftDraw)); if (!draw) return NULL; @@ -158,7 +158,7 @@ XftDrawCreateBitmap (Display *dpy, { XftDraw *draw; - draw = (XftDraw *) malloc (sizeof (XftDraw)); + draw = malloc (sizeof (XftDraw)); if (!draw) return NULL; draw->dpy = dpy; @@ -184,7 +184,7 @@ XftDrawCreateAlpha (Display *dpy, { XftDraw *draw; - draw = (XftDraw *) malloc (sizeof (XftDraw)); + draw = malloc (sizeof (XftDraw)); if (!draw) return NULL; draw->dpy = dpy; @@ -324,8 +324,8 @@ XftDrawSrcPicture (XftDraw *draw, _Xconst XftColor *color) { if (info->colors[i].pict && info->colors[i].screen == draw->screen && - !memcmp ((void *) &color->color, - (void *) &info->colors[i].color, + !memcmp ((const void *) &color->color, + (const void *) &info->colors[i].color, sizeof (XRenderColor))) return info->colors[i].pict; } @@ -525,7 +525,7 @@ XftDrawString8 (XftDraw *draw, glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) return; } @@ -548,11 +548,14 @@ XftDrawString16 (XftDraw *draw, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) return; } @@ -576,11 +579,14 @@ XftDrawString32 (XftDraw *draw, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) return; } @@ -607,6 +613,9 @@ XftDrawStringUtf8 (XftDraw *draw, int l; int size; + if (len <= 0) + return; + i = 0; glyphs = glyphs_local; size = NUM_LOCAL; @@ -614,7 +623,7 @@ XftDrawStringUtf8 (XftDraw *draw, { if (i == size) { - glyphs_new = malloc ((size_t)size * 2 * sizeof (FT_UInt)); + glyphs_new = AllocUIntArray (size * 2); if (!glyphs_new) { if (glyphs != glyphs_local) @@ -652,6 +661,9 @@ XftDrawStringUtf16 (XftDraw *draw, int l; int size; + if (len <= 0) + return; + i = 0; glyphs = glyphs_local; size = NUM_LOCAL; @@ -659,7 +671,7 @@ XftDrawStringUtf16 (XftDraw *draw, { if (i == size) { - glyphs_new = malloc ((size_t)size * 2 * sizeof (FT_UInt)); + glyphs_new = AllocUIntArray (size * 2); if (!glyphs_new) { if (glyphs != glyphs_local) @@ -755,11 +767,14 @@ XftDrawCharSpec (XftDraw *draw, XftGlyphSpec *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (XftGlyphSpec)); + glyphs = AllocGlyphSpecArray (len); if (!glyphs) return; } @@ -784,11 +799,14 @@ XftDrawCharFontSpec (XftDraw *draw, XftGlyphFontSpec *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (XftGlyphFontSpec)); + glyphs = AllocGlyphFontSpecArray (len); if (!glyphs) return; } diff --git a/lib/libXft/src/xftextent.c b/lib/libXft/src/xftextent.c index 1f84757ac..d30b95eb3 100644 --- a/lib/libXft/src/xftextent.c +++ b/lib/libXft/src/xftextent.c @@ -123,11 +123,14 @@ XftTextExtents8 (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len < 0) + return; + if (len <= NUM_LOCAL) - glyphs = glyphs_local; + *(glyphs = glyphs_local) = 0; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) { memset (extents, '\0', sizeof (XGlyphInfo)); @@ -151,11 +154,14 @@ XftTextExtents16 (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len < 0) + return; + if (len <= NUM_LOCAL) - glyphs = glyphs_local; + *(glyphs = glyphs_local) = 0; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) { memset (extents, '\0', sizeof (XGlyphInfo)); @@ -179,11 +185,14 @@ XftTextExtents32 (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len < 0) + return; + if (len <= NUM_LOCAL) - glyphs = glyphs_local; + *(glyphs = glyphs_local) = 0; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) { memset (extents, '\0', sizeof (XGlyphInfo)); @@ -210,14 +219,17 @@ XftTextExtentsUtf8 (Display *dpy, int l; int size; + if (len < 0) + return; + i = 0; - glyphs = glyphs_local; + *(glyphs = glyphs_local) = 0; size = NUM_LOCAL; while (len && (l = FcUtf8ToUcs4 (string, &ucs4, len)) > 0) { if (i == size) { - glyphs_new = malloc ((size_t)size * 2 * sizeof (FT_UInt)); + glyphs_new = AllocUIntArray (size * 2); if (!glyphs_new) { if (glyphs != glyphs_local) @@ -254,14 +266,17 @@ XftTextExtentsUtf16 (Display *dpy, int l; int size; + if (len < 0) + return; + i = 0; - glyphs = glyphs_local; + *(glyphs = glyphs_local) = 0; size = NUM_LOCAL; while (len && (l = FcUtf16ToUcs4 (string, endian, &ucs4, len)) > 0) { if (i == size) { - glyphs_new = malloc ((size_t)size * 2 * sizeof (FT_UInt)); + glyphs_new = AllocUIntArray (size * 2); if (!glyphs_new) { if (glyphs != glyphs_local) diff --git a/lib/libXft/src/xftfont.c b/lib/libXft/src/xftfont.c index d361498db..7a944e3fe 100644 --- a/lib/libXft/src/xftfont.c +++ b/lib/libXft/src/xftfont.c @@ -120,7 +120,7 @@ XftFontOpenName (Display *dpy, int screen, const char *name) FcResult result; XftFont *font; - pat = FcNameParse ((FcChar8 *) name); + pat = FcNameParse ((const FcChar8 *) name); if (XftDebug () & XFT_DBG_OPEN) { printf ("XftFontOpenName \"%s\": ", name); diff --git a/lib/libXft/src/xftfreetype.c b/lib/libXft/src/xftfreetype.c index 1246605a4..75c2f5f52 100644 --- a/lib/libXft/src/xftfreetype.c +++ b/lib/libXft/src/xftfreetype.c @@ -1,23 +1,24 @@ /* + * Copyright © 2022 Thomas E. Dickey * Copyright © 2000 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the above copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The above copyright holders make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. + * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "xftint.h" @@ -45,7 +46,7 @@ _XftGetFile (const FcChar8 *file, int id) for (f = _XftFtFiles; f; f = f->next) { - if (!strcmp (f->file, (char *) file) && f->id == id) + if (!strcmp (f->file, (const char *) file) && f->id == id) { ++f->ref; if (XftDebug () & XFT_DBG_REF) @@ -54,11 +55,11 @@ _XftGetFile (const FcChar8 *file, int id) return f; } } - f = malloc (sizeof (XftFtFile) + strlen ((char *) file) + 1); + f = malloc (sizeof (XftFtFile) + strlen ((const char *) file) + 1); if (!f) return NULL; - XftMemAlloc (XFT_MEM_FILE, (int)(sizeof (XftFtFile) + strlen ((char *) file) + 1)); + XftMemAlloc (XFT_MEM_FILE, sizeof (XftFtFile) + strlen ((const char *) file) + 1); if (XftDebug () & XFT_DBG_REF) printf ("FontFile %s/%d matches new\n", file, id); @@ -68,7 +69,7 @@ _XftGetFile (const FcChar8 *file, int id) f->ref = 1; f->file = (char *) (f+1); - strcpy (f->file, (char *) file); + strcpy (f->file, (const char *) file); f->id = id; f->lock = 0; @@ -87,7 +88,7 @@ _XftGetFaceFile (FT_Face face) f = malloc (sizeof (XftFtFile)); if (!f) return NULL; - XftMemAlloc (XFT_MEM_FILE, sizeof(XftFtFile)); + XftMemAlloc (XFT_MEM_FILE, sizeof (XftFtFile)); f->next = NULL; f->ref = 1; @@ -366,10 +367,10 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi) { XftDisplayInfo *info = _XftDisplayInfoGet (dpy, True); FcChar8 *filename; - int id; + int id, mid; double dsize; double aspect; - FcMatrix *font_matrix; + FcMatrix *font_matrix, fm1; FcBool hinting, vertical_layout, autohint, global_advance; int hint_style; FcChar32 hash, *hashp; @@ -385,7 +386,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi) * hash or XftFontInfoEqual(). */ - memset (fi, '\0', sizeof(*fi)); + memset (fi, '\0', sizeof (*fi)); /* * Find the associated file @@ -432,7 +433,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi) if (XftDebug() & XFT_DBG_OPEN) printf ("XftFontInfoFill: %s: %d (%g pixels)\n", - (filename ? filename : (FcChar8 *) "<none>"), id, dsize); + (filename ? filename : (const FcChar8 *) "<none>"), id, dsize); /* * Get antialias value */ @@ -490,6 +491,22 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi) goto bail1; } + mid = 1; + while (FcPatternGetMatrix (pattern, FC_MATRIX, mid, &font_matrix) == FcResultMatch) { + FcMatrixInit(&fm1); +#define PreScale(value) ((double) (value) / (double) 0x10000L) + fm1.xx = PreScale(fi->matrix.xx); + fm1.yy = PreScale(fi->matrix.yy); + fm1.xy = PreScale(fi->matrix.xy); + fm1.yx = PreScale(fi->matrix.yx); + FcMatrixMultiply(&fm1, font_matrix, &fm1); + fi->matrix.xx = (FT_Fixed)(0x10000L * fm1.xx); + fi->matrix.yy = (FT_Fixed)(0x10000L * fm1.yy); + fi->matrix.xy = (FT_Fixed)(0x10000L * fm1.xy); + fi->matrix.yx = (FT_Fixed)(0x10000L * fm1.yx); + mid++; + } + fi->transform = (fi->matrix.xx != 0x10000 || fi->matrix.xy != 0 || fi->matrix.yx != 0 || fi->matrix.yy != 0x10000); @@ -523,7 +540,7 @@ XftFontInfoFill (Display *dpy, _Xconst FcPattern *pattern, XftFontInfo *fi) /* * Compute glyph load flags */ - fi->load_flags = FT_LOAD_DEFAULT; + fi->load_flags = FT_LOAD_DEFAULT | FT_LOAD_COLOR; #ifndef XFT_EMBEDDED_BITMAP #define XFT_EMBEDDED_BITMAP "embeddedbitmap" @@ -717,7 +734,7 @@ bail0: } static void -XftFontInfoEmpty (Display *dpy, XftFontInfo *fi) +XftFontInfoEmpty (Display *dpy _X_UNUSED, XftFontInfo *fi) { if (fi->file) _XftReleaseFile (fi->file); @@ -757,7 +774,7 @@ XftFontInfoHash (_Xconst XftFontInfo *fi) _X_EXPORT FcBool XftFontInfoEqual (_Xconst XftFontInfo *a, _Xconst XftFontInfo *b) { - return memcmp ((void *) a, (void *) b, sizeof (XftFontInfo)) == 0; + return memcmp ((const void *) a, (const void *) b, sizeof (XftFontInfo)) == 0; } _X_EXPORT XftFont * @@ -775,11 +792,12 @@ XftFontOpenInfo (Display *dpy, FcChar32 hash_value; FcChar32 rehash_value; FcBool antialias; + FcBool color; int max_glyph_memory; - int alloc_size; + size_t alloc_size; int ascent, descent, height; int i; - int num_glyphs; + FT_UInt num_glyphs; if (!info) return NULL; @@ -831,12 +849,18 @@ XftFontOpenInfo (Display *dpy, if (!(face->face_flags & FT_FACE_FLAG_SCALABLE)) antialias = FcFalse; + color = FT_HAS_COLOR(face) ? FcTrue : FcFalse; + /* * Find the appropriate picture format */ if (fi->render) { - if (antialias) + if (color) + { + format = XRenderFindStandardFormat (dpy, PictStandardARGB32); + } + else if (antialias) { switch (fi->rgba) { case FC_RGBA_RGB: @@ -869,7 +893,6 @@ XftFontOpenInfo (Display *dpy, } else { - num_unicode = 0; hash_value = 0; rehash_value = 0; } @@ -878,11 +901,11 @@ XftFontOpenInfo (Display *dpy, * Sometimes the glyphs are numbered 1..n, other times 0..n-1, * accept either numbering scheme by making room in the table */ - num_glyphs = (int)face->num_glyphs + 1; + num_glyphs = (FT_UInt)face->num_glyphs + 1; alloc_size = (sizeof (XftFontInt) + (size_t)num_glyphs * sizeof (XftGlyph *) + hash_value * sizeof (XftUcsHash)); - font = malloc ((size_t)alloc_size); + font = malloc (alloc_size); if (!font) goto bail2; @@ -968,6 +991,13 @@ XftFontOpenInfo (Display *dpy, * which doesn't happen in XftFontInfoFill */ font->info.antialias = antialias; + + /* + * Set color value, which is only known once the + * font was loaded + */ + font->info.color = color; + /* * bump XftFile reference count */ @@ -980,10 +1010,15 @@ XftFontOpenInfo (Display *dpy, memset (font->glyphs, '\0', (size_t)num_glyphs * sizeof (XftGlyph *)); font->num_glyphs = num_glyphs; /* + * Memory-usage tracking + */ + font->newest = FT_UINT_MAX; + font->total_inuse = 0; + /* * Unicode hash table information */ font->hash_table = (XftUcsHash *) (font->glyphs + font->num_glyphs); - for (i = 0; i < hash_value; i++) + for (i = 0; (FcChar32) i < hash_value; i++) { font->hash_table[i].ucs4 = ((FcChar32) ~0); font->hash_table[i].glyph = 0; @@ -999,9 +1034,13 @@ XftFontOpenInfo (Display *dpy, /* * Glyph memory management fields */ - font->glyph_memory = 0; + font->glyph_memory = 0; font->max_glyph_memory = (unsigned long)max_glyph_memory; - font->use_free_glyphs = info->use_free_glyphs; + font->track_mem_usage = info->track_mem_usage; + font->use_free_glyphs = info->use_free_glyphs; + font->sizeof_glyph = (font->track_mem_usage + ? sizeof(XftGlyphUsage) + : sizeof(XftGlyph)); _XftUnlockFile (fi->file); @@ -1030,7 +1069,7 @@ XftFontOpenPattern (Display *dpy, FcPattern *pattern) } _X_EXPORT XftFont * -XftFontCopy (Display *dpy, XftFont *public) +XftFontCopy (Display *dpy _X_UNUSED, XftFont *public) { XftFontInt *font = (XftFontInt *) public; @@ -1043,7 +1082,7 @@ XftFontDestroy (Display *dpy, XftFont *public) { XftDisplayInfo *info = _XftDisplayInfoGet (dpy, False); XftFontInt *font = (XftFontInt *) public; - int i; + FT_UInt i; /* note reduction in memory use */ if (info) diff --git a/lib/libXft/src/xftglyphs.c b/lib/libXft/src/xftglyphs.c index c3ee98a59..d928a702f 100644 --- a/lib/libXft/src/xftglyphs.c +++ b/lib/libXft/src/xftglyphs.c @@ -1,23 +1,24 @@ /* + * Copyright © 2022 Thomas E. Dickey * Copyright © 2000 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the above copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The above copyright holders make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. + * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "xftint.h" @@ -26,12 +27,54 @@ #include FT_SYNTHESIS_H +#include FT_GLYPH_H + +typedef double m3x3[3][3]; + +static void +m3x3_uniform(m3x3 m) +{ + m[0][0] = m[1][1] = m[2][2] = 1.0; + m[0][1] = m[1][0] = m[0][2] = m[1][2] = m[2][0] = m[2][1] = 0; +} + +static void +m3x3_transform(FT_Vector *v, m3x3 m) +{ + double x, y; + + x = (double)v->x; + y = (double)v->y; + v->x = (FT_Pos)(x * m[0][0] + y * m[0][1] + m[0][2] + 0.5); + v->y = (FT_Pos)(x * m[1][0] + y * m[1][1] + m[1][2] + 0.5); +} + +static void +m3x3_invert(m3x3 m, m3x3 mi) +{ + double det; + + det = m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1]); + det -= m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0]); + det += m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]); + det = 1.0 / det; + mi[0][0] = det * (m[1][1] * m[2][2] - m[1][2] * m[2][1]); + mi[1][0] = det * (m[1][2] * m[2][0] - m[1][0] * m[2][2]); + mi[2][0] = det * (m[1][0] * m[2][1] - m[1][1] * m[2][0]); + mi[0][1] = det * (m[0][2] * m[2][1] - m[0][1] * m[2][2]); + mi[1][1] = det * (m[0][0] * m[2][2] - m[0][2] * m[2][0]); + mi[2][1] = det * (m[0][1] * m[2][0] - m[0][0] * m[2][1]); + mi[0][2] = det * (m[0][1] * m[1][2] - m[0][2] * m[1][1]); + mi[1][2] = det * (m[0][2] * m[1][0] - m[0][0] * m[1][2]); + mi[2][2] = det * (m[0][0] * m[1][1] - m[0][1] * m[1][0]); +} + /* * Validate the memory info for a font */ static void -_XftFontValidateMemory (Display *dpy, XftFont *public) +_XftFontValidateMemory (Display *dpy _X_UNUSED, XftFont *public) { XftFontInt *font = (XftFontInt *) public; unsigned long glyph_memory; @@ -48,10 +91,72 @@ _XftFontValidateMemory (Display *dpy, XftFont *public) } } if (glyph_memory != font->glyph_memory) - printf ("Font glyph cache incorrect has %ld bytes, should have %ld\n", + printf ("Font glyph cache incorrect has %lu bytes, should have %lu\n", font->glyph_memory, glyph_memory); } +/* + * Validate the glyph usage-links for a font. + */ +static void +_XftValidateGlyphUsage(XftFontInt *font) +{ + if (font->newest != FT_UINT_MAX) { + FT_UInt forward; + FT_UInt reverse; + FT_UInt next; + XftGlyphUsage *x1st = (XftGlyphUsage *) font->glyphs[font->newest]; + XftGlyphUsage *xuse = x1st; + for (forward = 1, + next = x1st->newer; + xuse != NULL && + next != font->newest; + next = xuse->newer) { + if (next >= font->num_glyphs) { + printf("Xft: out of range; %d\n", next); + break; + } + if (++forward > font->total_inuse) { + printf("Xft: too many in-use glyphs (%d vs %d)\n", + forward, font->total_inuse); + if (forward > font->total_inuse + 10) + break; + } + xuse = (XftGlyphUsage *) font->glyphs[next]; + } + if (forward < font->total_inuse) { + printf("Xft: too few in-use glyphs (%u vs %d)\n", + forward, font->total_inuse); + } + for (reverse = 1, + next = x1st->older; + xuse != NULL && + next != font->newest; + next = xuse->older) { + if (next >= font->num_glyphs) { + printf("Xft out of range; %d\n", next); + break; + } + if (++reverse > font->total_inuse) { + printf("Xft: too many in-use glyphs (%d vs %d)\n", + reverse, font->total_inuse); + if (reverse > font->total_inuse + 10) + break; + } + xuse = (XftGlyphUsage *) font->glyphs[next]; + } + if (reverse < font->total_inuse) { + printf("Xft: too few in-use glyphs (%u vs %d)\n", + reverse, font->total_inuse); + } + if (forward != reverse) { + printf("Xft: forward %d vs reverse %d\n", + forward, reverse); + exit(1); + } + } +} + /* we sometimes need to convert the glyph bitmap in a FT_GlyphSlot * into a different format. For example, we want to convert a * FT_PIXEL_MODE_LCD or FT_PIXEL_MODE_LCD_V bitmap into a 32-bit @@ -78,7 +183,9 @@ _XftFontValidateMemory (Display *dpy, XftFont *public) static int _compute_xrender_bitmap_size( FT_Bitmap* target, FT_GlyphSlot slot, - FT_Render_Mode mode ) + FT_Render_Mode mode, + FT_Matrix* matrix, + m3x3 m ) { FT_Bitmap* ftbit; int width, height, pitch; @@ -91,6 +198,63 @@ _compute_xrender_bitmap_size( FT_Bitmap* target, width = (int)ftbit->width; height = (int)ftbit->rows; + + if ( matrix && mode == FT_RENDER_MODE_NORMAL ) + { + FT_Matrix mirror, inverse; + FT_Vector vector; + int xc, yc; + int left, right, top, bottom; + + left = right = top = bottom = 0; + for (xc = 0; xc <= 1; xc++) { + for (yc = 0; yc <= 1; yc++) { + vector.x = xc * width; + vector.y = yc * height; + FT_Vector_Transform(&vector, matrix); + if (xc == 0 && yc == 0) { + left = right = (int)vector.x; + top = bottom = (int)vector.y; + } else { + if (left > vector.x) left = (int)vector.x; + if (right < vector.x) right = (int)vector.x; + if (bottom > vector.y) bottom = (int)vector.y; + if (top < vector.y) top = (int)vector.y; + } + } + } + width = (int)(right - left); + height = (int)(top - bottom); + + mirror.xx = + 0x10000; + mirror.yy = - 0x10000; + mirror.xy = mirror.yx = 0; + inverse = *matrix; + FT_Matrix_Multiply(&mirror, &inverse); + FT_Matrix_Invert(&inverse); + FT_Matrix_Multiply(&mirror, &inverse); + + vector.x = vector.y = 0; + FT_Vector_Transform(&vector, &inverse); + left = (int)vector.x; + bottom = (int)vector.y; + vector.x = width; + vector.y = height; + FT_Vector_Transform(&vector, &inverse); + right = (int)vector.x; + top = (int)vector.y; + left = (right - left) - (int)ftbit->width; + bottom = (top - bottom) - (int)ftbit->rows; + + m[0][0] = (double)inverse.xx / 0x10000; + m[0][1] = (double)inverse.xy / 0x10000; + m[1][0] = (double)inverse.yx / 0x10000; + m[1][1] = (double)inverse.yy / 0x10000; + m[0][2] = (double)-left / 2; + m[1][2] = (double)-bottom / 2; + m[2][0] = m[2][1] = 0.0; + m[2][2] = 1.0; + } pitch = (width+3) & ~3; switch ( ftbit->pixel_mode ) @@ -112,6 +276,10 @@ _compute_xrender_bitmap_size( FT_Bitmap* target, } break; + case FT_PIXEL_MODE_BGRA: + pitch = width * 4; + break; + case FT_PIXEL_MODE_LCD: if ( mode != FT_RENDER_MODE_LCD ) return -1; @@ -143,6 +311,125 @@ _compute_xrender_bitmap_size( FT_Bitmap* target, } /* this functions converts the glyph bitmap found in a FT_GlyphSlot + * into a different format while scaling by applying the given matrix + * (see _compute_xrender_bitmap_size) + * + * you should call this function after _compute_xrender_bitmap_size + * + * target :: target bitmap descriptor. Note that its 'buffer' pointer + * must point to memory allocated by the caller + * + * source :: the source bitmap descriptor + * + * matrix :: the scaling matrix to apply + */ +static void +_scaled_fill_xrender_bitmap( FT_Bitmap* target, + FT_Bitmap* source, + m3x3 m ) +{ + unsigned char* src_buf = source->buffer; + unsigned char* dst_line = target->buffer; + int src_pitch = source->pitch; + int width = (int) target->width; + int height = (int) target->rows; + int pitch = target->pitch; + int i, x, y; + FT_Vector vector, vector0; + int sampling_width; + int sampling_height; + int sample_count; + + if ( src_pitch < 0 ) + src_buf -= ((unsigned) src_pitch * (source->rows - 1)); + + /* compute how many source pixels a target pixel spans */ + vector.x = 1; + vector.y = 1; + m3x3_transform(&vector, m); + vector0.x = 0; + vector0.y = 0; + m3x3_transform(&vector0, m); + sampling_width = (int) ((vector.x - vector0.x) / 2); + sampling_height = (int) ((vector.y - vector0.y) / 2); + if (sampling_width < 0) sampling_width = -sampling_width; + if (sampling_height < 0) sampling_height = -sampling_height; + sample_count = (2 * sampling_width + 1) * (2 * sampling_height + 1); + + for ( y = height; y > 0; y--, dst_line += pitch ) + { + for ( x = 0; x < width; x++ ) + { + unsigned char* src; + + /* compute target pixel location in source space */ + vector.x = x; + vector.y = height - y; + m3x3_transform(&vector, m); + + if (source->pixel_mode == FT_PIXEL_MODE_BGRA) + { + if (vector.x < -sampling_width + || vector.x > (source->width + (unsigned) sampling_width)) + continue; + if (vector.y < -sampling_height + || vector.y > (source->rows + (unsigned) sampling_height)) + continue; + } + else + { + if (vector.x < 0 || vector.x >= source->width) + continue; + if (vector.y < 0 || vector.y >= source->rows) + continue; + } + + switch ( source->pixel_mode ) + { + case FT_PIXEL_MODE_MONO: /* convert mono to 8-bit gray, scale using nearest pixel */ + src = src_buf + (vector.y * src_pitch); + if ( src[(vector.x >> 3)] & (0x80 >> (vector.x & 7)) ) + dst_line[x] = 0xff; + break; + + case FT_PIXEL_MODE_GRAY: /* scale using nearest pixel */ + src = src_buf + (vector.y * src_pitch); + dst_line[x] = src[vector.x]; + break; + + case FT_PIXEL_MODE_BGRA: /* scale by averaging all relevant source pixels, keep BGRA format */ + { + int sample_x, sample_y; + int bgra[4] = { 0, 0, 0, 0 }; + + for (sample_y = - sampling_height; sample_y < sampling_height + 1; ++sample_y) + { + int src_y = (int) (vector.y + sample_y); + + if (src_y < 0 || (FT_Pos) src_y >= source->rows) + continue; + src = src_buf + (src_y * src_pitch); + for (sample_x = - sampling_width; sample_x < sampling_width + 1; ++sample_x) + { + int src_x = (int) (vector.x + sample_x); + + if (src_x < 0 || (FT_Pos) src_x >= source->width) + continue; + for (i = 0; i < 4; ++i) + bgra[i] += src[src_x * 4 + i]; + } + } + + for (i = 0; i < 4; ++i) + dst_line[4 * x + i] = (unsigned char) (bgra[i] / sample_count); + break; + } + } + } + } +} + +/* this functions converts the glyph bitmap found in a FT_GlyphSlot * into a different format (see _compute_xrender_bitmap_size) * * you should call this function after _compute_xrender_bitmap_size @@ -166,15 +453,15 @@ _fill_xrender_bitmap( FT_Bitmap* target, { unsigned char* srcLine = ftbit->buffer; - unsigned char* dstLine = target->buffer; - int src_pitch = ftbit->pitch; - int width = (int)target->width; - int height = (int)target->rows; - int pitch = target->pitch; - int subpixel; - int h; - - subpixel = ( mode == FT_RENDER_MODE_LCD || + unsigned char* dstLine = target->buffer; + int src_pitch = ftbit->pitch; + int width = (int)target->width; + int height = (int)target->rows; + int pitch = target->pitch; + int subpixel; + int h; + + subpixel = ( mode == FT_RENDER_MODE_LCD || mode == FT_RENDER_MODE_LCD_V ); if ( src_pitch < 0 ) @@ -244,6 +531,11 @@ _fill_xrender_bitmap( FT_Bitmap* target, } break; + case FT_PIXEL_MODE_BGRA: /* Preserve BGRA format */ + for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch ) + memcpy( dstLine, srcLine, (size_t) width * 4 ); + break; + case FT_PIXEL_MODE_LCD: if ( !bgr ) { @@ -363,8 +655,11 @@ XftFontLoadGlyphs (Display *dpy, FT_Bitmap* ftbit; FT_Bitmap local; FT_Vector vector; + m3x3 m; FT_Face face; FT_Render_Mode mode = FT_RENDER_MODE_MONO; + FcBool transform; + FcBool glyph_transform; if (!info) return; @@ -374,6 +669,8 @@ XftFontLoadGlyphs (Display *dpy, if (!face) return; + if (font->info.color) + mode = FT_RENDER_MODE_NORMAL; if (font->info.antialias) { switch (font->info.rgba) { @@ -390,6 +687,8 @@ XftFontLoadGlyphs (Display *dpy, } } + transform = font->info.transform && mode != FT_RENDER_MODE_MONO; + while (nglyph--) { glyphindex = *glyphs++; @@ -440,29 +739,29 @@ XftFontLoadGlyphs (Display *dpy, /* * Compute glyph metrics from FreeType information */ - if(font->info.transform && glyphslot->format != FT_GLYPH_FORMAT_BITMAP) + if (transform) { /* * calculate the true width by transforming all four corners. */ int xc, yc; left = right = top = bottom = 0; - for(xc = 0; xc <= 1; xc ++) { - for(yc = 0; yc <= 1; yc++) { + for (xc = 0; xc <= 1; xc++) { + for (yc = 0; yc <= 1; yc++) { vector.x = glyphslot->metrics.horiBearingX + xc * glyphslot->metrics.width; vector.y = glyphslot->metrics.horiBearingY - yc * glyphslot->metrics.height; FT_Vector_Transform(&vector, &font->info.matrix); if (XftDebug() & XFT_DBG_GLYPH) printf("Trans %d %d: %d %d\n", (int) xc, (int) yc, (int) vector.x, (int) vector.y); - if(xc == 0 && yc == 0) { + if (xc == 0 && yc == 0) { left = right = (int)vector.x; top = bottom = (int)vector.y; } else { - if(left > vector.x) left = (int)vector.x; - if(right < vector.x) right = (int)vector.x; - if(bottom > vector.y) bottom = (int)vector.y; - if(top < vector.y) top = (int)vector.y; + if (left > vector.x) left = (int)vector.x; + if (right < vector.x) right = (int)vector.x; + if (bottom > vector.y) bottom = (int)vector.y; + if (top < vector.y) top = (int)vector.y; } } @@ -470,7 +769,7 @@ XftFontLoadGlyphs (Display *dpy, left = (int)FLOOR(left); right = (int)CEIL(right); bottom = (int)FLOOR(bottom); - top = CEIL(top); + top = (int)CEIL(top); } else { left = (int)FLOOR( glyphslot->metrics.horiBearingX ); @@ -480,14 +779,11 @@ XftFontLoadGlyphs (Display *dpy, bottom = (int)FLOOR( glyphslot->metrics.horiBearingY - glyphslot->metrics.height ); } - width = TRUNC(right - left); - height = TRUNC( top - bottom ); - /* * Clip charcell glyphs to the bounding box * XXX transformed? */ - if (font->info.spacing >= FC_CHARCELL && !font->info.transform) + if (font->info.spacing >= FC_CHARCELL && !transform) { if (font->info.load_flags & FT_LOAD_VERTICAL_LAYOUT) { @@ -500,7 +796,6 @@ XftFontLoadGlyphs (Display *dpy, adjust = top; top -= adjust; bottom -= adjust; - height = font->public.max_advance_width; } } else @@ -514,23 +809,24 @@ XftFontLoadGlyphs (Display *dpy, adjust = left; left -= adjust; right -= adjust; - width = font->public.max_advance_width; } } } + glyph_transform = transform; if ( glyphslot->format != FT_GLYPH_FORMAT_BITMAP ) { error = FT_Render_Glyph( face->glyph, mode ); if (error) continue; + glyph_transform = False; } FT_Library_SetLcdFilter( _XftFTlibrary, FT_LCD_FILTER_NONE ); if (font->info.spacing >= FC_MONO) { - if (font->info.transform) + if (transform) { if (font->info.load_flags & FT_LOAD_VERTICAL_LAYOUT) { @@ -542,9 +838,9 @@ XftFontLoadGlyphs (Display *dpy, vector.x = face->size->metrics.max_advance; vector.y = 0; } - FT_Vector_Transform (&vector, &font->info.matrix); - xftg->metrics.xOff = (short)(vector.x >> 6); - xftg->metrics.yOff = (short)(-(vector.y >> 6)); + FT_Vector_Transform(&vector, &font->info.matrix); + xftg->metrics.xOff = (short)(TRUNC(ROUND(vector.x))); + xftg->metrics.yOff = (short)(TRUNC(ROUND(vector.y))); } else { @@ -603,7 +899,7 @@ XftFontLoadGlyphs (Display *dpy, { for (x = 0; x < width * 8; x++) { - printf ("%c", line[x>>3] & (1 << (x & 7)) ? '#' : ' '); + printf ("%c", (line[x>>3] & (1 << (x & 7))) ? '#' : ' '); } } printf ("|\n"); @@ -613,20 +909,35 @@ XftFontLoadGlyphs (Display *dpy, } } - size = _compute_xrender_bitmap_size( &local, glyphslot, mode ); + m3x3_uniform(m); + size = _compute_xrender_bitmap_size( &local, glyphslot, mode, glyph_transform ? &font->info.matrix : NULL, m ); if ( size < 0 ) continue; xftg->metrics.width = (unsigned short)local.width; xftg->metrics.height = (unsigned short)local.rows; - xftg->metrics.x = (short)(- glyphslot->bitmap_left); - xftg->metrics.y = (short)( glyphslot->bitmap_top); + if (glyph_transform) + { + m3x3 mi; + + m3x3_invert(m, mi); + vector.x = - glyphslot->bitmap_left; + vector.y = glyphslot->bitmap_top; + m3x3_transform(&vector, mi); + xftg->metrics.x = (short)vector.x; + xftg->metrics.y = (short)vector.y; + } + else + { + xftg->metrics.x = (short)(- glyphslot->bitmap_left); + xftg->metrics.y = (short)( glyphslot->bitmap_top); + } /* * If the glyph is relatively large (> 1% of server memory), * don't send it until necessary. */ - if (!need_bitmaps && size > info->max_glyph_memory / 100) + if (!need_bitmaps && ((unsigned long) size > (info->max_glyph_memory / 100))) continue; /* @@ -645,9 +956,12 @@ XftFontLoadGlyphs (Display *dpy, local.buffer = bufBitmap; - _fill_xrender_bitmap( &local, glyphslot, mode, - (font->info.rgba == FC_RGBA_BGR || - font->info.rgba == FC_RGBA_VBGR ) ); + if (mode == FT_RENDER_MODE_NORMAL && glyph_transform) + _scaled_fill_xrender_bitmap(&local, &glyphslot->bitmap, m); + else + _fill_xrender_bitmap( &local, glyphslot, mode, + (font->info.rgba == FC_RGBA_BGR || + font->info.rgba == FC_RGBA_VBGR) ); /* * Copy or convert into local buffer. @@ -662,7 +976,12 @@ XftFontLoadGlyphs (Display *dpy, */ glyph = (Glyph) glyphindex; - xftg->glyph_memory = (size_t)size + sizeof (XftGlyph); + if (xftg->picture) + { + XRenderFreePicture(dpy, xftg->picture); + xftg->picture = 0; + } + xftg->glyph_memory = (size_t)size + font->sizeof_glyph; if (font->format) { if (!font->glyphset) @@ -685,15 +1004,43 @@ XftFontLoadGlyphs (Display *dpy, } } } - else if ( mode != FT_RENDER_MODE_NORMAL ) + else if (glyphslot->bitmap.pixel_mode == FT_PIXEL_MODE_BGRA || mode != FT_RENDER_MODE_NORMAL) { /* invert ARGB <=> BGRA */ if (ImageByteOrder (dpy) != XftNativeByteOrder ()) XftSwapCARD32 ((CARD32 *) bufBitmap, size >> 2); } - XRenderAddGlyphs (dpy, font->glyphset, &glyph, - &xftg->metrics, 1, - (char *) bufBitmap, size); + + if (glyphslot->bitmap.pixel_mode == FT_PIXEL_MODE_BGRA) + { + Pixmap pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), local.width, local.rows, 32); + GC gc = XCreateGC(dpy, pixmap, 0, NULL); + XImage image = { + (int) local.width, (int) local.rows, 0, ZPixmap, (char *)bufBitmap, + dpy->byte_order, dpy->bitmap_unit, dpy->bitmap_bit_order, 32, + 32, (int) (local.width * 4 - (unsigned) local.pitch), 32, + 0, 0, 0, NULL, { NULL } + }; + + XInitImage(&image); + XPutImage(dpy, pixmap, gc, &image, 0, 0, 0, 0, local.width, local.rows); + xftg->picture = XRenderCreatePicture(dpy, pixmap, font->format, 0, NULL); + + XFreeGC(dpy, gc); + XFreePixmap(dpy, pixmap); + /* + * Record 256 times higher memory pressure for unrotated + * pictures, and maximum for rotated pictures. + */ + if (font->info.matrix.xy || font->info.matrix.yx) + xftg->glyph_memory += font->max_glyph_memory - (unsigned long) size; + else + xftg->glyph_memory += (size_t)size * 255; + } + else + XRenderAddGlyphs (dpy, font->glyphset, &glyph, + &xftg->metrics, 1, + (char *) bufBitmap, size); } else { @@ -712,8 +1059,46 @@ XftFontLoadGlyphs (Display *dpy, if (XftDebug() & XFT_DBG_CACHE) _XftFontValidateMemory (dpy, pub); if (XftDebug() & XFT_DBG_CACHEV) - printf ("Caching glyph 0x%x size %ld\n", glyphindex, + printf ("Caching glyph 0x%x size %lu\n", glyphindex, xftg->glyph_memory); + + if (font->track_mem_usage) { + XftGlyphUsage *xuse = (XftGlyphUsage *) xftg; + + if (font->newest == FT_UINT_MAX) { + xuse->older = glyphindex; + xuse->newer = glyphindex; + if (XftDebug() & XFT_DBG_USAGE) + printf("alloc %p -> %d: %p USE %d.%d\n", + (void *) font, glyphindex, + (void *) xuse, xuse->older, xuse->newer); + } else { + XftGlyphUsage *xnew; + XftGlyphUsage *xold; + + assert(font->glyphs[font->newest] != NULL); + xnew = (XftGlyphUsage *) font->glyphs[font->newest]; + + assert(font->glyphs[xnew->newer] != NULL); + xold = (XftGlyphUsage *) font->glyphs[xnew->newer]; + + xuse->older = font->newest; + xuse->newer = xnew->newer; + xnew->newer = glyphindex; + xold->older = glyphindex; + if (XftDebug() & XFT_DBG_USAGE) + printf("alloc %p -> %d: %p USE %d.%d, %p NEW %d.%d %p OLD %d.%d\n", + (void *) font, glyphindex, + (void *) xuse, xuse->older, xuse->newer, + (void *) xnew, xnew->older, xnew->newer, + (void *) xold, xold->older, xold->newer); + } + + font->newest = glyphindex; + font->total_inuse++; + if (XftDebug() & XFT_DBG_USAGE) + _XftValidateGlyphUsage(font); + } } if (bufBitmap != bufLocal) free (bufBitmap); @@ -742,9 +1127,14 @@ XftFontUnloadGlyphs (Display *dpy, continue; if (xftg->glyph_memory) { + if (XftDebug() & XFT_DBG_CACHEV) + printf ("Uncaching glyph 0x%x size %lu\n", + glyphindex, xftg->glyph_memory); if (font->format) { - if (font->glyphset) + if (xftg->picture) + XRenderFreePicture(dpy, xftg->picture); + else if (font->glyphset) { glyphBuf[nused++] = (Glyph) glyphindex; if (nused == sizeof (glyphBuf) / sizeof (glyphBuf[0])) @@ -754,17 +1144,52 @@ XftFontUnloadGlyphs (Display *dpy, } } } - else - { - if (xftg->bitmap) - free (xftg->bitmap); - } + else if (xftg->bitmap) + free (xftg->bitmap); font->glyph_memory -= xftg->glyph_memory; if (info) info->glyph_memory -= xftg->glyph_memory; } + + if (font->track_mem_usage) { + XftGlyphUsage *xuse = (XftGlyphUsage *) xftg; + XftGlyphUsage *xtmp; + + if (XftDebug() & XFT_DBG_USAGE) + printf("free %p -> %p USE %d.%d\n", + (void *) font, (void *) xuse, xuse->older, xuse->newer); + + if (xuse->older != FT_UINT_MAX) { + xtmp = (XftGlyphUsage *) font->glyphs[xuse->older]; + if (xtmp != NULL) { + /* update link around to oldest glyph */ + xtmp->newer = xuse->newer; + } + if (font->newest == glyphindex) { + if (font->newest == xuse->older) + font->newest = FT_UINT_MAX; + else + font->newest = xuse->older; + } + } + if (xuse->newer != FT_UINT_MAX) { + xtmp = (XftGlyphUsage *) font->glyphs[xuse->newer]; + if (xtmp != NULL) { + /* update link around to newest glyph */ + xtmp->older = xuse->older; + } + } + if (font->total_inuse) { + font->total_inuse--; + } else { + fprintf (stderr, "Xft: glyph count error\n"); + } + if (XftDebug() & XFT_DBG_USAGE) + _XftValidateGlyphUsage(font); + } + free (xftg); - XftMemFree (XFT_MEM_GLYPH, sizeof (XftGlyph)); + XftMemFree (XFT_MEM_GLYPH, font->sizeof_glyph); font->glyphs[glyphindex] = NULL; } if (font->glyphset && nused) @@ -790,13 +1215,21 @@ XftFontCheckGlyph (Display *dpy, { if (!xftg) { - xftg = (XftGlyph *) malloc (sizeof (XftGlyph)); + xftg = malloc (font->sizeof_glyph); if (!xftg) return FcFalse; - XftMemAlloc (XFT_MEM_GLYPH, sizeof (XftGlyph)); + XftMemAlloc (XFT_MEM_GLYPH, font->sizeof_glyph); + xftg->bitmap = NULL; xftg->glyph_memory = 0; + xftg->picture = 0; font->glyphs[glyph] = xftg; + + if (font->track_mem_usage) { + XftGlyphUsage *xuse = (XftGlyphUsage *) xftg; + xuse->older = FT_UINT_MAX; + xuse->newer = FT_UINT_MAX; + } } n = *nmissing; missing[n++] = glyph; @@ -808,14 +1241,46 @@ XftFontCheckGlyph (Display *dpy, *nmissing = n; return FcTrue; } - else - return FcFalse; + + /* + * Make unloading faster by moving newly-referenced glyphs to the front + * of the list, leaving the less-used glyphs on the end. + */ + if (font->track_mem_usage + && font->total_inuse > 10 + && font->newest != FT_UINT_MAX + && font->newest != glyph) + { + XftGlyphUsage *xuse = (XftGlyphUsage *) xftg; + XftGlyphUsage *xtmp = (XftGlyphUsage *) font->glyphs[font->newest]; + XftGlyphUsage *xold; + XftGlyphUsage *xnew; + + /* delink */ + xold = (XftGlyphUsage *) font->glyphs[xuse->older]; + xnew = (XftGlyphUsage *) font->glyphs[xuse->newer]; + assert(xold != NULL); + assert(xnew != NULL); + xold->newer = xuse->newer; + xnew->older = xuse->older; + + /* relink */ + xnew = (XftGlyphUsage *) font->glyphs[xtmp->newer]; + assert(xnew != NULL); + xnew->older = glyph; + xuse->older = font->newest; + xuse->newer = xtmp->newer; + xtmp->newer = glyph; + + font->newest = glyph; + } + return FcFalse; } _X_EXPORT FcBool -XftCharExists (Display *dpy, +XftCharExists (Display *dpy _X_UNUSED, XftFont *pub, - FcChar32 ucs4) + FcChar32 ucs4) { if (pub->charset) return FcCharSetHasChar (pub->charset, ucs4); @@ -859,14 +1324,14 @@ XftCharIndex (Display *dpy, offset = 1; } ent = ent + offset; - if (ent >= font->hash_value) + if (ent >= (FcChar32)font->hash_value) ent -= (FcChar32)font->hash_value; } return font->hash_table[ent].glyph; } /* - * Pick a random glyph from the font and remove it from the cache + * Remove glyph(s) from the font to reduce memory-usage. */ _X_HIDDEN void _XftFontUncacheGlyph (Display *dpy, XftFont *pub) @@ -878,40 +1343,64 @@ _XftFontUncacheGlyph (Display *dpy, XftFont *pub) if (!font->glyph_memory) return; - if (font->use_free_glyphs) + + if (XftDebug() & XFT_DBG_CACHE) + _XftFontValidateMemory (dpy, pub); + + if (font->track_mem_usage) { + /* + * Remove the oldest glyph from the font. + */ + if (font->newest != FT_UINT_MAX) { + XftGlyphUsage *xuse = (XftGlyphUsage *) font->glyphs[font->newest]; + if ((glyphindex = xuse->newer) != FT_UINT_MAX) + XftFontUnloadGlyphs (dpy, pub, &glyphindex, 1); + } + } + else if (font->use_free_glyphs) + { + /* + * Pick a random glyph from the font and remove it from the cache + */ glyph_memory = arc4random_uniform(font->glyph_memory); + for (glyphindex = 0; glyphindex < font->num_glyphs; glyphindex++) + { + xftg = font->glyphs[glyphindex]; + if (xftg) + { + if (xftg->glyph_memory > glyph_memory) + { + XftFontUnloadGlyphs (dpy, pub, &glyphindex, 1); + break; + } + glyph_memory -= xftg->glyph_memory; + } + } } else { + /* + * Free all glyphs, since they are part of a set. + */ if (font->glyphset) { XRenderFreeGlyphSet (dpy, font->glyphset); font->glyphset = 0; } - glyph_memory = 0; - } - - if (XftDebug() & XFT_DBG_CACHE) - _XftFontValidateMemory (dpy, pub); - for (glyphindex = 0; glyphindex < font->num_glyphs; glyphindex++) - { - xftg = font->glyphs[glyphindex]; - if (xftg) + for (glyphindex = 0; glyphindex < font->num_glyphs; glyphindex++) { - if (xftg->glyph_memory > glyph_memory) + xftg = font->glyphs[glyphindex]; + if (xftg) { - if (XftDebug() & XFT_DBG_CACHEV) - printf ("Uncaching glyph 0x%x size %ld\n", - glyphindex, xftg->glyph_memory); - XftFontUnloadGlyphs (dpy, pub, &glyphindex, 1); - if (!font->use_free_glyphs) - continue; - break; + if (xftg->glyph_memory > 0) + { + XftFontUnloadGlyphs (dpy, pub, &glyphindex, 1); + } } - glyph_memory -= xftg->glyph_memory; } } + if (XftDebug() & XFT_DBG_CACHE) _XftFontValidateMemory (dpy, pub); } @@ -926,7 +1415,7 @@ _XftFontManageMemory (Display *dpy, XftFont *pub) if (XftDebug() & XFT_DBG_CACHE) { if (font->glyph_memory > font->max_glyph_memory) - printf ("Reduce memory for font 0x%lx from %ld to %ld\n", + printf ("Reduce memory for font 0x%lx from %lu to %lu\n", font->glyphset ? font->glyphset : (unsigned long) font, font->glyph_memory, font->max_glyph_memory); } diff --git a/lib/libXft/src/xftinit.c b/lib/libXft/src/xftinit.c index 78eb3ed9d..b7632e3ab 100644 --- a/lib/libXft/src/xftinit.c +++ b/lib/libXft/src/xftinit.c @@ -25,7 +25,7 @@ static Bool _XftConfigInitialized; _X_EXPORT Bool -XftInit (_Xconst char *config) +XftInit (_Xconst char *config _X_UNUSED) { if (_XftConfigInitialized) return True; @@ -44,45 +44,48 @@ XftGetVersion (void) static struct { const char *name; int alloc_count; - int alloc_mem; + size_t alloc_mem; int free_count; - int free_mem; + size_t free_mem; } XftInUse[XFT_MEM_NUM] = { - { "XftDraw", 0, 0 }, - { "XftFont", 0 ,0 }, - { "XftFtFile", 0, 0 }, - { "XftGlyph", 0, 0 }, + { "XftDraw", 0, 0, 0, 0 }, /* XFT_MEM_DRAW */ + { "XftFont", 0, 0, 0, 0 }, /* XFT_MEM_FONT */ + { "XftFtFile", 0, 0, 0, 0 }, /* XFT_MEM_FILE */ + { "XftGlyph", 0, 0, 0, 0 }, /* XFT_MEM_GLYPH */ }; -static int XftAllocCount, XftAllocMem; -static int XftFreeCount, XftFreeMem; +static int XftAllocCount; +static size_t XftAllocMem; -static const int XftMemNotice = 1*1024*1024; +static int XftFreeCount; +static size_t XftFreeMem; -static int XftAllocNotify, XftFreeNotify; +static const size_t XftMemNotice = 1*1024*1024; + +static size_t XftAllocNotify, XftFreeNotify; _X_HIDDEN void XftMemReport (void) { int i; printf ("Xft Memory Usage:\n"); - printf ("\t Which Alloc Free\n"); - printf ("\t count bytes count bytes\n"); + printf ("\t Which Alloc Free\n"); + printf ("\t count bytes count bytes\n"); for (i = 0; i < XFT_MEM_NUM; i++) - printf ("\t%8.8s%8d%8d%8d%8d\n", + printf ("\t%9.9s%8d%8lu%8d%8lu\n", XftInUse[i].name, - XftInUse[i].alloc_count, XftInUse[i].alloc_mem, - XftInUse[i].free_count, XftInUse[i].free_mem); - printf ("\t%8.8s%8d%8d%8d%8d\n", + XftInUse[i].alloc_count, (unsigned long) XftInUse[i].alloc_mem, + XftInUse[i].free_count, (unsigned long) XftInUse[i].free_mem); + printf ("\t%9.9s%8d%8lu%8d%8lu\n", "Total", - XftAllocCount, XftAllocMem, - XftFreeCount, XftFreeMem); + XftAllocCount, (unsigned long) XftAllocMem, + XftFreeCount, (unsigned long) XftFreeMem); XftAllocNotify = 0; XftFreeNotify = 0; } _X_HIDDEN void -XftMemAlloc (int kind, int size) +XftMemAlloc (int kind, size_t size) { if (XftDebug() & XFT_DBG_MEMORY) { @@ -97,7 +100,7 @@ XftMemAlloc (int kind, int size) } _X_HIDDEN void -XftMemFree (int kind, int size) +XftMemFree (int kind, size_t size) { if (XftDebug() & XFT_DBG_MEMORY) { diff --git a/lib/libXft/src/xftint.h b/lib/libXft/src/xftint.h index ced9a029b..c59985ab1 100644 --- a/lib/libXft/src/xftint.h +++ b/lib/libXft/src/xftint.h @@ -1,23 +1,24 @@ /* + * Copyright © 2022 Thomas E. Dickey * Copyright © 2000 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the above copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The above copyright holders make no * representations about the suitability of this software for any purpose. It * is provided "as is" without express or implied warranty. * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. + * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO + * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE + * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* @@ -50,6 +51,7 @@ #endif #endif #include <ctype.h> +#include <assert.h> #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -85,10 +87,21 @@ typedef struct _XftGlyph { XGlyphInfo metrics; void *bitmap; unsigned long glyph_memory; + Picture picture; } XftGlyph; /* - * A hash table translates Unicode values into glyph indicies + * If the "trackmemusage" option is set, glyphs are managed via a doubly-linked + * list. To save space, the links are just array indices. + */ +typedef struct _XftGlyphUsage { + XftGlyph contents; + FT_UInt newer; + FT_UInt older; +} XftGlyphUsage; + +/* + * A hash table translates Unicode values into glyph indices */ typedef struct _XftUcsHash { FcChar32 ucs4; @@ -134,6 +147,7 @@ struct _XftFontInfo { FT_F26Dot6 xsize, ysize; /* pixel size */ FcBool antialias; /* doing antialiasing */ FcBool embolden; /* force emboldening */ + FcBool color; /* contains color glyphs */ int rgba; /* subpixel order */ int lcd_filter; /* lcd filter */ FT_Matrix matrix; /* glyph transformation matrix */ @@ -163,7 +177,7 @@ typedef struct _XftFontInt { * This array follows the font in memory */ XftGlyph **glyphs; - int num_glyphs; /* size of glyphs/bitmaps arrays */ + FT_UInt num_glyphs; /* size of glyphs/bitmaps arrays */ /* * Hash table to get from Unicode value to glyph ID * This array follows the glyphs in memory @@ -181,6 +195,10 @@ typedef struct _XftFontInt { */ unsigned long glyph_memory; unsigned long max_glyph_memory; + unsigned sizeof_glyph; /* sizeof(XftGlyph) or XftGlyphUsage */ + FT_UInt newest; /* index, for tracking usage */ + FT_UInt total_inuse; /* total, for verifying usage */ + FcBool track_mem_usage; /* Use XftGlyphUsage */ FcBool use_free_glyphs; /* Use XRenderFreeGlyphs */ } XftFontInt; @@ -250,6 +268,7 @@ typedef struct _XftDisplayInfo { XRenderPictFormat *solidFormat; unsigned long glyph_memory; unsigned long max_glyph_memory; + FcBool track_mem_usage; FcBool use_free_glyphs; int num_unref_fonts; int max_unref_fonts; @@ -273,6 +292,9 @@ typedef struct _XftDisplayInfo { extern XftDisplayInfo *_XftDisplayInfo; +/* + * Bits in $XFT_DEBUG, which can be combined. + */ #define XFT_DBG_OPEN 1 #define XFT_DBG_OPENV 2 #define XFT_DBG_RENDER 4 @@ -283,47 +305,24 @@ extern XftDisplayInfo *_XftDisplayInfo; #define XFT_DBG_CACHE 128 #define XFT_DBG_CACHEV 256 #define XFT_DBG_MEMORY 512 +#define XFT_DBG_USAGE 1024 -#define XFT_MEM_DRAW 0 -#define XFT_MEM_FONT 1 -#define XFT_MEM_FILE 2 -#define XFT_MEM_GLYPH 3 -#define XFT_MEM_NUM 4 - -/* xftcompat.c */ -void XftFontSetDestroy (FcFontSet *s); -FcBool XftMatrixEqual (_Xconst FcMatrix *mat1, _Xconst FcMatrix *mat2); -void XftMatrixMultiply (FcMatrix *result, FcMatrix *a, FcMatrix *b); -void XftMatrixRotate (FcMatrix *m, double c, double s); -void XftMatrixScale (FcMatrix *m, double sx, double sy); -void XftMatrixShear (FcMatrix *m, double sh, double sv); -FcPattern *XftPatternCreate (void); -void XftValueDestroy (FcValue v); -void XftPatternDestroy (FcPattern *p); -FcBool XftPatternAdd (FcPattern *p, _Xconst char *object, FcValue value, FcBool append); -FcBool XftPatternDel (FcPattern *p, _Xconst char *object); -FcBool XftPatternAddInteger (FcPattern *p, _Xconst char *object, int i); -FcBool XftPatternAddDouble (FcPattern *p, _Xconst char *object, double i); -FcBool XftPatternAddMatrix (FcPattern *p, _Xconst char *object, FcMatrix *i); -FcBool XftPatternAddString (FcPattern *p, _Xconst char *object, char *i); -FcBool XftPatternAddBool (FcPattern *p, _Xconst char *object, FcBool i); -FcResult XftPatternGet (FcPattern *p, _Xconst char *object, int id, FcValue *v); -FcResult XftPatternGetInteger (FcPattern *p, _Xconst char *object, int id, int *i); -FcResult XftPatternGetDouble (FcPattern *p, _Xconst char *object, int id, double *i); -FcResult XftPatternGetString (FcPattern *p, _Xconst char *object, int id, char **i); -FcResult XftPatternGetMatrix (FcPattern *p, _Xconst char *object, int id, FcMatrix **i); -FcResult XftPatternGetBool (FcPattern *p, _Xconst char *object, int id, FcBool *i); -FcPattern *XftPatternDuplicate (FcPattern *orig); -FcPattern *XftPatternVaBuild (FcPattern *orig, va_list va); -FcPattern *XftPatternBuild (FcPattern *orig, ...); -FcBool XftNameUnparse (FcPattern *pat, char *dest, int len); -FcBool XftGlyphExists (Display *dpy, XftFont *font, FcChar32 ucs4); -FcObjectSet *XftObjectSetCreate (void); -Bool XftObjectSetAdd (FcObjectSet *os, _Xconst char *object); -void XftObjectSetDestroy (FcObjectSet *os); -FcObjectSet *XftObjectSetVaBuild (_Xconst char *first, va_list va); -FcObjectSet *XftObjectSetBuild (_Xconst char *first, ...); -FcFontSet *XftListFontSets (FcFontSet **sets, int nsets, FcPattern *p, FcObjectSet *os); +/* + * Categories for memory allocation. + */ +typedef enum { + XFT_MEM_DRAW + , XFT_MEM_FONT + , XFT_MEM_FILE + , XFT_MEM_GLYPH + , XFT_MEM_NUM +} XFT_MEM_KIND; + +#define AllocTypedArray(n,type) malloc ((size_t)(n) * sizeof (type)) +#define AllocUIntArray(n) AllocTypedArray(n, FT_UInt) +#define AllocGlyphElt8Array(n) AllocTypedArray(n, XGlyphElt8) +#define AllocGlyphSpecArray(n) AllocTypedArray(n, XftGlyphSpec) +#define AllocGlyphFontSpecArray(n) AllocTypedArray(n, XftGlyphFontSpec) /* xftcore.c */ void @@ -415,10 +414,10 @@ void XftMemReport (void); void -XftMemAlloc (int kind, int size); +XftMemAlloc (int kind, size_t size); void -XftMemFree (int kind, int size); +XftMemFree (int kind, size_t size); /* xftlist.c */ FcFontSet * diff --git a/lib/libXft/src/xftlist.c b/lib/libXft/src/xftlist.c index f15974530..1f54424bc 100644 --- a/lib/libXft/src/xftlist.c +++ b/lib/libXft/src/xftlist.c @@ -23,10 +23,10 @@ #include "xftint.h" _X_HIDDEN FcFontSet * -XftListFontsPatternObjects (Display *dpy, - int screen, +XftListFontsPatternObjects (Display *dpy _X_UNUSED, + int screen _X_UNUSED, FcPattern *pattern, - FcObjectSet *os) + FcObjectSet *os) { return FcFontList (NULL, pattern, os); } diff --git a/lib/libXft/src/xftname.c b/lib/libXft/src/xftname.c index e1201999b..fbd4f0aa2 100644 --- a/lib/libXft/src/xftname.c +++ b/lib/libXft/src/xftname.c @@ -25,7 +25,7 @@ _X_EXPORT FcPattern *XftNameParse (const char *name) { - return FcNameParse ((FcChar8 *) name); + return FcNameParse ((const FcChar8 *) name); } _X_EXPORT FcBool @@ -36,7 +36,7 @@ XftNameUnparse (FcPattern *pat, char *dest, int len) name = FcNameUnparse (pat); if (!name) return FcFalse; - if (strlen ((char *) name) + 1 > len) + if (strlen ((char *) name) + 1 > (size_t) len) { FcPattern *new = FcPatternDuplicate (pat); free (name); @@ -46,7 +46,7 @@ XftNameUnparse (FcPattern *pat, char *dest, int len) FcPatternDestroy (new); if (!name) return FcFalse; - if (strlen ((char *) name) + 1 > len) + if (strlen ((char *) name) + 1 > (size_t) len) { strncpy (dest, ((char *) name), (size_t) len - 1); dest[len - 1] = '\0'; diff --git a/lib/libXft/src/xftrender.c b/lib/libXft/src/xftrender.c index a352737bc..3021d5616 100644 --- a/lib/libXft/src/xftrender.c +++ b/lib/libXft/src/xftrender.c @@ -26,6 +26,47 @@ #define NUM_ELT_LOCAL 128 /* + * Dispatch glyph drawing to the correct XRenderCompositeString function + */ +static void +_XftCompositeString (Display *dpy, + int op, + Picture src, + Picture dst, + XRenderPictFormat *format, + GlyphSet glyphset, + int srcx, + int srcy, + int dstx, + int dsty, + int charwidth, + unsigned int *chars, + int nchars) +{ + if (nchars == 0) + return; + + switch (charwidth) { + case 1: + default: + XRenderCompositeString8 (dpy, op, + src, dst, format, glyphset, + srcx, srcy, dstx, dsty, (char*)chars, nchars); + break; + case 2: + XRenderCompositeString16(dpy, op, + src, dst, format, glyphset, + srcx, srcy, dstx, dsty, (unsigned short*)chars, nchars); + break; + case 4: + XRenderCompositeString32(dpy, op, + src, dst, format, glyphset, + srcx, srcy, dstx, dsty, (unsigned int*)chars, nchars); + break; + } +} + +/* * Use the Render extension to draw the glyphs */ @@ -43,18 +84,22 @@ XftGlyphRender (Display *dpy, int nglyphs) { XftFontInt *font = (XftFontInt *) pub; - int i; + int i, j; FT_UInt missing[XFT_NMISSING]; int nmissing; FT_UInt g, max; - int size, width; + int width; + int dstx, dsty; Glyph wire; + XftGlyph* glyph; char *char8; unsigned short *char16; unsigned int *char32; unsigned int char_local[NUM_LOCAL]; unsigned int *chars; FcBool glyphs_loaded; + size_t size; + size_t needed; if (!font->format) return; @@ -94,49 +139,100 @@ XftGlyphRender (Display *dpy, size = sizeof (unsigned int); } chars = char_local; - if (nglyphs * size > sizeof (char_local)) + if ((size_t)nglyphs > SIZE_MAX / size) + goto bail1; + needed = (size_t)nglyphs * size; + if (needed > sizeof (char_local)) { - chars = malloc ((size_t)(nglyphs * size)); + chars = malloc (needed); if (!chars) goto bail1; } + dstx = x; + dsty = y; char8 = (char *) chars; char16 = (unsigned short *) chars; char32 = (unsigned int *) chars; - for (i = 0; i < nglyphs; i++) + for (i = 0, j = 0; i < nglyphs; i++) { wire = (Glyph) glyphs[i]; - if (wire >= font->num_glyphs || !font->glyphs[wire]) + if (wire >= (Glyph) font->num_glyphs || !font->glyphs[wire]) wire = 0; - switch (width) { - case 1: char8[i] = (char) wire; break; - case 2: char16[i] = (unsigned short) wire; break; - case 4: char32[i] = (unsigned int) wire; break; + glyph = font->glyphs[wire]; + if (glyph == NULL) + continue; + if (glyph->picture) + { + _XftCompositeString(dpy, op, src, dst, font->format, font->glyphset, srcx, srcy, x, y, width, chars, j); + XRenderComposite(dpy, PictOpOver, glyph->picture, None, dst, 0, 0, 0, 0, dstx - glyph->metrics.x, dsty - glyph->metrics.y, glyph->metrics.width, glyph->metrics.height); + dstx += glyph->metrics.xOff; + dsty += glyph->metrics.yOff; + x = dstx; + y = dsty; + j = 0; + } + else + { + switch (width) { + case 1: char8[j] = (char) wire; break; + case 2: char16[j] = (unsigned short) wire; break; + case 4: char32[j] = (unsigned int) wire; break; + } + dstx += glyph->metrics.xOff; + dsty += glyph->metrics.yOff; + ++j; } } - switch (width) { + _XftCompositeString(dpy, op, src, dst, font->format, font->glyphset, + srcx, srcy, x, y, width, chars, j); + if (chars != char_local) + free (chars); +bail1: + if (glyphs_loaded) + _XftFontManageMemory (dpy, pub); +} + +/* + * Dispatch glyph drawing to the correct XRenderCompositeText function + */ +static void +_XftCompositeText (Display *dpy, + int op, + Picture src, + Picture dst, + XRenderPictFormat *format, + int srcx, + int srcy, + int dstx, + int dsty, + int eltwidth, + XGlyphElt8 *elts, + int nelt) +{ + if (nelt == 0) + return; + + switch (eltwidth) { case 1: default: - XRenderCompositeString8 (dpy, op, - src, dst, font->format, font->glyphset, - srcx, srcy, x, y, char8, nglyphs); + XRenderCompositeText8 (dpy, op, + src, dst, format, + srcx, srcy, dstx, dsty, + (XGlyphElt8*)elts, nelt); break; case 2: - XRenderCompositeString16(dpy, op, - src, dst, font->format, font->glyphset, - srcx, srcy, x, y, char16, nglyphs); + XRenderCompositeText16(dpy, op, + src, dst, format, + srcx, srcy, dstx, dsty, + (XGlyphElt16*)elts, nelt); break; case 4: - XRenderCompositeString32(dpy, op, - src, dst, font->format, font->glyphset, - srcx, srcy, x, y, char32, nglyphs); + XRenderCompositeText32(dpy, op, + src, dst, format, + srcx, srcy, dstx, dsty, + (XGlyphElt32*)elts, nelt); break; } - if (chars != char_local) - free (chars); -bail1: - if (glyphs_loaded) - _XftFontManageMemory (dpy, pub); } _X_EXPORT void @@ -232,7 +328,7 @@ XftGlyphSpecRender (Display *dpy, for (i = 0; i < nglyphs; i++) { g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ + /* Substitute default for non-existent glyphs */ if (g >= font->num_glyphs || !font->glyphs[g]) g = 0; if (font->glyphs[g]) @@ -246,14 +342,15 @@ XftGlyphSpecRender (Display *dpy, while (++i < nglyphs) { g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ + /* Substitute default for non-existent glyphs */ if (g >= font->num_glyphs || !font->glyphs[g]) g = 0; /* * check to see if the glyph is placed where it would - * fall using the normal spacing + * fall using the normal spacing and if it would render + * as a XRender glyph */ - if ((glyph = font->glyphs[g])) + if ((glyph = font->glyphs[g]) && !glyph->picture) { if (x != glyphs[i].x || y != glyphs[i].y) { @@ -267,15 +364,15 @@ XftGlyphSpecRender (Display *dpy, } elts = elts_local; - if (nelt > NUM_ELT_LOCAL) + if (!font->info.color && nelt > NUM_ELT_LOCAL) { - elts = malloc ((size_t)nelt * sizeof (XGlyphElt8)); + elts = AllocGlyphElt8Array (nelt); if (!elts) goto bail2; } /* - * Generate the list of glyph elts + * Generate the list of glyph elts or render color glyphs */ nelt = 0; x = y = 0; @@ -284,11 +381,21 @@ XftGlyphSpecRender (Display *dpy, for (i = 0; i < nglyphs; i++) { g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ + /* Substitute default for non-existent glyphs */ if (g >= font->num_glyphs || !font->glyphs[g]) g = 0; if ((glyph = font->glyphs[g])) { + if (glyph->picture) + { + XRenderComposite(dpy, PictOpOver, glyph->picture, None, + dst, 0, 0, 0, 0, + glyphs[i].x - glyph->metrics.x, + glyphs[i].y - glyph->metrics.y, + glyph->metrics.width, + glyph->metrics.height); + continue; + } if (!i || x != glyphs[i].x || y != glyphs[i].y) { if (n) @@ -320,23 +427,9 @@ XftGlyphSpecRender (Display *dpy, elts[nelt].nchars = n; nelt++; } - switch (width) { - case 1: - XRenderCompositeText8 (dpy, op, src, dst, font->format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - elts, nelt); - break; - case 2: - XRenderCompositeText16 (dpy, op, src, dst, font->format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - (XGlyphElt16 *) elts, nelt); - break; - case 4: - XRenderCompositeText32 (dpy, op, src, dst, font->format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - (XGlyphElt32 *) elts, nelt); - break; - } + _XftCompositeText(dpy, op, src, dst, font->format, + srcx, srcy, glyphs[0].x, glyphs[0].y, + width, elts, nelt); if (elts != elts_local) free (elts); @@ -362,11 +455,14 @@ XftCharSpecRender (Display *dpy, XftGlyphSpec *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (XftGlyphSpec)); + glyphs = AllocGlyphSpecArray (len); if (!glyphs) return; } @@ -507,7 +603,7 @@ XftGlyphFontSpecRender (Display *dpy, XftFont *pub = glyphs[i].font; XftFontInt *font = (XftFontInt *) pub; g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ + /* Substitute default for non-existent glyphs */ if (g >= font->num_glyphs || !font->glyphs[g]) g = 0; if (font->glyphs[g]) @@ -528,14 +624,14 @@ XftGlyphFontSpecRender (Display *dpy, XftFont *pub = glyphs[i].font; XftFontInt *font = (XftFontInt *) pub; g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ + /* Substitute default for non-existent glyphs */ if (g >= font->num_glyphs || !font->glyphs[g]) g = 0; /* * check to see if the glyph is placed where it would * fall using the normal spacing */ - if ((glyph = font->glyphs[g])) + if ((glyph = font->glyphs[g]) && !glyph->picture) { if (pub != prevPublic || x != glyphs[i].x || y != glyphs[i].y) { @@ -554,13 +650,13 @@ XftGlyphFontSpecRender (Display *dpy, elts = elts_local; if (nelt > NUM_ELT_LOCAL) { - elts = malloc ((size_t)nelt * sizeof (XGlyphElt8)); + elts = AllocGlyphElt8Array (nelt); if (!elts) goto bail2; } /* - * Generate the list of glyph elts + * Generate the list of glyph elts and render color glyphs */ nelt = 0; x = y = 0; @@ -573,11 +669,21 @@ XftGlyphFontSpecRender (Display *dpy, XftFontInt *font = (XftFontInt *) pub; g = glyphs[i].glyph; - /* Substitute default for non-existant glyphs */ + /* Substitute default for non-existent glyphs */ if (g >= font->num_glyphs || !font->glyphs[g]) g = 0; if ((glyph = font->glyphs[g])) { + if (glyph->picture) + { + XRenderComposite(dpy, PictOpOver, glyph->picture, None, + dst, 0, 0, 0, 0, + glyphs[i].x - glyph->metrics.x, + glyphs[i].y - glyph->metrics.y, + glyph->metrics.width, + glyph->metrics.height); + continue; + } if (!i || pub != prevPublic || x != glyphs[i].x || y != glyphs[i].y) { if (n) @@ -610,23 +716,9 @@ XftGlyphFontSpecRender (Display *dpy, elts[nelt].nchars = n; nelt++; } - switch (width) { - case 1: - XRenderCompositeText8 (dpy, op, src, dst, format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - elts, nelt); - break; - case 2: - XRenderCompositeText16 (dpy, op, src, dst, format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - (XGlyphElt16 *) elts, nelt); - break; - case 4: - XRenderCompositeText32 (dpy, op, src, dst, format, - srcx, srcy, glyphs[0].x, glyphs[0].y, - (XGlyphElt32 *) elts, nelt); - break; - } + _XftCompositeText(dpy, op, src, dst, format, + srcx, srcy, glyphs[0].x, glyphs[0].y, + width, elts, nelt); if (elts != elts_local) free (elts); @@ -652,11 +744,14 @@ XftCharFontSpecRender (Display *dpy, XftGlyphFontSpec *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (XftGlyphFontSpec)); + glyphs = AllocGlyphFontSpecArray (len); if (!glyphs) return; } @@ -689,11 +784,14 @@ XftTextRender8 (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) return; } @@ -721,11 +819,14 @@ XftTextRender16 (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) return; } @@ -753,11 +854,14 @@ XftTextRender16BE (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) return; } @@ -786,11 +890,14 @@ XftTextRender16LE (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) return; } @@ -819,11 +926,14 @@ XftTextRender32 (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) return; } @@ -851,11 +961,14 @@ XftTextRender32BE (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) return; } @@ -887,11 +1000,14 @@ XftTextRender32LE (Display *dpy, FT_UInt *glyphs, glyphs_local[NUM_LOCAL]; int i; + if (len <= 0) + return; + if (len <= NUM_LOCAL) glyphs = glyphs_local; else { - glyphs = malloc ((size_t)len * sizeof (FT_UInt)); + glyphs = AllocUIntArray (len); if (!glyphs) return; } @@ -926,6 +1042,9 @@ XftTextRenderUtf8 (Display *dpy, int l; int size; + if (len <= 0) + return; + i = 0; glyphs = glyphs_local; size = NUM_LOCAL; @@ -933,7 +1052,7 @@ XftTextRenderUtf8 (Display *dpy, { if (i == size) { - glyphs_new = malloc ((size_t)size * 2 * sizeof (FT_UInt)); + glyphs_new = AllocUIntArray (size * 2); if (!glyphs_new) { if (glyphs != glyphs_local) @@ -958,7 +1077,7 @@ XftTextRenderUtf8 (Display *dpy, _X_EXPORT void XftTextRenderUtf16 (Display *dpy, - int op, + int op _X_UNUSED, Picture src, XftFont *pub, Picture dst, @@ -976,6 +1095,9 @@ XftTextRenderUtf16 (Display *dpy, int l; int size; + if (len <= 0) + return; + i = 0; glyphs = glyphs_local; size = NUM_LOCAL; @@ -983,7 +1105,7 @@ XftTextRenderUtf16 (Display *dpy, { if (i == size) { - glyphs_new = malloc ((size_t)size * 2 * sizeof (FT_UInt)); + glyphs_new = AllocUIntArray (size * 2); if (!glyphs_new) { if (glyphs != glyphs_local) diff --git a/lib/libXft/src/xftstr.c b/lib/libXft/src/xftstr.c index a5733f4bb..50d808159 100644 --- a/lib/libXft/src/xftstr.c +++ b/lib/libXft/src/xftstr.c @@ -27,7 +27,7 @@ _XftMatchSymbolic (XftSymbolic *s, int n, const char *name, int def) { while (n--) { - if (!FcStrCmpIgnoreCase ((FcChar8 *) s->name, (FcChar8 *) name)) + if (!FcStrCmpIgnoreCase ((const FcChar8 *) s->name, (const FcChar8 *) name)) return s->value; s++; } diff --git a/lib/libXft/src/xftxlfd.c b/lib/libXft/src/xftxlfd.c index dee2f44de..afd9da0e7 100644 --- a/lib/libXft/src/xftxlfd.c +++ b/lib/libXft/src/xftxlfd.c @@ -81,7 +81,7 @@ XftGetInt(const char *ptr, int *val) } _X_EXPORT FcPattern * -XftXlfdParse (const char *xlfd_orig, FcBool ignore_scalable, FcBool complete) +XftXlfdParse (const char *xlfd_orig, FcBool ignore_scalable _X_UNUSED, FcBool complete _X_UNUSED) { FcPattern *pat; const char *xlfd = xlfd_orig; @@ -89,8 +89,6 @@ XftXlfdParse (const char *xlfd_orig, FcBool ignore_scalable, FcBool complete) const char *family; const char *weight_name; const char *slant; - const char *registry; - const char *encoding; char *save; int pixel; int point; @@ -113,9 +111,9 @@ XftXlfdParse (const char *xlfd_orig, FcBool ignore_scalable, FcBool complete) if (!(xlfd = XftGetInt (++xlfd, &resy))) return NULL; if (!(xlfd = strchr (/* spacing = */ ++xlfd, '-'))) return NULL; if (!(xlfd = strchr (/* average_width = */ ++xlfd, '-'))) return NULL; - if (!(xlfd = strchr (registry = ++xlfd, '-'))) return NULL; + if (!(xlfd = strchr (/* registry = */ ++xlfd, '-'))) return NULL; /* make sure no fields follow this one */ - if ((xlfd = strchr (encoding = ++xlfd, '-'))) return NULL; + if ((/* xlfd = */ strchr (/* encoding = */ ++xlfd, '-'))) return NULL; if (!pixel) return NULL; @@ -131,7 +129,7 @@ XftXlfdParse (const char *xlfd_orig, FcBool ignore_scalable, FcBool complete) return NULL; } - if (!FcPatternAddString (pat, XFT_XLFD, (FcChar8 *) xlfd_orig)) goto bail; + if (!FcPatternAddString (pat, XFT_XLFD, (const FcChar8 *) xlfd_orig)) goto bail; XftSplitStr (foundry, save); if (save[0] && strcmp (save, "*") != 0) |