<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Firefox on Haseeb Majid</title>
    <link>https://haseebmajid.dev/tags/firefox/</link>
    <description>Recent content in Firefox on Haseeb Majid</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Mon, 20 Jan 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://haseebmajid.dev/tags/firefox/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>How to Fix Firefox Rendering Emoji Font (NixOS)</title>
      <link>https://haseebmajid.dev/posts/2025-01-20-how-to-fix-firefox-rendering-emoji-font-black-bold-numbers-issue/</link>
      <pubDate>Mon, 20 Jan 2025 00:00:00 +0000</pubDate>
      
      <guid>https://haseebmajid.dev/posts/2025-01-20-how-to-fix-firefox-rendering-emoji-font-black-bold-numbers-issue/</guid>
      <description>&lt;p&gt;I was some issues with the ways some fonts were rendering in Nix/NixOS machines. It seemed to specifically effect
a few apps, mainly Firefox and only certain webpages. Sometimes numbers would render like below:&lt;/p&gt;
&lt;p&gt;&lt;img
        loading=&#34;lazy&#34;
        src=&#34;https://haseebmajid.dev/posts/2025-01-20-how-to-fix-firefox-rendering-emoji-font-black-bold-numbers-issue/images/bad.png&#34;
        type=&#34;&#34;
        alt=&#34;Bad Rendering&#34;
        
      /&gt;&lt;/p&gt;
&lt;h2 id=&#34;debugging-steps&#34;&gt;Debugging Steps&lt;/h2&gt;
&lt;p&gt;This occurred off and on over the course of a few weeks. My font setup was primarily done using
&lt;a href=&#34;https://github.com/danth/stylix&#34;&gt;stylix&lt;/a&gt; and a bit of NixOS option config.&lt;/p&gt;
&lt;p&gt;I noticed this only seemed to happen when the CSS on the page include a font-family like so &amp;ldquo;monospace&amp;rdquo; i.e.
the monospace font in quotes. But without quotes, the font would render fine.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I was some issues with the ways some fonts were rendering in Nix/NixOS machines. It seemed to specifically effect
a few apps, mainly Firefox and only certain webpages. Sometimes numbers would render like below:</p>
<p><img
        loading="lazy"
        src="/posts/2025-01-20-how-to-fix-firefox-rendering-emoji-font-black-bold-numbers-issue/images/bad.png"
        type=""
        alt="Bad Rendering"
        
      /></p>
<h2 id="debugging-steps">Debugging Steps</h2>
<p>This occurred off and on over the course of a few weeks. My font setup was primarily done using
<a href="https://github.com/danth/stylix">stylix</a> and a bit of NixOS option config.</p>
<p>I noticed this only seemed to happen when the CSS on the page include a font-family like so &ldquo;monospace&rdquo; i.e.
the monospace font in quotes. But without quotes, the font would render fine.</p>
<p>I made a few posts to ask for help, as I was confused, why this was happening, and found a similar issue,
you can find here: <a href="https://old.reddit.com/r/NixOS/comments/1fha5hl/firefox_font_problem/">https://old.reddit.com/r/NixOS/comments/1fha5hl/firefox_font_problem/</a>.</p>
<p>Anyway, I didn&rsquo;t get any reply, so I decided to use fc-match to see what font my system was returning.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">blog on  2025-01-20-how-to-fix-firefox-rendering-emoji-font-black-bold-numbers-issue <span class="o">[</span><span class="nv">$?</span><span class="o">]</span> via 🐹 v1.22.10 via ❄  impure <span class="o">(</span>nix-shell-env<span class="o">)</span> took 19s
</span></span><span class="line"><span class="cl">❯ fc-match monospace
</span></span><span class="line"><span class="cl">MonoLisa-Regular.ttf: <span class="s2">&#34;MonoLisa&#34;</span> <span class="s2">&#34;Regular&#34;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">blog on  2025-01-20-how-to-fix-firefox-rendering-emoji-font-black-bold-numbers-issue <span class="o">[</span><span class="nv">$?</span><span class="o">]</span> via 🐹 v1.22.10 via ❄  impure <span class="o">(</span>nix-shell-env<span class="o">)</span>
</span></span><span class="line"><span class="cl">❯ fc-match <span class="s1">&#39;&#34;monospace&#34;&#39;</span>
</span></span><span class="line"><span class="cl">NotoSans<span class="o">[</span>wdth,wght<span class="o">]</span>.ttf: <span class="s2">&#34;Noto Sans&#34;</span> <span class="s2">&#34;Regular&#34;</span>
</span></span></code></pre></div><p>I thought I&rsquo;d found the smoking gun, ohh it was trying to use the San font to render it. I asked someone to share their
working config from an Ubuntu machine and theirs also seemed to be similar to mine.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">╰─ fc-match <span class="s2">&#34;monospace&#34;</span>
</span></span><span class="line"><span class="cl">DejaVuSansMono.ttf: <span class="s2">&#34;DejaVu Sans Mono&#34;</span> <span class="s2">&#34;Book&#34;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">╰─ fc-match <span class="s1">&#39;&#34;monospace&#34;&#39;</span>
</span></span><span class="line"><span class="cl">DejaVuSans.ttf: <span class="s2">&#34;DejaVu Sans&#34;</span> <span class="s2">&#34;Book&#34;</span>
</span></span></code></pre></div><p>Then whilst looking up stuff specific to how Firefox renders fonts, I realised in the DevTools there is a page for
fonts, it&rsquo;s just a bit hidden. I mean, it makes sense, of course there is.</p>
<p><img
        loading="lazy"
        src="/posts/2025-01-20-how-to-fix-firefox-rendering-emoji-font-black-bold-numbers-issue/images/fonts.png"
        type=""
        alt="Font Panel Firefox"
        
      /></p>
