How to install new font in RStudio? - macos

I want to install a new font in RStudio.
More specifically, I use RStudio in my office (Windows) and at home (OS X), but I see that the fonts are different and takes me a while to get used to that.
Can someone suggest how to install SAS monospace font in RStudio in Mac?
(I did a search here and in Google but I had no luck finding an answer to my question.)
Thank you in advance!

I ran into similar issue on Windows I wanted to use a new font I installed, mononoki font. I could not find an option to change so I look at RStudio source code and discovered that for Desktop Version of RStudio, RStudio automatically loads fonts from the OS. It should work the same way on MAC.
All you have to do is:
1.Install your font as usual for your OS
2.Then restart RStudio
3.The new font appears in the Editor Fonts pull down menu
(navigation: Global Options -->Appearance --> Editor Fonts)
4.Select the font from Editor Fonts pulldown menu.(Your Done!)
Here is the code which loads the fonts from RStudio. As you can see it automatically loads proportional and fixed fonts. The Web Version of RStudio restricts the font selection to only a few fonts.
static class DesktopThemeFontLoader implements ThemeFontLoader
{
public native final String getProportionalFont() /*-{
return $wnd.desktop.proportionalFont();
}-*/;
public native final String getFixedWidthFont() /*-{
return $wnd.desktop.fixedWidthFont();
}-*/;
}

Related

Bundle custom fonts into macOS standalone application using Xcode

I am new to macOS standalone application development and I am working on fixing the issues in it. I am running with an issue where the custom fonts not getting applied to controls present in the application. I am using Xcode 11.3 in macOS Mojave 10.14
There is already a fonts folder added to the project which contains all the font files (.ttf) extension. I have referred the "fonts" folder using the key "Application fonts resource path" in the Info.plist file. Even after applying all these changes the controls are getting referred to system font instead of the embedded font.
Also, the custom fonts which are added to the project is not being shown in the Font dropdown list of Attribute inspector.
Can you please suggest on what needs to be done in order to embed the custom fonts into the project and also show these custom fonts in fonts dropdown list?
Install the font
On your macOS, double click on all the fonts you'd like to use. Following window will appear for each:
Click on the Install Font button.
Attributes inspector
You can now choose your font. Remember, only installed fonts are listed. Fonts bundled with your application are not. Select your custom font.
Bundle fonts
Add a new Copy Files phase
Set subpaths to Fonts
Drop all the font files there
Info.plist
Add a new row Application fonts resource path (ATSApplicationFontsPath)
Set value to Fonts (must match copy files phase subpath)
Test
How to test that fonts are bundled correctly:
Close the storyboard (Xcode)
Launch Font Book
Right click on your custom font and disable it
Launch your application and test that all the custom fonts are bundled properly and work as expected
Launch Font Book
Right click on your custom font and enable it again
WARNING
Do NOT open the storyboard file if you disable/remove your custom font.
You'll get the following warning if you do ...
... and all your custom font settings are gone. You can open the storyboard file again, but you have to enable/install your custom font.

Why are my TrueType hints ignored?

I have integrated some hints (a prep handler to update the cvt and glyph instructions (simple MIAPs to copy the cvt values to specific points) into a custom TTF font.
I changed the fonts via Python fontTools.ttx
The font and the hints work perfectly when I test the font in TrueTypeViewerQt.
The font (and the hints) work also in PIL.
I can also see the hints in FontForge (for prep and the glyphs), but debugging them just shows "".
I also get this message in the console window:
SplineFontPieceMeal() going unhinted...
When I now use the font from a PDF file (written via reportlab), the font is used, but my hints seem to be ignored by Acrobat Reader, Ghostscript, mudraw, Chrome Web Browser (integrated PDF view), or an own application based on PDFium.
Then font exported from the PDF (via mutool) still contains the hints which work in TrueTypeViewerQt.
PDF: https://www.dropbox.com/s/qn3iooazsq1z2w5/d85.pdf?dl=0
Font: https://www.dropbox.com/s/p6qwug9h6vcgps0/testbar.ttf?dl=0
Any ideas?

Inconsolata font on Android Studio

I want to use Inconsolata font on a intelliJ editor (Android Studio) on Windows but it looks messy.
I managed to load inconsolata by adding some antialiasing options on studio.exe.vmoptions. I just added these options
-Dawt.useSystemAAFontSettings=on
-Dswing.aatext=true
-Dsun.java2d.xrender=true
and now the font loads but it looks too much crappy to use. Actually any font on this ide looks crappy. Here's a screenshot of the same font on SublimeText right and on Android Studio left
Anyone knows if you can use this font on intelliJ based editors or if there are some issues associated with this font?
We can simply use google fonts It's very easy to implements. only you have to follow these steps.
step 1) Open layout.xml of your project and the select font family of text view in attributes (for reference screen shot is attached)
step 2) The in font family select More fonts.. option if your font is not there. then you will see a new window will open, there you can type your required font & select the desired font from that list i.e) Regular, Bold, Italic etc.. as shown in below image.
step 3) Then you will observe a font folder will be auto generated in /res folder having your selected fonts xml file
Then you can directly use this font family in xml as
android:fontFamily="#font/inconsolata"

