https://wiki.archlinux.org/api.php?action=feedcontributions&user=Iridium&feedformat=atomArchWiki - User contributions [en]2024-03-29T13:29:26ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Bcachefs&diff=792817Bcachefs2023-11-19T10:41:01Z<p>Iridium: linux-git -> linux-mainline (less bleeding edge, and actually enables bcachefs in its default config)</p>
<hr />
<div>[[Category:File systems]]<br />
[[ja:Bcachefs]]<br />
{{Related articles start}}<br />
{{Related|File systems}}<br />
{{Related articles end}}<br />
<br />
[https://bcachefs.org/ Bcachefs] is a next-generation CoW filesystem that aims to provide features from [[Btrfs]] and [[ZFS]] with a cleaner codebase, more stability, greater speed and a GPL-compatible license.<br />
<br />
It is built upon [[Bcache]] and is mainly developed by Kent Overstreet.<br />
<br />
== Installation ==<br />
<br />
As of [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9e87705289667a6c5185c619ea32f3d39314eb1b kernel 6.7] Bcachefs has been merged into the upstream [[Kernel]] so the {{AUR|linux-mainline}} kernel may be [[install]]ed.<br />
<br />
The Bcachefs userspace tools are available from {{Pkg|bcachefs-tools}}.<br />
<br />
== Setup ==<br />
<br />
=== Single drive ===<br />
<br />
# bcachefs format /dev/sda<br />
# mount -t bcachefs /dev/sda /mnt<br />
<br />
=== Multiple drives ===<br />
<br />
Bcachefs stripes data by default, similar to RAID0. Redundancy is handled via the '''replicas''' option. 2 drives with {{ic|--replicas{{=}}2}} is equivalent to RAID1, 4 drives with {{ic|--replicas{{=}}2}} is equivalent to RAID10, etc.<br />
<br />
# bcachefs format /dev/sda /dev/sdb --replicas=''n''<br />
# mount -t bcachefs /dev/sda:/dev/sdb /mnt<br />
<br />
Heterogeneous drives are supported. If they are different sizes, larger stripes will be used on some, so that they all fill up at the same rate. If they are different speeds, reads for replicated data will be sent to the ones with the lowest IO latency. If some are more reliable than others (a hardware raid device, for example) you can set {{ic|--durability{{=}}2 ''device''}} to count each copy of data on that device as 2 replicas.<br />
<br />
=== SSD caching ===<br />
<br />
Bcachefs has 3 storage targets: background, foreground, and promote. Writes to the filesystem prioritize the foreground drives, which are then moved to the background over time. Reads are cached on the promote drives.<br />
<br />
{{Note|These are only priority guidelines for a single large pool. Writes will go directly to the background if the foreground is full, or to promote if they both are. Metadata will prefer the foreground, but can be written to any of them. Be careful when removing a cache drive, as it may still contain data. see [[#Removing a device]]}}<br />
<br />
A recommended configuration is to use an ssd group for the foreground and promote, and an hdd group for the background (a writeback cache).<br />
<br />
# bcachefs format \<br />
--label=ssd.ssd1 /dev/sda \<br />
--label=ssd.ssd2 /dev/sdb \<br />
--label=hdd.hdd1 /dev/sdc \<br />
--label=hdd.hdd2 /dev/sdd \<br />
--label=hdd.hdd3 /dev/sde \<br />
--label=hdd.hdd4 /dev/sdf \<br />
--replicas=2 \<br />
--foreground_target=ssd \<br />
--promote_target=ssd \<br />
--background_target=hdd<br />
# mount -t bcachefs /dev/sda:/dev/sdb:/dev/sdc:/dev/sdd:/dev/sde:/dev/sdf /mnt<br />
<br />
For a writethrough cache, do the same as above, but set {{ic|--durability{{=}}0 ''device''}} on each of the ssd devices.<br />
For a writearound cache, foreground target to the hdd group, and promote target to the ssd group.<br />
<br />
== Configuration ==<br />
<br />
{{Expansion|Missing details on which options should be used}}<br />
<br />
Most options can be set at either during {{ic|bcachefs format}}, at mount time ({{ic|1=mount -o option=value}}), or through sysfs ({{ic|echo X > /sys/fs/bcachefs/''UUID''/options/''option''}}). Setting the option during format or changing it through sysfs saves it in the filesystem's superblock, making it the default for those drives. Mount options override those defaults.<br />
<br />
{{Note|The filesystem must be mounted for sysfs to be available. All operations except fsck are possible on a live filesystem.}}<br />
<br />
* data_checksum, metadata_checksum (none, crc32c, crc64)<br />
* (foreground) compression, background_compression (none, lz4, gzip, zstd)<br />
* foreground_target, background_target, promote_target<br />
<br />
The following can also be set on a per directory or per file basis with {{ic|1=bcachefs setattr ''file'' --option=value}}<br />
<br />
* data_replicas<br />
* data_checksum<br />
* compression, background_compression<br />
* foreground_target, background_target, promote_target<br />
<br />
{{Note|Disk usage reporting currently shows uncompressed size. Compression is otherwise complete.}}<br />
<br />
=== Changing a device's group ===<br />
<br />
# echo ''group.drive_name'' > /sys/fs/bcachefs/''filesystem_uuid''/dev-''X''/label<br />
<br />
{{Note|This requires a remount to take effect.}}<br />
<br />
=== Adding a device ===<br />
<br />
# bcachefs device add --label=''group.drive_name'' /mnt /dev/''device''<br />
<br />
If this is the first drive in a group, you will need to change the target settings to make use of it. This example is for adding a cache drive.<br />
<br />
# echo ''new_group'' > /sys/fs/bcachefs/''filesystem_uuid''/options/promote_target<br />
# echo ''new_group'' > /sys/fs/bcachefs/''filesystem_uuid''/options/foreground_target<br />
# echo ''old_group'' > /sys/fs/bcachefs/''filesystem_uuid''/options/background_target<br />
<br />
{{Note|Only new writes will be striped across added devices. Existing ones will be unchanged until disk usage reaches a certain threshold, when the disk rebalance is triggered. It is not currently possible to manually trigger a rebalance/restripe.}}<br />
<br />
=== Removing a device ===<br />
<br />
First make sure there are at least 2 metadata replicas (Evacuate does not appear to work for metadata). If your data and metadata are already replicated, you may skip this step.<br />
<br />
# echo 2 > /sys/fs/bcachefs/''UUID''/options/metadata_replicas<br />
# bcachefs data rereplicate /mnt<br />
# bcachefs device set-state ''device'' readonly<br />
# bcachefs device evacuate ''device''<br />
<br />
To remove the device:<br />
<br />
# bcachefs device remove ''device''<br />
# bcachefs data rereplicate /mnt<br />
<br />
== Tips and tricks ==<br />
<br />
{{Expansion|Information on auto-mounting would be useful}}<br />
<br />
Check the [[journal]] for more useful error messages.<br />
<br />
== See also ==<br />
<br />
* [https://bcachefs.org/bcachefs-principles-of-operation.pdf Official Manual]<br />
* [https://www.patreon.com/bcachefs Kent Overstreet's Patreon page]<br />
* [[Wikipedia:Bcachefs]]</div>Iridiumhttps://wiki.archlinux.org/index.php?title=Lenovo_ThinkPad_T480s&diff=551389Lenovo ThinkPad T480s2018-10-26T19:05:59Z<p>Iridium: </p>
<hr />
<div>[[Category:Lenovo]]<br />
[[ja:Lenovo ThinkPad T480s]]<br />
{| class="wikitable" style="float: right;"<br />
| '''Device''' || '''Status''' <br />
|-<br />
| [[Intel graphics]] || {{Yes}} <br />
|-<br />
| [[Wireless]] || {{Yes}}<br />
|-<br />
| [[ALSA]] || {{Y|no beep}}<br />
|-<br />
| [[TrackPoint]] || {{Yes}}<br />
|-<br />
| [[Touchpad]] || {{Yes}}<br />
|-<br />
| [[Webcam]] || {{Yes}}<br />
|-<br />
| Fingerprint Sensor || {{No}}<br />
|-<br />
| [[ThinkPad mobile internet|Mobile Broadband]] || {{Yes}}<br />
|-<br />
| [[Bluetooth]] || <br />
|-<br />
| Smartcard Reader || {{Yes}}<br />
|-<br />
|}<br />
<br />
This article covers the installation and configuration of Arch Linux on a Lenovo T480s laptop. Everything seems to work pretty much out the box.<br />
<br />
For a general overview of laptop-related articles and recommendations, see [[Laptop]].<br />
<br />
== Hardware ==<br />
<br />
Using kernel 4.15.7-1-ARCH.<br />
<br />
Release Date: 01/22/2018<br />
Product Name: 20L7CTO1WW<br />
SKU Number: LENOVO_MT_20L7_BU_Think_FM_ThinkPad T480s<br />
Product Name: 20L7CTO1WW<br />
<br />
{{ic|lspci}} returns something like:<br />
<br />
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 08)<br />
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)<br />
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 08)<br />
00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model<br />
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)<br />
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)<br />
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21)<br />
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)<br />
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 (rev f1)<br />
00:1c.4 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #5 (rev f1)<br />
00:1c.6 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #7 (rev f1)<br />
00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1)<br />
00:1f.0 ISA bridge: Intel Corporation Device 9d4e (rev 21)<br />
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)<br />
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)<br />
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)<br />
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (4) I219-V (rev 21)<br />
04:00.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:00.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:01.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:02.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
06:00.0 System peripheral: Intel Corporation JHL6240 Thunderbolt 3 NHI (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
3c:00.0 USB controller: Intel Corporation Device 15c1 (rev 01)<br />
3d:00.0 Network controller: Intel Corporation Wireless 8265 / 8275 (rev 78)<br />
3e:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd Device a808<br />
<br />
<br />
{{ic|lsusb}} returns something like:<br />
<br />
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<br />
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
Bus 002 Device 013: ID 0bda:0316 Realtek Semiconductor Corp. <br />
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<br />
Bus 001 Device 004: ID 5986:2113 Acer, Inc <br />
Bus 001 Device 003: ID 8087:0a2b Intel Corp. <br />
Bus 001 Device 005: ID 046d:c246 Logitech, Inc. Gaming Mouse G300<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
<br />
=== Fingerprint reader ===<br />
Fingerprint sensor 06cb:009a is not supported by libfprint right now. There is a project to reverse enginer windows driver - https://github.com/nmikhailov/Validity90 .<br />
<br />
== Powersaving ==<br />
Without special configuration and with default firmware settings, power usage is a bit high (around 7,5W in idle). There are a few knobs to improve battery life:<br />
<br />
{{Warning|Changing Thunderbolt BIOS options has been reported to irreversibly brick ThinkPads. This is a BIOS bug. Until there is more information available on that matter (or a fix underway), use these options with care.}} <br />
* Set "Thunderbolt BIOS Assist Mode" to "Enabled" in the EFI firmware interface. This seems to reduce number of idle wakeups.<br />
* Disable unused peripherals under "Security" -> "I/O port access" in the firmware. This especially applies to the SD/MMC-cardreader, which seems to drain some power even when idle<br />
<br />
As of Kernel 4.15, DisplayPort PSR (Panel self refresh) is disabled by default and broken when forcibly enabled (system hangs after a few seconds, display lag). 4.17-rc1 seems to improve a lot in this regard, but PSR still sometimes causes the screen to freeze for a few seconds.<br />
<br />
== Thermal Throttling Fix ==<br />
<br />
Workaround for Linux throttling issues on Lenovo T480 / T480s / X1C6 notebooks as described here.<br />
<br />
This script forces the CPU package power limit (PL1/2) to 44 W (29 W on battery) and the temperature trip point to 95 'C (85 'C on battery) by overriding default values in MSR and MCHBAR every 5 seconds (30 on battery) to block the Embedded Controller from resetting these values to default.<br />
<br />
https://github.com/erpalma/lenovo-throttling-fix<br />
<br />
<br />
== See also ==<br />
<br />
* [https://www.youtube.com/watch?v=gRvYTLntgv4&list=PLiKgVPlhUNuz9k0xIp7PGUV5mmDdTS1vJ T480s install video playlist]</div>Iridiumhttps://wiki.archlinux.org/index.php?title=Lenovo_ThinkPad_T480s&diff=528794Lenovo ThinkPad T480s2018-07-03T20:42:01Z<p>Iridium: smartcard works</p>
<hr />
<div>[[Category:Lenovo]]<br />
[[ja:Lenovo ThinkPad T480s]]<br />
{| class="wikitable" style="float: right;"<br />
| '''Device''' || '''Status''' <br />
|-<br />
| [[Intel graphics]] || {{Yes}} <br />
|-<br />
| [[Wireless]] || {{Yes}}<br />
|-<br />
| [[ALSA]] || {{Y|no beep}}<br />
|-<br />
| [[TrackPoint]] || {{Yes}}<br />
|-<br />
| [[Touchpad]] || {{Yes}}<br />
|-<br />
| [[Webcam]] || {{Yes}}<br />
|-<br />
| Fingerprint Sensor || {{No}}<br />
|-<br />
| [[ThinkPad mobile internet|Mobile Broadband]] || {{Yes}}<br />
|-<br />
| [[Bluetooth]] || <br />
|-<br />
| Smartcard Reader || {{Yes}}<br />
|-<br />
|}<br />
<br />
This article covers the installation and configuration of Arch Linux on a Lenovo T480s laptop. Everything seems to work pretty much out the box.<br />
<br />
For a general overview of laptop-related articles and recommendations, see [[Laptop]].<br />
<br />
== Hardware ==<br />
<br />
Using kernel 4.15.7-1-ARCH.<br />
<br />
Release Date: 01/22/2018<br />
Product Name: 20L7CTO1WW<br />
SKU Number: LENOVO_MT_20L7_BU_Think_FM_ThinkPad T480s<br />
Product Name: 20L7CTO1WW<br />
<br />
{{ic|lspci}} returns something like:<br />
<br />
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 08)<br />
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)<br />
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 08)<br />
00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model<br />
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)<br />
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)<br />
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21)<br />
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)<br />
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 (rev f1)<br />
00:1c.4 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #5 (rev f1)<br />
00:1c.6 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #7 (rev f1)<br />
00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1)<br />
00:1f.0 ISA bridge: Intel Corporation Device 9d4e (rev 21)<br />
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)<br />
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)<br />
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)<br />
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (4) I219-V (rev 21)<br />
04:00.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:00.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:01.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:02.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
06:00.0 System peripheral: Intel Corporation JHL6240 Thunderbolt 3 NHI (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
3c:00.0 USB controller: Intel Corporation Device 15c1 (rev 01)<br />
3d:00.0 Network controller: Intel Corporation Wireless 8265 / 8275 (rev 78)<br />
3e:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd Device a808<br />
<br />
<br />
{{ic|lsusb}} returns something like:<br />
<br />
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<br />
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
Bus 002 Device 013: ID 0bda:0316 Realtek Semiconductor Corp. <br />
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<br />
Bus 001 Device 004: ID 5986:2113 Acer, Inc <br />
Bus 001 Device 003: ID 8087:0a2b Intel Corp. <br />
Bus 001 Device 005: ID 046d:c246 Logitech, Inc. Gaming Mouse G300<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
<br />
=== Fingerprint reader ===<br />
Fingerprint sensor 06cb:009a is not supported by libfprint right now. There is a project to reverse enginer windows driver - https://github.com/nmikhailov/Validity90 .<br />
<br />
== Powersaving ==<br />
Without special configuration and with default firmware settings, power usage is a bit high (around 7,5W in idle). There are a few knobs to improve battery life:<br />
<br />
* Set "Thunderbolt BIOS Assist Mode" to "Enabled" in the EFI firmware interface. This seems to reduce number of idle wakeups.<br />
* Disable unused peripherals under "Security" -> "I/O port access" in the firmware. This especially applies to the SD/MMC-cardreader, which seems to drain some power even when idle<br />
<br />
As of Kernel 4.15, DisplayPort PSR (Panel self refresh) is disabled by default and broken when forcibly enabled (system hangs after a few seconds, display lag). 4.17-rc1 seems to improve a lot in this regard, but PSR still sometimes causes the screen to freeze for a few seconds.<br />
<br />
== See also ==<br />
<br />
* [https://www.youtube.com/watch?v=gRvYTLntgv4&list=PLiKgVPlhUNuz9k0xIp7PGUV5mmDdTS1vJ T480s install video playlist]</div>Iridiumhttps://wiki.archlinux.org/index.php?title=Lenovo_ThinkPad_T480s&diff=520766Lenovo ThinkPad T480s2018-05-09T17:31:45Z<p>Iridium: Mobile broadbank is working</p>
<hr />
<div>[[Category:Lenovo]]<br />
[[ja:Lenovo ThinkPad T480s]]<br />
{| class="wikitable" style="float: right;"<br />
| '''Device''' || '''Status''' <br />
|-<br />
| [[Intel graphics]] || {{Yes}} <br />
|-<br />
| [[Wireless]] || {{Yes}}<br />
|-<br />
| [[ALSA]] || {{Y|no beep}}<br />
|-<br />
| [[TrackPoint]] || {{Yes}}<br />
|-<br />
| [[Touchpad]] || {{Yes}}<br />
|-<br />
| [[Webcam]] || {{Yes}}<br />
|-<br />
| Fingerprint Sensor || {{No}}<br />
|-<br />
| [[ThinkPad mobile internet|Mobile Broadband]] || {{Yes}}<br />
|-<br />
| [[Bluetooth]] || <br />
|-<br />
| Smartcard Reader || <br />
|-<br />
|}<br />
<br />
This article covers the installation and configuration of Arch Linux on a Lenovo T480s laptop. Everything seems to work pretty much out the box.<br />
<br />
For a general overview of laptop-related articles and recommendations, see [[Laptop]].<br />
<br />
== Hardware ==<br />
<br />
Using kernel 4.15.7-1-ARCH.<br />
<br />
Release Date: 01/22/2018<br />
Product Name: 20L7CTO1WW<br />
SKU Number: LENOVO_MT_20L7_BU_Think_FM_ThinkPad T480s<br />
Product Name: 20L7CTO1WW<br />
<br />
{{ic|lspci}} returns something like:<br />
<br />
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 08)<br />
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)<br />
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 08)<br />
00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model<br />
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)<br />
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)<br />
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21)<br />
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)<br />
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 (rev f1)<br />
00:1c.4 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #5 (rev f1)<br />
00:1c.6 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #7 (rev f1)<br />
00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1)<br />
00:1f.0 ISA bridge: Intel Corporation Device 9d4e (rev 21)<br />
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)<br />
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)<br />
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)<br />
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (4) I219-V (rev 21)<br />
04:00.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:00.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:01.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:02.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
06:00.0 System peripheral: Intel Corporation JHL6240 Thunderbolt 3 NHI (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
3c:00.0 USB controller: Intel Corporation Device 15c1 (rev 01)<br />
3d:00.0 Network controller: Intel Corporation Wireless 8265 / 8275 (rev 78)<br />
3e:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd Device a808<br />
<br />
<br />
{{ic|lsusb}} returns something like:<br />
<br />
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<br />
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
Bus 002 Device 013: ID 0bda:0316 Realtek Semiconductor Corp. <br />
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<br />
Bus 001 Device 004: ID 5986:2113 Acer, Inc <br />
Bus 001 Device 003: ID 8087:0a2b Intel Corp. <br />
Bus 001 Device 005: ID 046d:c246 Logitech, Inc. Gaming Mouse G300<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
<br />
=== Fingerprint reader ===<br />
Fingerprint sensor 06cb:009a is not supported by libfprint right now. There is a project to reverse enginer windows driver - https://github.com/nmikhailov/Validity90 .<br />
<br />
== Powersaving ==<br />
Without special configuration and with default firmware settings, power usage is a bit high (around 7,5W in idle). There are a few knobs to improve battery life:<br />
<br />
* Set "Thunderbolt BIOS Assist Mode" to "Enabled" in the EFI firmware interface. This seems to reduce number of idle wakeups.<br />
* Disable unused peripherals under "Security" -> "I/O port access" in the firmware. This especially applies to the SD/MMC-cardreader, which seems to drain some power even when idle<br />
<br />
As of Kernel 4.15, DisplayPort PSR (Panel self refresh) is disabled by default and broken when forcibly enabled (system hangs after a few seconds, display lag). 4.17-rc1 seems to improve a lot in this regard, but PSR still sometimes causes the screen to freeze for a few seconds.<br />
<br />
== See also ==<br />
<br />
* [https://www.youtube.com/watch?v=gRvYTLntgv4&list=PLiKgVPlhUNuz9k0xIp7PGUV5mmDdTS1vJ T480s install video playlist]</div>Iridiumhttps://wiki.archlinux.org/index.php?title=Lenovo_ThinkPad_T480s&diff=518216Lenovo ThinkPad T480s2018-04-21T23:22:15Z<p>Iridium: Powersaving</p>
<hr />
<div>[[Category:Lenovo]]<br />
[[ja:Lenovo ThinkPad T480s]]<br />
{| class="wikitable" style="float: right;"<br />
| '''Device''' || '''Status''' <br />
|-<br />
| [[Intel graphics]] || {{Yes}} <br />
|-<br />
| [[Wireless]] || {{Yes}}<br />
|-<br />
| [[ALSA]] || {{Y|no beep}}<br />
|-<br />
| [[TrackPoint]] || {{Yes}}<br />
|-<br />
| [[Touchpad]] || {{Yes}}<br />
|-<br />
| [[Webcam]] || {{Yes}}<br />
|-<br />
| Fingerprint Sensor || {{No}}<br />
|-<br />
| [[ThinkPad mobile internet|Mobile Broadband]] || <br />
|-<br />
| [[Bluetooth]] || <br />
|-<br />
| Smartcard Reader || <br />
|-<br />
|}<br />
<br />
This article covers the installation and configuration of Arch Linux on a Lenovo T480s laptop. Everything seems to work pretty much out the box.<br />
<br />
For a general overview of laptop-related articles and recommendations, see [[Laptop]].<br />
<br />
== Hardware ==<br />
<br />
Using kernel 4.15.7-1-ARCH.<br />
<br />
Release Date: 01/22/2018<br />
Product Name: 20L7CTO1WW<br />
SKU Number: LENOVO_MT_20L7_BU_Think_FM_ThinkPad T480s<br />
Product Name: 20L7CTO1WW<br />
<br />
{{ic|lspci}} returns something like:<br />
<br />
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 08)<br />
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)<br />
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 08)<br />
00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model<br />
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)<br />
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)<br />
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21)<br />
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)<br />
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 (rev f1)<br />
00:1c.4 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #5 (rev f1)<br />
00:1c.6 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #7 (rev f1)<br />
00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1)<br />
00:1f.0 ISA bridge: Intel Corporation Device 9d4e (rev 21)<br />
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)<br />
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)<br />
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)<br />
00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (4) I219-V (rev 21)<br />
04:00.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:00.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:01.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
05:02.0 PCI bridge: Intel Corporation JHL6240 Thunderbolt 3 Bridge (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
06:00.0 System peripheral: Intel Corporation JHL6240 Thunderbolt 3 NHI (Low Power) [Alpine Ridge LP 2016] (rev 01)<br />
3c:00.0 USB controller: Intel Corporation Device 15c1 (rev 01)<br />
3d:00.0 Network controller: Intel Corporation Wireless 8265 / 8275 (rev 78)<br />
3e:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd Device a808<br />
<br />
<br />
{{ic|lsusb}} returns something like:<br />
<br />
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<br />
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
Bus 002 Device 013: ID 0bda:0316 Realtek Semiconductor Corp. <br />
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<br />
Bus 001 Device 004: ID 5986:2113 Acer, Inc <br />
Bus 001 Device 003: ID 8087:0a2b Intel Corp. <br />
Bus 001 Device 005: ID 046d:c246 Logitech, Inc. Gaming Mouse G300<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
<br />
=== Fingerprint reader ===<br />
Fingerprint sensor 06cb:009a is not supported by libfprint right now. There is a project to reverse enginer windows driver - https://github.com/nmikhailov/Validity90 .<br />
<br />
== Powersaving ==<br />
Without special configuration and with default firmware settings, power usage is a bit high (around 7,5W in idle). There are a few knobs to improve battery life:<br />
<br />
* Set "Thunderbolt BIOS Assist Mode" to "Enabled" in the EFI firmware interface. This seems to reduce number of idle wakeups.<br />
* Disable unused peripherals under "Security" -> "I/O port access" in the firmware. This especially applies to the SD/MMC-cardreader, which seems to drain some power even when idle<br />
<br />
As of Kernel 4.15, DisplayPort PSR (Panel self refresh) is disabled by default and broken when forcibly enabled (system hangs after a few seconds, display lag). 4.17-rc1 seems to improve a lot in this regard, but PSR still sometimes causes the screen to freeze for a few seconds.<br />
<br />
== See also ==<br />
<br />
* [https://www.youtube.com/watch?v=gRvYTLntgv4&list=PLiKgVPlhUNuz9k0xIp7PGUV5mmDdTS1vJ T480s install video playlist]</div>Iridiumhttps://wiki.archlinux.org/index.php?title=Font_configuration&diff=512295Font configuration2018-02-28T14:28:30Z<p>Iridium: Subpixel rendering</p>
<hr />
<div>[[Category:Fonts]]<br />
[[it:Font configuration]]<br />
[[ja:フォント設定]]<br />
[[ru:Font configuration]]<br />
[[sr:Font configuration]]<br />
[[zh-hans:Font configuration]]<br />
{{Related articles start}}<br />
{{Related|Fonts}}<br />
{{Related|Font configuration/Examples}}<br />
{{Related|Java Runtime Environment Fonts}}<br />
{{Related|Metric-compatible fonts}}<br />
{{Related|MS Fonts}}<br />
{{Related|X Logical Font Description}}<br />
{{Related articles end}}<br />
<br />
[http://www.freedesktop.org/wiki/Software/fontconfig/ Fontconfig] is a library designed to provide a list of available [[fonts]] to applications, and also for configuration for how fonts get rendered: see [[Wikipedia:Fontconfig]]. The FreeType library {{Pkg|freetype2}} renders the fonts, based on this configuration.<br />
<br />
Though Fontconfig is the standard in modern Linux, some applications rely on the original method of font selection and display, the [[X Logical Font Description]].<br />
<br />
The font rendering packages on Arch Linux includes support for ''freetype2'' with the bytecode interpreter (BCI) enabled. For better font rendering, especially with an LCD monitor, see [[#Fontconfig configuration]] and [[Font configuration/Examples]].<br />
<br />
== Font paths ==<br />
<br />
For fonts to be known to applications, they must be cataloged for easy and quick access.<br />
<br />
The font paths initially known to Fontconfig are: {{ic|/usr/share/fonts/}}, {{ic|~/.local/share/fonts}} (and {{ic|~/.fonts/}}, now deprecated). Fontconfig will scan these directories recursively. For ease of organization and installation, it is recommended to use these font paths when [[adding fonts]].<br />
<br />
To see a list of known Fontconfig fonts:<br />
$ fc-list : file<br />
<br />
See {{man|1|fc-list}} for more output formats.<br />
<br />
Check for Xorg's known font paths by reviewing its log:<br />
<br />
$ grep /fonts ~/.local/share/xorg/Xorg.0.log<br />
<br />
{{Tip|<br />
* You can also check the list of [[Xorg]]'s known font paths using the command {{ic|xset q}}.<br />
* Use {{ic|/var/log/Xorg.0.log}} if Xorg is run with root privileges.<br />
}}<br />
<br />
Keep in mind that Xorg does not search recursively through the {{ic|/usr/share/fonts/}} directory like Fontconfig does. To add a path, the full path must be used:<br />
Section "Files"<br />
FontPath "/usr/share/fonts/local/"<br />
EndSection<br />
<br />
If you want font paths to be set on a per-user basis, you can add and remove font paths from the default by adding the following line(s) to {{ic|~/.xinitrc}}:<br />
xset +fp /usr/share/fonts/local/ # Prepend a custom font path to Xorg's list of known font paths<br />
xset -fp /usr/share/fonts/sucky_fonts/ # Remove the specified font path from Xorg's list of known font paths<br />
<br />
To see a list of known Xorg fonts use {{ic|xlsfonts}}, from the {{Pkg|xorg-xlsfonts}} package.<br />
<br />
== Fontconfig configuration ==<br />
<br />
Fontconfig is documented in the [http://www.freedesktop.org/software/fontconfig/fontconfig-user.html fonts-conf] man page.<br />
<br />
Configuration can be done per-user through {{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}, and globally with {{ic|/etc/fonts/local.conf}}. The settings in the per-user configuration have precedence over the global configuration. Both these files use the same syntax.<br />
{{Note|Configuration files and directories: {{ic|~/.fonts.conf/}}, {{ic|~/.fonts.conf.d/}} and {{ic|~/.fontconfig/*.cache-*}} are deprecated since {{Pkg|fontconfig}} 2.10.1 ([http://cgit.freedesktop.org/fontconfig/commit/?id&#61;8c255fb185d5651b57380b0a9443001e8051b29d upstream commit]) and will not be read by default in the future versions of the package. New paths are {{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}, {{ic|$XDG_CONFIG_HOME/fontconfig/conf.d/NN-name.conf}} and {{ic|$XDG_CACHE_HOME/fontconfig/*.cache-*}} respectively. If using the second location, make sure the naming is valid (where {{ic|NN}} is a two digit number like {{ic|00}}, {{ic|10}}, or {{ic|99}}).}}<br />
<br />
Fontconfig gathers all its configurations in a central file ({{ic|/etc/fonts/fonts.conf}}). This file is replaced during fontconfig updates and should not be edited. Fontconfig-aware applications source this file to know available fonts and how they get rendered. This file is a conglomeration of rules from the global configuration ({{ic|/etc/fonts/local.conf}}), the configured presets in {{ic|/etc/fonts/conf.d/}}, and the user configuration file ({{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}). {{ic|fc-cache}} can be used to rebuild fontconfig's configuration, although changes will only be visible in newly launched applications.<br />
<br />
{{Note|For some desktop environments (such as [[GNOME]] and [[KDE]]) using the ''Font Control Panel'' will automatically create or overwrite the user font configuration file. For these desktop environments, it is best to match your already defined font configurations to get the expected behavior.}}<br />
<br />
Fontconfig configuration files use [[Wikipedia:XML|XML]] format and need these headers:<br />
<br />
{{bc|<nowiki><br />
<?xml version="1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<br />
<!-- settings go here --><br />
<br />
</fontconfig><br />
</nowiki>}}<br />
<br />
The configuration examples in this article omit these tags.<br />
<br />
=== Presets ===<br />
<br />
There are presets installed in the directory {{ic|/etc/fonts/conf.avail}}. They can be enabled by creating [[Wikipedia:Symbolic link|symbolic link]]s to them, both per-user and globally, as described in {{ic|/etc/fonts/conf.d/README}}. These presets will override matching settings in their respective configuration files.<br />
<br />
For example, to enable sub-pixel RGB rendering globally:<br />
<br />
# cd /etc/fonts/conf.d<br />
# ln -s ../conf.avail/10-sub-pixel-rgb.conf<br />
<br />
To do the same but instead for a per-user configuration:<br />
<br />
$ mkdir $XDG_CONFIG_HOME/fontconfig/conf.d<br />
$ ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf $XDG_CONFIG_HOME/fontconfig/conf.d<br />
<br />
=== Anti-aliasing ===<br />
<br />
[[Wikipedia:Font rasterization|Font rasterization]] converts vector font data to bitmap data so that it can be displayed. The result can appear jagged due to [[Wikipedia:Aliasing|aliasing]]. The technique known as [[Wikipedia:Anti-aliasing|anti-aliasing]] can be used to increase the apparent resolution of font edges. Anti-aliasing is '''enabled''' by default. To disable it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="antialias" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
{{Note|Some applications, like [[GNOME]] may [[#Troubleshooting|override default anti-aliasing settings]].}}<br />
<br />
=== Hinting ===<br />
<br />
[[Wikipedia:Font hinting|Font hinting]] (also known as instructing) is the use of mathematical instructions to adjust the display of an outline font so that it lines up with a rasterized grid, (i.e. the pixel grid of the display). Its intended effect is to make fonts appear more crisp so that they are more readable. Fonts will line up correctly without hinting when displays have around 300 [[Wikipedia:Dots per inch|DPI]].<br />
<br />
==== Byte-Code Interpreter (BCI) ====<br />
<br />
Using BCI hinting, instructions in TrueType fonts are rendered according to FreeTypes's interpreter. BCI hinting works well with fonts with good hinting instructions. Hinting is '''enabled''' by default. To disable it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="hinting" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
==== Autohinter ====<br />
<br />
The autohinter attempts to do automatic hinting and disregards any existing hinting information. Originally it was the default because TrueType2 fonts were patent-protected but now that these patents have expired there is very little reason to use it. It does work better with fonts that have broken or no hinting information but it will be strongly sub-optimal for fonts with good hinting information. Generally common fonts are of the later kind so autohinter will not be useful. Autohinter is '''disabled''' by default. To enable it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="autohint" mode="assign"><br />
<bool>true</bool><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
==== Hintstyle ====<br />
<br />
Hintstyle is the amount of font reshaping done to line up to the grid. Hinting values are: {{ic|hintnone}}, {{ic|hintslight}}, {{ic|hintmedium}}, and {{ic|hintfull}}. {{ic|hintslight}} will make the font more fuzzy to line up to the grid but will be better in retaining font shape, while {{ic|hintfull}} will be a crisp font that aligns well to the pixel grid but will lose a greater amount of font shape. '''{{ic|hintslight}}''' is the default setting. To change it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="hintstyle" mode="assign"><br />
<const>hintnone</const><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
{{Note|Some applications, like [[GNOME]] may [[#Troubleshooting|override default hinting settings.]]}}<br />
<br />
=== Pixel alignment ===<br />
Most monitors manufactured today use the Red, Green, Blue (RGB) specification. Fontconfig will need to know your monitor type to be able to display your fonts correctly. Monitors are either: '''RGB''' (most common), '''BGR''', '''V-RGB''' (vertical), or '''V-BGR'''. A monitor test can be found [http://www.lagom.nl/lcd-test/subpixel.php here].<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="rgba" mode="assign"><br />
<const>rgb</const><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
{{Note|Without subpixel rendering (see below), freetype will only care about the alignment (vertical or horizontal) of the subpixels. There is no difference between '''RGB''' and '''BGR''', for example.}}<br />
<br />
=== Subpixel rendering ===<br />
''Subpixel rendering'' is a technique to improve sharpness of font rendering by effectively tripling the horizontal (or vertical) resolution through the use of subpixels [https://en.wikipedia.org/wiki/Subpixel_rendering]. On Windows machines, this technique is called 'ClearType'. Subpixel rendering is covered by Microsoft-patents and '''disabled''' by default on Archlinux. To enable it, you have to re-compile freetype and enable the FT_CONFIG_OPTION_SUBPIXEL_RENDERING, or use e.g. the AUR-package {{AUR|freetype2-cleartype}}.<br />
<br />
To enable subpixel rendering, make sure that correct pixel alignment (see above) is configured.<br />
<br />
{{Note|1=The default autohinter and subpixel rendering are not designed to work together, hence you will want to enable the subpixel autohinter. Subpixel hinting mode configured in the file {{ic|/etc/profile.d/freetype2.sh}} which includes a brief documentation. Possible values are {{ic|1=truetype:interpreter-version=35}} (classic mode/2.6 default), {{ic|1=truetype:interpreter-version=38}} ("Infinality" mode), {{ic|1=truetype:interpreter-version=40}} (minimal mode/2.7 default). For details, also see [https://www.freetype.org/freetype2/docs/subpixel-hinting.html]}}<br />
<br />
==== LCD filter ====<br />
<br />
When using subpixel rendering, you should enable the LCD filter, which is designed to reduce colour fringing. This is described under [http://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html LCD filtering] in the FreeType 2 API reference. Different options are described under [http://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html#FT_LcdFilter FT_LcdFilter], and are illustrated by this [http://www.spasche.net/files/lcdfiltering/ LCD filter test] page.<br />
<br />
The {{ic|lcddefault}} filter will work for most users. Other filters are available that can be used in special situations: {{ic|lcdlight}}; a lighter filter ideal for fonts that look too bold or fuzzy, {{ic|lcdlegacy}}, the original Cairo filter; and {{ic|lcdnone}} to disable it entirely.<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="lcdfilter" mode="assign"><br />
<const>lcddefault</const><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
Note that this option has no effect if not used with a custom freetype-package that enables subpixel rendering.<br />
<br />
==== Advanced LCD filter specification ====<br />
<br />
If the available built-in LCD filters are not satisfactory, it is possible to tweak the font rendering very specifically by building a custom freetype2 package and modifying the hardcoded filters. The [[Arch Build System]] can be used to build and install packages from source.<br />
<br />
First, refresh the freetype2 PKGBUILD as root:<br />
<br />
# abs extra/freetype2<br />
<br />
This example uses {{ic|/var/abs/build}} as the build directory, substitute it according to your personal ABS setup. Download and extract the freetype2 package as a regular user:<br />
<br />
$ cd /var/abs/build<br />
$ cp -r ../extra/freetype2 .<br />
$ cd freetype2<br />
$ makepkg -o<br />
<br />
Enable subpixel rendering by editing the file {{ic|src/freetype-VERSION/include/freetype/config/ftoption.h}} and uncommenting the FT_CONFIG_OPTION_SUBPIXEL_RENDERING-#define.<br />
<br />
Then, edit the file {{ic|src/freetype-VERSION/src/base/ftlcdfil.c}} and look up the definition of the constant {{ic|default_filter[5]}}:<br />
<br />
static const FT_Byte default_filter[5] =<br />
{ 0x10, 0x40, 0x70, 0x40, 0x10 };<br />
<br />
This constant defines a low-pass filter applied to the rendered glyph. Modify it as needed. (reference: [https://lists.nongnu.org/archive/html/freetype/2006-09/msg00069.html freetype list discussion]) Save the file, build and install the custom package:<br />
<br />
$ makepkg -e<br />
# pacman -Rd freetype2<br />
# pacman -U freetype2-VERSION-ARCH.pkg.tar.xz<br />
<br />
Reboot or restart X. The lcddefault filter should now render fonts differently.<br />
<br />
=== Disable auto-hinter for bold fonts ===<br />
<br />
The auto-hinter uses sophisticated methods for font rendering, but often makes bold fonts too wide. Fortunately, a solution can be turning off the autohinter for bold fonts while leaving it on for the rest:<br />
...<br />
<match target="font"><br />
<test name="weight" compare="more"><br />
<const>medium</const><br />
</test><br />
<edit name="autohint" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
...<br />
<br />
=== Replace or set default fonts ===<br />
<br />
The most reliable way to do this is to add an XML fragment similar to the one below. ''Using the "binding" attribute will give you better results'', for example, in Firefox where you may not want to change properties of font being replaced. This will cause Ubuntu to be used in place of Georgia:<br />
<br />
{{bc|<nowiki><br />
...<br />
<match target="pattern"><br />
<test qual="any" name="family"><string>georgia</string></test><br />
<edit name="family" mode="assign" binding="same"><string>Ubuntu</string></edit><br />
</match><br />
...<br />
</nowiki>}}<br />
<br />
An alternate approach is to set the "preferred" font, but ''this only works if the original font is not on the system'', in which case the one specified will be substituted:<br />
<br />
{{bc|<nowiki><br />
...<br />
<!-- Replace Helvetica with Bitstream Vera Sans Mono --><br />
<!-- Note, an alias for Helvetica should already exist in default conf files --><br />
<alias><br />
<family>Helvetica</family><br />
<prefer><family>Bitstream Vera Sans Mono</family></prefer><br />
<default><family>fixed</family></default><br />
</alias><br />
...<br />
</nowiki>}}<br />
<br />
=== Whitelisting and blacklisting fonts ===<br />
<br />
The element {{ic|<selectfont>}} is used in conjunction with the {{ic|<acceptfont>}} and {{ic|<rejectfont>}} elements to selectively whitelist or blacklist fonts from the resolve list and match requests. The simplest and most typical use case it to reject one font that is needed to be installed, however is getting matched for a generic font query that is causing problems within application user interfaces.<br />
<br />
First obtain the Family name as listed in the font itself:<br />
<br />
{{hc|1=$ fc-scan .fonts/lklug.ttf --format='%{family}\n'|2=<br />
LKLUG<br />
}}<br />
<br />
Then use that Family name in a {{ic|<rejectfont>}} stanza:<br />
<br />
{{bc|<nowiki><br />
<selectfont><br />
<rejectfont><br />
<pattern><br />
<patelt name="family" ><br />
<string>LKLUG</string><br />
</patelt><br />
</pattern><br />
</rejectfont><br />
</selectfont><br />
</nowiki>}}<br />
<br />
Typically when both elements are combined, {{ic|<rejectfont>}} is first used on a more general matching glob to reject a large group (such as a whole directory), then {{ic|<acceptfont>}} is used after it to whitelist individual fonts out of the larger blacklisted group.<br />
<br />
{{bc|<nowiki><br />
<selectfont><br />
<rejectfont><br />
<glob>/usr/share/fonts/OTF/*</glob><br />
</rejectfont><br />
<acceptfont><br />
<pattern><br />
<patelt name="family" ><br />
<string>Monaco</string><br />
</patelt><br />
</pattern><br />
</acceptfont><br />
</selectfont><br />
</nowiki>}}<br />
<br />
=== Disable bitmap fonts ===<br />
<br />
Bitmap fonts are sometimes used as fallbacks for missing fonts, which may cause text to be rendered pixelated or too large. Use the {{ic|70-no-bitmaps.conf}} [[#Presets|preset]] to disable this behavior. <br />
<br />
<div id="EmbeddedBitmap">To disable embedded bitmap for all fonts:<div><br />
<br />
{{hc|~/.config/fontconfig/conf.d/20-no-embedded.conf|<nowiki><br />
<?xml version="1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<match target="font"><br />
<edit name="embeddedbitmap" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</fontconfig><br />
</nowiki>}}<br />
<br />
To disable embedded bitmap fonts for a specific font:<br />
<br />
<match target="font"><br />
<test qual="any" name="family"><br />
<string>Monaco</string><br />
</test><br />
<edit name="embeddedbitmap"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
<br />
=== Disable scaling of bitmap fonts ===<br />
<br />
To disable scaling of bitmap fonts (which often makes them blurry), remove {{ic|/etc/fonts/conf.d/10-scale-bitmap-fonts.conf}}.<br />
<br />
=== Create bold and italic styles for incomplete fonts ===<br />
<br />
FreeType has the ability to automatically create ''italic'' and '''bold''' styles for fonts that do not have them, but only if explicitly required by the application. Given programs rarely send these requests, this section covers manually forcing generation of missing styles.<br />
<br />
Start by editing {{ic|/usr/share/fonts/fonts.cache-1}} as explained below. Store a copy of the modifications on another file, because a font update with {{ic|fc-cache}} will overwrite {{ic|/usr/share/fonts/fonts.cache-1}}.<br />
<br />
Assuming the Dupree font is installed:<br />
"dupree.ttf" 0 "Dupree:style=Regular:slant=0:weight=80:width=100:foundry=unknown:index=0:outline=True:''etc...''<br />
<br />
Duplicate the line, change {{ic|<nowiki>style=Regular</nowiki>}} to {{ic|<nowiki>style=Bold</nowiki>}} or any other style. Also change {{ic|<nowiki>slant=0</nowiki>}} to {{ic|<nowiki>slant=100</nowiki>}} for italic, {{ic|<nowiki>weight=80</nowiki>}} to {{ic|<nowiki>weight=200</nowiki>}} for bold, or combine them for '''''bold italic''''':<br />
"dupree.ttf" 0 "Dupree:style=Bold Italic:slant=100:weight=200:width=100:foundry=unknown:index=0:outline=True:''etc...''<br />
<br />
Now add necessary modifications to {{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}:<br />
{{bc|<nowiki><br />
...<br />
<match target="font"><br />
<test name="family" qual="any"><br />
<string>Dupree</string><br />
&lt;!-- other fonts here .... --&gt;<br />
</test><br />
<test name="weight" compare="more_eq"><int>140</int></test><br />
<edit name="embolden" mode="assign"><bool>true</bool></edit><br />
</match><br />
<br />
<match target="font"><br />
<test name="family" qual="any"><br />
<string>Dupree</string><br />
&lt;!-- other fonts here .... --&gt;<br />
</test><br />
<test name="slant" compare="more_eq"><int>80</int></test><br />
<edit name="matrix" mode="assign"><br />
<times><br />
<name>matrix</name><br />
<matrix><br />
<double>1</double><double>0.2</double><br />
<double>0</double><double>1</double><br />
</matrix><br />
</times><br />
</edit><br />
</match><br />
...<br />
</nowiki>}}<br />
{{Tip| Use the value 'embolden' for existing bold fonts in order to make them even bolder.}}<br />
<br />
=== Change rule overriding ===<br />
<br />
{{Accuracy|{{ic|/etc/fonts/conf.d/50-user.conf}} will be created again when {{Pkg|fontconfig}} is updated}}<br />
<br />
Fontconfig processes files in {{ic|/etc/fonts/conf.d}} in numerical order. This enables rules or files to override one another, but often confuses users about what file gets parsed last.<br />
<br />
To guarantee that personal settings take precedence over any other rules, change their ordering:<br />
# cd /etc/fonts/conf.d<br />
# mv 50-user.conf 99-user.conf<br />
<br />
This change seems however to be unnecessary for the most of the cases, because a user is given enough control by default to set up own font preferences, hinting and antialiasing properties, alias new fonts to generic font families, etc.<br />
<br />
=== Query the current settings ===<br />
<br />
To find out what settings are in effect, use {{ic|fc-match --verbose}}. eg.<br />
<br />
{{hc|$ fc-match --verbose Sans|<br />
family: "DejaVu Sans"(s)<br />
hintstyle: 3(i)(s)<br />
hinting: True(s)<br />
...<br />
}}<br />
<br />
Look up the meaning of the numbers at http://www.freedesktop.org/software/fontconfig/fontconfig-user.html. Eg. 'hintstyle: 3' means 'hintfull'<br />
<br />
== Applications without fontconfig support ==<br />
<br />
Some applications like [[URxvt]] and [[Emacs]] will ignore fontconfig settings. You can work around this by using {{ic|~/.Xresources}}, but it is as flexible as fontconfig. Example (see [[#Fontconfig configuration]] for explanations of the options):<br />
<br />
{{hc|~/.Xresources|<nowiki><br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintslight<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
</nowiki>}}<br />
<br />
Make sure the settings are loaded properly when X starts with {{ic|xrdb -q}} (see [[Xresources]] for more information).<br />
<br />
== Troubleshooting ==<br />
<br />
=== Distorted fonts ===<br />
<br />
{{Note|96 DPI is not a standard. You should use your monitor's actual DPI to get proper font rendering, especially when using subpixel rendering.}}<br />
<br />
If fonts are still unexpectedly large or small, poorly proportioned or simply rendering poorly, fontconfig may be using the incorrect DPI.<br />
<br />
Fontconfig should be able to detect DPI parameters as discovered by the Xorg server. You can check the automatically discovered DPI with {{ic|xdpyinfo}} (provided by the {{pkg|xorg-xdpyinfo}} package):<br />
<br />
{{hc|<nowiki>$ xdpyinfo | grep dots</nowiki>|<br />
resolution: 102x102 dots per inch<br />
}}<br />
<br />
If the DPI is detected incorrectly (usually due to an incorrect monitor [[Wikipedia:Extended Display Identification Data|EDID]]), you can specify it manually in the Xorg configuration, see [[Xorg#Display size and DPI]]. This is the recommended solution, but it may not work with buggy drivers.<br />
<br />
Fontconfig will default to the Xft.dpi variable if it is set. Xft.dpi is usually set by desktop environments (usually to Xorg's DPI setting) or manually in {{ic|~/.Xdefaults}} or {{ic|~/.Xresources}}. Use xrdb to query for the value:<br />
<br />
{{hc|<nowiki>$ xrdb -query | grep dpi</nowiki>|<br />
Xft.dpi: 102<br />
}}<br />
<br />
Those still having problems can fall back to manually setting the DPI used by fontconfig:<br />
<br />
...<br />
<!-- Setup for DPI=96 --><br />
<match target="pattern"><br />
<edit name="dpi" mode="assign"><double>102</double></edit><br />
</match><br />
...<br />
<br />
=== Calibri, Cambria, Monaco, etc. not rendering properly ===<br />
<br />
Some scalable fonts have embedded bitmap versions which are rendered instead, mainly at smaller sizes. Using [[Metric-compatible fonts]] as replacements can improve the rendering in these cases. <br />
<br />
You can also force using scalable fonts at all sizes by [[#Disable bitmap fonts|disabling embedded bitmap]], sacrificing some rendering quality.<br />
<br />
=== Applications overriding hinting ===<br />
<br />
Some applications or desktop environments may override default fontconfig hinting and anti-aliasing settings. This may happen with [[GNOME]] 3, for example while you are using Qt applications like {{pkg|vlc}} or {{pkg|smplayer}}. Use the specific configuration program for the application in such cases. For GNOME, try {{pkg|gnome-tweak-tool}}.<br />
<br />
=== Applications not picking up hinting from DE's settings ===<br />
<br />
For instance, under GNOME it sometimes happens that Firefox applies full hinting even when it's set to "none" in GNOME's settings, which results in sharp and widened fonts. In this case you would have to add hinting settings to your {{ic|fonts.conf}} file:<br />
<br />
<?xml version='1.0'?><br />
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <br />
<fontconfig><br />
<match target="font"><br />
<edit mode="assign" name="hinting"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</fontconfig><br />
<br />
In this example, hinting is set to "grayscale".<br />
<br />
=== Incorrect hinting in GTK applications on non-Gnome systems ===<br />
<br />
{{Accuracy|Mentions GTK relies on fontconfig, then claims that "some" fonts get the hinting "wrong", and ends up refering to Xft (but see e.g [http://doc.opensuse.org/documentation/html/openSUSE_113/opensuse-reference/cha.fontconfig.html#sec.fontconfig.xft]). IOW, unsupported claims and unclear relations}}<br />
<br />
[[GNOME]] uses the XSETTINGS system to configure font rendering. Outside of GNOME, GTK applications rely on fontconfig, but some fonts get the hinting wrong causing them to look too bold or too light. <br />
<br />
A simple solution is using {{AUR|xsettingsd-git}} to provide the configuration, for example:<br />
<br />
{{hc|~/.xsettingsd|<br />
Xft/Hinting 1<br />
Xft/RGBA "rgb"<br />
Xft/HintStyle "hintslight"<br />
Xft/Antialias 1<br />
}}<br />
<br />
Alternatively you could just write the font configuration as {{ic|Xft.*}} directives in {{ic|~/.Xresources}} without using a settings daemon.<br />
<br />
=== Helvetica font problem in generated PDFs ===<br />
<br />
If the following command<br />
<br />
fc-match helvetica<br />
<br />
produces<br />
<br />
helvR12-ISO8859-1.pcf.gz: "Helvetica" "Regular"<br />
<br />
then the bitmap font provided by {{Pkg|xorg-fonts-75dpi}} is likely to be embedded into PDFs generated by "Print to File" or "Export" in various applications. The bitmap font was probably installed as a consequence of installing the whole {{Grp|xorg}} group (which is usually NOT recommended). To solve the pixelized font problem, you can uninstall the package. Install {{Pkg|gsfonts}} (Type 1) or {{Pkg|tex-gyre-fonts}} (OpenType) for corresponding free subsitute of Helvetica (and other PostScript/PDF base fonts).<br />
<br />
You may also experience similar problem when you open a PDF which requires Helvetica but does not have it embedded for viewing.<br />
<br />
=== FreeType Breaking Bitmap Fonts ===<br />
<br />
Some users are reporting problems ({{Bug|52502}}) with bitmap fonts having changed names after upgrading {{Pkg|freetype2}} to version 2.7.1, creating havok in terminal emulators and several other programs such as {{AUR|dwm}} or {{Pkg|dmenu}} by falling back to another (different) font. This was caused by the changes to the PCF font family format, which is described in their ''release notes'' [https://sourceforge.net/projects/freetype/files/freetype2/2.7.1/]. Users transitioning from the old format might want to create a ''font alias'' to remedy the problems, like the solution which is described in [https://forum.manjaro.org/t/terminus-font-name-fix-after-freetype2-update-to-2-7-1-1/15530], given here too:<br />
<br />
Assume we want to create an alias for {{Pkg|terminus-font}}, which was renamed from {{ic|Terminus}} to {{ic|xos4 Terminus}} in the previously described {{Pkg|freetype2}} update:<br />
* Create a configuration file in {{ic|/etc/fonts/conf.avail/}} for the ''font alias'':<br />
{{hc|/etc/fonts/conf.avail/33-TerminusPCFFont.conf|<?xml version<nowiki>=</nowiki>"1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<alias><br />
<family>Terminus</family><br />
<prefer><family>xos4 Terminus</family></prefer><br />
<default><family>fixed</family></default><br />
</alias><br />
</fontconfig><br />
}}<br />
* Create a symbolic link towards it in the {{ic|/etc/fonts/conf.d}} directory. In our example we would link as follows: {{ic|ln -s /etc/fonts/conf.avail/33-TerminusPCFFont.conf /etc/fonts/conf.d}} to make the change permanent.<br />
Everything should now work as it did before the update, the ''font alias'' should not be in effect, but make sure to either reload {{ic|.Xresources}} or restart the display server first so the affected programs can use the alias.<br />
<br />
== See also ==<br />
<br />
* [http://www.freedesktop.org/software/fontconfig/fontconfig-user.html Fontconfig Users' Guide]<br />
* [http://www.x.org/X11R6.8.2/doc/fonts.html Fonts in X11R6.8.2] - Official Xorg font information<br />
* [http://freetype.sourceforge.net/freetype2/ FreeType 2 overview]<br />
* [https://forums.gentoo.org/viewtopic-t-723341.html Gentoo font-rendering thread]<br />
* [http://www.freetype.org/freetype2/docs/text-rendering-general.html On slight hinting]</div>Iridiumhttps://wiki.archlinux.org/index.php?title=Talk:Font_configuration&diff=511989Talk:Font configuration2018-02-25T12:51:10Z<p>Iridium: subpixel-rendering vs hinting</p>
<hr />
<div>== Unclear instructions ==<br />
It is not entierly clear what file the following configuration should be put:<br />
<div style="border-style: dotted;"><br />
Keep in mind that Xorg does not search recursively through the /usr/share/fonts/ directory like Fontconfig does. To add a path, the full path must be used:<br />
<br />
Section "Files"<br />
FontPath "/usr/share/fonts/local/"<br />
EndSection<br />
</div><br />
[[User:Axper|axper]] ([[User talk:Axper|talk]]) 08:43, 30 November 2013 (UTC)<br />
<br />
== freetype2 config changes ==<br />
<br />
freetype2 no longer uses local.conf (same with infinality) and has switched to /etc/fonts/conf.d/* config files symlinked to /etc/fonts/conf.avail/*. I'm happy to update this page but don't want to step on the plans of someone more informed than I. If I don't hear back in a week or so I'll go ahead and add some minor changes to reflect this new configuration setup.<br />
:Freetype2 has had conf.avail and conf.d for a while. One of the files in conf.d is "51-local.conf" and that lets you use /etc/fonts/local.conf for your own local settings. The freetype2-infinality package just now installs the default non-customized Infinality config to conf.avail so people know it exists without reading the documentation. [[User:Thestinger|thestinger]] 13:18, 30 November 2011 (EST)<br />
<br />
== Contradictory recommendations? ==<br />
<br />
I'm not familiar with fontconfig - I've configured it rarely and a long time ago for a different OS. So I'm not sure if something is just not clear to me but as I read the article, it is giving me contradictory instructions:<br />
* early on, it suggests enabling both the autohinter and subpixel rendering to improve appearance after installing msfonts<br />
* later on, it says that the autohinter should not be used with subpixel rendering<br />
I realise that the methods used to enable these are different in the two cases (one sets up symlinks in conf.d; one adds sections to local.conf) but if this explains the apparent inconsistency, it would be really good to explain why there's no conflict in this case. --[[User:Margali|Margali]] 19:07, 4 March 2012 (EST)<br />
<br />
== Autogenerating missing shapes and weights ==<br />
<br />
Since the article is about improving the appearance of fonts, I would suggest qualifying the section which explains how to have fontconfig generate italics and bold/bolder fonts on the fly. I doubt very much that it is faking italics. I assume it fakes slanted versions (which are not the same as italics). Moreover, it is unlikely that the results of autogeneration will be especially pleasing. Font designers would abhor such things and not, I think, because they need the work! Faked versions can be acceptable but they will not look as good - the spacing will not be optimal, the shapes of the glyphs and the metrics will not be quite right as good fonts vary these things appropriately for different weights, shapes and sizes. --[[User:Margali|Margali]] 19:13, 4 March 2012 (EST)<br />
<br />
== Configuration confusion ==<br />
<br />
As currently set out, I'm not clear what the relationship is between configuration via symlinks in conf.d (adding to conf.avail as needed) and via local.conf. Should these be used for different aspects of configuration? Or are they equivalent/interchangeable?<br />
<br />
I also don't quite understand about the numbering. It looked to me as if higher numbered files under conf.d were more specific than lower numbered ones. I assumed this was so that e.g. config specific to a particular font overrode general, default config for all fonts. But the article suggests that is wrong. So should I be renumbering the files there in order to get this behaviour?<br />
<br />
e.g. Will the font-specific set up in 20-unhint-small-dejavu-sans-mono.conf get overridden by 10-bcihint.conf (a file I created with the section for BCI hints from the article)? I used 10- because that's the number for the autohinter file under conf.avail so I assumed that number was about right.<br />
<br />
--[[User:Margali|Margali]] 19:23, 4 March 2012 (EST)<br />
<br />
== October 2013 Quality of Font Rendering ==<br />
<br />
The package '''[https://www.archlinux.org/packages/extra/x86_64/fontconfig/ extra/fontconfig]''' was updated to '''2.11.0-1''' as at 2013-10-13 (UTC). Per ['''[https://bbs.archlinux.org/viewtopic.php?pid=1337337#p1337337 BBS#1337337]'''] by '''anton''' and associated ArchLinux flyspray entry ['''[https://bugs.archlinux.org/task/25499 FS#25499]'''], the file '''29-replace-bitmap-fonts.conf''' was dropped from the package (this file was an ArchLinux customisation).<br />
<br />
'''anton''' provides a workaround in that thread, as does '''FDServices''' at ['''[https://bbs.archlinux.org/viewtopic.php?pid=1337433#p1337433 BBS#1337433]'''] and '''heftig''' at ['''[https://bbs.archlinux.org/viewtopic.php?pid=1337776#p1337776 BBS#1337776]''']. I can confirm -- at least on my rig -- that the workaround provided by FDServices was successful after log out/in to establish a new session<br />
<br />
I am noting this here for the benefit of other contributors who may come hunting for this over time; not sure if (or how) it should be worked into the main article. Full credit is due to the contributors named above for this, rather than me; I am merely the messenger here!<br />
<br />
--[[User:Aexoxea|aexoxea]] ([[User_talk:Aexoxea|talk]]) 14:46, 15 October 2013 (UTC)<br />
<br />
: Further to the above, here is a 'compromise' method (per the information provided by '''FDServices''' and '''heftig''' above) that doesn't involve restoring the '''29-replace-bitmap-fonts.conf''' file, and that seems to be working OK here: Install '''[https://www.archlinux.org/packages/extra/any/tex-gyre-fonts/ extra/tex-gyre-fonts]''' and then symlink {{ic|/etc/fonts/conf.avail/70-no-bitmaps.conf}} under {{ic|~/.fonts.conf.d/}}.<br />
<br />
: Obviously this is user-specific, but it also avoids creating the symlink under '''/etc''' manually (since files created therein other than by packages tend to be forgotten). As I know comparitively little about font configuration, any feedback on issues or potential issues with this method is welcomed.<br />
<br />
: --[[User:Aexoxea|aexoxea]] ([[User_talk:Aexoxea|talk]]) 07:08, 16 October 2013 (UTC)<br />
<br />
:: The above generated some warnings for me, so I'm now using destination directory {{ic|~/.config/fontconfig/conf.d/}}. This appears to be an XDG-preferred destination (at least on ArchLinux), however I don't know whether others mileage may vary, so both are noted here. Hopefully the last update to this thread from me!<br />
<br />
:: --[[User:Aexoxea|aexoxea]] ([[User_talk:Aexoxea|talk]]) 08:14, 18 October 2013 (UTC)<br />
<br />
== Change Rule Overriding ==<br />
<br />
I'm fairly sure that this section is completely incorrect. I believe that while fontconfig does scan the XML files in the order stated, the first file scanned has the highest precedence. Hence 99-user.conf actually has the minimum precedence, and would therefore be overridden by anything else. --[[User:Teppic74|Teppic74]] ([[User talk:Teppic74|talk]]) 19:26, 6 June 2014 (UTC)<br />
<br />
:Now it should be correct. --[[User:Larpico|Larpico]] ([[User talk:Larpico|talk]]) 03:41, 28 October 2014 (UTC)<br />
<br />
:: My edit was reverted, but that's fine because it was incorrect. Unfortunately, the information that replaced it, is also wrong. Rule overriding in fontconfig seems to be quite complex. alexoj provides a very good explanation in this [https://github.com/bohoomil/fontconfig-ultimate/issues/51#issuecomment-64678322 issue]. --[[User:Larpico|Larpico]] ([[User talk:Larpico|talk]]) 23:04, 3 July 2015 (UTC)<br />
<br />
== [[Font configuration#Font problem in Generated PDFs]] states {{pkg|gsfonts}} (Type 1) ==<br />
<br />
[[Font configuration#Font problem in Generated PDFs]], which is section 4.6 in [[Font configuration#Troubleshooting]], states {{pkg|gsfonts}} (Type 1). Doesn't gsfonts-20160531 OTF, while 2015 and earlier, were Type1? While at it, perhaps {{pkg|xorg-fonts-type1}} should be mentioned too. {{unsigned|14:56, 2017 March 16|Regid }}<br />
<br />
== Subpixel rendering ==<br />
My edit on subpixel rendering for freetype2 just got reverted. To elaborate further: What's needed in order for the lcdfilter options to take effect is the FT_CONFIG_OPTION_SUBPIXEL_RENDERING, see [https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html]. This is *NOT* the same as TT_CONFIG_OPTION_SUBPIXEL_HINTING, which is enabled in Archlinux. Debian and Ubuntu enable SUBPIXEL_RENDERING in their binary packages, Archlinux doesn't.<br />
{{Unsigned|21:23, 11 February 2018|Iridium}}<br />
<br />
:What's the difference between subpixel ''rendering'' and ''hinting''? The claim that the instructions don't make any difference is not correct due to the note on subpixel hinting. In any case, the section should be reworked instead of adding a warning that the following instructions don't make sense. -- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 17:17, 12 February 2018 (UTC)<br />
<br />
::''Hinting'' is the process of aligning the font to the pixel grid in such a way that you maximize the sharpness while reducing the accurecy of spacing between letters a bit. freetype has done hinting for ages, either automatically (autohinter) or by interpreting bytecode embedded into truetype-fonts (although that has been disabled for some time due to patent issues). ''Subpixel rendering'' is the process of rendering letters in such a way that you exploit the physical LCD layout and the fact that the human eye is more sensitive to brightness than to color. Effectively, the vertical (or horizontal) resolution of the font rendering grid is tripled and the glyph is then rendered as usual, ignoring the fact that the subpixels have different colors. Example image: https://upload.wikimedia.org/wikipedia/commons/5/57/Subpixel-rendering-RGB.png . ''Subpixel hinting'' extends the hinter to align the glyphs on the grid defined by the ''subpixels'' (not ''pixels'') on the screen, which obviously becomes useful once you render on the grid defined by the subpixels. Once you enable subpixel ''rendering'', you get slight color fringes at the edges of the glyphs. The ''lcdfilter''-option applies a low-pass filter to the resulting image to reduce the visual effect of these, while slightly reducing sharpness. Archlinux enables subpixel ''hinting'', but not subpixel ''rendering''. However, without subpixel ''rendering'', ''subpixel hinting'' does not make much sense, as the rendering engine is going to output only pixels with R=G=B anyway. Still, the truetype-interpreter-option seems to make a slight difference, as it generally gives slightly different hinting results. Still, without subpixel ''rendering'', the hinting-part does not make much sense. The lcdfilter-option is ignored alltogether (see https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html), as in the absence of subpixel-rendered fonts, low-pass-filtering does not make any sense. After having a quick look at the freetype-source, the rgba-option at least has ''some'' effect: There is a difference between verical and horizontal subpixel-alignments, even with disabled subpixel-rendering. Still, enabling this option on an archlinux-system using distribution package won't have the described effects. [[User:Iridium|Iridium]] ([[User talk:Iridium|talk]]) 12:51, 25 February 2018 (UTC)</div>Iridiumhttps://wiki.archlinux.org/index.php?title=Talk:Font_configuration&diff=510501Talk:Font configuration2018-02-11T21:25:05Z<p>Iridium: subpixel rendering (2)</p>
<hr />
<div>== Subpixel rendering ==<br />
My edit on subpixel rendering for freetype2 just got reverted. To elaborate further: What's needed in order for the lcdfilter options to take effect is the FT_CONFIG_OPTION_SUBPIXEL_RENDERING, see [https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html]. This is *NOT* the same as TT_CONFIG_OPTION_SUBPIXEL_HINTING, which is enabled in Archlinux. Debian and Ubuntu enable SUBPIXEL_RENDERING in their binary packages, Archlinux doesn't.<br />
<br />
== Unclear instructions ==<br />
It is not entierly clear what file the following configuration should be put:<br />
<div style="border-style: dotted;"><br />
Keep in mind that Xorg does not search recursively through the /usr/share/fonts/ directory like Fontconfig does. To add a path, the full path must be used:<br />
<br />
Section "Files"<br />
FontPath "/usr/share/fonts/local/"<br />
EndSection<br />
</div><br />
[[User:Axper|axper]] ([[User talk:Axper|talk]]) 08:43, 30 November 2013 (UTC)<br />
<br />
== freetype2 config changes ==<br />
<br />
freetype2 no longer uses local.conf (same with infinality) and has switched to /etc/fonts/conf.d/* config files symlinked to /etc/fonts/conf.avail/*. I'm happy to update this page but don't want to step on the plans of someone more informed than I. If I don't hear back in a week or so I'll go ahead and add some minor changes to reflect this new configuration setup.<br />
:Freetype2 has had conf.avail and conf.d for a while. One of the files in conf.d is "51-local.conf" and that lets you use /etc/fonts/local.conf for your own local settings. The freetype2-infinality package just now installs the default non-customized Infinality config to conf.avail so people know it exists without reading the documentation. [[User:Thestinger|thestinger]] 13:18, 30 November 2011 (EST)<br />
<br />
== Contradictory recommendations? ==<br />
<br />
I'm not familiar with fontconfig - I've configured it rarely and a long time ago for a different OS. So I'm not sure if something is just not clear to me but as I read the article, it is giving me contradictory instructions:<br />
* early on, it suggests enabling both the autohinter and subpixel rendering to improve appearance after installing msfonts<br />
* later on, it says that the autohinter should not be used with subpixel rendering<br />
I realise that the methods used to enable these are different in the two cases (one sets up symlinks in conf.d; one adds sections to local.conf) but if this explains the apparent inconsistency, it would be really good to explain why there's no conflict in this case. --[[User:Margali|Margali]] 19:07, 4 March 2012 (EST)<br />
<br />
== Autogenerating missing shapes and weights ==<br />
<br />
Since the article is about improving the appearance of fonts, I would suggest qualifying the section which explains how to have fontconfig generate italics and bold/bolder fonts on the fly. I doubt very much that it is faking italics. I assume it fakes slanted versions (which are not the same as italics). Moreover, it is unlikely that the results of autogeneration will be especially pleasing. Font designers would abhor such things and not, I think, because they need the work! Faked versions can be acceptable but they will not look as good - the spacing will not be optimal, the shapes of the glyphs and the metrics will not be quite right as good fonts vary these things appropriately for different weights, shapes and sizes. --[[User:Margali|Margali]] 19:13, 4 March 2012 (EST)<br />
<br />
== Configuration confusion ==<br />
<br />
As currently set out, I'm not clear what the relationship is between configuration via symlinks in conf.d (adding to conf.avail as needed) and via local.conf. Should these be used for different aspects of configuration? Or are they equivalent/interchangeable?<br />
<br />
I also don't quite understand about the numbering. It looked to me as if higher numbered files under conf.d were more specific than lower numbered ones. I assumed this was so that e.g. config specific to a particular font overrode general, default config for all fonts. But the article suggests that is wrong. So should I be renumbering the files there in order to get this behaviour?<br />
<br />
e.g. Will the font-specific set up in 20-unhint-small-dejavu-sans-mono.conf get overridden by 10-bcihint.conf (a file I created with the section for BCI hints from the article)? I used 10- because that's the number for the autohinter file under conf.avail so I assumed that number was about right.<br />
<br />
--[[User:Margali|Margali]] 19:23, 4 March 2012 (EST)<br />
<br />
== October 2013 Quality of Font Rendering ==<br />
<br />
The package '''[https://www.archlinux.org/packages/extra/x86_64/fontconfig/ extra/fontconfig]''' was updated to '''2.11.0-1''' as at 2013-10-13 (UTC). Per ['''[https://bbs.archlinux.org/viewtopic.php?pid=1337337#p1337337 BBS#1337337]'''] by '''anton''' and associated ArchLinux flyspray entry ['''[https://bugs.archlinux.org/task/25499 FS#25499]'''], the file '''29-replace-bitmap-fonts.conf''' was dropped from the package (this file was an ArchLinux customisation).<br />
<br />
'''anton''' provides a workaround in that thread, as does '''FDServices''' at ['''[https://bbs.archlinux.org/viewtopic.php?pid=1337433#p1337433 BBS#1337433]'''] and '''heftig''' at ['''[https://bbs.archlinux.org/viewtopic.php?pid=1337776#p1337776 BBS#1337776]''']. I can confirm -- at least on my rig -- that the workaround provided by FDServices was successful after log out/in to establish a new session<br />
<br />
I am noting this here for the benefit of other contributors who may come hunting for this over time; not sure if (or how) it should be worked into the main article. Full credit is due to the contributors named above for this, rather than me; I am merely the messenger here!<br />
<br />
--[[User:Aexoxea|aexoxea]] ([[User_talk:Aexoxea|talk]]) 14:46, 15 October 2013 (UTC)<br />
<br />
: Further to the above, here is a 'compromise' method (per the information provided by '''FDServices''' and '''heftig''' above) that doesn't involve restoring the '''29-replace-bitmap-fonts.conf''' file, and that seems to be working OK here: Install '''[https://www.archlinux.org/packages/extra/any/tex-gyre-fonts/ extra/tex-gyre-fonts]''' and then symlink {{ic|/etc/fonts/conf.avail/70-no-bitmaps.conf}} under {{ic|~/.fonts.conf.d/}}.<br />
<br />
: Obviously this is user-specific, but it also avoids creating the symlink under '''/etc''' manually (since files created therein other than by packages tend to be forgotten). As I know comparitively little about font configuration, any feedback on issues or potential issues with this method is welcomed.<br />
<br />
: --[[User:Aexoxea|aexoxea]] ([[User_talk:Aexoxea|talk]]) 07:08, 16 October 2013 (UTC)<br />
<br />
:: The above generated some warnings for me, so I'm now using destination directory {{ic|~/.config/fontconfig/conf.d/}}. This appears to be an XDG-preferred destination (at least on ArchLinux), however I don't know whether others mileage may vary, so both are noted here. Hopefully the last update to this thread from me!<br />
<br />
:: --[[User:Aexoxea|aexoxea]] ([[User_talk:Aexoxea|talk]]) 08:14, 18 October 2013 (UTC)<br />
<br />
== Change Rule Overriding ==<br />
<br />
I'm fairly sure that this section is completely incorrect. I believe that while fontconfig does scan the XML files in the order stated, the first file scanned has the highest precedence. Hence 99-user.conf actually has the minimum precedence, and would therefore be overridden by anything else. --[[User:Teppic74|Teppic74]] ([[User talk:Teppic74|talk]]) 19:26, 6 June 2014 (UTC)<br />
<br />
:Now it should be correct. --[[User:Larpico|Larpico]] ([[User talk:Larpico|talk]]) 03:41, 28 October 2014 (UTC)<br />
<br />
:: My edit was reverted, but that's fine because it was incorrect. Unfortunately, the information that replaced it, is also wrong. Rule overriding in fontconfig seems to be quite complex. alexoj provides a very good explanation in this [https://github.com/bohoomil/fontconfig-ultimate/issues/51#issuecomment-64678322 issue]. --[[User:Larpico|Larpico]] ([[User talk:Larpico|talk]]) 23:04, 3 July 2015 (UTC)<br />
<br />
== [[Font configuration#Font problem in Generated PDFs]] states {{pkg|gsfonts}} (Type 1) ==<br />
<br />
[[Font configuration#Font problem in Generated PDFs]], which is section 4.6 in [[Font configuration#Troubleshooting]], states {{pkg|gsfonts}} (Type 1). Doesn't gsfonts-20160531 OTF, while 2015 and earlier, were Type1? While at it, perhaps {{pkg|xorg-fonts-type1}} should be mentioned too. {{unsigned|14:56, 2017 March 16|Regid }}</div>Iridiumhttps://wiki.archlinux.org/index.php?title=Font_configuration&diff=510500Font configuration2018-02-11T21:23:52Z<p>Iridium: Re previous edit: It isn't. See discussion.</p>
<hr />
<div>[[Category:Fonts]]<br />
[[it:Font configuration]]<br />
[[ja:フォント設定]]<br />
[[ru:Font configuration]]<br />
[[sr:Font configuration]]<br />
[[zh-hans:Font configuration]]<br />
{{Related articles start}}<br />
{{Related|Fonts}}<br />
{{Related|Font configuration/Examples}}<br />
{{Related|Java Runtime Environment Fonts}}<br />
{{Related|Metric-compatible fonts}}<br />
{{Related|MS Fonts}}<br />
{{Related|X Logical Font Description}}<br />
{{Related articles end}}<br />
<br />
[http://www.freedesktop.org/wiki/Software/fontconfig/ Fontconfig] is a library designed to provide a list of available [[fonts]] to applications, and also for configuration for how fonts get rendered: see [[Wikipedia:Fontconfig]]. The FreeType library {{Pkg|freetype2}} renders the fonts, based on this configuration.<br />
<br />
Though Fontconfig is the standard in modern Linux, some applications rely on the original method of font selection and display, the [[X Logical Font Description]].<br />
<br />
The font rendering packages on Arch Linux includes support for ''freetype2'' with the bytecode interpreter (BCI) enabled. For better font rendering, especially with an LCD monitor, see [[#Fontconfig configuration]] and [[Font configuration/Examples]].<br />
<br />
== Font paths ==<br />
<br />
For fonts to be known to applications, they must be cataloged for easy and quick access.<br />
<br />
The font paths initially known to Fontconfig are: {{ic|/usr/share/fonts/}}, {{ic|~/.local/share/fonts}} (and {{ic|~/.fonts/}}, now deprecated). Fontconfig will scan these directories recursively. For ease of organization and installation, it is recommended to use these font paths when [[adding fonts]].<br />
<br />
To see a list of known Fontconfig fonts:<br />
$ fc-list : file<br />
<br />
See {{man|1|fc-list}} for more output formats.<br />
<br />
Check for Xorg's known font paths by reviewing its log:<br />
<br />
$ grep /fonts ~/.local/share/xorg/Xorg.0.log<br />
<br />
{{Tip|<br />
* You can also check the list of [[Xorg]]'s known font paths using the command {{ic|xset q}}.<br />
* Use {{ic|/var/log/Xorg.0.log}} if Xorg is run with root privileges.<br />
}}<br />
<br />
Keep in mind that Xorg does not search recursively through the {{ic|/usr/share/fonts/}} directory like Fontconfig does. To add a path, the full path must be used:<br />
Section "Files"<br />
FontPath "/usr/share/fonts/local/"<br />
EndSection<br />
<br />
If you want font paths to be set on a per-user basis, you can add and remove font paths from the default by adding the following line(s) to {{ic|~/.xinitrc}}:<br />
xset +fp /usr/share/fonts/local/ # Prepend a custom font path to Xorg's list of known font paths<br />
xset -fp /usr/share/fonts/sucky_fonts/ # Remove the specified font path from Xorg's list of known font paths<br />
<br />
To see a list of known Xorg fonts use {{ic|xlsfonts}}, from the {{Pkg|xorg-xlsfonts}} package.<br />
<br />
== Fontconfig configuration ==<br />
<br />
Fontconfig is documented in the [http://www.freedesktop.org/software/fontconfig/fontconfig-user.html fonts-conf] man page.<br />
<br />
Configuration can be done per-user through {{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}, and globally with {{ic|/etc/fonts/local.conf}}. The settings in the per-user configuration have precedence over the global configuration. Both these files use the same syntax.<br />
{{Note|Configuration files and directories: {{ic|~/.fonts.conf/}}, {{ic|~/.fonts.conf.d/}} and {{ic|~/.fontconfig/*.cache-*}} are deprecated since {{Pkg|fontconfig}} 2.10.1 ([http://cgit.freedesktop.org/fontconfig/commit/?id&#61;8c255fb185d5651b57380b0a9443001e8051b29d upstream commit]) and will not be read by default in the future versions of the package. New paths are {{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}, {{ic|$XDG_CONFIG_HOME/fontconfig/conf.d/NN-name.conf}} and {{ic|$XDG_CACHE_HOME/fontconfig/*.cache-*}} respectively. If using the second location, make sure the naming is valid (where {{ic|NN}} is a two digit number like {{ic|00}}, {{ic|10}}, or {{ic|99}}).}}<br />
<br />
Fontconfig gathers all its configurations in a central file ({{ic|/etc/fonts/fonts.conf}}). This file is replaced during fontconfig updates and should not be edited. Fontconfig-aware applications source this file to know available fonts and how they get rendered. This file is a conglomeration of rules from the global configuration ({{ic|/etc/fonts/local.conf}}), the configured presets in {{ic|/etc/fonts/conf.d/}}, and the user configuration file ({{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}). {{ic|fc-cache}} can be used to rebuild fontconfig's configuration, although changes will only be visible in newly launched applications.<br />
<br />
{{Note|For some desktop environments (such as [[GNOME]] and [[KDE]]) using the ''Font Control Panel'' will automatically create or overwrite the user font configuration file. For these desktop environments, it is best to match your already defined font configurations to get the expected behavior.}}<br />
<br />
Fontconfig configuration files use [[Wikipedia:XML|XML]] format and need these headers:<br />
<br />
{{bc|<nowiki><br />
<?xml version="1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<br />
<!-- settings go here --><br />
<br />
</fontconfig><br />
</nowiki>}}<br />
<br />
The configuration examples in this article omit these tags.<br />
<br />
=== Presets ===<br />
<br />
There are presets installed in the directory {{ic|/etc/fonts/conf.avail}}. They can be enabled by creating [[Wikipedia:Symbolic link|symbolic link]]s to them, both per-user and globally, as described in {{ic|/etc/fonts/conf.d/README}}. These presets will override matching settings in their respective configuration files.<br />
<br />
For example, to enable sub-pixel RGB rendering globally:<br />
<br />
# cd /etc/fonts/conf.d<br />
# ln -s ../conf.avail/10-sub-pixel-rgb.conf<br />
<br />
To do the same but instead for a per-user configuration:<br />
<br />
$ mkdir $XDG_CONFIG_HOME/fontconfig/conf.d<br />
$ ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf $XDG_CONFIG_HOME/fontconfig/conf.d<br />
<br />
=== Anti-aliasing ===<br />
<br />
[[Wikipedia:Font rasterization|Font rasterization]] converts vector font data to bitmap data so that it can be displayed. The result can appear jagged due to [[Wikipedia:Aliasing|aliasing]]. The technique known as [[Wikipedia:Anti-aliasing|anti-aliasing]] can be used to increase the apparent resolution of font edges. Anti-aliasing is '''enabled''' by default. To disable it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="antialias" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
{{Note|Some applications, like [[GNOME]] may [[#Troubleshooting|override default anti-aliasing settings]].}}<br />
<br />
=== Hinting ===<br />
<br />
[[Wikipedia:Font hinting|Font hinting]] (also known as instructing) is the use of mathematical instructions to adjust the display of an outline font so that it lines up with a rasterized grid, (i.e. the pixel grid of the display). Its intended effect is to make fonts appear more crisp so that they are more readable. Fonts will line up correctly without hinting when displays have around 300 [[Wikipedia:Dots per inch|DPI]].<br />
<br />
==== Byte-Code Interpreter (BCI) ====<br />
<br />
Using BCI hinting, instructions in TrueType fonts are rendered according to FreeTypes's interpreter. BCI hinting works well with fonts with good hinting instructions. Hinting is '''enabled''' by default. To disable it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="hinting" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
==== Autohinter ====<br />
<br />
The autohinter attempts to do automatic hinting and disregards any existing hinting information. Originally it was the default because TrueType2 fonts were patent-protected but now that these patents have expired there is very little reason to use it. It does work better with fonts that have broken or no hinting information but it will be strongly sub-optimal for fonts with good hinting information. Generally common fonts are of the later kind so autohinter will not be useful. Autohinter is '''disabled''' by default. To enable it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="autohint" mode="assign"><br />
<bool>true</bool><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
==== Hintstyle ====<br />
<br />
Hintstyle is the amount of font reshaping done to line up to the grid. Hinting values are: {{ic|hintnone}}, {{ic|hintslight}}, {{ic|hintmedium}}, and {{ic|hintfull}}. {{ic|hintslight}} will make the font more fuzzy to line up to the grid but will be better in retaining font shape, while {{ic|hintfull}} will be a crisp font that aligns well to the pixel grid but will lose a greater amount of font shape. '''{{ic|hintslight}}''' is the default setting. To change it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="hintstyle" mode="assign"><br />
<const>hintnone</const><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
{{Note|Some applications, like [[GNOME]] may [[#Troubleshooting|override default hinting settings.]]}}<br />
<br />
=== Subpixel rendering ===<br />
{{Warning|Subpixel rendering is covered by Microsoft patents on ClearType and has to be explicitely enabled during compilation. Currently, the Archlinux package for freetype2 does '''*NOT*''' enable subpixel rendering, and the settings outlined below do not have any effect on font rendering. In order to use subpixel rendering, you have to compile e.g. the AUR-package 'freetype2-cleartype'}}<br />
<br />
Most monitors manufactured today use the Red, Green, Blue (RGB) specification. Fontconfig will need to know your monitor type to be able to display your fonts correctly. Monitors are either: '''RGB''' (most common), '''BGR''', '''V-RGB''' (vertical), or '''V-BGR'''. A monitor test can be found [http://www.lagom.nl/lcd-test/subpixel.php here].<br />
<br />
To enable subpixel rendering:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="rgba" mode="assign"><br />
<const>rgb</const><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
{{Note|1=Subpixel rendering effectively triples the horizontal (or vertical) resolution for fonts by making use of subpixels. The default autohinter and subpixel rendering are not designed to work together, hence you will want to enable the subpixel autohinter. Prior to {{Pkg|freetype2}} 2.7, the subpixel hinting mode was configurable with the {{ic|FT2_SUBPIXEL_HINTING}} [[environment variable]]. Possible values were {{ic|0}} (disabled), {{ic|1}} (Infinality) and {{ic|2}} (minimal). From {{Pkg|freetype2}} 2.7, subpixel hinting uses upstream's configuration method, which has a different syntax. Subpixel hinting mode configured in the file {{ic|/etc/profile.d/freetype2.sh}} which includes a brief documentation. Possible values are {{ic|1=truetype:interpreter-version=35}} (classic mode/2.6 default), {{ic|1=truetype:interpreter-version=38}} ("Infinality" mode), {{ic|1=truetype:interpreter-version=40}} (minimal mode/2.7 default).}}<br />
<br />
==== LCD filter ====<br />
<br />
When using subpixel rendering, you should enable the LCD filter, which is designed to reduce colour fringing. This is described under [http://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html LCD filtering] in the FreeType 2 API reference. Different options are described under [http://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html#FT_LcdFilter FT_LcdFilter], and are illustrated by this [http://www.spasche.net/files/lcdfiltering/ LCD filter test] page.<br />
<br />
The {{ic|lcddefault}} filter will work for most users. Other filters are available that can be used in special situations: {{ic|lcdlight}}; a lighter filter ideal for fonts that look too bold or fuzzy, {{ic|lcdlegacy}}, the original Cairo filter; and {{ic|lcdnone}} to disable it entirely.<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="lcdfilter" mode="assign"><br />
<const>lcddefault</const><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
==== Advanced LCD filter specification ====<br />
<br />
If the available built-in LCD filters are not satisfactory, it is possible to tweak the font rendering very specifically by building a custom freetype2 package and modifying the hardcoded filters. The [[Arch Build System]] can be used to build and install packages from source.<br />
<br />
First, refresh the freetype2 PKGBUILD as root:<br />
<br />
# abs extra/freetype2<br />
<br />
This example uses {{ic|/var/abs/build}} as the build directory, substitute it according to your personal ABS setup. Download and extract the freetype2 package as a regular user:<br />
<br />
$ cd /var/abs/build<br />
$ cp -r ../extra/freetype2 .<br />
$ cd freetype2<br />
$ makepkg -o<br />
<br />
Edit the file {{ic|src/freetype-VERSION/src/base/ftlcdfil.c}} and look up the definition of the constant {{ic|default_filter[5]}}:<br />
<br />
static const FT_Byte default_filter[5] =<br />
{ 0x10, 0x40, 0x70, 0x40, 0x10 };<br />
<br />
This constant defines a low-pass filter applied to the rendered glyph. Modify it as needed. (reference: [https://lists.nongnu.org/archive/html/freetype/2006-09/msg00069.html freetype list discussion]) Save the file, build and install the custom package:<br />
<br />
$ makepkg -e<br />
# pacman -Rd freetype2<br />
# pacman -U freetype2-VERSION-ARCH.pkg.tar.xz<br />
<br />
Reboot or restart X. The lcddefault filter should now render fonts differently.<br />
<br />
=== Disable auto-hinter for bold fonts ===<br />
<br />
The auto-hinter uses sophisticated methods for font rendering, but often makes bold fonts too wide. Fortunately, a solution can be turning off the autohinter for bold fonts while leaving it on for the rest:<br />
...<br />
<match target="font"><br />
<test name="weight" compare="more"><br />
<const>medium</const><br />
</test><br />
<edit name="autohint" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
...<br />
<br />
=== Replace or set default fonts ===<br />
<br />
The most reliable way to do this is to add an XML fragment similar to the one below. ''Using the "binding" attribute will give you better results'', for example, in Firefox where you may not want to change properties of font being replaced. This will cause Ubuntu to be used in place of Georgia:<br />
<br />
{{bc|<nowiki><br />
...<br />
<match target="pattern"><br />
<test qual="any" name="family"><string>georgia</string></test><br />
<edit name="family" mode="assign" binding="same"><string>Ubuntu</string></edit><br />
</match><br />
...<br />
</nowiki>}}<br />
<br />
An alternate approach is to set the "preferred" font, but ''this only works if the original font is not on the system'', in which case the one specified will be substituted:<br />
<br />
{{bc|<nowiki><br />
...<br />
<!-- Replace Helvetica with Bitstream Vera Sans Mono --><br />
<!-- Note, an alias for Helvetica should already exist in default conf files --><br />
<alias><br />
<family>Helvetica</family><br />
<prefer><family>Bitstream Vera Sans Mono</family></prefer><br />
<default><family>fixed</family></default><br />
</alias><br />
...<br />
</nowiki>}}<br />
<br />
=== Whitelisting and blacklisting fonts ===<br />
<br />
The element {{ic|<selectfont>}} is used in conjunction with the {{ic|<acceptfont>}} and {{ic|<rejectfont>}} elements to selectively whitelist or blacklist fonts from the resolve list and match requests. The simplest and most typical use case it to reject one font that is needed to be installed, however is getting matched for a generic font query that is causing problems within application user interfaces.<br />
<br />
First obtain the Family name as listed in the font itself:<br />
<br />
{{hc|1=$ fc-scan .fonts/lklug.ttf --format='%{family}\n'|2=<br />
LKLUG<br />
}}<br />
<br />
Then use that Family name in a {{ic|<rejectfont>}} stanza:<br />
<br />
{{bc|<nowiki><br />
<selectfont><br />
<rejectfont><br />
<pattern><br />
<patelt name="family" ><br />
<string>LKLUG</string><br />
</patelt><br />
</pattern><br />
</rejectfont><br />
</selectfont><br />
</nowiki>}}<br />
<br />
Typically when both elements are combined, {{ic|<rejectfont>}} is first used on a more general matching glob to reject a large group (such as a whole directory), then {{ic|<acceptfont>}} is used after it to whitelist individual fonts out of the larger blacklisted group.<br />
<br />
{{bc|<nowiki><br />
<selectfont><br />
<rejectfont><br />
<glob>/usr/share/fonts/OTF/*</glob><br />
</rejectfont><br />
<acceptfont><br />
<pattern><br />
<patelt name="family" ><br />
<string>Monaco</string><br />
</patelt><br />
</pattern><br />
</acceptfont><br />
</selectfont><br />
</nowiki>}}<br />
<br />
=== Disable bitmap fonts ===<br />
<br />
Bitmap fonts are sometimes used as fallbacks for missing fonts, which may cause text to be rendered pixelated or too large. Use the {{ic|70-no-bitmaps.conf}} [[#Presets|preset]] to disable this behavior. <br />
<br />
<div id="EmbeddedBitmap">To disable embedded bitmap for all fonts:<div><br />
<br />
{{hc|~/.config/fontconfig/conf.d/20-no-embedded.conf|<nowiki><br />
<?xml version="1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<match target="font"><br />
<edit name="embeddedbitmap" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</fontconfig><br />
</nowiki>}}<br />
<br />
To disable embedded bitmap fonts for a specific font:<br />
<br />
<match target="font"><br />
<test qual="any" name="family"><br />
<string>Monaco</string><br />
</test><br />
<edit name="embeddedbitmap"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
<br />
=== Disable scaling of bitmap fonts ===<br />
<br />
To disable scaling of bitmap fonts (which often makes them blurry), remove {{ic|/etc/fonts/conf.d/10-scale-bitmap-fonts.conf}}.<br />
<br />
=== Create bold and italic styles for incomplete fonts ===<br />
<br />
FreeType has the ability to automatically create ''italic'' and '''bold''' styles for fonts that do not have them, but only if explicitly required by the application. Given programs rarely send these requests, this section covers manually forcing generation of missing styles.<br />
<br />
Start by editing {{ic|/usr/share/fonts/fonts.cache-1}} as explained below. Store a copy of the modifications on another file, because a font update with {{ic|fc-cache}} will overwrite {{ic|/usr/share/fonts/fonts.cache-1}}.<br />
<br />
Assuming the Dupree font is installed:<br />
"dupree.ttf" 0 "Dupree:style=Regular:slant=0:weight=80:width=100:foundry=unknown:index=0:outline=True:''etc...''<br />
<br />
Duplicate the line, change {{ic|<nowiki>style=Regular</nowiki>}} to {{ic|<nowiki>style=Bold</nowiki>}} or any other style. Also change {{ic|<nowiki>slant=0</nowiki>}} to {{ic|<nowiki>slant=100</nowiki>}} for italic, {{ic|<nowiki>weight=80</nowiki>}} to {{ic|<nowiki>weight=200</nowiki>}} for bold, or combine them for '''''bold italic''''':<br />
"dupree.ttf" 0 "Dupree:style=Bold Italic:slant=100:weight=200:width=100:foundry=unknown:index=0:outline=True:''etc...''<br />
<br />
Now add necessary modifications to {{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}:<br />
{{bc|<nowiki><br />
...<br />
<match target="font"><br />
<test name="family" qual="any"><br />
<string>Dupree</string><br />
&lt;!-- other fonts here .... --&gt;<br />
</test><br />
<test name="weight" compare="more_eq"><int>140</int></test><br />
<edit name="embolden" mode="assign"><bool>true</bool></edit><br />
</match><br />
<br />
<match target="font"><br />
<test name="family" qual="any"><br />
<string>Dupree</string><br />
&lt;!-- other fonts here .... --&gt;<br />
</test><br />
<test name="slant" compare="more_eq"><int>80</int></test><br />
<edit name="matrix" mode="assign"><br />
<times><br />
<name>matrix</name><br />
<matrix><br />
<double>1</double><double>0.2</double><br />
<double>0</double><double>1</double><br />
</matrix><br />
</times><br />
</edit><br />
</match><br />
...<br />
</nowiki>}}<br />
{{Tip| Use the value 'embolden' for existing bold fonts in order to make them even bolder.}}<br />
<br />
=== Change rule overriding ===<br />
<br />
{{Accuracy|{{ic|/etc/fonts/conf.d/50-user.conf}} will be created again when {{Pkg|fontconfig}} is updated}}<br />
<br />
Fontconfig processes files in {{ic|/etc/fonts/conf.d}} in numerical order. This enables rules or files to override one another, but often confuses users about what file gets parsed last.<br />
<br />
To guarantee that personal settings take precedence over any other rules, change their ordering:<br />
# cd /etc/fonts/conf.d<br />
# mv 50-user.conf 99-user.conf<br />
<br />
This change seems however to be unnecessary for the most of the cases, because a user is given enough control by default to set up own font preferences, hinting and antialiasing properties, alias new fonts to generic font families, etc.<br />
<br />
=== Query the current settings ===<br />
<br />
To find out what settings are in effect, use {{ic|fc-match --verbose}}. eg.<br />
<br />
{{hc|$ fc-match --verbose Sans|<br />
family: "DejaVu Sans"(s)<br />
hintstyle: 3(i)(s)<br />
hinting: True(s)<br />
...<br />
}}<br />
<br />
Look up the meaning of the numbers at http://www.freedesktop.org/software/fontconfig/fontconfig-user.html. Eg. 'hintstyle: 3' means 'hintfull'<br />
<br />
== Applications without fontconfig support ==<br />
<br />
Some applications like [[URxvt]] and [[Emacs]] will ignore fontconfig settings. You can work around this by using {{ic|~/.Xresources}}, but it is as flexible as fontconfig. Example (see [[#Fontconfig configuration]] for explanations of the options):<br />
<br />
{{hc|~/.Xresources|<nowiki><br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintslight<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
</nowiki>}}<br />
<br />
Make sure the settings are loaded properly when X starts with {{ic|xrdb -q}} (see [[Xresources]] for more information).<br />
<br />
== Troubleshooting ==<br />
<br />
=== Distorted fonts ===<br />
<br />
{{Note|96 DPI is not a standard. You should use your monitor's actual DPI to get proper font rendering, especially when using subpixel rendering.}}<br />
<br />
If fonts are still unexpectedly large or small, poorly proportioned or simply rendering poorly, fontconfig may be using the incorrect DPI.<br />
<br />
Fontconfig should be able to detect DPI parameters as discovered by the Xorg server. You can check the automatically discovered DPI with {{ic|xdpyinfo}} (provided by the {{pkg|xorg-xdpyinfo}} package):<br />
<br />
{{hc|<nowiki>$ xdpyinfo | grep dots</nowiki>|<br />
resolution: 102x102 dots per inch<br />
}}<br />
<br />
If the DPI is detected incorrectly (usually due to an incorrect monitor [[Wikipedia:Extended Display Identification Data|EDID]]), you can specify it manually in the Xorg configuration, see [[Xorg#Display size and DPI]]. This is the recommended solution, but it may not work with buggy drivers.<br />
<br />
Fontconfig will default to the Xft.dpi variable if it is set. Xft.dpi is usually set by desktop environments (usually to Xorg's DPI setting) or manually in {{ic|~/.Xdefaults}} or {{ic|~/.Xresources}}. Use xrdb to query for the value:<br />
<br />
{{hc|<nowiki>$ xrdb -query | grep dpi</nowiki>|<br />
Xft.dpi: 102<br />
}}<br />
<br />
Those still having problems can fall back to manually setting the DPI used by fontconfig:<br />
<br />
...<br />
<!-- Setup for DPI=96 --><br />
<match target="pattern"><br />
<edit name="dpi" mode="assign"><double>102</double></edit><br />
</match><br />
...<br />
<br />
=== Calibri, Cambria, Monaco, etc. not rendering properly ===<br />
<br />
Some scalable fonts have embedded bitmap versions which are rendered instead, mainly at smaller sizes. Using [[Metric-compatible fonts]] as replacements can improve the rendering in these cases. <br />
<br />
You can also force using scalable fonts at all sizes by [[#Disable bitmap fonts|disabling embedded bitmap]], sacrificing some rendering quality.<br />
<br />
=== Applications overriding hinting ===<br />
<br />
Some applications or desktop environments may override default fontconfig hinting and anti-aliasing settings. This may happen with [[GNOME]] 3, for example while you are using Qt applications like {{pkg|vlc}} or {{pkg|smplayer}}. Use the specific configuration program for the application in such cases. For GNOME, try {{pkg|gnome-tweak-tool}}.<br />
<br />
=== Applications not picking up hinting from DE's settings ===<br />
<br />
For instance, under GNOME it sometimes happens that Firefox applies full hinting even when it's set to "none" in GNOME's settings, which results in sharp and widened fonts. In this case you would have to add hinting settings to your {{ic|fonts.conf}} file:<br />
<br />
<?xml version='1.0'?><br />
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <br />
<fontconfig><br />
<match target="font"><br />
<edit mode="assign" name="hinting"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</fontconfig><br />
<br />
In this example, hinting is set to "grayscale".<br />
<br />
=== Incorrect hinting in GTK applications on non-Gnome systems ===<br />
<br />
{{Accuracy|Mentions GTK relies on fontconfig, then claims that "some" fonts get the hinting "wrong", and ends up refering to Xft (but see e.g [http://doc.opensuse.org/documentation/html/openSUSE_113/opensuse-reference/cha.fontconfig.html#sec.fontconfig.xft]). IOW, unsupported claims and unclear relations}}<br />
<br />
[[GNOME]] uses the XSETTINGS system to configure font rendering. Outside of GNOME, GTK applications rely on fontconfig, but some fonts get the hinting wrong causing them to look too bold or too light. <br />
<br />
A simple solution is using {{AUR|xsettingsd-git}} to provide the configuration, for example:<br />
<br />
{{hc|~/.xsettingsd|<br />
Xft/Hinting 1<br />
Xft/RGBA "rgb"<br />
Xft/HintStyle "hintslight"<br />
Xft/Antialias 1<br />
}}<br />
<br />
Alternatively you could just write the font configuration as {{ic|Xft.*}} directives in {{ic|~/.Xresources}} without using a settings daemon.<br />
<br />
=== Helvetica font problem in generated PDFs ===<br />
<br />
If the following command<br />
<br />
fc-match helvetica<br />
<br />
produces<br />
<br />
helvR12-ISO8859-1.pcf.gz: "Helvetica" "Regular"<br />
<br />
then the bitmap font provided by {{Pkg|xorg-fonts-75dpi}} is likely to be embedded into PDFs generated by "Print to File" or "Export" in various applications. The bitmap font was probably installed as a consequence of installing the whole {{Grp|xorg}} group (which is usually NOT recommended). To solve the pixelized font problem, you can uninstall the package. Install {{Pkg|gsfonts}} (Type 1) or {{Pkg|tex-gyre-fonts}} (OpenType) for corresponding free subsitute of Helvetica (and other PostScript/PDF base fonts).<br />
<br />
You may also experience similar problem when you open a PDF which requires Helvetica but does not have it embedded for viewing.<br />
<br />
=== FreeType Breaking Bitmap Fonts ===<br />
<br />
Some users are reporting problems ({{Bug|52502}}) with bitmap fonts having changed names after upgrading {{Pkg|freetype2}} to version 2.7.1, creating havok in terminal emulators and several other programs such as {{AUR|dwm}} or {{Pkg|dmenu}} by falling back to another (different) font. This was caused by the changes to the PCF font family format, which is described in their ''release notes'' [https://sourceforge.net/projects/freetype/files/freetype2/2.7.1/]. Users transitioning from the old format might want to create a ''font alias'' to remedy the problems, like the solution which is described in [https://forum.manjaro.org/t/terminus-font-name-fix-after-freetype2-update-to-2-7-1-1/15530], given here too:<br />
<br />
Assume we want to create an alias for {{Pkg|terminus-font}}, which was renamed from {{ic|Terminus}} to {{ic|xos4 Terminus}} in the previously described {{Pkg|freetype2}} update:<br />
* Create a configuration file in {{ic|/etc/fonts/conf.avail/}} for the ''font alias'':<br />
{{hc|/etc/fonts/conf.avail/33-TerminusPCFFont.conf|<?xml version<nowiki>=</nowiki>"1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<alias><br />
<family>Terminus</family><br />
<prefer><family>xos4 Terminus</family></prefer><br />
<default><family>fixed</family></default><br />
</alias><br />
</fontconfig><br />
}}<br />
* Create a symbolic link towards it in the {{ic|/etc/fonts/conf.d}} directory. In our example we would link as follows: {{ic|ln -s /etc/fonts/conf.avail/33-TerminusPCFFont.conf /etc/fonts/conf.d}} to make the change permanent.<br />
Everything should now work as it did before the update, the ''font alias'' should not be in effect, but make sure to either reload {{ic|.Xresources}} or restart the display server first so the affected programs can use the alias.<br />
<br />
== See also ==<br />
<br />
* [http://www.freedesktop.org/software/fontconfig/fontconfig-user.html Fontconfig Users' Guide]<br />
* [http://www.x.org/X11R6.8.2/doc/fonts.html Fonts in X11R6.8.2] - Official Xorg font information<br />
* [http://freetype.sourceforge.net/freetype2/ FreeType 2 overview]<br />
* [https://forums.gentoo.org/viewtopic-t-723341.html Gentoo font-rendering thread]<br />
* [http://www.freetype.org/freetype2/docs/text-rendering-general.html On slight hinting]</div>Iridiumhttps://wiki.archlinux.org/index.php?title=Talk:Font_configuration&diff=510499Talk:Font configuration2018-02-11T21:23:49Z<p>Iridium: subpixel rendering</p>
<hr />
<div>== Subpixel rendering ==<br />
My edit on subpixel rendering for freetype2 just got reverted. To elaborate further: What's needed in order for the lcdfilter options to take effect is the FT_CONFIG_OPTION_SUBPIXEL_RENDERING, see [[https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html]]. This is *NOT* the same as TT_CONFIG_OPTION_SUBPIXEL_HINTING. Debian and Ubuntu enable SUBPIXEL_RENDERING in their binary packages, Archlinux doesn't.<br />
<br />
== Unclear instructions ==<br />
It is not entierly clear what file the following configuration should be put:<br />
<div style="border-style: dotted;"><br />
Keep in mind that Xorg does not search recursively through the /usr/share/fonts/ directory like Fontconfig does. To add a path, the full path must be used:<br />
<br />
Section "Files"<br />
FontPath "/usr/share/fonts/local/"<br />
EndSection<br />
</div><br />
[[User:Axper|axper]] ([[User talk:Axper|talk]]) 08:43, 30 November 2013 (UTC)<br />
<br />
== freetype2 config changes ==<br />
<br />
freetype2 no longer uses local.conf (same with infinality) and has switched to /etc/fonts/conf.d/* config files symlinked to /etc/fonts/conf.avail/*. I'm happy to update this page but don't want to step on the plans of someone more informed than I. If I don't hear back in a week or so I'll go ahead and add some minor changes to reflect this new configuration setup.<br />
:Freetype2 has had conf.avail and conf.d for a while. One of the files in conf.d is "51-local.conf" and that lets you use /etc/fonts/local.conf for your own local settings. The freetype2-infinality package just now installs the default non-customized Infinality config to conf.avail so people know it exists without reading the documentation. [[User:Thestinger|thestinger]] 13:18, 30 November 2011 (EST)<br />
<br />
== Contradictory recommendations? ==<br />
<br />
I'm not familiar with fontconfig - I've configured it rarely and a long time ago for a different OS. So I'm not sure if something is just not clear to me but as I read the article, it is giving me contradictory instructions:<br />
* early on, it suggests enabling both the autohinter and subpixel rendering to improve appearance after installing msfonts<br />
* later on, it says that the autohinter should not be used with subpixel rendering<br />
I realise that the methods used to enable these are different in the two cases (one sets up symlinks in conf.d; one adds sections to local.conf) but if this explains the apparent inconsistency, it would be really good to explain why there's no conflict in this case. --[[User:Margali|Margali]] 19:07, 4 March 2012 (EST)<br />
<br />
== Autogenerating missing shapes and weights ==<br />
<br />
Since the article is about improving the appearance of fonts, I would suggest qualifying the section which explains how to have fontconfig generate italics and bold/bolder fonts on the fly. I doubt very much that it is faking italics. I assume it fakes slanted versions (which are not the same as italics). Moreover, it is unlikely that the results of autogeneration will be especially pleasing. Font designers would abhor such things and not, I think, because they need the work! Faked versions can be acceptable but they will not look as good - the spacing will not be optimal, the shapes of the glyphs and the metrics will not be quite right as good fonts vary these things appropriately for different weights, shapes and sizes. --[[User:Margali|Margali]] 19:13, 4 March 2012 (EST)<br />
<br />
== Configuration confusion ==<br />
<br />
As currently set out, I'm not clear what the relationship is between configuration via symlinks in conf.d (adding to conf.avail as needed) and via local.conf. Should these be used for different aspects of configuration? Or are they equivalent/interchangeable?<br />
<br />
I also don't quite understand about the numbering. It looked to me as if higher numbered files under conf.d were more specific than lower numbered ones. I assumed this was so that e.g. config specific to a particular font overrode general, default config for all fonts. But the article suggests that is wrong. So should I be renumbering the files there in order to get this behaviour?<br />
<br />
e.g. Will the font-specific set up in 20-unhint-small-dejavu-sans-mono.conf get overridden by 10-bcihint.conf (a file I created with the section for BCI hints from the article)? I used 10- because that's the number for the autohinter file under conf.avail so I assumed that number was about right.<br />
<br />
--[[User:Margali|Margali]] 19:23, 4 March 2012 (EST)<br />
<br />
== October 2013 Quality of Font Rendering ==<br />
<br />
The package '''[https://www.archlinux.org/packages/extra/x86_64/fontconfig/ extra/fontconfig]''' was updated to '''2.11.0-1''' as at 2013-10-13 (UTC). Per ['''[https://bbs.archlinux.org/viewtopic.php?pid=1337337#p1337337 BBS#1337337]'''] by '''anton''' and associated ArchLinux flyspray entry ['''[https://bugs.archlinux.org/task/25499 FS#25499]'''], the file '''29-replace-bitmap-fonts.conf''' was dropped from the package (this file was an ArchLinux customisation).<br />
<br />
'''anton''' provides a workaround in that thread, as does '''FDServices''' at ['''[https://bbs.archlinux.org/viewtopic.php?pid=1337433#p1337433 BBS#1337433]'''] and '''heftig''' at ['''[https://bbs.archlinux.org/viewtopic.php?pid=1337776#p1337776 BBS#1337776]''']. I can confirm -- at least on my rig -- that the workaround provided by FDServices was successful after log out/in to establish a new session<br />
<br />
I am noting this here for the benefit of other contributors who may come hunting for this over time; not sure if (or how) it should be worked into the main article. Full credit is due to the contributors named above for this, rather than me; I am merely the messenger here!<br />
<br />
--[[User:Aexoxea|aexoxea]] ([[User_talk:Aexoxea|talk]]) 14:46, 15 October 2013 (UTC)<br />
<br />
: Further to the above, here is a 'compromise' method (per the information provided by '''FDServices''' and '''heftig''' above) that doesn't involve restoring the '''29-replace-bitmap-fonts.conf''' file, and that seems to be working OK here: Install '''[https://www.archlinux.org/packages/extra/any/tex-gyre-fonts/ extra/tex-gyre-fonts]''' and then symlink {{ic|/etc/fonts/conf.avail/70-no-bitmaps.conf}} under {{ic|~/.fonts.conf.d/}}.<br />
<br />
: Obviously this is user-specific, but it also avoids creating the symlink under '''/etc''' manually (since files created therein other than by packages tend to be forgotten). As I know comparitively little about font configuration, any feedback on issues or potential issues with this method is welcomed.<br />
<br />
: --[[User:Aexoxea|aexoxea]] ([[User_talk:Aexoxea|talk]]) 07:08, 16 October 2013 (UTC)<br />
<br />
:: The above generated some warnings for me, so I'm now using destination directory {{ic|~/.config/fontconfig/conf.d/}}. This appears to be an XDG-preferred destination (at least on ArchLinux), however I don't know whether others mileage may vary, so both are noted here. Hopefully the last update to this thread from me!<br />
<br />
:: --[[User:Aexoxea|aexoxea]] ([[User_talk:Aexoxea|talk]]) 08:14, 18 October 2013 (UTC)<br />
<br />
== Change Rule Overriding ==<br />
<br />
I'm fairly sure that this section is completely incorrect. I believe that while fontconfig does scan the XML files in the order stated, the first file scanned has the highest precedence. Hence 99-user.conf actually has the minimum precedence, and would therefore be overridden by anything else. --[[User:Teppic74|Teppic74]] ([[User talk:Teppic74|talk]]) 19:26, 6 June 2014 (UTC)<br />
<br />
:Now it should be correct. --[[User:Larpico|Larpico]] ([[User talk:Larpico|talk]]) 03:41, 28 October 2014 (UTC)<br />
<br />
:: My edit was reverted, but that's fine because it was incorrect. Unfortunately, the information that replaced it, is also wrong. Rule overriding in fontconfig seems to be quite complex. alexoj provides a very good explanation in this [https://github.com/bohoomil/fontconfig-ultimate/issues/51#issuecomment-64678322 issue]. --[[User:Larpico|Larpico]] ([[User talk:Larpico|talk]]) 23:04, 3 July 2015 (UTC)<br />
<br />
== [[Font configuration#Font problem in Generated PDFs]] states {{pkg|gsfonts}} (Type 1) ==<br />
<br />
[[Font configuration#Font problem in Generated PDFs]], which is section 4.6 in [[Font configuration#Troubleshooting]], states {{pkg|gsfonts}} (Type 1). Doesn't gsfonts-20160531 OTF, while 2015 and earlier, were Type1? While at it, perhaps {{pkg|xorg-fonts-type1}} should be mentioned too. {{unsigned|14:56, 2017 March 16|Regid }}</div>Iridiumhttps://wiki.archlinux.org/index.php?title=Font_configuration&diff=510494Font configuration2018-02-11T20:04:47Z<p>Iridium: Subpixel rendering is disabled in archlinux</p>
<hr />
<div>[[Category:Fonts]]<br />
[[it:Font configuration]]<br />
[[ja:フォント設定]]<br />
[[ru:Font configuration]]<br />
[[sr:Font configuration]]<br />
[[zh-hans:Font configuration]]<br />
{{Related articles start}}<br />
{{Related|Fonts}}<br />
{{Related|Font configuration/Examples}}<br />
{{Related|Java Runtime Environment Fonts}}<br />
{{Related|Metric-compatible fonts}}<br />
{{Related|MS Fonts}}<br />
{{Related|X Logical Font Description}}<br />
{{Related articles end}}<br />
<br />
[http://www.freedesktop.org/wiki/Software/fontconfig/ Fontconfig] is a library designed to provide a list of available [[fonts]] to applications, and also for configuration for how fonts get rendered: see [[Wikipedia:Fontconfig]]. The FreeType library {{Pkg|freetype2}} renders the fonts, based on this configuration.<br />
<br />
Though Fontconfig is the standard in modern Linux, some applications rely on the original method of font selection and display, the [[X Logical Font Description]].<br />
<br />
The font rendering packages on Arch Linux includes support for ''freetype2'' with the bytecode interpreter (BCI) enabled. For better font rendering, especially with an LCD monitor, see [[#Fontconfig configuration]] and [[Font configuration/Examples]].<br />
<br />
== Font paths ==<br />
<br />
For fonts to be known to applications, they must be cataloged for easy and quick access.<br />
<br />
The font paths initially known to Fontconfig are: {{ic|/usr/share/fonts/}}, {{ic|~/.local/share/fonts}} (and {{ic|~/.fonts/}}, now deprecated). Fontconfig will scan these directories recursively. For ease of organization and installation, it is recommended to use these font paths when [[adding fonts]].<br />
<br />
To see a list of known Fontconfig fonts:<br />
$ fc-list : file<br />
<br />
See {{man|1|fc-list}} for more output formats.<br />
<br />
Check for Xorg's known font paths by reviewing its log:<br />
<br />
$ grep /fonts ~/.local/share/xorg/Xorg.0.log<br />
<br />
{{Tip|<br />
* You can also check the list of [[Xorg]]'s known font paths using the command {{ic|xset q}}.<br />
* Use {{ic|/var/log/Xorg.0.log}} if Xorg is run with root privileges.<br />
}}<br />
<br />
Keep in mind that Xorg does not search recursively through the {{ic|/usr/share/fonts/}} directory like Fontconfig does. To add a path, the full path must be used:<br />
Section "Files"<br />
FontPath "/usr/share/fonts/local/"<br />
EndSection<br />
<br />
If you want font paths to be set on a per-user basis, you can add and remove font paths from the default by adding the following line(s) to {{ic|~/.xinitrc}}:<br />
xset +fp /usr/share/fonts/local/ # Prepend a custom font path to Xorg's list of known font paths<br />
xset -fp /usr/share/fonts/sucky_fonts/ # Remove the specified font path from Xorg's list of known font paths<br />
<br />
To see a list of known Xorg fonts use {{ic|xlsfonts}}, from the {{Pkg|xorg-xlsfonts}} package.<br />
<br />
== Fontconfig configuration ==<br />
<br />
Fontconfig is documented in the [http://www.freedesktop.org/software/fontconfig/fontconfig-user.html fonts-conf] man page.<br />
<br />
Configuration can be done per-user through {{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}, and globally with {{ic|/etc/fonts/local.conf}}. The settings in the per-user configuration have precedence over the global configuration. Both these files use the same syntax.<br />
{{Note|Configuration files and directories: {{ic|~/.fonts.conf/}}, {{ic|~/.fonts.conf.d/}} and {{ic|~/.fontconfig/*.cache-*}} are deprecated since {{Pkg|fontconfig}} 2.10.1 ([http://cgit.freedesktop.org/fontconfig/commit/?id&#61;8c255fb185d5651b57380b0a9443001e8051b29d upstream commit]) and will not be read by default in the future versions of the package. New paths are {{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}, {{ic|$XDG_CONFIG_HOME/fontconfig/conf.d/NN-name.conf}} and {{ic|$XDG_CACHE_HOME/fontconfig/*.cache-*}} respectively. If using the second location, make sure the naming is valid (where {{ic|NN}} is a two digit number like {{ic|00}}, {{ic|10}}, or {{ic|99}}).}}<br />
<br />
Fontconfig gathers all its configurations in a central file ({{ic|/etc/fonts/fonts.conf}}). This file is replaced during fontconfig updates and should not be edited. Fontconfig-aware applications source this file to know available fonts and how they get rendered. This file is a conglomeration of rules from the global configuration ({{ic|/etc/fonts/local.conf}}), the configured presets in {{ic|/etc/fonts/conf.d/}}, and the user configuration file ({{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}). {{ic|fc-cache}} can be used to rebuild fontconfig's configuration, although changes will only be visible in newly launched applications.<br />
<br />
{{Note|For some desktop environments (such as [[GNOME]] and [[KDE]]) using the ''Font Control Panel'' will automatically create or overwrite the user font configuration file. For these desktop environments, it is best to match your already defined font configurations to get the expected behavior.}}<br />
<br />
Fontconfig configuration files use [[Wikipedia:XML|XML]] format and need these headers:<br />
<br />
{{bc|<nowiki><br />
<?xml version="1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<br />
<!-- settings go here --><br />
<br />
</fontconfig><br />
</nowiki>}}<br />
<br />
The configuration examples in this article omit these tags.<br />
<br />
=== Presets ===<br />
<br />
There are presets installed in the directory {{ic|/etc/fonts/conf.avail}}. They can be enabled by creating [[Wikipedia:Symbolic link|symbolic link]]s to them, both per-user and globally, as described in {{ic|/etc/fonts/conf.d/README}}. These presets will override matching settings in their respective configuration files.<br />
<br />
For example, to enable sub-pixel RGB rendering globally:<br />
<br />
# cd /etc/fonts/conf.d<br />
# ln -s ../conf.avail/10-sub-pixel-rgb.conf<br />
<br />
To do the same but instead for a per-user configuration:<br />
<br />
$ mkdir $XDG_CONFIG_HOME/fontconfig/conf.d<br />
$ ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf $XDG_CONFIG_HOME/fontconfig/conf.d<br />
<br />
=== Anti-aliasing ===<br />
<br />
[[Wikipedia:Font rasterization|Font rasterization]] converts vector font data to bitmap data so that it can be displayed. The result can appear jagged due to [[Wikipedia:Aliasing|aliasing]]. The technique known as [[Wikipedia:Anti-aliasing|anti-aliasing]] can be used to increase the apparent resolution of font edges. Anti-aliasing is '''enabled''' by default. To disable it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="antialias" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
{{Note|Some applications, like [[GNOME]] may [[#Troubleshooting|override default anti-aliasing settings]].}}<br />
<br />
=== Hinting ===<br />
<br />
[[Wikipedia:Font hinting|Font hinting]] (also known as instructing) is the use of mathematical instructions to adjust the display of an outline font so that it lines up with a rasterized grid, (i.e. the pixel grid of the display). Its intended effect is to make fonts appear more crisp so that they are more readable. Fonts will line up correctly without hinting when displays have around 300 [[Wikipedia:Dots per inch|DPI]].<br />
<br />
==== Byte-Code Interpreter (BCI) ====<br />
<br />
Using BCI hinting, instructions in TrueType fonts are rendered according to FreeTypes's interpreter. BCI hinting works well with fonts with good hinting instructions. Hinting is '''enabled''' by default. To disable it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="hinting" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
==== Autohinter ====<br />
<br />
The autohinter attempts to do automatic hinting and disregards any existing hinting information. Originally it was the default because TrueType2 fonts were patent-protected but now that these patents have expired there is very little reason to use it. It does work better with fonts that have broken or no hinting information but it will be strongly sub-optimal for fonts with good hinting information. Generally common fonts are of the later kind so autohinter will not be useful. Autohinter is '''disabled''' by default. To enable it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="autohint" mode="assign"><br />
<bool>true</bool><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
==== Hintstyle ====<br />
<br />
Hintstyle is the amount of font reshaping done to line up to the grid. Hinting values are: {{ic|hintnone}}, {{ic|hintslight}}, {{ic|hintmedium}}, and {{ic|hintfull}}. {{ic|hintslight}} will make the font more fuzzy to line up to the grid but will be better in retaining font shape, while {{ic|hintfull}} will be a crisp font that aligns well to the pixel grid but will lose a greater amount of font shape. '''{{ic|hintslight}}''' is the default setting. To change it:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="hintstyle" mode="assign"><br />
<const>hintnone</const><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
{{Note|Some applications, like [[GNOME]] may [[#Troubleshooting|override default hinting settings.]]}}<br />
<br />
=== Subpixel rendering ===<br />
{{Warning|Subpixel rendering is covered by Microsoft patents on ClearType and has to be explicitely enabled during compilation. Currently, the Archlinux package for freetype2 does '''*NOT*''' enable subpixel rendering, and the settings outlined below do not have any effect on font rendering. In order to use subpixel rendering, you have to compile e.g. the AUR-package 'freetype2-cleartype'}}<br />
<br />
Most monitors manufactured today use the Red, Green, Blue (RGB) specification. Fontconfig will need to know your monitor type to be able to display your fonts correctly. Monitors are either: '''RGB''' (most common), '''BGR''', '''V-RGB''' (vertical), or '''V-BGR'''. A monitor test can be found [http://www.lagom.nl/lcd-test/subpixel.php here].<br />
<br />
To enable subpixel rendering:<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="rgba" mode="assign"><br />
<const>rgb</const><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
{{Note|1=Subpixel rendering effectively triples the horizontal (or vertical) resolution for fonts by making use of subpixels. The default autohinter and subpixel rendering are not designed to work together, hence you will want to enable the subpixel autohinter. Prior to {{Pkg|freetype2}} 2.7, the subpixel hinting mode was configurable with the {{ic|FT2_SUBPIXEL_HINTING}} [[environment variable]]. Possible values were {{ic|0}} (disabled), {{ic|1}} (Infinality) and {{ic|2}} (minimal). From {{Pkg|freetype2}} 2.7, subpixel hinting uses upstream's configuration method, which has a different syntax. Subpixel hinting mode configured in the file {{ic|/etc/profile.d/freetype2.sh}} which includes a brief documentation. Possible values are {{ic|1=truetype:interpreter-version=35}} (classic mode/2.6 default), {{ic|1=truetype:interpreter-version=38}} ("Infinality" mode), {{ic|1=truetype:interpreter-version=40}} (minimal mode/2.7 default).}}<br />
<br />
==== LCD filter ====<br />
<br />
When using subpixel rendering, you should enable the LCD filter, which is designed to reduce colour fringing. This is described under [http://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html LCD filtering] in the FreeType 2 API reference. Different options are described under [http://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html#FT_LcdFilter FT_LcdFilter], and are illustrated by this [http://www.spasche.net/files/lcdfiltering/ LCD filter test] page.<br />
<br />
The {{ic|lcddefault}} filter will work for most users. Other filters are available that can be used in special situations: {{ic|lcdlight}}; a lighter filter ideal for fonts that look too bold or fuzzy, {{ic|lcdlegacy}}, the original Cairo filter; and {{ic|lcdnone}} to disable it entirely.<br />
<br />
{{bc|<nowiki><br />
<match target="font"><br />
<edit name="lcdfilter" mode="assign"><br />
<const>lcddefault</const><br />
</edit><br />
</match><br />
</nowiki>}}<br />
<br />
==== Advanced LCD filter specification ====<br />
<br />
If the available built-in LCD filters are not satisfactory, it is possible to tweak the font rendering very specifically by building a custom freetype2 package and modifying the hardcoded filters. The [[Arch Build System]] can be used to build and install packages from source.<br />
<br />
First, refresh the freetype2 PKGBUILD as root:<br />
<br />
# abs extra/freetype2<br />
<br />
This example uses {{ic|/var/abs/build}} as the build directory, substitute it according to your personal ABS setup. Download and extract the freetype2 package as a regular user:<br />
<br />
$ cd /var/abs/build<br />
$ cp -r ../extra/freetype2 .<br />
$ cd freetype2<br />
$ makepkg -o<br />
<br />
Edit the file {{ic|src/freetype-VERSION/src/base/ftlcdfil.c}} and look up the definition of the constant {{ic|default_filter[5]}}:<br />
<br />
static const FT_Byte default_filter[5] =<br />
{ 0x10, 0x40, 0x70, 0x40, 0x10 };<br />
<br />
This constant defines a low-pass filter applied to the rendered glyph. Modify it as needed. (reference: [https://lists.nongnu.org/archive/html/freetype/2006-09/msg00069.html freetype list discussion]) Save the file, build and install the custom package:<br />
<br />
$ makepkg -e<br />
# pacman -Rd freetype2<br />
# pacman -U freetype2-VERSION-ARCH.pkg.tar.xz<br />
<br />
Reboot or restart X. The lcddefault filter should now render fonts differently.<br />
<br />
=== Disable auto-hinter for bold fonts ===<br />
<br />
The auto-hinter uses sophisticated methods for font rendering, but often makes bold fonts too wide. Fortunately, a solution can be turning off the autohinter for bold fonts while leaving it on for the rest:<br />
...<br />
<match target="font"><br />
<test name="weight" compare="more"><br />
<const>medium</const><br />
</test><br />
<edit name="autohint" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
...<br />
<br />
=== Replace or set default fonts ===<br />
<br />
The most reliable way to do this is to add an XML fragment similar to the one below. ''Using the "binding" attribute will give you better results'', for example, in Firefox where you may not want to change properties of font being replaced. This will cause Ubuntu to be used in place of Georgia:<br />
<br />
{{bc|<nowiki><br />
...<br />
<match target="pattern"><br />
<test qual="any" name="family"><string>georgia</string></test><br />
<edit name="family" mode="assign" binding="same"><string>Ubuntu</string></edit><br />
</match><br />
...<br />
</nowiki>}}<br />
<br />
An alternate approach is to set the "preferred" font, but ''this only works if the original font is not on the system'', in which case the one specified will be substituted:<br />
<br />
{{bc|<nowiki><br />
...<br />
<!-- Replace Helvetica with Bitstream Vera Sans Mono --><br />
<!-- Note, an alias for Helvetica should already exist in default conf files --><br />
<alias><br />
<family>Helvetica</family><br />
<prefer><family>Bitstream Vera Sans Mono</family></prefer><br />
<default><family>fixed</family></default><br />
</alias><br />
...<br />
</nowiki>}}<br />
<br />
=== Whitelisting and blacklisting fonts ===<br />
<br />
The element {{ic|<selectfont>}} is used in conjunction with the {{ic|<acceptfont>}} and {{ic|<rejectfont>}} elements to selectively whitelist or blacklist fonts from the resolve list and match requests. The simplest and most typical use case it to reject one font that is needed to be installed, however is getting matched for a generic font query that is causing problems within application user interfaces.<br />
<br />
First obtain the Family name as listed in the font itself:<br />
<br />
{{hc|1=$ fc-scan .fonts/lklug.ttf --format='%{family}\n'|2=<br />
LKLUG<br />
}}<br />
<br />
Then use that Family name in a {{ic|<rejectfont>}} stanza:<br />
<br />
{{bc|<nowiki><br />
<selectfont><br />
<rejectfont><br />
<pattern><br />
<patelt name="family" ><br />
<string>LKLUG</string><br />
</patelt><br />
</pattern><br />
</rejectfont><br />
</selectfont><br />
</nowiki>}}<br />
<br />
Typically when both elements are combined, {{ic|<rejectfont>}} is first used on a more general matching glob to reject a large group (such as a whole directory), then {{ic|<acceptfont>}} is used after it to whitelist individual fonts out of the larger blacklisted group.<br />
<br />
{{bc|<nowiki><br />
<selectfont><br />
<rejectfont><br />
<glob>/usr/share/fonts/OTF/*</glob><br />
</rejectfont><br />
<acceptfont><br />
<pattern><br />
<patelt name="family" ><br />
<string>Monaco</string><br />
</patelt><br />
</pattern><br />
</acceptfont><br />
</selectfont><br />
</nowiki>}}<br />
<br />
=== Disable bitmap fonts ===<br />
<br />
Bitmap fonts are sometimes used as fallbacks for missing fonts, which may cause text to be rendered pixelated or too large. Use the {{ic|70-no-bitmaps.conf}} [[#Presets|preset]] to disable this behavior. <br />
<br />
<div id="EmbeddedBitmap">To disable embedded bitmap for all fonts:<div><br />
<br />
{{hc|~/.config/fontconfig/conf.d/20-no-embedded.conf|<nowiki><br />
<?xml version="1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<match target="font"><br />
<edit name="embeddedbitmap" mode="assign"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</fontconfig><br />
</nowiki>}}<br />
<br />
To disable embedded bitmap fonts for a specific font:<br />
<br />
<match target="font"><br />
<test qual="any" name="family"><br />
<string>Monaco</string><br />
</test><br />
<edit name="embeddedbitmap"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
<br />
=== Disable scaling of bitmap fonts ===<br />
<br />
To disable scaling of bitmap fonts (which often makes them blurry), remove {{ic|/etc/fonts/conf.d/10-scale-bitmap-fonts.conf}}.<br />
<br />
=== Create bold and italic styles for incomplete fonts ===<br />
<br />
FreeType has the ability to automatically create ''italic'' and '''bold''' styles for fonts that do not have them, but only if explicitly required by the application. Given programs rarely send these requests, this section covers manually forcing generation of missing styles.<br />
<br />
Start by editing {{ic|/usr/share/fonts/fonts.cache-1}} as explained below. Store a copy of the modifications on another file, because a font update with {{ic|fc-cache}} will overwrite {{ic|/usr/share/fonts/fonts.cache-1}}.<br />
<br />
Assuming the Dupree font is installed:<br />
"dupree.ttf" 0 "Dupree:style=Regular:slant=0:weight=80:width=100:foundry=unknown:index=0:outline=True:''etc...''<br />
<br />
Duplicate the line, change {{ic|<nowiki>style=Regular</nowiki>}} to {{ic|<nowiki>style=Bold</nowiki>}} or any other style. Also change {{ic|<nowiki>slant=0</nowiki>}} to {{ic|<nowiki>slant=100</nowiki>}} for italic, {{ic|<nowiki>weight=80</nowiki>}} to {{ic|<nowiki>weight=200</nowiki>}} for bold, or combine them for '''''bold italic''''':<br />
"dupree.ttf" 0 "Dupree:style=Bold Italic:slant=100:weight=200:width=100:foundry=unknown:index=0:outline=True:''etc...''<br />
<br />
Now add necessary modifications to {{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}:<br />
{{bc|<nowiki><br />
...<br />
<match target="font"><br />
<test name="family" qual="any"><br />
<string>Dupree</string><br />
&lt;!-- other fonts here .... --&gt;<br />
</test><br />
<test name="weight" compare="more_eq"><int>140</int></test><br />
<edit name="embolden" mode="assign"><bool>true</bool></edit><br />
</match><br />
<br />
<match target="font"><br />
<test name="family" qual="any"><br />
<string>Dupree</string><br />
&lt;!-- other fonts here .... --&gt;<br />
</test><br />
<test name="slant" compare="more_eq"><int>80</int></test><br />
<edit name="matrix" mode="assign"><br />
<times><br />
<name>matrix</name><br />
<matrix><br />
<double>1</double><double>0.2</double><br />
<double>0</double><double>1</double><br />
</matrix><br />
</times><br />
</edit><br />
</match><br />
...<br />
</nowiki>}}<br />
{{Tip| Use the value 'embolden' for existing bold fonts in order to make them even bolder.}}<br />
<br />
=== Change rule overriding ===<br />
<br />
{{Accuracy|{{ic|/etc/fonts/conf.d/50-user.conf}} will be created again when {{Pkg|fontconfig}} is updated}}<br />
<br />
Fontconfig processes files in {{ic|/etc/fonts/conf.d}} in numerical order. This enables rules or files to override one another, but often confuses users about what file gets parsed last.<br />
<br />
To guarantee that personal settings take precedence over any other rules, change their ordering:<br />
# cd /etc/fonts/conf.d<br />
# mv 50-user.conf 99-user.conf<br />
<br />
This change seems however to be unnecessary for the most of the cases, because a user is given enough control by default to set up own font preferences, hinting and antialiasing properties, alias new fonts to generic font families, etc.<br />
<br />
=== Query the current settings ===<br />
<br />
To find out what settings are in effect, use {{ic|fc-match --verbose}}. eg.<br />
<br />
{{hc|$ fc-match --verbose Sans|<br />
family: "DejaVu Sans"(s)<br />
hintstyle: 3(i)(s)<br />
hinting: True(s)<br />
...<br />
}}<br />
<br />
Look up the meaning of the numbers at http://www.freedesktop.org/software/fontconfig/fontconfig-user.html. Eg. 'hintstyle: 3' means 'hintfull'<br />
<br />
== Applications without fontconfig support ==<br />
<br />
Some applications like [[URxvt]] and [[Emacs]] will ignore fontconfig settings. You can work around this by using {{ic|~/.Xresources}}, but it is as flexible as fontconfig. Example (see [[#Fontconfig configuration]] for explanations of the options):<br />
<br />
{{hc|~/.Xresources|<nowiki><br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintslight<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
</nowiki>}}<br />
<br />
Make sure the settings are loaded properly when X starts with {{ic|xrdb -q}} (see [[Xresources]] for more information).<br />
<br />
== Troubleshooting ==<br />
<br />
=== Distorted fonts ===<br />
<br />
{{Note|96 DPI is not a standard. You should use your monitor's actual DPI to get proper font rendering, especially when using subpixel rendering.}}<br />
<br />
If fonts are still unexpectedly large or small, poorly proportioned or simply rendering poorly, fontconfig may be using the incorrect DPI.<br />
<br />
Fontconfig should be able to detect DPI parameters as discovered by the Xorg server. You can check the automatically discovered DPI with {{ic|xdpyinfo}} (provided by the {{pkg|xorg-xdpyinfo}} package):<br />
<br />
{{hc|<nowiki>$ xdpyinfo | grep dots</nowiki>|<br />
resolution: 102x102 dots per inch<br />
}}<br />
<br />
If the DPI is detected incorrectly (usually due to an incorrect monitor [[Wikipedia:Extended Display Identification Data|EDID]]), you can specify it manually in the Xorg configuration, see [[Xorg#Display size and DPI]]. This is the recommended solution, but it may not work with buggy drivers.<br />
<br />
Fontconfig will default to the Xft.dpi variable if it is set. Xft.dpi is usually set by desktop environments (usually to Xorg's DPI setting) or manually in {{ic|~/.Xdefaults}} or {{ic|~/.Xresources}}. Use xrdb to query for the value:<br />
<br />
{{hc|<nowiki>$ xrdb -query | grep dpi</nowiki>|<br />
Xft.dpi: 102<br />
}}<br />
<br />
Those still having problems can fall back to manually setting the DPI used by fontconfig:<br />
<br />
...<br />
<!-- Setup for DPI=96 --><br />
<match target="pattern"><br />
<edit name="dpi" mode="assign"><double>102</double></edit><br />
</match><br />
...<br />
<br />
=== Calibri, Cambria, Monaco, etc. not rendering properly ===<br />
<br />
Some scalable fonts have embedded bitmap versions which are rendered instead, mainly at smaller sizes. Using [[Metric-compatible fonts]] as replacements can improve the rendering in these cases. <br />
<br />
You can also force using scalable fonts at all sizes by [[#Disable bitmap fonts|disabling embedded bitmap]], sacrificing some rendering quality.<br />
<br />
=== Applications overriding hinting ===<br />
<br />
Some applications or desktop environments may override default fontconfig hinting and anti-aliasing settings. This may happen with [[GNOME]] 3, for example while you are using Qt applications like {{pkg|vlc}} or {{pkg|smplayer}}. Use the specific configuration program for the application in such cases. For GNOME, try {{pkg|gnome-tweak-tool}}.<br />
<br />
=== Applications not picking up hinting from DE's settings ===<br />
<br />
For instance, under GNOME it sometimes happens that Firefox applies full hinting even when it's set to "none" in GNOME's settings, which results in sharp and widened fonts. In this case you would have to add hinting settings to your {{ic|fonts.conf}} file:<br />
<br />
<?xml version='1.0'?><br />
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> <br />
<fontconfig><br />
<match target="font"><br />
<edit mode="assign" name="hinting"><br />
<bool>false</bool><br />
</edit><br />
</match><br />
</fontconfig><br />
<br />
In this example, hinting is set to "grayscale".<br />
<br />
=== Incorrect hinting in GTK applications on non-Gnome systems ===<br />
<br />
{{Accuracy|Mentions GTK relies on fontconfig, then claims that "some" fonts get the hinting "wrong", and ends up refering to Xft (but see e.g [http://doc.opensuse.org/documentation/html/openSUSE_113/opensuse-reference/cha.fontconfig.html#sec.fontconfig.xft]). IOW, unsupported claims and unclear relations}}<br />
<br />
[[GNOME]] uses the XSETTINGS system to configure font rendering. Outside of GNOME, GTK applications rely on fontconfig, but some fonts get the hinting wrong causing them to look too bold or too light. <br />
<br />
A simple solution is using {{AUR|xsettingsd-git}} to provide the configuration, for example:<br />
<br />
{{hc|~/.xsettingsd|<br />
Xft/Hinting 1<br />
Xft/RGBA "rgb"<br />
Xft/HintStyle "hintslight"<br />
Xft/Antialias 1<br />
}}<br />
<br />
Alternatively you could just write the font configuration as {{ic|Xft.*}} directives in {{ic|~/.Xresources}} without using a settings daemon.<br />
<br />
=== Helvetica font problem in generated PDFs ===<br />
<br />
If the following command<br />
<br />
fc-match helvetica<br />
<br />
produces<br />
<br />
helvR12-ISO8859-1.pcf.gz: "Helvetica" "Regular"<br />
<br />
then the bitmap font provided by {{Pkg|xorg-fonts-75dpi}} is likely to be embedded into PDFs generated by "Print to File" or "Export" in various applications. The bitmap font was probably installed as a consequence of installing the whole {{Grp|xorg}} group (which is usually NOT recommended). To solve the pixelized font problem, you can uninstall the package. Install {{Pkg|gsfonts}} (Type 1) or {{Pkg|tex-gyre-fonts}} (OpenType) for corresponding free subsitute of Helvetica (and other PostScript/PDF base fonts).<br />
<br />
You may also experience similar problem when you open a PDF which requires Helvetica but does not have it embedded for viewing.<br />
<br />
=== FreeType Breaking Bitmap Fonts ===<br />
<br />
Some users are reporting problems ({{Bug|52502}}) with bitmap fonts having changed names after upgrading {{Pkg|freetype2}} to version 2.7.1, creating havok in terminal emulators and several other programs such as {{AUR|dwm}} or {{Pkg|dmenu}} by falling back to another (different) font. This was caused by the changes to the PCF font family format, which is described in their ''release notes'' [https://sourceforge.net/projects/freetype/files/freetype2/2.7.1/]. Users transitioning from the old format might want to create a ''font alias'' to remedy the problems, like the solution which is described in [https://forum.manjaro.org/t/terminus-font-name-fix-after-freetype2-update-to-2-7-1-1/15530], given here too:<br />
<br />
Assume we want to create an alias for {{Pkg|terminus-font}}, which was renamed from {{ic|Terminus}} to {{ic|xos4 Terminus}} in the previously described {{Pkg|freetype2}} update:<br />
* Create a configuration file in {{ic|/etc/fonts/conf.avail/}} for the ''font alias'':<br />
{{hc|/etc/fonts/conf.avail/33-TerminusPCFFont.conf|<?xml version<nowiki>=</nowiki>"1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<alias><br />
<family>Terminus</family><br />
<prefer><family>xos4 Terminus</family></prefer><br />
<default><family>fixed</family></default><br />
</alias><br />
</fontconfig><br />
}}<br />
* Create a symbolic link towards it in the {{ic|/etc/fonts/conf.d}} directory. In our example we would link as follows: {{ic|ln -s /etc/fonts/conf.avail/33-TerminusPCFFont.conf /etc/fonts/conf.d}} to make the change permanent.<br />
Everything should now work as it did before the update, the ''font alias'' should not be in effect, but make sure to either reload {{ic|.Xresources}} or restart the display server first so the affected programs can use the alias.<br />
<br />
== See also ==<br />
<br />
* [http://www.freedesktop.org/software/fontconfig/fontconfig-user.html Fontconfig Users' Guide]<br />
* [http://www.x.org/X11R6.8.2/doc/fonts.html Fonts in X11R6.8.2] - Official Xorg font information<br />
* [http://freetype.sourceforge.net/freetype2/ FreeType 2 overview]<br />
* [https://forums.gentoo.org/viewtopic-t-723341.html Gentoo font-rendering thread]<br />
* [http://www.freetype.org/freetype2/docs/text-rendering-general.html On slight hinting]</div>Iridium