<p>So looking at this I realised it wasn&rsquo;t bold text it was rendering, but it was falling back and rendering the numbers
as emojis.</p>
<p>I then had a closer look at my font config in Nix and realised it wasn&rsquo;t doing what I thought it was doing.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-xml" data-lang="xml"><span class="line"><span class="cl"><span class="cp">&lt;?xml version=&#34;1.0&#34;?&gt;</span>
</span></span><span class="line"><span class="cl"><span class="cp">&lt;!DOCTYPE fontconfig SYSTEM &#34;fonts.dtd&#34;&gt;</span>
</span></span><span class="line"><span class="cl"><span class="nt">&lt;fontconfig&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="nt">&lt;alias</span> <span class="na">binding=</span><span class="s">&#34;weak&#34;</span><span class="nt">&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;family&gt;</span>monospace<span class="nt">&lt;/family&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;prefer&gt;</span>
</span></span><span class="line"><span class="cl">            <span class="nt">&lt;family&gt;</span>emoji<span class="nt">&lt;/family&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;/prefer&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="nt">&lt;/alias&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="nt">&lt;alias</span> <span class="na">binding=</span><span class="s">&#34;weak&#34;</span><span class="nt">&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;family&gt;</span>sans-serif<span class="nt">&lt;/family&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;prefer&gt;</span>
</span></span><span class="line"><span class="cl">            <span class="nt">&lt;family&gt;</span>emoji<span class="nt">&lt;/family&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;/prefer&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="nt">&lt;/alias&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="nt">&lt;alias</span> <span class="na">binding=</span><span class="s">&#34;weak&#34;</span><span class="nt">&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;family&gt;</span>serif<span class="nt">&lt;/family&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;prefer&gt;</span>
</span></span><span class="line"><span class="cl">            <span class="nt">&lt;family&gt;</span>emoji<span class="nt">&lt;/family&gt;</span>
</span></span><span class="line"><span class="cl">        <span class="nt">&lt;/prefer&gt;</span>
</span></span><span class="line"><span class="cl">    <span class="nt">&lt;/alias&gt;</span>
</span></span><span class="line"><span class="cl"><span class="nt">&lt;/fontconfig&gt;</span>
</span></span></code></pre></div><p>What I had done by copying and pasting some config I didn&rsquo;t fully understand (tut tut tut) is if the character was
available in the emoji font use that instead, i.e. the numbers or certain symbols like TM.
So after deleting that config and reloading Firefox, it was rendering properly as expected.</p>
<p>That&rsquo;s it! As expected, remember, to make sure you understand what your code is doing. I thought it was allowing emojis
to be rendered with the monospace font, not replacing it or preferring it.</p>
<p>Relevant commit resolving the above issue: <a href="https://gitlab.com/hmajid2301/nixicle/-/commit/3168db8df339d79e838c98f8675eb21a23452d4e">https://gitlab.com/hmajid2301/nixicle/-/commit/3168db8df339d79e838c98f8675eb21a23452d4e</a></p>
]]></content:encoded>
    </item>
    
    <item>
      <title>TIL: How to Fix Firefox Rendering Bug in Hyprland</title>
      <link>https://haseebmajid.dev/posts/2024-02-15-til-how-to-fix-firefox-rendering-bug-in-hyprland/</link>
      <pubDate>Thu, 15 Feb 2024 00:00:00 +0000</pubDate>
      
      <guid>https://haseebmajid.dev/posts/2024-02-15-til-how-to-fix-firefox-rendering-bug-in-hyprland/</guid>
      <description>&lt;p&gt;&lt;strong&gt;TIL: How to Fix Firefox Rendering Bug in Hyprland&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Recently, I had an issue with my Ubuntu laptop running Hyprland, when running Firefox it had this ugly border around
