How can I make my custom font support on bold or put multiple fonts? - swift

I want to use in my project text view with the custom font- heebo.
but I have a problem when I run my app all the bold word is not bolded
and everting is hebbo regular, how can I fix it or make this font to be multiple?
another solution is to write a function that takes the text inside of the text view and detect if its bold or regular and if its bold I put heebo-bold.ttf and if not I put heebo-reguler.ttf so if somebody helps me with that it will be good.

I downloaded the very same font you're trying (Heebo bold) and I've done the next steps:
Install font on the system (double click on .ttf file)
Copy the font to your project folder on xcode. (Make sure you're checking Copy items if needed and add to target 'your target' check boxes)
Add hebo-bold.ttf to your info.plist under "Fonts provided by application" (as in next image)
Build (cmd + B)
Use font from storyboard or by code:
yourLabel.font = UIFont(name: "Heebo-Bold", size: 18.0)
When you want to know the exact name a font has (when setting it by code you need this name not the filename like 'heebo-bold.ttf') you can use these couple of lines:
print(UIFont.familyNames)
print(UIFont.fontNames(forFamilyName: "familyName"))
First line will print the names of all family fonts available.
Second line will tell you the specific name you'll have to use on UIFont(name: String, size: CGFloat) (i.e. Heebo-Bold, Heebo-Italic, etc)

Related

Configuring the font-style of VS Code's inlay-hints

How can I change the font's style for VS Code's "Inlay Hints" feature?
I attempted to search for an answer, but could only find how to change the color, not the style.
Here's an example:
I would like the word target in the image below to render italic.
I tried the following, however, it did not work...
{
scope: "inlayHint",
settings: {
fontStyle: "italic",
},
},
I also tried adding editor.inlayHint to the scope, but the attempt was without success.
Setting the Font-style to italic isn't Possible.
Not all is lost though, there's a workaround that actually works pretty well.
As I stated above, setting the font-style to italic is not possible. There is, however, a workaround, and it works pretty darn well. Before I explain the workaround, I think its important to note that the first solution I tried to use, was to set the font to an italic variant, unfortunately setting "editor.inlayHints.fontFamily" to an italic variant of a font was something that VS Code didn't seem to allow. I have seen this in many other situations. The idea is, since you can't do this "fontStyle": "italic", you just change the font to an italic version.
For example:
If I use Cascadia Code as my font, then — in theory — I can just us the following configuration:
// #file "settings.json"
{
"editor.inlayHints.fontFamily": "'Cascadia Code Italic'"
}
...however, it unfortunately doesn't work that way — or at-least not in this situation. Not only do italic varients not work, but neither do bold variants and/or expanded variants (i.e. 'Inconsolata SemiExpanded', 'Inconsolata Bold', etc...).
While moving forward, I will state the obvious:
There is no "editor.inlayHints.fontStyle" setting.
So what do we do?
Well we can set the font-family using "editor.inlayHints.fontFamily".
Its a bit suprising that we can set the font, but not the font's style. I am not sure why they designed it this way, but it's obvious that they built the feature with specific constraints for reasons that are beyond me (reading the feature's development feed on GitHub would probably help anyone who wanted to know more about why the feature works how it does). Nevertheless, we have a highly customizable setting, that actually gives us far more control than the setting that we established, does not exist, editor.inlayHints.font.
What I do, personally, which has a cool tricked-out look, is I find a
non-monospaced hand-written style of font — usually from Google Fonts — and I assign that to the font-family. It took me a while to find some fonts that work. Anyone who has ever played with fonts, trying to find which font works best for them to write code with, will know: Picking fonts that are used anywhere inside the editor (or inside your code) is going to require great scrutiny, and the longer you code, the more set in your ways you get, so this can actually be a time consuming setting to configure. It took me an hour to settle on a font, and I settled on using the "Sriracha" font-family. Siracha is oblique in appearance (looks italic), its readable in the editor, it renders well in the editor (which not all fonts are going to do), and its slightly bolder than the standard weight of the font I use wich is Cascadia Code.
My Configuration results in the following appearance:
When changing the font family, there are a couple other settings that help to configure this feature.
So, in other words, just do the following:
Download the italic &/or bold style font you wont from Google Fonts, Font Squirrel, or some other font source you perfer.
Set the font family using "editor.inlayHints.fontFamily".
Critique the fonts configuration using the other settings available below.
// #file "settings.json"
{
// Font Family
"editor.inlayHints.fontFamily": "/*NAME OF FONT FAMILY*/",
// Font Size
"editor.inlayHints.fontSize": 14, // <-- Set the font-size you want
// Theme Colors Override
"workbench.colorCustomizations": {
// Overrides Theme Default Colors for InlayHints feature
"editorInlayHint.background": "#00001CCC",
"editorInlayHint.foreground": "#99FFBBCC",
// Overrides Theme Parameter hints fg for InlayHints feature
"editorInlayHint.parameterBackground": "#00001CCC",
"editorInlayHint.parameterForeground": "#99FFBBCC",
// Overrides Theme Type hints fg for InlayHints feature
"editorInlayHint.typeBackground": "#08000088",
"editorInlayHint.typeForeground": "#DDEEFF88"
},
}
Really its quite simple.
By being able to set the inlayHints font family to anything we want, we can achieve any sort of font style we want.
In settings.json you need a line like
"editor.inlayHints.fontFamily": "'Myfontitalic'",
Now, it seems vscode has some trouble reading a font name with non alphanumeric characters, if for instance the italic version is "Myfont-Italic" or "Myfont Italic".
A solution is to copy and rename the font to a new name, like "Myfontitalic", without spaces or other characters.
What I did was for Ubuntu but the same idea should work on any Linux, and probably Windows, using other tools (fontforge?)
apt install fonttools font-manager to get ttx a utility to change font info (font-manager is also useful)
use a search, font-manager, font-viewer, ... to find the location of the font (usually /usr/share/fonts/... or ~/.local/share/fonts)
copy a fresh version somewhere (home), cp ~/.local/share/fonts/Myfont-Italic.otf ~/temp.otf and cd to go home
translate to an XML copy ttx temp.otf as temp.ttx
edit temp.ttx (vi, ...), and change all "Myfont-Italic", "Myfont Italic" ... (relevant names) to a unique "Myfontitalic" name, save.
translate back to otf (...) with ttx temp.ttx (creates Myfontitalic.otf if it was an otf file)
To install the new font (locally), either double-click on it in the file explorer ( ~/Myfontitalic.otf ) or use a tool. Restart font-manager, the new font should be visible.
Restart vscode and add the line above in settings.json.
on a Mac find the font variant name like this:
Open "Font Book" App
Expand the desired font and select a variant.
Click the (i) icon on the Font Book toolbar.
Use the PostScript Name name in VS Code - for example "editor.inlayHints.fontFamily": "DankMono-Italic"
No one tells you where to edit this and that makes it a pain in the butt.
File>Preferences>Settings, search for color customizations, click "Edit in settings.json"
{
"workbench.colorCustomizations": {
"editorInlayHint.background": "#00000000",
"editorInlayHint.foreground": "#666666FF",
},
}

How VSCode choose the font from the given font list in editor.fontfamily?

When I open the VSCode editor.fontfamily setting, I found there is a list of font family in the input field. So I want to know that how VSCode choose the font from the given font list in editor.fontfamily?
Does it choose font following descended priority, and what is the stategy? Or the font in different locations have different effects?
Thanks.
The "list" is more of a set of fonts, where the first one is the preferred font, the next one being a fallback, and so on. It's not an actual list as far as a JSON object goes, it's just a string that's comma delimited.
{
"editor.fontFamily": "Consolas, 'Courier New', monospace",
// first second third
}
You can test this out by simply switching around the fonts and saving the file to see how Visual Studio Code reacts. If you put in a bogus font name as the first item in the set, when Visual Studio Code can't find the font, it will fallback to the next one. On Windows, if you supply nothing but invalid fonts, it looks like the ultimate fallback is Times New Roman (or an extremely similar looking font):

How do I change the font size in NCSIM gui?

We are using specman with NCSIM (IUS 12.2) in GUI mode.
I saw the answer on how to change the specview gui font settings, it works with Specview but not with the NCSIM gui.
How can we make the same thing for the simulator?
Currently there is no Simvision command or menu selection that will change the font size.
However, there is an alternate approach that you can use. Look for a file called
'Xdefaults' under your .simvision directory in your home directory ($HOME).
i.e. ~/.simvision/Xdefaults
If not, do the following:
There is a file called SimVision under
/share/cdssetup/simvision/app-defaults/
Copy the file 'SimVision' to ~/.simvision and name it 'Xdefaults'.
Now edit this Xdefaults file. It will have a section which looks like this,
! global settings
Simvision*foreground: black
Simvision*background: #dfdfdf
Simvision*Font: -adobe-helvetica-medium-r-normal--12-------*
Change the last line above to:
Simvision*Font: -adobe-helvetica-medium-r-normal--18-------*
or any other suitable number besides the default 12 to suit your needs.
Save this file and now invoke SimVision - you should see the font sizes increased.
In general, you can review and edit the Xdefaults file above to change the fonts of various windows.
For example - to change the font of the Source Browser - you can locate the following line in the Xdefaults file and edit it :
Simvision*SrcBrowser.fixedFont: --courier-medium-r-normal--12-
Simvision*SrcBrowser.valueFont: --courier-medium-r-normal--10-
Change Fonts of 'Cursor' & 'Cursor - Baseline'on Waveform Browser by adding following in /.simvision/Xdefaults
Simvision*WaveSet.deltaFont:
Change Fonts of 'Current time in the simulator'on Waveform Browser by adding following in ~/.simvision/Xdefaults

How to locate a textfield in Flash Pro CS6?

I'm updating a large .fla file from AS2.0 to AS3.0 and get the following warning:
WARNING: Text field variable names are not supported in ActionScript
3.0. The variable '_text' used for the text field '_textField' will not be exported. Fonts should be embedded for any text that may be
edited at runtime, other than text with the "Use Device Fonts"
setting. Use the Text > Font Embedding command to embed fonts.
Is there a quick way to locate the offending symbol? The Flash Pro "Find" function does not seem to be helpful for this (or anything else for that matter, at least on my Windows 7 computer).
Thank you.
The Movie Explorer panel will list a text field's variable name in parentheses after the text inside the field. E.g.:
Here's some text inside my field, (myTextVariable) , (TimesNewRoman, 12 pts)

Adding multiple fonts to UIAppFonts overrides each other

I'm trying to add some custom fonts to an iPhone app through UIAppFonts in Info.plist.
I can reach both fontnames by code, i.e. MyFont-Bold and MyFont-Medium.
My problem is that the last font in UIAppFonts array overrides the other one, making both MyFont-Bold and MyFont-Medium render out MyFont-Bold if this is the last entry in the plist array. By dragging MyFont-Bold as the first entry makes both font-names render MyFont-Medium.
The property list excerpt:
UIAppFonts
item 0 MyFont-Medium
item 1 MyFont-Bold
I'm calling the font with:
UIFont* applicationFontBold = [UIFont fontWithName:#"MyFont-Bold"
size:[UIFont buttonFontSize]];
UIFont* applicationFont = [UIFont fontWithName:#"MyFont-Medium"
size:[UIFont buttonFontSize]];
Anyone tried adding multiple fonts to one font-family?
Don't know if it was ever fixed, but I worked around this issue by actually modifying the font family names inside the .ttf files, using vim editor. Because you have different font-types (Bold and Medium) but actually the same fontfamily (MyFont) - the system mixes them up. So what I did in the first file - I actually modified the family to be MyFontA, and in the second file MyFontB (of course I had different names - these are just to match the example above).
This worked perfect.
I had a similar issue with multiple fonts of the same font family. I found that if I viewed the info.plist file as source code, the xml not formatted properly which cause only some of the fonts to register.