ttf2ufm_x2gs on Ubuntu 20.04 - ghostscript

I use national delivery service windows software for genarating and printing labels installed with Wine. The program works fine, but when I try to print the document printer uses different fonts for barcode. They provided 4 different ttf fonts with program to install it on system. I've installed them on wine and now they are OK in program. But problem comes when I try to print the files with printer or with cups-pdf the result is that the bar code looks completly different. I found out that I should install those fonts to ghostscript which transforms, but there is a problem. When I try to install font using ttf2ufm_x2gs which should install font to ghostscript I get following error code in terminal:
/usr/bin/ttf2ufm_x2gs: 82: .: 3:To many files open
I copied default config.cfg to folder with fonts. Only change that I've made is added ENCDIR and MAPDIR paths.

The Windows software must not be embedding the fonts into the ps/pdf as needed. The Xserver might be using the fonts correctly to display the result yet ghostscript can't embed the fonts needed for printing. The TTF fonts have probably not been added to a Fontmap file in the ghostscript library path or fontpath as required. The ttf2ufm_x2gs looks very complicated just for setting up fonts to be used by ghostscript. I suspect your fonts and Fontmap are still not working with ghostscript as needed. I don't use CUPS so can't help with that. The CUPS probably runs ghostscript to send the job to the printer and ghostscript can't find the TTF fonts.
I use the /usr/share/ghostscript/fonts/ directory for my own fonts to keep them separate from the dist packages so they won't be disturbed by package updates. Then the /usr/share/ghostscript/fonts/Fontmap file can be edited to tell ghostscript how to locate your needed TTF files. Be sure the Fontname is correct because that is difficult to discover with TTF files. The fontforge program can give the correct Fontname if unknown.
The Fontmap result should have the 4 TTF fonts listed, for example:
% font in same directory
/Fontname1 (font1.ttf) ;
% font in different directory
/Fontname2 (/path/to/font2.ttf) ;
% alternate style
(Fontname3) (font3.ttf) ;
% alternate style in different directory
(Fontname4) (/path/to/font4.ttf) ;

Related

Running Tika through tika-python in Windows produces encoding errors

I have python code that extracts text from pdf files using Tika Server through tika-python. It then stores the resulting output in individual json files.
The command I run to execute my script is
python extraction.py <full path to some local directory>
I'm using python 3.5
It works perfect in different MacBookPro computers.
It doesn´t work as expected in Windows, even using up-to-date Windows 10.
Some pdf files are processed, others produce an error such as:
'charmap' codec can't encode characters in position 3648-3649: character maps to <undefined>
I have tried changing the Code Page to 65001 and changing console font to Lucida Console, based on other questions posted on Stack Overflow, including 388490 (Unicode characters in Windows command line - how?) and 14109024 (How to make Unicode charset in cmd.exe by default?) and 1259084 (What encoding/code page is cmd.exe using?).
I also tried installing ConEmu (http://conemu.github.io/en/UnicodeSupport.html) and changing the default encoding for all consoles.
Other references mention win_unicode_console (https://github.com/Drekin/win-unicode-console) but the python patch recommended instructions are not working in my machine.
I use Anaconda as my python distribution.
I am interested in knowing how to be able to run my python code in Windows without having these encoding problems. From what I have read, this is not a problem with my python code nor with Tika Server but rather a Windows encoding issue.
Thank you all,
German

Windows: text file became binary

I am working on a QML project with Qt Creator 4.0.0 on Windows 10.
At one point I had a blue screen, and after rebooting, the file on which I was working became binary: impossible to open it on a text editor (including vim) or to see its text content.
I tried to change the file extension, to change the encoding in Sublime Text... nothing helped.
When asking for a git diff:
$ git diff qml/file.qml
Binary files a/qml/file.qml and b/qml/file.qml differ
Does anybody have any idea about how to retrieve the file?

Powerline (tmuxline and vim-airline) not showing the right characters [iTerm2, Mac OS X]

so I'm using tmuxline and vim-airline because I don't know how to install powerline for iTerm 2
Anyway they should be looking like tabs but there are characters here not showing. Can anyone help me out?
My question has been answered. Thanks guys!
For future viewers who might encounter the same problem. All you have to do is the following:
Write this in your terminal (iTerm2 etc...)
git clone https://github.com/powerline/fonts.git
Now find that file (usually ~/)
cd powerline/fonts
Then type
./install.sh
After that go to your terminals preferences (usually cmd+,) and go to profiles > profilename > Font (Change Font) > Search for "Powerline" and all the installed fonts for powerline should appear > apply.
Use Anti-aliased if you want, and you can separate into two different fonts so that you only need the powerline font for 'Non-ASCII', and your preferred font in 'Font'
Did you install the patched font, as mentioned in Installation on OS X?
Install downloaded patched font by double-clicking the font file in
Finder, then clicking Install this font in the preview window.
Despite the link is to powerline installation manual, vim-airline also suggests to install that font.
You need special fonts for tmux powerline. You can easily install them from the command line:
git clone https://github.com/powerline/fonts.git
sudo ./fonts/install.sh
Then you change fonts in iTerm2 (both regular and non-ASCII fonts).

Powerline symbols aren't working?

Hi I'm trying to use a power line theme for zsh and although I've installed the Powerline-symbols.otf and various fonts from the https://github.com/Lokaltog/powerline-fonts repo, I cannot get the Powerline prompt to show the symbols. Instead I get [X]'s where the symbols should be.
I'm using terminal and made sure that it is set to xterm-256 colours and utf-8 encoding.
Just downloading and installing the fonts is not enough. In order to get the Powerline symbols, you need to tell Terminal to use one of the patched fonts you downloaded.
This can be done from the menu Terminal->Preferences.... In Settings->Text click on the button Change... in the section Font. Choose any font with "Powerline" in its name and you should get to see the Powerline symbols.
I just set the font dejavuSansMono NF and problem solved
I didn't have the fonts in the font list. To install them you need to clone fonts
git clone https://github.com/powerline/fonts.git
then to open PowerShell and run
.\install.ps1
inside your fonts directory. If you get error
FullyQualifiedErrorId : UnauthorizedAccess
you need to update policies by running
Set-ExecutionPolicy Unrestricted
via PowerShell. After that try to install fonts again.
Now you will be able to change the font as instructed above by Adaephon

rmagick custom fonts as pictures

I'm using this script https://github.com/Joern/CustomFont/blob/master/custom_font.rb to generate pictures with text in a custom font.
It works fine.
Now I bought a very special font which works fine on my local working machine with this script.
On my server I also have Ubuntu installed, Ubuntu Server Edition.
So I synced my WebApp from my local machine to my server and then just saw that it doesn't use the font.
I installed it with fc-cache -vf and convert -list font lists the font as installed (also fc-list | grep "Innovage" brings "Innovage:style=Regular").
Strangely, rmagick just won't use the font.
In contrast, this works: convert -font Innovage-Regular -pointsize 72 label:Test test.jpg
Additionaly confusing: bringing the convert line from above into a ruby script, it doesn't use the font again.
Any other font does work, but because the font works on my local machine, it cannot have to do with the font.
So I guess the problem lies at rmagick.
It's the same rmagick and Imagemagick version as on my local machine.
I just can't get it, it's totally confusing me.
Yours, Joern.
okay the problem's solution lies at simple as it can be: the font was simply in the wrong font dir, so that it was installed by the system, but the font-dir, I compiled rmagick with, was different to the dir I put the font into.

Resources