Why are fonts looking so different in different themes in intellij?

In IntelliJ the Darcula theme fonts look as follows
and in the default light theme they look as follows
I want to use the lighter default theme, but I find the fonts in darcula theme to be more "clear" then the default lighter theme. Can you let me know how to correct this?
PS : I am using a Linux machine
This is controlled by Settings -> Editor -> Color & Fonts -> Font
However, I do not see a difference between the fonts for Darcula and the default theme :
Darcula :
vs.
Default:
both seem to use the same Consolas, Size 12 font.
Update
Since this is happening on Linux, from here:
Anti-aliasing of fonts is available with Oracle Java 1.6 on Linux. To
do this on a per user basis, add the following line to the user's
~/.bashrc.
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=[setting]'
Two other useful links :
How to fix font anti-aliasing in IntelliJ IDEA when using high DPI?
Intellij IDEA font smoothing in linux
I had the same question, and finally was able to discover the following:
The issue is not one font smoothing, but of the Default theme and the Darcula theme using different fonts on Linux. On my computer, the Default theme uses DejaVu Sans Mono, 12pt, but the Darcula theme uses Source Code Pro, 14pt.
If you want the Darcula Font, then go to File > Settings > Editor > Colors and Fonts > Font, make a copy of the Default scheme, and then change the font to Source Code Pro, 14pt.
See also the Wikipedia article on Source Code Pro .

How do you reliably render Khmer (Indic) fonts on the web (and in PDFs)?

I've been having a world of trouble getting Khmer fonts (an Indic script of Cambodia) to render reliably on the web across platforms (Mac, Windows, Linux).
Google web fonts recently added Khmer, which seems like the best bet. However, I have not been successful getting Khmer fonts to work on any Mac or Linux system. I can get them to work on Windows by installing the Khmer Unicode installer from http://khmeros.info but not by just including Google's font in an HTML file.
For example, see this screenshot of the Google web fonts page on a fresh Windows installation. You can see that the default Windows Khmer font (uuuuugly!) is being used instead of Danh's pretty fonts.
I have another test file here: http://dl.dropbox.com/u/634/khmer_test.html. For the first test, you should see something like this for both the web font and the default system font (assuming you have Hanuman installed). I have yet to find a system where both examples work reliably.
Any help would be greatly appreciated. My primary goal is to get this working on a website; a secondary goal is to get Khmer (and other Indic fonts) working in a PDF generator like iText (although I am aware iText itself does not support Indic fonts -- I'm hoping something similar does).
Every Cambodian Windows users are always delete the font name called: KhmerMool and Khmer Kampot. Then they change the default Khmer font in regedit too. You can check at http://thelifeandwork.blogspot.com/2010/01/changing-default-khmer-font-in-windows.html . I'm not sure about Khmer font and other Indic font in PDF. I always have problem when i copy Khmer unicode from PDF to put in OpenOffice or Office Word or LibreOffice.
Khmer Unicode displays on the web, it will always solve now by Google Webfont, please refer to that.
And if you want to have Khmer display in PDF by converting using iText, you can see following post:
Khmer Unicode in iText
http://ask.osify.com/qa/287
They are currently not yet support the display yet.
But, just today I can get it works by modifying the source code of iText (5.5.4-SNAPSHOT) as I just stated in my post: http://ask.osify.com/qa/613, not yet be able to publish since it's just start in testing around.
Updated 13/01/2016
I have added the source code sample for the rendering: http://ask.osify.com/qa/613
The rendering customization with iText for Khmer Unicode added in github: https://github.com/Seuksa/iTextKhmer

Resources