How to Use Calibri Font in Linux and Mac

to use calibri style for mac,ios,linux

If you have the calibri font in your system then you've to upload the font on the server and then provide the path in CSS. ofcourse you need different type format so font render perfectly on all browser.

body {
font-family: 'Calibri', Fallback, sans-serif;
}

@font-face {
font-family: 'Calibri';
src: url('Calibri.eot'); /* IE9 Compat Modes */
src: url('Calibri.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('Calibri.woff') format('woff'), /* Modern Browsers */
url('Calibri.ttf') format('truetype'), /* Safari, Android, iOS */
url('Calibri.svg#svgFontName') format('svg'); /* Legacy iOS */
}

Height of word boxes typed with Calibri font on Mac and Windows are different

In the general case, you can't. Pixel-perfect rendering across Windows and OS/X is rarely possible (unless you only use images). The font rendering on Mac is very sophisticated (compared to any other OS; a relic of having NeXT as an ancestor).

Even Safari doesn't render the same on Windows and on Mac. Sometimes, PDF files look different (usually better) on Mac.

A workaround is to size the container with a fixed height but then, you get all the usual problems when zooming and people with disabilities. And let's not get started with people who disable web fonts.

Calibri not appearing in font-family

Calibri is stored inside a Microsoft directory on the Mac --

Mac HDD/Library/Fonts/Microsoft/Calibri.ttf.

As Sparky points out, you can't simply declare any font for use if this is intended for a web page to be hosted somewhere. Fonts need to be accessible from the internet and the font files on your Mac are not. In addition, font licenses may not permit you to use Calibri as a web font.

All that being posted, if a user has Calibri installed on their system then the font should work provided your CSS rules are correct.

To get Calibri working on your machine, you need to capitalize the name.

.class { font-family: Calibri, san-serif; }

The above CSS rule functions here on my Mac.

Search for text in Calibri font in Word fails

Office 2007 introduced the concept of "themes". At that time, documents automatically became linked to a "theme" and the theme font became the default font. Word recognizes two default fonts, one for the body and one for headings. These are listed in various places, such as the font list, as +body and +heading. Word looks up the font assigned to +Body or +Heading, but that font format isn't applied directly to the text, even though that's what is visible in, for example, the font list in the Ribbon.

In order to "find" text formatted with the body default you need to search:

Range.Find.Font.Name = "+Body"

This is the Word standard since Word 2007, but it can be changed, of course, by having a theme with a different font attached to the document. In order to determine what the default them font is, use:

Document.Documenttheme.ThemeFontScheme.MinorFont(msoThemeLatin)

How can I check whether a given font has been loaded already using extrafont package in R?

Here is one potential approach to determine whether Calibri is installed and 'useable':

install.packages("showtext")
library(showtext)
list_of_fonts <- as.data.frame(font_files())

grep(pattern = "Calibri", x = list_of_fonts$family, ignore.case = TRUE, value = TRUE)

You can implement this in a number of ways, e.g. load the Calibri font if it's available or print a message if it's not available on the system:

if (!require(showtext)) install.packages("showtext")
#> Loading required package: showtext
#> Loading required package: sysfonts
#> Loading required package: showtextdb
library(showtext)
list_of_fonts <- as.data.frame(font_files())
if(any(grepl("Calibri.ttf", list_of_fonts, ignore.case = TRUE))){
Calibri <- list_of_fonts[list_of_fonts$file == "Calibri.ttf",]
sysfonts::font_add(family = "Calibri",
regular = list.files(path = Calibri$path,
pattern = "Calibri.ttf",
full.names = TRUE))
print("Calibri available")
} else{
print("Calibri not found")
}
#> [1] "Calibri available"

library(ggplot2)
showtext_auto()
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
ggtitle("Example plot") +
theme(text = element_text(family = "Calibri", size = 22))

Sample Image

Created on 2021-09-29 by the reprex package (v2.0.1)

N.B. This should work on windows/macOS/linux but I've only tested it on macOS. Also, @JonSpring commented first, so if he posts an answer please accept his instead of mine



Related Topics



Leave a reply



Submit