Graphics.set_font Ocaml - graphics

i m using the Graphics.set_font function to change the font of a text like
Graphics.set_font "-*-fixed-medium-r-semicondensed--50-*-*-*-*-*-iso8859-1";
my question is : What is the default font used by Ocaml ?
Thanks

I'm not intimately familiar with the Graphics library, much less its source code. But a cursory search reveals the following:
On UNIX, the DEFAULT_FONT is set to "fixed", which presumably means it will use whatever is configured as your system's fixed-width font.
On Windows, the gr_reset function loads the "Courier" font.

Related

Is importing a truetype font for perl module possible?

After a great deal of toiling I have managed to hack up a perl script that use PDF::Create to create pdf labels for a label printer. The script now works perfectly to suit my needs but the choices of fonts are limited. I have installed a true type font with gnome-font-viewer (I am using Debian Stretch).
According to the docs for PDF::Create: A postscript named "BaseFont" (Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique, Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique, Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic or Symbol) can be used to create the pdf.
How can I add my newly installed true type font to this list of Postscript basefonts so that I can use it to create a PDF? Or is this not possible?
There is an old and unresolved ticket requesting that feature on that module, so I suspect for PDF::Create, the answer is no, you can't use TTF fonts (I'd be happy to be proven wrong on that point).
Other Perl modules can use True Type and Open Type fonts. PDF::API2 does support them. I'll confess, I found that module's API to be somewhat intimidating.
Another module I have used extensively is PDF::Reuse which can be used to create PDFs from scratch, or by combining existing pages as templates and overlaying text and other elements. PDF::Reuse also supports the use of True Type fonts.

Is there a standard file extension for gnuplot files?

I have seen .gnu, .plt, and .gplot as file extensions for gnuplot scripts.
I know Linux doesn't care about file extensions, but what extension most universally declares to human beings "I am a gnuplot script!"?
As Romain, Dr. Person and neillb all point out and this wikibooks article confirms, there is no official standard extension for gnuplot files.
These three file extensions do seem popular:
.gpi
.plt
.gp
Of these .gp is shortest and seems like it would have the fewest collisions with other programs. But the other two extensions aren't in heavy use either. It appears that .plt was used by HPGL plotters and therefore some old Autocad files may have this extension. And files with a .gpi extension are used by Garmin GPS devices. Fwiw, googling for "gnuplot file extension gp" returns a few more results than similar searches for .gpi and .plt
While .gnuplot is a fair choice, it is seven characters long. Long file extensions can potentially detract from readability in the terminal because they open up the possibility of file names that are shorter than the file extension and because longer extensions are more likely to cause lines to wrap.
vim recognises .gpi, for more see Gnuplot Wikibook.
Gnuplot uses .gnu for the demos on their website, so I take that to be the standard.
what extension most universally
declares to human beings "I am a
gnuplot script!"?
For that, ".gnuplot" is hard to beat!
It's not common (probably because it's a bit long) but it unambiguously tells a human being what's inside the tin.
In contrast, wikipedia lists six other file formats with the extension .plt.
I don't think that ".gnuplot" should have been accepted as THE answer. There really isn't an answer. I've seen and used ".gp" before which is nice.
Wikipedia seems to suggest .plt would be standard-ish. That being said, GnuPlot itself doesn't define any standard and makes it freeform, so there isn't really an extension that tells "this is a gnuplot script".
Worth noting. Visual Studio Code has an extension for gnuplot syntax highlighting. It defines 5 extensions for gnuplot files:
.gp
.gnuplot
.gnu
.plot
.plt

beamer includegraphics with screenshots

