# Using fonts in app without installing them?

**URL:** <https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824>\
**Category:** General\
**Created:** [January 24, 2015, 5:12pm UTC](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824 "2015-01-24T17:12:54Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![Derek\_DiBenedetto](https://forum.xojo.com/user_avatar/forum.xojo.com/derek_dibenedetto/32/17867_2.png) [@Derek\_DiBenedetto](https://forum.xojo.com/u/Derek_DiBenedetto)\
**Post date:** [January 25, 2015, 6:45pm UTC](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824/21 "2015-01-25T18:45:07Z")

</div>

Is there a way to specify loading the font from the main running folder? Don’t necessarily want to install a bunch of fonts to a user’s desktop (this is for a Steam app). 🙂

---

<div class="post-metadata">

**Author:** ![Derek\_DiBenedetto](https://forum.xojo.com/user_avatar/forum.xojo.com/derek_dibenedetto/32/17867_2.png) [@Derek\_DiBenedetto](https://forum.xojo.com/u/Derek_DiBenedetto)\
**Post date:** [January 25, 2015, 6:51pm UTC](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824/22 "2015-01-25T18:51:01Z")

</div>

Would SpecialFolder.CurrentWorkingDirectory work?

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [January 25, 2015, 6:54pm UTC](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824/23 "2015-01-25T18:54:48Z")

</div>

> [@162144:@Derek DiBenedetto](#):
>
> Would SpecialFolder.CurrentWorkingDirectory work?

Would you be so kind to first test using Desktop and see if it works ? After that you can put the file anywhere you like.

Next to the exe is `GetFolderItem("")`.

---

<div class="post-metadata">

**Author:** ![Antonio\_Rinaldi](https://forum.xojo.com/user_avatar/forum.xojo.com/antonio_rinaldi/32/331_2.png) [@Antonio\_Rinaldi](https://forum.xojo.com/u/Antonio_Rinaldi)\
**Post date:** [January 25, 2015, 7:02pm UTC](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824/24 "2015-01-25T19:02:48Z")

</div>

Put them in the lib folder with a copyStep command (after build)  
I use a font folder inside and then to load the fonts I use

`#if TargetWin32
    dim f as FolderItem=app.ExecutableFile.Parent.Child(app.ExecutableFile.Name.Replace(".exe"," Libs"))
    if f.Exists then
      f=f.Child("fonts")
      if f.Exists then
        for i as Integer=1 to f.Count
          fonts.Append f.Item(i)
        next
      end if
    end if
    for i as integer=0 to Fonts.Ubound
      TemporarilyInstallFont(fonts(i))
    next
  #endif`  
fonts is an array that I use then for the UninstallTemporaryFont call  
The copy step is simple:  
create one after build, set applies to Both, subdirectory font, destination framework folder (that’s the Lib folder for win build)

---

<div class="post-metadata">

**Author:** ![Jürg\_Otter](https://forum.xojo.com/user_avatar/forum.xojo.com/j%C3%BCrg_otter/32/584_2.png) [@Jürg\_Otter](https://forum.xojo.com/u/J%C3%BCrg_Otter)\
**Post date:** [May 30, 2017, 9:40am UTC](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824/25 "2017-05-30T09:40:43Z")

</div>

Here’s an example Xojo project that shows how to use custom app fonts in Windows, macOS and Linux applications: [CustomAppFonts](http://www.jo-tools.ch/xojo/customappfonts/)

The fonts are not being installed on the OS - they are only available while the Application is running. This may be necessary, depending on the license of your fonts. On Windows and Linux it’s even possible to load/unload during runtime

Notes

1. macOS: Fonts are being added using Info.plist (see the corresponding project item) and a Post-Build CopyFiles-Step
2. Windows/Linux: Fonts are being added using Declares in modCustomAppFonts (see the corresponding Module in the project) and a Post-Build CopyFiles-Step

![](http://www.jo-tools.ch/xojo/customappfonts/caf_screenshot_2.png)

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [May 30, 2017, 12:06pm UTC](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824/26 "2017-05-30T12:06:38Z")

</div>

Note that this app, like others built with MBS ActivateFontMBS, does not work under Windows in anything \> 2016R3, because apparently Direct2D does not support dynamic font activation.

This thread is old now. There have been other threads about the same topic where that particular issue was discussed. So far no workaround has been found AFAIK.

---

<div class="post-metadata">

**Author:** ![Antonio\_Rinaldi](https://forum.xojo.com/user_avatar/forum.xojo.com/antonio_rinaldi/32/331_2.png) [@Antonio\_Rinaldi](https://forum.xojo.com/u/Antonio_Rinaldi)\
**Post date:** [May 30, 2017, 4:41pm UTC](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824/27 "2017-05-30T16:41:07Z")

</div>

Right but at least now I know how to add them (for now) on Linux

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [May 30, 2017, 6:19pm UTC](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824/28 "2017-05-30T18:19:28Z")

</div>

> [@333327:@Antonio Rinaldi](#):
>
> Right but at least now I know how to add them (for now) on Linux

Indeed 🙂

---

<div class="post-metadata">

**Author:** ![Jürg\_Otter](https://forum.xojo.com/user_avatar/forum.xojo.com/j%C3%BCrg_otter/32/584_2.png) [@Jürg\_Otter](https://forum.xojo.com/u/J%C3%BCrg_Otter)\
**Post date:** [March 28, 2020, 9:42am UTC](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824/29 "2020-03-28T09:42:44Z")

</div>

> [@333297:@Michel Bujardet](#):
>
> does not work under Windows in anything \> 2016R3

Right. The first Direct2D Xojo Versions in 2017 have broken this.  
Works again in 2018+ Xojo Versions.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:35pm UTC](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824/30 "2020-10-29T17:35:45Z")

</div>



[Previous page](https://forum.xojo.com/t/using-fonts-in-app-without-installing-them/21824.md?page=1)