it. Which looked something like this:&lt;/p&gt;
&lt;p&gt;&lt;img
        loading=&#34;lazy&#34;
        src=&#34;https://haseebmajid.dev/posts/2024-02-15-til-how-to-fix-firefox-rendering-bug-in-hyprland/images/firefox.png&#34;
        type=&#34;&#34;
        alt=&#34;Firefox&#34;
        
      /&gt;&lt;/p&gt;
&lt;p&gt;You can see a weird border around the browser, and if you try to view some of the context menus, they appear small and difficult to read.&lt;/p&gt;
&lt;h2 id=&#34;fix&#34;&gt;Fix&lt;/h2&gt;
&lt;p&gt;As per this &lt;a href=&#34;https://old.reddit.com/r/hyprland/comments/18o8m8q/firefox_croppingbad_rendering/&#34;&gt;Reddit thread&lt;/a&gt; &lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;.
There are two fixes, one upgrade to version 0.33 which I could not easily do with Ubuntu. So I used the other fix,&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><strong>TIL: How to Fix Firefox Rendering Bug in Hyprland</strong></p>
<p>Recently, I had an issue with my Ubuntu laptop running Hyprland, when running Firefox it had this ugly border around
it. Which looked something like this:</p>
<p><img
        loading="lazy"
        src="/posts/2024-02-15-til-how-to-fix-firefox-rendering-bug-in-hyprland/images/firefox.png"
        type=""
        alt="Firefox"
        
      /></p>
<p>You can see a weird border around the browser, and if you try to view some of the context menus, they appear small and difficult to read.</p>
<h2 id="fix">Fix</h2>
<p>As per this <a href="https://old.reddit.com/r/hyprland/comments/18o8m8q/firefox_croppingbad_rendering/">Reddit thread</a> <sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup>.
There are two fixes, one upgrade to version 0.33 which I could not easily do with Ubuntu. So I used the other fix,</p>
<ul>
<li>Right click on title bar</li>
<li>Select <code>Customize Toolbar..</code></li>
<li>Then check <code>Title Bar</code>
<ul>
<li>You may have to full-screen the app to make it easier to select the title bar</li>
</ul>
</li>
</ul>
<p><img
        loading="lazy"
        src="/posts/2024-02-15-til-how-to-fix-firefox-rendering-bug-in-hyprland/images/title.png"
        type=""
        alt="Title Bar"
        
      /></p>
<h3 id="hyprland-version">Hyprland Version</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">hyprctl version
</span></span><span class="line"><span class="cl">Hyprland, built from branch HEAD at commit 5b8cfdf2efc44106b61e60c642fd964823fd89f3  <span class="o">(</span>props: bump ver to v0.31.0<span class="o">)</span>.
</span></span><span class="line"><span class="cl">Tag: v0.31.0
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">flags: <span class="o">(</span><span class="k">if</span> any<span class="o">)</span>
</span></span><span class="line"><span class="cl">debug
</span></span></code></pre></div><div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p>Reddit Post with Fix: <a href="https://old.reddit.com/r/hyprland/comments/18o8m8q/firefox_croppingbad_rendering/">https://old.reddit.com/r/hyprland/comments/18o8m8q/firefox_croppingbad_rendering/</a>&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>
]]></content:encoded>
    </item>
    
    <item>
      <title>How to Remote Debug your SvelteKit on an Android Device in Firefox</title>
      <link>https://haseebmajid.dev/posts/2022-12-30-how-to-remote-debug-your-sveltekit-on-an-android-device-in-firefox/</link>
      <pubDate>Fri, 30 Dec 2022 00:00:00 +0000</pubDate>
      
      <guid>https://haseebmajid.dev/posts/2022-12-30-how-to-remote-debug-your-sveltekit-on-an-android-device-in-firefox/</guid>
      <description>&lt;p&gt;In this post, we will go over how you can test your SvelteKit app on your Android device in Firefox.
