I want to use font awersome in my project in the way, that user can choose which icon he wants. I found django-fontawesome-5 but there is one problem - there is no access to icon's unicode and I need it for one javascript component (html doesn't work there, and unicode does). I was looking all over the internet, but I coundn't find anything that would allow me to add font-awersome icons, with their unicodes somhow stored. My question is do you know how to get this feature?
The unicode codes are stored in icons.json and in icons_semantic_ui.json
Since you've got the codes source you can define a custom templatetag or a model/mixin method or a function which just gets a code from one of those json files using icon name
You can see example in fontawesome_5/utils.py
For example I want to use this .ttf font file:
https://www.onlinewebfonts.com/download/3b2646a48566403a55f62ceddbecbe18
It contains 29,064 glyphs.
I want to leave in it only the letters I use.
A short example: どこでもタップしてプレイ
So, from 29,064 it will be only 12 characters left. In my actual situation if will be around 300 glyphs.
Basically, I want to dramatically decrease it's file-size by removing unused glyphs
Is there a way to implement this by some script? I'm on macOS.
Or some app can do this and how exactly? Is there a real life example?
upd: answer from this question not working, throwing errors:
./subset.pl --chars="どこでもタップしてプレイ" /Users/User/Desktop/1.ttf /Users/User/Desktop/2.ttf
Wide character in subroutine entry at Font/Subsetter.pm line 1496.
In that question there are recommendation of use fixed this bug repo: https://github.com/fnp/librarian/blob/master/librarian/font-optimizer/subset.pl
And with it executing same command gives another errors:
Uses unhandled table 'BASE'
Uses forbidden table 'CFF '
As font file I used that from first link, just renamed it to 1.ttf
I need to be able to use the WEKA Explorer GUI but make the font size bigger for displaying to an audience. I was able to change the fonts for some parts of the text by modifying the call to java in the file RunWeka.ini Specifically, I changed the first uncommented line to
cmd_default=javaw -Dswing.aatext=true -Dswing.plaf.metal.controlFont=Tahoma-plain-18 -Dswing.plaf.metal.userFont=Tahoma-plain-18 -Dfile.encoding=#fileEncoding# -Xmx#maxheap# -Djava.net.useSystemProxies=#systemProxies# #javaOpts# -classpath "#wekajar#;#cp#" #mainclass#
The difference from what comes with the Weka distribution is that I added the first three arguments - the ones that begin with -Dswing. This changes the font size in many places but fails to change a few places as marked in the screen shot below.
Does anyone know how to change the font size for the remaining text? Another argument to java?
I have a problem.
I need to set some kind of z-index, like you can use on the web in HTML/CSS.
Because I have a text on an image, and therefore I want to be sure that it looks good when printing.
Is there some "z-index" code I can use on theese fo:block elements?
Thanks!
/Daniel
XSL-FO defines z-index property:
http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#z-index
You have to check your formatting agent whether does support this property.
This has been driving me crazy all day.
I need to get a font filename (eg. Arial.ttf) based on its name (Arial in this case) and whether it is bold, italic or both. Using those pieces of information, I need to find the font file so I can use it for rendering.
Some more examples:
Calibri, Bold would resolve to calibrib.ttf.
Calibri, Italic would resolve to calibrii.ttf.
Any ideas on how I could achieve this in C++ (Win32)
First, to my knowledge, there is no reliable way to do that.
The Windows API deals with font families and mappings, not with font files, which are dealt with at a lower level. Also note that even if you manage to get the file name of a font, no rendering function (that I know of) will accept it, so what will you do with it?
That said, you can look in the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts in order to obtain the file name of a font from its logical name. An implementation of that solution can be found here.
Related to the earlier posts, this seems to be a reliable way:
1) Read the registered Windows font list from
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Fonts\
You will obtain file names and alternate file paths here.
The Font names are not useful as they can change with user's locale.
2) Load the TrueType files (.ttf, .ttc, .otf):
Use FreeType https://www.freetype.org/). Just initialize the freetype library and load face with FT_New_Face(library, path, 0, &face).
3) Obtain the font Family name using FreeType.
Use FT_Get_Sfnt_Name_Count() and FT_Get_Sfnt_Name() to obtain the string table.
You will need to check if the encoding is Ansi, UTF16 or other, as some strings will be in multiple different languages and encodings.
4) Obtain the OS2 TrueType properties.
Use (TT_OS2 *) FT_Get_Sfnt_Table (face, ft_sfnt_os2) to get the OS2 structure.
Interpret the structure using docs like https://www.microsoft.com/typography/otspec/os2.htm#fc
5) Now you have font file path, family name, style properties and other information. Build a list of these and function to search for a file based on font family and style.
This Code Project project does what you want. As-is it fails on Windows 7 because the GetWinVer function stops at XP. It is trivial to add the case for Windows 7.
You normally do this by calling CreateFontIndirect and then getting the system to render. Perhaps you could explain why you can't use this standard approach.
One solution would be to access the font files and extract the name from the name table to create your own lookup (an STL map would be a simple way of doing that). Details of the TTF file format can be found here.