I'm using the LaTeX-Beamer class for making presentations. Every once in a while I need to include screenshots. Those graphics are pixel-based, of course. I use includegraphics like this:
\begin{figure}
\includegraphics[width= \paperwidth]{img/analyzer.png}
\end{figure}
or usually something like this:
\begin{figure}
\includegraphics[width= 0.8\linewidth]{img/analyzer.png}
\end{figure}
This leads to pretty bad readibility of the contained text, so I'm asking for your best practices: How would you include screenshots containing text considering, that I will do the output PDF with pdflatex?
EDIT: I suppose I'm looking for something like an 1:1 presetation of the image within beamer. However, [scale = 1.0] doesn't achieve what I'm looking for.
Your best bet is to scale the image outside of Latex for inclusion, and include it in 1:1 ratio. The scaling done by graphics packages in Latex isn't going to be anywhere near as good as possible from other tools. Latex (Tex) has limited floating-point arithmetic capabilities, whereas an external tool can use sophisticated algorithms to get the scaling better.
Another option is to use only a part of the screenshot, the one you want to concentrate on.
Edit: If you can change the font size before taking the screenshot, that's another option—just increase the font size for the screenshots.
Of course, you can combine the two methods.
I have done exactly what you do and e.g defined
\newcommand{\screenshot}[1]{\centerline{%
\includegraphics[height=7.8cm,transparent]{#1}}} % 7.8in
which worked with whatever style I was using at the time. The files included with this macro were all PNGs created with one the usual Linux screen capture tools.
Edit: You may have to play with the size (height and width) of your input files. It came out rather nice for me (and this was from a presentation in 2006).
How about scaling it as follows:
\includegraphics[scale=0.5]{images/myimage.jpg}
This works for me.
Have you tried to convert the image to .eps or .pdf file and use this file in LaTeX?
Maybe try also latex, dvips and ps2pdf.
Problem might be in used viewer, in Linux I use Document viewer or ePDFViewer and output is much worse than in Adobe Reader or Acrobat, which I use in Windows...

Page margins change in pdflatex

I use a style file that specifies page margins. I cannot understand the style file, but I guess it specifies bottom margins by using commands such as \vspace, \vskip, \vfil.
When I compile the tex document with pdflatex the margins, especially the bottom ones, change. When I compile the document first to ps then to pdf, the margins are good.
Do you have any idea, what the reason might be?
The contents of the style file can be accessed from http://tinypaste.com/c53d1
Probably because something is defaulting to a page size of 'Letter' and the other path is defaulting to a page size of 'A4' (or vice-versa). You might see if the \documentclass directive in your document allows you to specify page size. If you're using ps2pdf you may also have to specify the output page size. Also, don't forget to specify the destination device (-P IIRC) when using dvips so it renders computer modern fonts correctly in the PDF.
My teacher uses this structure:
% Nadefinujeme stranu A5
%
\setlength{\paperwidth}{148mm}
\setlength{\paperheight}{210mm}
% Pro PDFTeX potrebujeme navic definovat \pdfpagewidth
% a \pdfpageheight. Standardni TeX ale tyto registry nezna,
% nemuzeme do nich tedy hned prirazovat. Proto se nejprve
% trikem zeptame, jestli se preklada pomoci PDFTeXu
\ifx\pdfoutput\undefined
\else% Zda se, ze \pdfoutput je definovany, tj. pouziva se PDFTeX
\setlength{\pdfpagewidth}{\paperwidth}
\setlength{\pdfpageheight}{\paperheight}
\fi
%
In the comments there are:
A5 page definition:
For PDFTeX we also need to define \pdfpaperwidth and \pdfpaerheight. But standard TeX doesn't know those registers so we cannot assign them. Thats why we use a trick to ask whther PDFTeX is used.
It seems \pdfoutput is defined so PDFTeX is used.
I hope it should help you with solving the problem.
Try setting the page size by running texconfig. This sounds like a letter <-> a4 conversion problem to me. (This has annoyed me several times in the past!)
I guess it specifies bottom margins by using commands such as \vspace, \vskip, \vfil.
Nope, this is the part that specifies the page design:
\oddsidemargin9.6mm
\evensidemargin9.6mm
\topmargin-7.mm
\headheight20pt
\textwidth155mm
\textheight242mm
\parindent1cm
I think your problem is the page size switching between a4 and letter when you go between LaTeX and pdfLaTeX, although that might seem strange. You should find that loading the geometry package before fbe_tez helps. E.g.,
\usepackage{geometry,fbe_tex}
Geometry sets the physical paper size, which is a relatively modern (cf. setting up the page layout as that style does) feature.

How do I have Emacs load a font from a file?

In the interest of making my emacs setup more portable, I'd like to be able to set the current font by specifying a file rather than a font name, i.e. "Load ~/config/myfont.ttf and use size 12". Is there a way to do that in my .emacs? All the instructions I've found assume the font is already installed on the system. I'm using the XFT support on Linux, so a linux specific hack would be OK but I'd prefer something that would work on all targets.
Update: To be clear, I'm using a font that isn't standard on Windows / OS X / Linux. I'm not just looking to set a different font based on platform, but to specify a specific font file that I have (TTFs work on Windows and Linux, if not on Mac I'll get another version of the file but I still want to specify the font via file rather than name).
Unfortunately, you can't.
Emacs on different platforms uses different windowing toolkits, all of which take care of font handling for it. I don't believe you can specify a font filename in Emacs on any platform - it just doesn't work that way.
As for how to find the font:
On Linux, you could use XFT's support for a user-specific font config file which is usually ~/.fonts.conf (but check /etc/fonts/font.conf to be sure) to add whatever directory you place your fonts into.
On a Mac, you can add the font into ~/Library/Fonts. TTFs work fine on Macs, BTW.
On Windows, I think you'd just have to add it to the system fonts directory.
From there, you then go and tell Emacs (through customize or not) to use your font. You'll find the naming schemes to be different on each platform (not sure what Windows looks like), but customize should help take care of this for you - just keep a separate customize file per machine if need be.
...so basically your portable Emacs setup has to encompass more than just an Emacs config file (which, given that you're carrying a font file around, it already does).

Resources