Re: UILabel is maiming my Character

2015-10-15 Thread Gerriet M. Denkmann

> On 15 Oct 2015, at 00:03, David Duncan  wrote:
> 
> 
>> On Oct 14, 2015, at 4:02 AM, Gerriet M. Denkmann  
>> wrote:
>> 
>> I put into some iOS 9 app (Xcode 7.0)  4 UILabels.
>> All have Clip Subviews = off, font size 96 with a coloured background, text 
>> plain = “ฟี้กุฎุมพี”.
>> 
>> The difference is the font:
>> 
>> System: ok (but is too bold for my taste)
>> Thonburi and Thonburi Light: bottom get cut off 
>> System Light: bottom gets cut off rather much
>> 
>> System also uses Thonburi as font substitution.
>> 
>> With Clip Subviews = on the characters get clipped to the coloured 
>> background, which is even worse.
>> Note: some characters go well beyond the descender line (as specified by the 
>> font) and also above the line height.
>> 
>> How can I get a UILabel which does not maim my characters?
>> (Another question would be: how to get a background which covers all of the 
>> characters. But this is not important to me right now)
>> 
>> These UILabels are ultimately meant to go into UITableViewCells (without 
>> coloured background).
> 
> You will probably need to use an attributed string that specifies a taller 
> line height than normal. This happens automatically when the system language 
> is set to languages such as Thai, but not for other languages, as it would 
> apply to all text strings.

Thanks for this hint.
And thanks a lot to Alex for his very helpful code example!

Moving the baseLine up by about 8 % and increasing the LineHeight by 5 %  
finally (after lots of fiddling) gives me an acceptable UILabel with SystemFont 
Light.

CGFloat baseChangePercent = +8; 
CGFloat lineChangePercent = +5; 

CGFloat baselineOffset = fontSize * baseChangePercent / 100 ;
CGFloat lineHeightMultiple = 1 + lineChangePercent / 100;

NSMutableParagraphStyle *paragraph = [ [ NSMutableParagraphStyle alloc ] init ];
paragraph.lineHeightMultiple = lineHeightMultiple;

attributes =@{  NSBaselineOffsetAttributeName:  @(baselineOffset),
NSFontAttributeName:
font,
NSParagraphStyleAttributeName:  
paragraph,
 };
But of course these values are heavily dependent on the font (and maybe even on 
fontSize).

How to compute these numbers directly (as opposed to trial and error)?


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

Re: App Transport Security has blocked a cleartext HTTP for a local IP

2015-10-15 Thread Alex Zavatone
What happens if you only use this:

NSAllowsArbitraryLoads


??

On Oct 15, 2015, at 3:56 PM, Marek Hrušovský wrote:

