<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lior Azi on Medium]]></title>
        <description><![CDATA[Stories by Lior Azi on Medium]]></description>
        <link>https://medium.com/@azi?source=rss-543f14cb87c5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BgcbJUmLszNUgxzuESQJUQ.png</url>
            <title>Stories by Lior Azi on Medium</title>
            <link>https://medium.com/@azi?source=rss-543f14cb87c5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 20:09:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@azi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Proportional vs. Monospaced Numbers: When to use which one in order to avoid “Wiggling Labels”]]></title>
            <link>https://azi.medium.com/proportional-vs-monospaced-numbers-when-to-use-which-one-in-order-to-avoid-wiggling-labels-e31b1c83e4d0?source=rss-543f14cb87c5------2</link>
            <guid isPermaLink="false">https://medium.com/p/e31b1c83e4d0</guid>
            <category><![CDATA[typography]]></category>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[user-interface]]></category>
            <category><![CDATA[fonts]]></category>
            <dc:creator><![CDATA[Lior Azi]]></dc:creator>
            <pubDate>Fri, 09 Feb 2018 23:10:36 GMT</pubDate>
            <atom:updated>2024-11-23T13:16:57.729Z</atom:updated>
            <content:encoded><![CDATA[<h3>Definition</h3><p><strong>Proportional</strong> font is a font where each character occupies only as much width as it needs.<br><strong>Monospaced</strong> font (also called a fixed-pitch, fixed-width, tabular, or non-proportional font) is a font where each character occupies the same amount of space on a horizontal line of text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*Dj_3ASLj0ES7Krp6cXNbZg.png" /><figcaption>proportional font — a proportional width to each character</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*56zqTNr8nC-XIWFtVCeCxQ.png" /><figcaption>monospaced font — each character occupies the same width space</figcaption></figure><h3>The Problem</h3><p>The use of a proportional font in a <strong>dynamic</strong> <strong>label</strong> (with animated digits) causes a horizontal wiggling of the label (as in the second row of the example below) due to the fact the whole label’s width is changing all the time. <br>This wiggling highly hurts the user experience.<br>It causes the user’s eye to lose focus of the number change, due to the rapidly changes of the whole label horizontally, which creates a discomfort that must be avoided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*5Hy8C28ZA4Scy8evCfSZSA.gif" /><figcaption>(1) Monospaced numbers are more appropriate for dynamic labels (with animation)</figcaption></figure><h3>When should you use each one</h3><p>The main consideration of when to use each type of font is whether the text will be displayed in a <strong>dynamic label </strong>or<strong> static label</strong>.</p><h4>Dynamic label</h4><p>With a <strong>dynamic label </strong>we usually mean a label with numbers that will be animating due to a text change, f.e:</p><ul><li>File size label while it is downloaded (see in the example¹ above)</li><li>Time elapsed/remaining in video/music players²</li><li>Call time elapsed</li><li>Stopwatch³</li></ul><p>In these cases we should use monospaced numbers, which will help us avoiding those wiggling labels</p><h4>Static label</h4><p>In a <strong>static</strong> <strong>label</strong>, label with text which is not changed frequently, we’ll prefer to use the proportional font, f.e:</p><ul><li>Date label</li><li>Phone number label</li><li>Email address label</li><li>URL address label</li></ul><p>In these cases we should use proportional numbers.</p><h4>Good Real World Examples 👏🏻</h4><ul><li>iOS Music App</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*BRVlCocGlYuARh4mzmcfbQ.gif" /><figcaption>(2) iOS 11 Music App</figcaption></figure><ul><li>iOS Clock App Stopwatch</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*9qXPwaRdZSnV5hWfC_MhDA.gif" /><figcaption>(3) iOS11 Clock App Stopwatch</figcaption></figure><h4>“Bad” Real World Examples 😔</h4><h4>Web</h4><ul><li>F̶a̶c̶e̶b̶o̶o̶k̶ ̶W̶e̶b̶ ̶V̶i̶d̶e̶o̶ P̶l̶a̶y̶e̶r̶</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*pQQKWw0DJieITXBUlSST0g.gif" /><figcaption>Facebook Video playing on Chrome for MacOS</figcaption></figure><p>(reported a problem to fb)</p><h4>Desktop Apps</h4><ul><li>G̶o̶o̶g̶l̶e̶ ̶C̶h̶r̶o̶m̶e̶ ̶B̶r̶o̶w̶s̶e̶r̶ (Fixed on v65!)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/1*shIUnNvYFg6J7sk_1S3XgA.gif" /><figcaption>Google Chrome Browser for MacOS (v64.0.3282.119)</figcaption></figure><ul><li>A̶p̶p̶l̶e̶ ̶S̶a̶f̶a̶r̶i̶</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*8bSO74P3dcX-IqOh0HQSLA.gif" /><figcaption>Apple Safari Downloads (v11.0)</figcaption></figure><p>(filed a radar — rdar://37368720)</p><ul><li><a href="http://www.spotify.com/">Spotify</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*xz0aJ3-Ou9HPg9XEgqv9ag.gif" /><figcaption>Spotify macOS app Elapsed time in Player (v1.0.75.483)</figcaption></figure><h4>Mobile</h4><ul><li>T̶w̶i̶t̶t̶e̶r̶ ̶i̶O̶S̶ ̶A̶p̶p̶ ̶(̶F̶u̶l̶l̶-̶s̶c̶r̶e̶e̶n̶ ̶v̶i̶d̶e̶o̶ ̶p̶l̶a̶y̶e̶r̶)̶</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*R9K0LCkZlrP_StiyTtgaWw.gif" /><figcaption>Twitter iOS App Full-screen video player</figcaption></figure><ul><li>V̶L̶C̶ ̶P̶l̶a̶y̶e̶r̶ ̶f̶o̶r̶ ̶i̶O̶S̶</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*YY_-FQ6ieQfEFkCzjoUesg.gif" /><figcaption>VLC Player for iOS (v2.9)</figcaption></figure><h4>TV</h4><ul><li>World Cup Qualifiers Basketball TV Graphics 24-Shot Clock</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*sHuINeFRBtfeEJ_houvMdw.gif" /><figcaption>WC Qualifiers TV Graphics 24-Shot Clock (3rd from the left)</figcaption></figure><h3>The Solution</h3><p>As described in the text above, the solution is relatively easy.<br>In the all of the above “bad” examples a proportional font is used in dynamic labels, so the fix is simply to either <strong>enable monospaced digits in your current, or to change to another font supports monospaced digits</strong>.</p><h4>iOS</h4><p><strong>Using Monospaced Digits in iOS<br></strong>Since iOS9 the system font default display setting of numbers was changed from monospaced numbers to proportional numbers. It was probably changed because Apple figured out its the more frequent setting between the two. <br>In cases where a monospaced font is more appropriate the developer will need to opt-in to it:</p><p>If you’re using the system font (“San Francisco”) you can use the following code:</p><pre>myLabel.font = UIFont.monospacedDigitSystemFont(ofSize: 42.0, weight: UIFontWeightMedium)</pre><p>If you’re looking for a more generic solution, you should use the following font extension (Swift 4):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3b143c08497aae70184908efacadcc43/href">https://medium.com/media/3b143c08497aae70184908efacadcc43/href</a></iframe><p>and then just use it with:</p><pre>myLabel.font = myLabel.font.withMonospacedDigitFont</pre><p>Note: The above extension will only work if your font is supporting the <a href="https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html#Type6">monospaced digits feature</a>. If it doesn’t, consider using another font that does, or a monospaced font.(in iOS: “Courier” &amp; “Menlo” are monospaced fonts)</p><h4>SwiftUI</h4><p>Using the <strong>monospacedDigit</strong> font modifier:</p><p>System font -</p><pre>Text(&quot;0123456789&quot;)</pre><pre>   .monospacedDigit()</pre><p>Custom font -</p><pre>Text(&quot;0123456789&quot;)</pre><pre>   .font(.custom(&quot;Custom-Font-Name&quot;, size: 20.0))<br>   .monospacedDigit()</pre><h4>React Native</h4><pre>&lt;Text style={{fontVariant: &#39;tabular-nums&#39;}}&gt;<br>...<br>&lt;/Text&gt;</pre><h4>Web</h4><p>Using CSS:</p><pre>.yourcssclass {<br>  font-variant-numeric: tabular-nums;<br>}</pre><h3>Wrap Up</h3><p>So the next time you’re adding a label with digits, whether it’s for TV, Web or Mobile, pay attention if it is dynamic or static, and set the font to be monospaced or proportional accordingly. That will help you avoid label wiggling, which will improve your app/website’s overall experience.</p><p>Update(11/23/2024): Updated UIKit code gist</p><p>Update(11/4/2021): Facebook Web Video Played is now fixed! 🎉 🎉🎉. <br>VLC Player is now fixed!👏🏻👏🏻👏🏻</p><p>Update(6/25/2019): Added SwiftUI to iOS</p><p>Update(4/18/2019): Twitter Mobile App for iOS has fixed the issue! 🎉 🎉Apple Safari has fixes the issue on v12.0! 🎊🎊🎊</p><p>Update(3/15/2018): Google Chrome just fixed the issue on the latest macOS version — v65.0.3325.162, 👏🏻👏🏻👏🏻</p><p>Update(3/4/2018): Added <em>React Native</em> &amp; <em>Web</em> solutions</p><p>Update(2/21/2018): Added extension solution to <em>iOS</em></p><h4>References:</h4><ul><li><a href="https://developer.apple.com/videos/play/wwdc2015/804/">WWDC 2015 — Session 804 — “Introducing the New System Fonts”</a><br>(relevant part at 25:59)</li><li><a href="https://useyourloaf.com/blog/ios-9-proportional-numbers/">Use Your Loaf Blog — iOS 9 Proportional Numbers</a></li><li><a href="https://github.com/salutis/swift-font-monospaced-digits">Rudolf Adamkovič — Swift Font Monospaced Digits</a></li></ul><p><strong>This story is published in </strong><a href="http://blog.usejournal.com/"><strong>Noteworthy</strong></a><strong>, where 10,000+ readers come every day to learn about the people &amp; ideas shaping the products we love.</strong></p><p><a href="http://blog.usejournal.com/"><strong>Follow our publication</strong></a><strong> to see more product &amp; design stories featured by the </strong><a href="https://usejournal.com/?/utm_source=usejournal.com&amp;utm_medium=blog&amp;utm_campaign=guest_post&amp;utm_content=lior_azi"><strong>Journal</strong></a><strong> team.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e31b1c83e4d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Facebook Audience Network is hurting your iOS device’s battery life]]></title>
            <link>https://azi.medium.com/how-facebook-audience-network-is-hurting-your-ios-devices-battery-life-f6aa5ce35796?source=rss-543f14cb87c5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6aa5ce35796</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[battery]]></category>
            <category><![CDATA[facebook]]></category>
            <dc:creator><![CDATA[Lior Azi]]></dc:creator>
            <pubDate>Wed, 01 Jun 2016 13:25:17 GMT</pubDate>
            <atom:updated>2016-06-03T14:42:40.511Z</atom:updated>
            <content:encoded><![CDATA[<h4>Background:</h4><p>Back in October 2015, Facebook app was accused of high battery usage/drain in their main app, due to background audio usage. ( <a href="http://9to5mac.com/2015/10/17/facebook-app-battery-usage/">link1</a> )</p><p>Battery life is a VERY precious thing for users and many went paranoid about it, so paranoid some of them even uninstalled the Facebook app completely, and used Facebook via Safari which granted them up to 15% of battery life.( <a href="http://www.macrumors.com/2016/02/08/facebook-ios-app-battery-drain-issues/">link2</a> )</p><p>Facebook dug deep into their code finding the drain came from a background audio issue, and a processor issue which were fixed. ( <a href="http://www.macrumors.com/2015/10/22/facebook-ios-app-battery-drain-fix/">link3</a> ) The majority of people thought this will put an end to the whole battery story, but unfortunately there is a new episode…</p><h4>Today:</h4><p>After users have escaped the battery drain of the Facebook App, it seems that now our battery will be hammered by <strong>EVERY</strong> app that integrates the Facebook Audience Network SDK. The <a href="https://www.facebook.com/business/news/audience-network">Facebook Audience Network</a> lets an app developer extend his campaigns beyond Facebook to reach his audiences on mobile apps, mobile websites, Instant Articles, and videos,released first on October 2014.</p><p>It was found that the Facebook Audience Network<em> </em>SDK begins a background task which makes the app alive for 30 seconds more, which means it is using 30 seconds more of CPU time that has impact on the phone battery (method name: <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/#//apple_ref/occ/instm/UIApplication/beginBackgroundTaskWithExpirationHandler:">beginBackgroundTaskWithExpirationHandler</a><em>) </em>which tries to run (if the system allows it) whenever you press the home button in the app that integrated the SDK.</p><p>So every app that will use the Facebook Audience Network SDK will act in the same way, which will gain the percentage of battery use for each, which can have a impact on the overall battery time. In addition there is no place where Facebook makes developers aware of this matter.</p><p>Solution? It’s not currently possible to block the ability of an app to begin a background task. Disabling “Background App Refresh” or “Location Services” would not help you in this matter 😥. Three weeks before WWDC16, we can only hope that Apple will have a solution for that on the iOS10, which will greatly help iOS users.</p><p>-Lior Azi (@liorazi)</p><p>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6aa5ce35796" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>