[aframe]how show chinese characters in aframe? - aframe

I want to use 'text' property to show chinese characters, but the characters cannot show. for example:
<a-entity text="align:center;value: 返回back; "></a-entity>

You will need to get a font file that contains the Chinese characters. Then generate an SDF font with Hiero (https://github.com/libgdx/libgdx/wiki/Distance-field-fonts).
https://aframe.io/docs/0.5.0/components/text.html#generating-sdf-fonts
Alternatively, the process is similar for the text-geometry component, you can generate a font set with Chinese characters using FaceType.js

Use MSDF font generator (source) then load that fond in the text component.

Related

How can I add more glyphs in my True type font?

I am creating my series of glyphs in a custom font but I can only see glyphs which occupy the character spaces from U+0020 up until U+007f when the font is read by other programs. Is there a setting to allow all other characters to be read? In my font all characters after are called "control characters".
Thanks for any tips.
Glyphs which you add to your font appear based on the character that their encoding matches. If you add characters with no encoding, of course they won't be avaialble. You could consider giving them encodings of e.g. U+F000, U+F001, etc., which are in the Unicode Private Use Area. Then you could paste such characters into your program, or if you use Linux, some desktop environments allow you to press CtrlShiftU and type e.g. f000 and get the character U+F000.

Why does whitespaces between characters / words are handled in other way as general whitespaces?

I have create a font-subset for my two used fonts.
But if I enter the browser and inspect a given H1-Tag which should only use this font, it shows that 2 Fonts are used, because one character is taken from an Fallback_Font Open Sans:
The exact HTML-Tag:
<strong class="headline1">Carservice Meisterwerkstatt</strong>
The CSS which is used (BTW: PT Sans use the same Font-Subsetting, so the next Fallback for those 5 Glyphs is OpenSans):
To determine the Subset I've used: glyphhanger http://localhost:3000 and added the output of it as whitelist to the following command:
glyphhanger --whitelist=U+A,U+20-23,U+25-29,U+2B-3B,U+3F-57,U+59,U+5A,U+5F,U+61-7D,U+A9,U+C4,U+D6,U+DC,U+E4,U+F6,U+FC,U+F002,U+F017,U+F0F1,U+F2B5,U+F2DC,U+F46D,U+F500,U+F530,U+F5E1,U+F63B,U+F7D9 --subset=Dosis-VariableFont_wght.ttf
What I do search for is a way to figure out, which 5 Glyphs are used from Open Sans. Is there a way to get this in the DEV-Console?
For testing purposes, I've changed the font to other font face to see immediately if there is used another font as fallback. But as you can see, even with Alfredo as Fallback it is not visible which 5 glyph's are using this fallback.
I've tried now to remove each single Character in Content-Part of the Tag inside of the Dev-Console... and checked when does the font-mixing appear. I figured out, that it appear only if I have 2 Characters with a whitespace in between: r M
But if I enter only a character (or word) with a whitespace in front of, or after the character, it doesn't happend. M even not like M .
I found that there are more than one simple space-character. There are many (see https://emptycharacter.com/ down on topic Unicode empty characters)
So it seems the issue at least is, that the Font-Subset doesn't have the needed Unicode included.
If anybody knows how to easily figure out which exact unicode the browser request to the font, you are very welcome to paste it here as comment)

Adding glyphs to Fontforge

When I open Fontforge to create a new font, it only lists a limited set of characters / glyphs. In the font I create, I need some glyphs that are missing from that default set, e.g. "single right-pointing angle quotation mark" (U+203A) and "single left-pointing angle quotation mark" (U+2039).
How can I add "slots" for these glyphs, or rather:
What is the proper way to add glyphs that are defined in the Unicode table?
Ah, well, just go to Encoding > Add encoding slot, then there will be a dialog to set how many slot(s) you want to add.
Ah, well, just go to Encoding > Reencode and choose an encoding that contains the relevant slots.

How to avoid implicit mailto link in Restructured Text?

I'm new to Restructured Text and am trying to write a document that refers to a project with an "at" sign in the name, something like "Foo#BAR". When I convert the .rst file into HTML using the docutils "rst2html" tool, this is converted into a "mailto" link. If I use double backticks for verbatim rendering, it is turned into monospace text. How can I get it to be rendered in the normal text font, and not converted into a link?
You can use character escaping to include an # within a word. In reStructuredText the escape character is \, so try using Foo\#BAR in your document.

How to convert all color code #XXYYZZ to shorter 3 character version #XYZ of whole css file?

How to convert all color code #XXYYZZ to shorter 3 character version #XYZ of whole css file?
You can convert to the shorter 3-character version only colors expressed this way: #RRGGBB where the first and the second characters are the same, the third and fourth characters are the same and the fifth and sixth characters are the same.
So: #CC00DD can be shortened to #C0D while #CC01DD cannot.
A quick way to shorten all the possible colors in a CSS file is to open the file with an editor supporting regular expressions (for example kwrite or kate on linux) and replace (ignoring case) the following regular expression:
#([0-9A-F])\1([0-9A-F])\2([0-9A-F])\3
with this substitution text:
#\1\2\3
Tested with kate.
Otherwise you can use this tool where, if you only need to compress color codes, you can uncheck all the options except the "Compress color codes where possible".
If you are just interested in minimizing the download size for your CSS file, you might use one of the many CSS compressors available (such as this one). And be sure to do the same with your javascript files while you are at it.
You can only shorten CSS colour codes to a 3 character version if they take the form
#XXYYZZ
Then they can be abbreviated
#XYZ
There are only 216 different codes which meet this requirement.

Resources