> I read on some blogposts that ios9 GM did not support IP addresses for ATS.
> Do not know if this has changed.
> 
> On Thu, Oct 15, 2015 at 9:06 PM, Devarshi Kulshreshtha <
> devarshi.bluec...@gmail.com> wrote:
> 
>> Our webservices are hosted in some local IP, to bypass the App Transport
>> Security I added this as dictionary for NSAppTransportSecurity key in my
>> info.plist file:
>> 
>> 
>> 
>> NSAllowsArbitraryLoads
>> 
>> NSExceptionDomains
>> 
>> localhost
>> 
>> NSExceptionAllowsInsecureHTTPLoads
>> 
>> 
>> 10.32.27.12
>> 
>> NSExceptionAllowsInsecureHTTPLoads
>> 
>> 
>> 
>> 
>> 
>> but for some reasons I am still getting this error message:
>> 
>> App Transport Security has blocked a cleartext HTTP (http://) resource
>> load
>> since it is insecure. Temporary exceptions can be configured via your app's
>> Info.plist file
>> 
>> Any ideas?
>> 
>> --
>> Thanks,
>> 
>> Devarshi
>> ___
>> 
>> 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/xhruso00%40gmail.com
>> 
>> This email sent to xhrus...@gmail.com
> ___
> 
> 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/zav%40mac.com
> 
> This email sent to z...@mac.com


___

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

Re: App Transport Security has blocked a cleartext HTTP for a local IP

2015-10-15 Thread Marek Hrušovský
I read on some blogposts that ios9 GM did not support IP addresses for ATS.
Do not know if this has changed.

On Thu, Oct 15, 2015 at 9:06 PM, Devarshi Kulshreshtha <
devarshi.bluec...@gmail.com> wrote:

> Our webservices are hosted in some local IP, to bypass the App Transport
> Security I added this as dictionary for NSAppTransportSecurity key in my
> info.plist file:
>
>
> 
> NSAllowsArbitraryLoads
> 
> NSExceptionDomains
> 
> localhost
> 
> NSExceptionAllowsInsecureHTTPLoads
> 
> 
> 10.32.27.12
> 
> NSExceptionAllowsInsecureHTTPLoads
> 
> 
> 
> 
>
> but for some reasons I am still getting this error message:
>
> App Transport Security has blocked a cleartext HTTP (http://) resource
> load
> since it is insecure. Temporary exceptions can be configured via your app's
> Info.plist file
>
> Any ideas?
>
> --
> Thanks,
>
> Devarshi
> ___
>
> 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/xhruso00%40gmail.com
>
> This email sent to xhrus...@gmail.com
___

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

Re: App Transport Security has blocked a cleartext HTTP for a local IP

2015-10-15 Thread Jim Adams
They added a check for http vs https. You have to add an entry to the plist to 
allow that kind of access…

> On Oct 15, 2015, at 4:29 PM, Jens Alfke  wrote:
> 
> What’s the exact URL that failed to load?
> 
> —Jens
> ___
> 
> 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/jim.adams%40sas.com
> 
> This email sent to jim.ad...@sas.com


___

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

Re: App Transport Security has blocked a cleartext HTTP for a local IP

2015-10-15 Thread Jens Alfke
What’s the exact URL that failed to load?

—Jens
___

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

Re: UILabel is maiming my Character

2015-10-15 Thread Alex Zavatone
Gerriet, what I noticed at the time of writing those methods was that there was 
no predefined way to create superscripted text for NSAttributedText.

What my premise was to simulate/create superscripted text was to raise the 
baseline a % of the text's font size and reduce the font size used for the 
superscript by a fixed percentage.

What this lead to was declaring preset settings in the form of attribute 
dictionaries for the desired font styles I wished to achieve and then just 
applying those to ranges to create what we used to call style runs.

You'll notice that I started with method1, method2, etc and moved from the 
simplest approach to more structured approaches.

One nice little thing that I didn't know I pasted in there was a context 
sensitive currency formatter for US currency which superscripts the appropriate 
values if the amount is < 1 dollar or >= than 1 dollar.  It might seem trivial, 
but it handles superscripting the cents and the cent sign in cases less than a 
dollar and the $ in cases of one dollar or more.

Honestly, working with the formatting options in NSAttributedText and creating 
these text formatters was as much fun as I'd had coding since ye olde Director 
days.


Gerriet, I hate to tell you, but I forgot how I got the results.  I'll toss you 
the whole project so you can rip it apart and see if it helps you at all.

Cheers.


On Oct 15, 2015, at 2:28 AM, Gerriet M. Denkmann wrote:

> 
>> On 15 Oct 2015, at 00:03, David Duncan  wrote:
>> 
>> 
>>> On Oct 14, 2015, at 4:02 AM, Gerriet M. Denkmann  
>>> wrote:
>>> 
>>> I put into some iOS 9 app (Xcode 7.0)  4 UILabels.
>>> All have Clip Subviews = off, font size 96 with a coloured background, text 
>>> plain = “ฟี้กุฎุมพี”.
>>> 
>>> The difference is the font:
>>> 
>>> System: ok (but is too bold for my taste)
>>> Thonburi and Thonburi Light: bottom get cut off 
>>> System Light: bottom gets cut off rather much
>>> 
>>> System also uses Thonburi as font substitution.
>>> 
>>> With Clip Subviews = on the characters get clipped to the coloured 
>>> background, which is even worse.
>>> Note: some characters go well beyond the descender line (as specified by 
>>> the font) and also above the line height.
>>> 
>>> How can I get a UILabel which does not maim my characters?
>>> (Another question would be: how to get a background which covers all of the 
>>> characters. But this is not important to me right now)
>>> 
>>> These UILabels are ultimately meant to go into UITableViewCells (without 
>>> coloured background).
>> 
>> You will probably need to use an attributed string that specifies a taller 
>> line height than normal. This happens automatically when the system language 
>> is set to languages such as Thai, but not for other languages, as it would 
>> apply to all text strings.
> 
> Thanks for this hint.
> And thanks a lot to Alex for his very helpful code example!
> 
> Moving the baseLine up by about 8 % and increasing the LineHeight by 5 %  
> finally (after lots of fiddling) gives me an acceptable UILabel with 
> SystemFont Light.
> 
> CGFloat baseChangePercent = +8;   
> CGFloat lineChangePercent = +5;   
>   
> CGFloat baselineOffset = fontSize * baseChangePercent / 100 ;
> CGFloat lineHeightMultiple = 1 + lineChangePercent / 100;
> 
> NSMutableParagraphStyle *paragraph = [ [ NSMutableParagraphStyle alloc ] init 
> ];
> paragraph.lineHeightMultiple = lineHeightMultiple;
> 
> attributes =  @{  NSBaselineOffsetAttributeName:  @(baselineOffset),
>   NSFontAttributeName:
> font,
>   NSParagraphStyleAttributeName:  
> paragraph,
>};
> But of course these values are heavily dependent on the font (and maybe even 
> on fontSize).
> 
> How to compute these numbers directly (as opposed to trial and error)?
> 
> 
> 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

App Transport Security has blocked a cleartext HTTP for a local IP

2015-10-15 Thread Devarshi Kulshreshtha
Our webservices are hosted in some local IP, to bypass the App Transport
Security I added this as dictionary for NSAppTransportSecurity key in my
info.plist file:



NSAllowsArbitraryLoads

NSExceptionDomains

localhost

NSExceptionAllowsInsecureHTTPLoads


10.32.27.12

NSExceptionAllowsInsecureHTTPLoads





but for some reasons I am still getting this error message:

App Transport Security has blocked a cleartext HTTP (http://) resource load
since it is insecure. Temporary exceptions can be configured via your app's
Info.plist file

Any ideas?

-- 
Thanks,

Devarshi
___

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