> On 29 Nov 2016, at 00:40, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> On Nov 28, 2016, at 07:01 , Gerriet M. Denkmann <gerri...@icloud.com> wrote:
>> 
>> But in my case I have “21:37:44” where ““21:37” is bold and “:44” is thin.
> 
> a. Are you using an attributed string whose text is “21:37:44”, or two 
> unattributed strings?

One attributed string, where the first 5 chars have NSFontAttributeName = 
boldFont and the last 3 have
NSFontAttributeName = thinFont.

> b. You have a — I don’t know exactly what to call it — “logical” or 
> “consistency” problem inherent in this situation, because it’s not obvious 
> which font the second “:” should be in. I’m not suggesting you’re incapable 
> of making a decision, but that your actual problem is a consequence of this 
> underlying ambiguity. What would you do if the “:” glyphs were radically 
> different in the two fonts?

UIFont *boldFont = [ UIFont systemFontOfSize: pointSize  weight: 
UIFontWeightLight ];
UIFont *thinFont = [ UIFont systemFontOfSize: pointSize  weight: 
UIFontWeightUltraLight ];

I just assume that the glyphs, coming form the same family, are somewhat 
consistent.

> c. Where does the colon character come from in the first place? Specifically, 
> you’re using a formatted time string, which could be expected to come from 
> (say) a DateFormatter. How do you know there are going to be any colons at 
> all, let alone two of them?

They indeed come from an NSDateFormatter:
timeFormatter = [ [ NSDateFormatter alloc ] init];
timeFormatter.dateFormat = @"HH:mm:ss";                                  

> Given that you work so much with non-Latin scripts, I find it surprising that 
> you would make assumptions about how a time is represented. (Again, of 
> course, you may have decided this is the correct approach for your scenario, 
> but it strikes me as worth commenting on.)
> 
> What I’m suggesting is that perhaps you should treat this as something like a 
> code smell, and re-evaluate whether changing fonts in the middle of the time 
> string is a good idea.

The effect I am after is: hours and minutes should be emphasized, the seconds 
should not.
Maybe I could use the same font with different colours: black versus light gray 
or something like this.

But right now I am still trying to implement Alistairs suggestion.


Kind regards,

Gerriet.



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to