summaryrefslogtreecommitdiff
path: root/devdocs/elisp/font-selection.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/font-selection.html
new repository
Diffstat (limited to 'devdocs/elisp/font-selection.html')
-rw-r--r--devdocs/elisp/font-selection.html35
1 files changed, 35 insertions, 0 deletions
diff --git a/devdocs/elisp/font-selection.html b/devdocs/elisp/font-selection.html
new file mode 100644
index 00000000..c555c683
--- /dev/null
+++ b/devdocs/elisp/font-selection.html
@@ -0,0 +1,35 @@
+ <h4 class="subsection">Font Selection</h4> <p>Before Emacs can draw a character on a graphical display, it must select a <em>font</em> for that character<a id="DOCF26" href="#FOOT26"><sup>26</sup></a>. See <a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Fonts.html#Fonts">Fonts</a> in <cite>The GNU Emacs Manual</cite>. Normally, Emacs automatically chooses a font based on the faces assigned to that character—specifically, the face attributes <code>:family</code>, <code>:weight</code>, <code>:slant</code>, and <code>:width</code> (see <a href="face-attributes">Face Attributes</a>). The choice of font also depends on the character to be displayed; some fonts can only display a limited set of characters. If no available font exactly fits the requirements, Emacs looks for the <em>closest matching font</em>. The variables in this section control how Emacs makes this selection. </p> <dl> <dt id="face-font-family-alternatives">User Option: <strong>face-font-family-alternatives</strong>
+</dt> <dd>
+<p>If a given family is specified but does not exist, this variable specifies alternative font families to try. Each element should have this form: </p> <div class="example"> <pre class="example">(<var>family</var> <var>alternate-families</var>…)
+</pre>
+</div> <p>If <var>family</var> is specified but not available, Emacs will try the other families given in <var>alternate-families</var>, one by one, until it finds a family that does exist. </p>
+</dd>
+</dl> <dl> <dt id="face-font-selection-order">User Option: <strong>face-font-selection-order</strong>
+</dt> <dd>
+<p>If there is no font that exactly matches all desired face attributes (<code>:width</code>, <code>:height</code>, <code>:weight</code>, and <code>:slant</code>), this variable specifies the order in which these attributes should be considered when selecting the closest matching font. The value should be a list containing those four attribute symbols, in order of decreasing importance. The default is <code>(:width :height :weight
+:slant)</code>. </p> <p>Font selection first finds the best available matches for the first attribute in the list; then, among the fonts which are best in that way, it searches for the best matches in the second attribute, and so on. </p> <p>The attributes <code>:weight</code> and <code>:width</code> have symbolic values in a range centered around <code>normal</code>. Matches that are more extreme (farther from <code>normal</code>) are somewhat preferred to matches that are less extreme (closer to <code>normal</code>); this is designed to ensure that non-normal faces contrast with normal ones, whenever possible. </p> <p>One example of a case where this variable makes a difference is when the default font has no italic equivalent. With the default ordering, the <code>italic</code> face will use a non-italic font that is similar to the default one. But if you put <code>:slant</code> before <code>:height</code>, the <code>italic</code> face will use an italic font, even if its height is not quite right. </p>
+</dd>
+</dl> <dl> <dt id="face-font-registry-alternatives">User Option: <strong>face-font-registry-alternatives</strong>
+</dt> <dd>
+<p>This variable lets you specify alternative font registries to try, if a given registry is specified and doesn’t exist. Each element should have this form: </p> <div class="example"> <pre class="example">(<var>registry</var> <var>alternate-registries</var>…)
+</pre>
+</div> <p>If <var>registry</var> is specified but not available, Emacs will try the other registries given in <var>alternate-registries</var>, one by one, until it finds a registry that does exist. </p>
+</dd>
+</dl> <p>Emacs can make use of scalable fonts, but by default it does not use them. </p> <dl> <dt id="scalable-fonts-allowed">User Option: <strong>scalable-fonts-allowed</strong>
+</dt> <dd>
+<p>This variable controls which scalable fonts to use. A value of <code>nil</code>, the default, means do not use scalable fonts. <code>t</code> means to use any scalable font that seems appropriate for the text. </p> <p>Otherwise, the value must be a list of regular expressions. Then a scalable font is enabled for use if its name matches any regular expression in the list. For example, </p> <div class="example"> <pre class="example">(setq scalable-fonts-allowed '("iso10646-1$"))
+</pre>
+</div> <p>allows the use of scalable fonts with registry <code>iso10646-1</code>. </p>
+</dd>
+</dl> <dl> <dt id="face-font-rescale-alist">Variable: <strong>face-font-rescale-alist</strong>
+</dt> <dd>
+<p>This variable specifies scaling for certain faces. Its value should be a list of elements of the form </p> <div class="example"> <pre class="example">(<var>fontname-regexp</var> . <var>scale-factor</var>)
+</pre>
+</div> <p>If <var>fontname-regexp</var> matches the font name that is about to be used, this says to choose a larger similar font according to the factor <var>scale-factor</var>. You would use this feature to normalize the font size if certain fonts are bigger or smaller than their nominal heights and widths would suggest. </p>
+</dd>
+</dl><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Font-Selection.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Font-Selection.html</a>
+ </p>
+</div>