If you&amp;rsquo;re like me you are building an app that you want users to use on both normal PCs (laptops, Desktop) and
their smartphones.&lt;/p&gt;
&lt;p&gt;But the question arises how can we debug our app on a smartphone?
One way to achieve this is to use Firefox and remote debugging, you will need to connect your
smartphone via USB to your device running the SvelteKit app i.e. your Laptop.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>In this post, we will go over how you can test your SvelteKit app on your Android device in Firefox.
If you&rsquo;re like me you are building an app that you want users to use on both normal PCs (laptops, Desktop) and
their smartphones.</p>
<p>But the question arises how can we debug our app on a smartphone?
One way to achieve this is to use Firefox and remote debugging, you will need to connect your
smartphone via USB to your device running the SvelteKit app i.e. your Laptop.</p>
<h2 id="smartphone">SmartPhone</h2>
<p>On your phone make sure you have developer mode on and have switched on USB debugging <sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup>.
Open up Firefox, then click on the 3 dots to open up the context menu go to <code>Settings</code>,
scroll down and check <code>Remote debugging via USB</code> to &ldquo;on&rdquo;.</p>
<p><img
        loading="lazy"
        src="/posts/2022-12-30-how-to-remote-debug-your-sveltekit-on-an-android-device-in-firefox/images/firefox_usb_debugging.jpeg"
        type=""
        alt="Firefox USB Debugging"
        
      /></p>
<p>Next, connect your smartphone to your PC via USB.</p>
<h2 id="pc">PC</h2>
<p>On your PC start up your SvelteKit application for example <code>npm run dev -- --host --port 5173 --open</code>.
Where <code>dev</code> is <code>vite dev</code> in my <code>package.json</code>. This will start the app but <code>--host</code> will mean it is accessible
to devices on the same private network:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">&gt; bookmarkey-gui@0.0.1 dev
</span></span><span class="line"><span class="cl">&gt; vite dev --host --port <span class="m">5173</span> --open
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  VITE v4.0.1  ready in <span class="m">701</span> ms
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  ➜  Local:   http://localhost:5173/
</span></span><span class="line"><span class="cl">  ➜  Network: http://192.168.0.26:5173/
</span></span><span class="line"><span class="cl">  ➜  Network: http://10.121.2.243:5173/
</span></span><span class="line"><span class="cl">  ➜  Network: http://172.24.0.1:5173/
</span></span><span class="line"><span class="cl">  ➜  press h to show <span class="nb">help</span>
</span></span></code></pre></div><p>This means we can connect to our PC on <code>http://192.168.0.26:5173/</code> from our smartphone and access the SvelteKit site.
You may want to set up your firewall such that only your smartphone can connect to your PC. In my case, since I am only
developing at home I have allowed all traffic on port 5173.</p>
<p><img
        loading="lazy"
        src="/posts/2022-12-30-how-to-remote-debug-your-sveltekit-on-an-android-device-in-firefox/images/ufw_rules.png"
        type=""
        alt="Firewall Rules"
        
      /></p>
<details
  class="notice warning"
  open="true"
>
    <summary class="notice-title">Firewall</summary>
  
  Make sure you know what you are doing when playing around with your firewall rules!
You don&rsquo;t want to allow more access than is necessary. Especially if you working in say
a coffee shop on public WIFI.
</details>

<h3 id="firefox">Firefox</h3>
<p></p>
<p>Now on your PC still:</p>
<ul>
<li>Open Firefox</li>
<li>Go to <code>about:debugging</code></li>
<li>You should see your device under <code>USB enabled</code>.</li>
<li>Select connect</li>
<li>Click on your phone</li>
<li>Then select your SvelteKit app to inspect</li>
</ul>
<p>
<img
        loading="lazy"
        src="/posts/2022-12-30-how-to-remote-debug-your-sveltekit-on-an-android-device-in-firefox/images/firefox_inspect.png"
        type=""
        alt="Firefox Inspect"
        
      />
<img
        loading="lazy"
        src="/posts/2022-12-30-how-to-remote-debug-your-sveltekit-on-an-android-device-in-firefox/images/firefox_console.png"
        type=""
        alt="Firefox Console"
        
      /></p>
<details
  class="notice warning"
  open="true"
>
    <summary class="notice-title">Cannot See Smartphone</summary>
  
  If you don&rsquo;t see your device it may be because your USB preferences are set to only charge your device.
On my phone, I have to change it to <code>File Transfer/Android Auto</code>. Then Firefox can see the phone.
</details>

<p></p>
<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p>How to setup USB debugging, <a href="https://www.youtube.com/watch?v=nYoH5B2GXXY">https://www.youtube.com/watch?v=nYoH5B2GXXY</a>&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
