When running frama-c-gui, I'd like to increase its font size (for a tutorial, class, demo, video, etc), to ensure the text is visible in a large room. How can I do it?
The exact answer may depend on system settings, but overall, these should work:
If your Frama-C GUI has been compiled with GTK 2 (i.e. you have the opam package lablgtk installed but not lablgtk3):
If you are using Frama-C <= 25 (Manganese):
There is a frama-c.rc file in the share directory of the Frama-C installation (frama-c -print-share-path). You can modify the lines with font_name by adding the desired size after the font name, e.g.:
font_name = "DejaVu Sans" -> font_name = "DejaVu Sans 18"
Then re-run the GUI.
If you are using Frama-C >= 26 (Iron):
The frama-c.rc file is not installed, so you have to manually write it. A simple way to do so is to open file $(frama-c -print-share-path)/frama-c.rc in your favorite text editor and then write the following:
style "large"
{
font_name = "18"
}
widget "*" style "large"
Save and reload the GUI.
If none of the above work for GTK 2, in some systems it is possible to simply add/modify file ~/.gtkrc-2.0, with a line such as:
gtk-font-name="Noto Sans, 18"
This will however apply to all GTK 2 applications. However, this has stopped working in some recent systems.
If you are using GTK 3 (e.g. you had the opam package lablgtk3 installed):
Use GTK's high DPI settings, such as:
GDK_DPI_SCALE=1.33 frama-c-gui <options>
Adjust the scale factor as you wish.
Related
I am using Jupyter in Windows.
I mean to change coloring of the QT console.
How can I select one of the built in CSSs as the default, via configuration file?
I mean to avoid passing it as an argument as in jupyter qtconsole --style monokai.
I would rather use a configuration file, e.g. file1 = %USERPROFILE%\.jupyter\jupyter_qtconsole_config.py
What I ultimately want to do is write monokai in some configuration file, and have the QTconsole load the built-in monokai.
What I tried so far:
As a test, execute
jupyter qtconsole --style monokai.
It actually brought monokai (white fgr on dark gray bgr). Moreover, it combined well with my selected c.ConsoleWidget.font_size = 12 in file1.
Then, trying to use my own css.
I copied a monokai.css file in C:\Users\user1 (I have quite a few in my system, but I guess any one should work for the most basic stuff).
In file1 I included one of the lines
c.JupyterQtConsoleApp.stylesheet = u'C:/Users/user1/monokai.css'
c.JupyterQtConsoleApp.stylesheet = 'C:/Users/user1/monokai.css'
c.JupyterQtConsoleApp.stylesheet = 'C:\\Users\\user1\\monokai.css'
None worked.
If I made this work, I would still have to find how to replace the specification of a file as a location by a simple CSS name among the built-in.
PS: I know I could also set a Windows shortcut that launches jupyter qtconsole --style monokai.
I also mean to avoid this.
This is a solution, but I am not certain it is the only one, or if it is the most portable across systems.
Note: there might be some issues, yet to be solved, in the way this configuration works, see https://github.com/jupyter/qtconsole/issues/334
Use
c.JupyterWidget.syntax_style = 'monokai'
in file %USERPROFILE%\.jupyter\jupyter_qtconsole_config.py
or ~\.jupyter\jupyter_qtconsole_config.py.
Inspired by this.
I use the package extrafont with ggplot to produce graphics where all text is in Linux Libertine. I use multiple computers and have a problem because the system font families have different names - "Linux Libertine" and "Linux Libertine G". This means I have to change the name of the font family in my code each time I change computer.
I tried to change the name in the font table from "Linux Libertine G" to "Linux Libertine" so they match, however this results in r not recognising the font.
Any ideas how to get around this?
The "G" means it's a Linux Libertine variant with graphite instructions added. IIRC it's not the upstream version but a fork distributed with LibreOffice.
It should probably be aliased at fontconfig level to the original font name so apps know they should use one for the other when an exact match is unavailable (you have some aliasing fontconfig templates in Fedora "fontpackages" package).
Not sure, however, that R fontconfig support is complete today. If not that will severely limit the font substitution possibilities open to you.
I created several simple ggplot2 plots and saved them to PDF files using the following commands:
p <- ggplot(plotobject, aes(x=Pos, y=Pval),res=300)
ggsave(plot=p,height=6,width=6,dpi=200, filename="~/example.pdf")
If I now open this example.pdf in Adobe Illustrator I get the following error:
The font AdobePiStd is missing. Affected text will be displayed using
a substitute font.
Is there a way in ggplot2 to specify a font (I presume this is for the dots/points) that Adobe will understand or otherwise is there a way to get this font working in Adobe?
/edit just to clarify, the text/labels/titles are all just fine its the dots that are missing for the font
/edit2 I got a working solution by just using the EPS output in ggsave, but still would love to find out a way to also be able to just open/import ggplot2 plots in PDF format directly in AI
Although changing the fonts used by AI works well, an alternative is to restrict ggplot2 from using Dingbats in the first place by adding the argument 'useDingbats' to your ggsave command eg:
ggsave(plot=p,height=6,width=6,dpi=200, filename="~/example.pdf", useDingbats=FALSE)
I ran into this problem as well on Mac OS X 10.8.2.
This resolved the issue for me:
font='/Library/Application Support/Adobe/PDFL/10.9/Fonts/AdobePiStd.otf'
cp $font /Library/Fonts/
On your system, find the file with find:
find / -name AdobePiStd.otf 2>/dev/null
/Applications/Adobe Photoshop CC 2018/Adobe Photoshop CC 2018.app/Contents/Required/PDFL/Resource/Fonts/AdobePiStd.otf
/Applications/Adobe Illustrator CC 2018/Adobe Illustrator.app/Contents/Required/PDFL Resource/Resource/Fonts/AdobePiStd.otf
/Applications/Adobe Acrobat DC/Adobe Acrobat.app/Contents/Resources/Resource/Font/AdobePiStd.otf
For dots or points that don't' display correctly in a pdf, I just substitute Zapf Dingbats for the missing font in Adobe Illustrator. For simple plot markers, this does the job most of the time.
This seems to be a perverse problem in which Adobe Illustrator cannot find a font (AdobePiStd) that is distributed with Adobe Reader and thus is likely present.
If you search your computer, you are likely to find it. On my WindowsXP system, it was in:
C:\Program Files\Adobe\Reader 10.0\Resource\Font
After finding it, you can install it and other fonts in that folder, which should enable Illustrator to find them.
For other font/pdf problems in R, the embedFonts function in grDevices package is useful.
Use useDingbats=FALSE for the pdf output, then Illustrator will no complain.
pdf("example.pdf", useDingbats=FALSE)
ggplot(plotobject, aes(x=Pos, y=Pval),res=300)
dev.off()
You can download the font AdobePiStd - just Google it, download and install. After you reboot, the font should display correctly. You can then use the 'Find Font ...' utility within Illustrator to change it if you wish.
EDIT 2018 The question under was for the initial confusion face. The answer to this question is pdf(useDingbats = FALSE) as stated in numerous answers above. I won't delete this answer, in case you want to read about fonts (which might become a problem too).
OLD ANSWER AI does not recognize Helvetica type fonts. In my computer it doesn't matter that much, since it automatically replaces the font with something suitable. Of course you'd want to change the font in some cases. I often do it manually in AI (just select all the text and change the font type). Here is a thread on how to change the font in ggplot2: Modifying fonts in ggplot2
Ps. There is also another thread that might be helpful: Fonts in R plots
Another option that in simple cases might solve the problem is to in illustrator select the textobjects not displayed correctly and change the font. Helvetica Neue works for me.
I could solve the problem just by adding alpha specification. If you don't need any transparency you can chose an alpha value of 0.9 ...
example:
ggplot() + geom_point(aes(x=..,y=.., color=...), alpha=0.8)
I have installed RRO on a new macbook pro 13" retina (two cores) & Yosemite.
I tried with RSTUDIO and R 25 (S. Urbinek notorious benchmark) and I got the test time down from ~31 s to a blazing 5 s (thanks to multithreading and Intel MKL). Marvellous!
The problems are with Sublime text. I use Sublime text 3 as text console more often than rstudio for a variety of reasons.
I use it in conjunction with the package R-Box to drive where I want to send the code to: either to the R console, or with SublimeREPL R to direct the code to Sublime itself splitting the screen in two and sending the code to the right hand of the screen where I run the R console.
Normally I configure R-Box user settings with R, and SublimeREPL specifying the R path as /usr/bin/R (see below).
Results (sadly)
R-Box & R does not work: it cannot find the RRO app (even changing
the name of the app from RRO to R it does not find it).
R-Box & SublimeREPL (i.e. the
console in the right side of the screen) shows the console OK, but there is no
visible prompt, hence it is of no use.
These are the R scripts that work with CRAN R:
# R-Box
{
"App": "R",
"osx":
{
"App": "SublimeREPL"
}
}
# SublimeREPL
{
"default_extend_env": {"PATH": "{PATH};/usr/bin/R"},
"show_transferred_text": true
}
(I posted this also on the RRO forun at https://groups.google.com/forum/#!topic/rropen/bK_YPqxhXsI)
PS: could somebody with tagging power create a tag for RRO (Revolution R Open)?
The first issues with R-Box is resolved changing RRO app name to R.app (alias didn't work and I had explicitly to change the name of the app).
As in my comment above, the second issue with SublimeREPL is resolved changing the setting of
echo = true
in the file at ~/Library/Application Support/Sublime Text 3/Packages/SublimeREPL/config/R (otherwise set to false).
As the change it is not in a file "customisable" in the console one needs to probably change it at any new release of SublimeREPL.
I have a problem with typefaces and PDF-Output in R. On this windows machine there is no Helvetica and the Font used by the device seems to be Arial as you can see below.
The simple problem is, that Arial is used (as I want it to be) but editing the PDF-File it says Helvetica is used. How can I get R to write the correct Name into the PDF-file. pdf(...,family="Arial") won't work, as this family is not known (grDevices version 2.15.1).
Or can I substitude this font in the PDF afterwards, creating a file with the font I want?
R-PDF-Output
Comparision from this Article:Arial vs. Helvetica
Since R-3.1.0, this is much more straightforward. Now, to get an Arial font, just set family="ArialMT":
pdf("Arial.pdf", height=0.3, width=1.45, family="ArialMT")
grid::grid.text("CGJQRSafrst1237")
dev.off()
Quoting from the April 2014 R-3.1.0 release notes:
There is a new family, "ArialMT", for the pdf() and postscript()
devices. This will only be rendered correctly on viewers which
have access to Monotype TrueType fonts (which are sometimes
requested by journals).
To ensure that the pdf will be rendered correctly wherever it's viewed, you'll need to also embed the required Arial fonts in the document. Here's one easy way to do that:
library(extrafont)
loadfonts() ## Really only needed the first time you use extrafont
## Modify this to point to the corresponding Ghostscript executable on your own machine
Sys.setenv(R_GSCMD = "C:/Program Files/gs/gs9.07/bin/gswin64c.exe")
embed_fonts("Arial.pdf")
You need to set a new font family for use with pdf(). This requires you to have Adobe Font Metric files (*.afm files) for the fonts you wish to use. You can convert the .tty files to .afm ones or find .afm files for Arial on the interweb if you don't already have them.
Arial <- Type1Font(family = "Arial",
metrics = c("ArialMT.afm",
"arial-BoldMT.afm",
"Arial-ItalicMT.afm",
"Arial-BoldItalicMT.afm"))
where the character vector metrics contains the paths to the relevant .afm files, The files should be specified in this order:
plain face
bold face
italic face
bold-italic face
The you use the pdfFonts() function to add a mapping to these new fonts
pdfFonts(Arial = Arial)
where Arial is the object produced by Type1Font() earlier.
The final step is to use the family argument in pdf() which refers to one of the existing families as defined by pdfFonts():
pdf("testArial.pdf", family = "Arial")
plot(1:10, 1:10)
dev.off()
I haven't tried this as I don't have Arial on my system nor too many .afm files lying around, but I pieced this together from several sources:
Paul Murrell and Brian Ripley (2006) Non-standard fonts in PostScript and PDF graphics. R News, 6(2):41-47. PDF
A posting by David L. Carlson on the R mailing list from earlier this year.
An alternative depending on how your system is set-up is to a Cairo-based PDF device as that will use the functions of your system to identify and load fonts based simply on their name. See ?cairo_pdf and then the Cairo Fonts section of ?X11 for details.
As it is stated in the one of the comments, base 14 fonts does'nt need to be embedded and Helvetica is one of these fonts.PDF consumers are supposed to provide replacements for such fonts and Arial (or Arial MT) is often used in place of Helvetica.
I'm not familiar with R but you seem to be able to embed fonts afterward
edit: This question's answer explains how to embed fonts afterward with ghostscript, just be sure to have GS map Helvetica (or Arial) to the version of the font you want. Thanks to Gavin Simpson
for having me search for that :)
R by default does not embed fonts. It just specifies that a Helvetica is to be used. You're probably best off embedding fonts. There's two ways to do that, either use the cairo_pdf device or the extrafont package with the usual pdf device. cairo_pdf is a lot simpler, but the output differs in subtle ways from pdf.