I need to create a Microsoft Word Mail Merge document in my Java Spring MVC application. But running it in Ubuntu server resulting in a document that missing the default font use in the document, which is the Calibri font. So I need to install the font in Ubuntu to make the document looks as expected.
Here what I need to do to install the font in my Ubuntu box. Starts by updating the repository package list to get latest packages information for upgrades or new package installation.
sudo apt-get update
Then install FontForge in our system. FontForge is a free and open source font editor, but in this case it will help to do the font conversion in the installation script on the upcoming step.
sudo apt-get install fontforge
Install the Microsoft Cabinet file un-packer. This is required for the next script to successfully install the fonts.
sudo apt-get install cabextract
The following script will install Microsoft Vista TrueType Fonts (TTF) in Ubuntu. It includes the following fonts, Calibri, Cambria, Candara, Consolas, Constantia, and Corbel.
wget https://gist.github.com/maxwelleite/10774746/raw/ttf-vista-fonts-installer.sh -q -O - | sudo bash
Run the next command to see if the font successfully installed. You will see the Calibri fonts in the result if the fonts successfully installed.
fc-list | grep Calibri
Here are the list of installed Calibri fonts.
/usr/share/fonts/truetype/vista/calibriz.ttf: Calibri:style=Bold Italic /usr/share/fonts/truetype/vista/calibrii.ttf: Calibri:style=Italic /usr/share/fonts/truetype/vista/calibrib.ttf: Calibri:style=Bold /usr/share/fonts/truetype/vista/calibri.ttf: Calibri:style=Regular
- How do I convert Map to JSON and vice versa using Jackson? - June 12, 2022
- How do I find Java version? - March 21, 2022
- How do I convert CSV to JSON string using Jackson? - February 13, 2022