Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>(The rendering referred to is not the default rendering of <code>kbd</code>, which simply shows the content in the system’s default monospace font. But e.g. in StackOverflow pages, a style sheet is used to format <code>kbd</code> so that it looks like a keycap.)</p> <p>Somewhat surprisingly, there is a Unicode way to create something that looks like a character in a keycap: enter the character, then immediately COMBINING ENCLOSING KEYCAP <a href="http://www.fileformat.info/info/unicode/char/20e3/index.htm" rel="nofollow noreferrer">U+20E3</a>.</p> <p><a href="http://www.fileformat.info/info/unicode/char/20e3/fontsupport.htm" rel="nofollow noreferrer">Font support</a> to this character is very limited but contains a few free fonts. Unfortunately, none of them is a sans-serif font, and the character to be shown inside should normally appear in such a font – after all, real keycaps contains very simple shapes for characters, without serifs. And generally, a character and an enclosing mark should be taken from the same font; otherwise they might be incompatible. However, it seems that taking the normal character from the sans-serif font (FreeSans) in <a href="http://savannah.gnu.org/projects/freefont/" rel="nofollow noreferrer">GNU Freefont</a> and the combining mark from the serif font (FreeSerif) of the same source creates a reasonable presentation:</p> <p><img src="https://i.stack.imgur.com/NfyKM.png" alt="enter image description here"></p> <p>I’m afraid it won’t work here in text, but I’ll try: A⃣ .</p> <p>Whether this works depends on the use of suitable fonts, as mentioned, but also on the rendering software. Programs have been rather bad at displaying combining marks, but there has been some improvement. I tested this in Word 2007, where it works OK, and also on web browsers (Chrome, Firefox, IE) with good results using code like this:</p> <pre><code>&lt;style&gt; .cap { font-family: FreeSerif; } .cap span { font-family: FreeSans; } &lt;/style&gt; &lt;span class="cap"&gt;&lt;span&gt;A&lt;/span&gt;&amp;#x20e3;&lt;/span&gt; </code></pre> <p>It isn’t perfect, when using the fonts mentioned. The character in the cap is not quite centered. Moreover, if I try to use the technique e.g. for the character Å (which is present on normal Nordic keyboards), the ring above A extends out of the cap. You could tweak this by setting the font size of the letter in the cap to, say, 85% of the font size of the combining mark, but then the horizontal position of the letter is even more off.</p> <p>To summarize, it is <em>possible</em> to do such things at the character level, but if you can use other methods, like using a border or a background image for a character, you can probably achieve better rendering.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload