# Bitmap font scaling on Html5 (SOLVED)

**URL:** <https://forum.defold.com/t/bitmap-font-scaling-on-html5-solved/64779>\
**Category:** Questions\
**Created:** [April 1, 2020, 6:01pm UTC](https://forum.defold.com/t/bitmap-font-scaling-on-html5-solved/64779 "2020-04-01T18:01:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gianmichele](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/gianmichele/32/24028_2.png) [@gianmichele](https://forum.defold.com/u/gianmichele)\
**Post date:** [April 1, 2020, 6:01pm UTC](https://forum.defold.com/t/bitmap-font-scaling-on-html5-solved/64779/1 "2020-04-01T18:01:30Z")

</div>

Hi there,

I have a bitmap font that I’m scaling down to 0.7 on all axis. This works just fine on desktop (haven’t tried mobile yet), but for some reason the same on web looks jagged. Any idea?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 1, 2020, 9:22pm UTC](https://forum.defold.com/t/bitmap-font-scaling-on-html5-solved/64779/2 "2020-04-01T21:22:09Z")

</div>

No, not really. Can you share a minimal project please?

---

<div class="post-metadata">

**Author:** ![gianmichele](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/gianmichele/32/24028_2.png) [@gianmichele](https://forum.defold.com/u/gianmichele)\
**Post date:** [April 1, 2020, 9:59pm UTC](https://forum.defold.com/t/bitmap-font-scaling-on-html5-solved/64779/3 "2020-04-01T21:59:52Z")

</div>

Yes sure!

If you compare native build (osx in my case) and web build, you’ll see the web build has jagged font scaling. It is especially visible in the W character.

Also for some reason the colors are different, with web being less saturated.

[project.zip](https://defold-forum-bucket.nbg1.your-objectstorage.com/original/3X/e/9/e988be4ea074ff3d6c69454f3f5ba0b136dab6b7.zip) (49.1 KB)

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 2, 2020, 8:47am UTC](https://forum.defold.com/t/bitmap-font-scaling-on-html5-solved/64779/4 "2020-04-02T08:47:22Z")

</div>

> [@gianmichele](#):
>
> If you compare native build (osx in my case) and web build, you’ll see the web build has jagged font scaling. It is especially visible in the W character.

The project you sent me has HTML5 Scale Mode set to Downscale Fit. This means that the canvas will be scaled to ensure that it’s always fully visible in the window. I think that is what’s causing that extra jaggedness.

---

<div class="post-metadata">

**Author:** ![gianmichele](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/gianmichele/32/24028_2.png) [@gianmichele](https://forum.defold.com/u/gianmichele)\
**Post date:** [April 2, 2020, 9:19am UTC](https://forum.defold.com/t/bitmap-font-scaling-on-html5-solved/64779/5 "2020-04-02T09:19:28Z")

</div>

I’ve tried with just Fit and no scale option. Even the no scale option has a rougher result compared to desktop build with different sizes and aspect ratios.  
Is this something to be expected?

---

<div class="post-metadata">

**Author:** ![aglitchman](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/aglitchman/32/19432_2.png) [@aglitchman](https://forum.defold.com/u/aglitchman)\
**Post date:** [April 2, 2020, 9:48am UTC](https://forum.defold.com/t/bitmap-font-scaling-on-html5-solved/64779/6 "2020-04-02T09:48:24Z")

</div>

I guess that Defold doesn’t use mipmaps for bitmap font so it looks rough when downscaled.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [April 2, 2020, 12:01pm UTC](https://forum.defold.com/t/bitmap-font-scaling-on-html5-solved/64779/7 "2020-04-02T12:01:31Z")

</div>

> [@gianmichele](#):
>
> I’ve tried with just Fit and no scale option. Even the no scale option has a rougher result compared to desktop build with different sizes and aspect ratios.

Hmm, I didn’t really notice any difference when using No Scale. Maybe I didn’t look close enough. @AGulev what is your experience with bitmap fonts on HTML5?

Btw, did you try using a distance field font instead @gianmichele?

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [April 2, 2020, 12:17pm UTC](https://forum.defold.com/t/bitmap-font-scaling-on-html5-solved/64779/8 "2020-04-02T12:17:12Z")

</div>

I don’t remember any specific issues. Usually, it just works fine.  
Maybe it’s something similar to [this issue](https://forum.defold.com/t/blurred-textures-in-html5-def-2396-solved/24896/3) and [High DPI](https://defold.com/manuals/project-settings/#high-dpi) should be enabled?

---

<div class="post-metadata">

**Author:** ![gianmichele](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/gianmichele/32/24028_2.png) [@gianmichele](https://forum.defold.com/u/gianmichele)\
**Post date:** [April 2, 2020, 1:04pm UTC](https://forum.defold.com/t/bitmap-font-scaling-on-html5-solved/64779/9 "2020-04-02T13:04:40Z")

</div>

> [@AGulev](#):
>
> Maybe it’s something similar to [this issue](https://forum.defold.com/t/blurred-textures-in-html5-def-2396-solved/24896/3) and [High DPI](https://defold.com/manuals/project-settings/#high-dpi) should be enabled?

Bingo! That fixed it thanks a lot everyone
