Most ergonomic way to present text info on iPhone - iphone

What is the best and most ergonomic way to present info on an iPhone?
I currently have a simple GPS-type app that on one view shows the map and on another all the movement data such as speed, altitude, heading and co-ords. I show these few variables (which are constantly changing) with white font on a black background.
The font I currently use: Helvetica, 24.0
This app will actually be used in driving conditions so it has to be good on the eye and readable in many conditions, e.g. at night. Obviously it will be readable, but what is the most ergonomic option, looking at these aspects:
Font Family (AKA Type, e.g. Helvetica)
Font Color
Font Size
Background Color

I've found that white on black works very well on these displays. For one thing, it makes the whole phone one solid black area (if the phone is black), and the text stands out at a glance. I would consider using Helvetica Bold rather than Helvetica. But I think Helvetica is a good choice because it's the standard on the iPhone, and people will expect it. As for font size, with a GPS I'd much prefer text to err on the side of being large than being small. People will forgive a little cramping in the map display if you give the text a size boost.

Related

the best way to handle dark mode logos in html emails

am designing a html email template that supports dark mode for all email clients but am facing a problem with the logo.
The logo is a black .png image and the default/light background is white, so in dark mode it becomes black over black. Adding an outline to the logo is not an option, using 2 images with classes and controlling which one to display using media queries won't work for Gmail ios and some outlook versions, so am left with three choices but am not sure wither they are applicable and supported by all famous clients:
forcing the white background by using a gradient as the background-color value instead of a hex value
using this method that I found online for webpages:
<picture>
<source srcset="dark-mode.png" media="(prefers-color-scheme: dark)">
<img src="light-image.png">
</picture>
using an SVG instead of the image so the fill color will change.
So, are any of them is applicable and supported?
Also, more suggestions/ideas/options are appreciated.
Support for SVG is quite limited so unfortunately that's not an option: https://www.caniemail.com/features/image-svg/
#media prefers-color-scheme: dark is not supported on Gmail/some Outlooks, so that's not going to work. https://www.caniemail.com/features/css-at-media-prefers-color-scheme/
Using a gradient to force unchanging background is not ideal (we should be supporting customer's preferences), and also not 100% cross-compatible. (background-image: linear-gradient(#ffffff,#ffffff);)
If a 1px white stroke is no good for you, you could try a soft glow like Litmus do.
Alternatively, sometimes we just end up putting a single-colour background in the image itself (i.e. getting rid of the transparency), perhaps with rounded corners (a tiny bit of transparency on the corners). Works best for icons, but might be your only option.

Unity: text is clear in editor but blurry in game

I've read that Unity has problems rendering clear text and I've tried out several different fixes: setting a large font size on the imported font and changing the character setting to unicode, making the text size large and then scaling it down, setting filter mode to point when it comes to pixel fonts... All these methods seem to work from the editor (as in, the text appears crisp), but in the game the text is still blurry:
vs.
(The screenshot is using free aspect - the text looks better, but still somewhat blurry, when the game view resolution matches the reference resolution.)
Currently, the imported font (not pixel) is set to a size of 180; rendering to smooth; character to unicode. The text isn't scaled right now and is at a size of 50. The canvas is set to scale with screen size, and the reference resolution is 2560x1440 (a Samsung S7). It should also be noted that at a different resolution, the box around the text (which is an image) also gets blurry, which makes me think it's a problem with the canvas scaling.
What am I missing?
Turns out all I had to do was uncheck Low Resolution Aspect Ratios in the game view... The text is still slightly blurry, but likely that's typical of Unity. To counter that, I just decided to use a pixel font (using the fix explained in this video).
I use scaling down as a workaround.
For me, it was using Unity-Remote. After building the app directly I didn't see the blur anymore.
I had the same problem, the best solution to the blurry text problem in Unity is as follows:
Select the text item from the scene.
Go to Font and see where your font is located in your project folder
Go to your font in your project
Change the font size from 16 to 100-300
change "Character" to "Unicode"
Press Apply

How, in iOS, can I get the width of a string as rendered in a particular font and point size?

I would like to draw cards on a screen that have a small amount of text when they're laid out, more text when they're zoomed in, and ideally animate from one setting to the other like jQuery(...).show('slow');. The beginning state is slightly rotated via an affine transformation; I would like it to rotate and expand to the zoomed-in view.
I have seen the documentation at https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/CoreText_Programming/Operations/Operations.html#//apple_ref/doc/uid/TP40005533-CH4-SW1 , but I want something lower level. I want, in responsive programming fashion, to zoom in and progressively reveal more information according to a triage; so an ID number might come at top when it is zoomed out, then "JS" below it on its own line, expanding to "J Smith" if / when the card is wide enough, and "Jane Smith" if things are zoomed in. Rather than fitting more cards for iPads vs. iPhones, about the same number of cards would fit on one display in either circumstance, but the iPad display would display bigger cards that would include more information when not zoomed in.
Is there any function that can accept a string, a font identifier, and a font size and return how many pixels wide the string is? I know it's usually an error to micromanage what is already low-level in Core Text Programming, but I want a carefully chosen responsive design that is optimized for iPhone small, iPad small, zoomed in, and everything in between that would occur, with progressive disclosure and a triage of information.
Yes. For pre-iOS7 (deprecated in iOS7), see NSStrings method (and its other variants)
- (CGSize)sizeWithFont:(UIFont *)font
For iOS7 (and + probably)
- (CGSize)sizeWithAttributes:(NSDictionary *)attrs
Example code:
CGSize drawnSize = [myString sizeWithFont:myFont];

Why is my small font too blurry on an iPhone?

I am porting a game from the iPad to iPhone (using XCode cocos+box). I use a custom font (*.ttf) which is nice when drawn with a big font size, but if I use a small font size, the text gets too blurry.
If I do not scale font size itself but scale the font's parent, the text becomes too sharp-cut and memory consuming. Since I'm porting a game, I need font to be a bit blurry, but not too much so that it is still readable.
There is also another problem with the blurriness: not all text looks nice. I create a "Start game" label and it looks just fine but when I create a "Settings" label just the same way it looks more blurry.
Is it because of the *.ttf file or is it me doing something wrong? If it is the font, how can I fix it?
Text and images look blurry if they are drawn at half pixel boundaries, can you provide us with the source code that is responsible for drawing the text into the screen?

UIFont and Diacriticals

I'm writing a iPhone app that needs to render i18n text that includes diacriticals (tildes, accents, etc.). Apple provides the UIFont class which can be used to get a given typeface/font-size combination's leading, ascent, descent, etc.
The problem is that this information does not accurately reflect diacriticals. Specifically, diacriticals on capital letters often exceed the lineHeight (the UIFont property formerly known as leading).
The same problem exists throughout the frameworks, ie. NSString:sizeWithFont has the same issue.
I need to know the true bounding box for text as I am using OpenGL which does not have text drawing support and therefore requires rendering text to a texture.
Currently, I'm using a hack to get around this issue. Is there a better way?
It's not possible with NSString, since it just returns a size. You can try CoreText which seems to support returning bounding boxes, but that's a bit overkill.
It's a difficult problem when Unicode supports things like è̀̀̀ (see also: zalgo); things can render above the top of a line so you can't just draw the characters. Some text-drawing APIs make you specify the baseline and give you the bounding box so you can get both ascenders and descenders, but UIKit doesn't do this.
Then, you have crazy cursive fonts with the occasional huge ascender. It's unclear how to handle these either.
The lazy way is to render to a texture with margins at the top and bottom (0.5 lines? 1 line?) and not care too much about the extra overhead of some transparent pixels.
I haven't looked at CoreText much, but it doesn't look particularly promising.