# Using Custom fonts for a Package

**URL:** https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259
**Category:** New to Julia
**Created:** [November 22, 2017, 9:25pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259 "2017-11-22T21:25:39Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Acrylami](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/acrylami/32/2711_2.png) [@Acrylami](https://discourse.julialang.org/u/Acrylami)
#### Post date: [November 22, 2017, 9:25pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/1 "2017-11-22T21:25:39Z")

</div>

Hi everyone,

I’m new to Julia and I’m trying to contribute to BioJulia. For the package I’m working on I need to print to the console in a custom font as I need to convert text to a set of specific symbols available in that font.

How can I include this font in my package so I can print to the console using it and everyone who adds that package will also be able to see the text in the correct font?

Thanks

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [November 23, 2017, 3:52am UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/2 "2017-11-23T03:52:04Z")

</div>

> [@Acrylami](#):
>
> I need to print to the console in a custom font as I need to convert text to a set of specific symbols available in that font.

Do the symbols have standard Unicode encodings? If so, that should free you from tying yourself to a particular font.

---

<div class="post-metadata">

### Author: ![Acrylami](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/acrylami/32/2711_2.png) [@Acrylami](https://discourse.julialang.org/u/Acrylami)
#### Post date: [November 23, 2017, 11:10am UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/3 "2017-11-23T11:10:42Z")

</div>

I believe not. It’s called Ambiscript and it was created as a font of unique symbols.

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [November 23, 2017, 12:25pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/4 "2017-11-23T12:25:24Z")

</div>

The Julia REPL _per se_ has nothing to do with fonts, it just emits character codes, your terminal converts that into a visual rendering using fonts. If you are using some kind of a text terminal, you should be able to set the font for that (outside Julia). Then, assuming it handles UTF8 (most should do these days) you just print the right character codes. Perhaps defining constants for them would help.

---

<div class="post-metadata">

### Author: ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)
#### Post date: [November 24, 2017, 10:13am UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/5 "2017-11-24T10:13:39Z")

</div>

Are you referring to the font on [this page](http://ambiscript.org/truetype/)? That won’t work well - at least, if you change the terminal’s font to that you won’t be able to read ordinary text…

---

<div class="post-metadata">

### Author: ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)
#### Post date: [November 24, 2017, 12:39pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/6 "2017-11-24T12:39:18Z")

</div>

Looks like such a cool way to visualize DNA, though.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [November 24, 2017, 12:54pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/7 "2017-11-24T12:54:57Z")

</div>

If you’re using IJulia with the Jupyter notebook interface, which runs in the browser, you can emit HTML output, and use HTML directives to control the font.

---

<div class="post-metadata">

### Author: ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)
#### Post date: [November 24, 2017, 5:04pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/8 "2017-11-24T17:04:40Z")

</div>

Like this, perhaps:

 ![01](https://global.discourse-cdn.com/julialang/original/3X/3/f/3f90e8f12f727169ccff568b4df18e2fcc0674a7.png)

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [November 24, 2017, 6:02pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/9 "2017-11-24T18:02:53Z")

</div>

Note that IJulia automatically calls `display` on the result of executing a cell. So you can _either_ have the cell end with an `HTML("<font ...>")` object _or_ call `display("text/html", "<font ...>")` — no need for `display(HTML(...))`.

---

<div class="post-metadata">

### Author: ![Acrylami](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/acrylami/32/2711_2.png) [@Acrylami](https://discourse.julialang.org/u/Acrylami)
#### Post date: [November 25, 2017, 3:53pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/10 "2017-11-25T15:53:50Z")

</div>

That’s perfect! Can I ask how you imported/registered the font so it knew what you meant by DNABold?

---

<div class="post-metadata">

### Author: ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)
#### Post date: [November 25, 2017, 5:23pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/11 "2017-11-25T17:23:14Z")

</div>

Most people probably do the same steps as described at some length for the three main platforms [here](https://www.howtogeek.com/192980/how-to-install-remove-and-manage-fonts-on-windows-mac-and-linux/). I load fonts using a font manager (Linotype’s FontExplorerPro), which is probably atypical…

You can usually find the names by looking at the details of the font. Often, the PostScript name seems to be the one that works, although I suspect that too may be platform-dependent.

 ![41](https://global.discourse-cdn.com/julialang/original/3X/9/d/9dd006147e0cd26de96750aea3e6afc3958b7c49.png)

---

<div class="post-metadata">

### Author: ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)
#### Post date: [November 25, 2017, 5:42pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/12 "2017-11-25T17:42:27Z")

</div>

For use in IJulia, you could also use [`@font-face`](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face) CSS which would mean that the user wouldn’t have to manually install the font.

---

<div class="post-metadata">

### Author: ![Acrylami](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/acrylami/32/2711_2.png) [@Acrylami](https://discourse.julialang.org/u/Acrylami)
#### Post date: [November 25, 2017, 7:05pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/13 "2017-11-25T19:05:58Z")

</div>

Ahh thank you that’s very helpful. The output is directly to the Julia console so would these solutions be compatible with that? I’ll let you know how I get along with figuring it out.

And Stevengi, is it possible to output CSS formatted text to the Julia console for display in the console?

---

<div class="post-metadata">

### Author: ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)
#### Post date: [November 25, 2017, 7:11pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/14 "2017-11-25T19:11:12Z")

</div>

I don’t think that’s possible, if you mean the Terminal app on a Mac, for example.

---

<div class="post-metadata">

### Author: ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)
#### Post date: [November 25, 2017, 8:51pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/15 "2017-11-25T20:51:02Z")

</div>

I wonder if it might be possible to use a build script with BinDeps.jl to install the fonts? Wouldn’t help the terminal case, of course.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [November 25, 2017, 9:15pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/16 "2017-11-25T21:15:26Z")

</div>

> [@Acrylami](#):
>
> And Stevengi, is it possible to output CSS formatted text to the Julia console for display in the console?

No, you need a browser to handle HTML and CSS, so you need IJulia or similar.

---

<div class="post-metadata">

### Author: ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)
#### Post date: [November 25, 2017, 9:24pm UTC](https://discourse.julialang.org/t/using-custom-fonts-for-a-package/7259/17 "2017-11-25T21:24:46Z")

</div>

The best (though admittedly not short-term) solution would be to [submit a proposal](http://unicode.org/pending/proposals.html) to include the characters in Unicode.
