Re: -glyphWithName:

2014-08-23 Thread Kyle Sluder
On Fri, Aug 22, 2014, at 10:57 PM, Raglan T. Tiger wrote:
 
 
 NSFont *font = [NSFont systemFontOfSize:288];
 NSGlyph glyph = [font glyphWithName:glyphName];
 
 
 if glyphName is @“A” for example I get A
 
 if the glyphName is @“” I get nothing
 
 if the glyphName is @“ampersand” I get 
 
 I cannot find a list that tells me the names of these non-alphabet
 characters.
 
 Where should I look for this list and will the names be the same
 regardless of font?

You should probably ask this question on the coretext-dev to get an
answer from an authoritative source. But I would wager that the valid
glyph names come from this table:
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6post.html

Obviously 258 names can't cover modern fonts that can span the dozens of
thousands of Unicode codepoints. The documentation on the 'Zapf` table
implies that font designers can name their glyphs whatever the hell they
want:
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6Zapf.html
(see section The GlyphIdentifier Structure).

So the question I have is: what are you actually trying to do?

--Kyle Sluder

___

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: iOS database within sandbox

2014-08-23 Thread Michelangelo Chasseur
I would recommend taking a look into the newly released Realm 
(http://realm.io). I’ve been using it for the last couple of weeks and I’d bet 
it’s a solid alternative to SQL base databases / ORMs (SQLite). APIs are really 
easy to grasp and queries to the database are human-friendly and powerful. Plus 
it’s really fast and you don’t have to bother about contexts and all the 
hassles you have to go thru when you use CoreData on multiple threads.

Mike  

--  
Michelangelo Chasseur


Il giorno sabato 23 agosto 2014, alle ore 03:57, Luther Baker ha scritto:  

 I'm not sure how helpful this is but rechnically, Core Data is an ORM - an 
 object to relational mapping framework. Also realize that Core Data is most 
 often configured to use SQLite as its backing store. In addition the, Xcode 
 ships with a nice CoreData/ORM editor which often makes Core Data easier and 
 faster to use for the average case.
  
 But, if you have sufficient reason, you are more than welcome to use SQLite 
 directly ... Additionally then, you may also want to consider FMDB, Gus 
 Mueller's thin wrapper around SQLite that makes it much easier to work with 
 in the context of an iOS app.
  
 Finally then, the database need not necessarily reside in the Documents' 
 directory ... save for the fact that different directories are cleared out 
 differently based on a few rules inherent to the platform. So in a sense, 
 yes, you are probably safest dropping the SQLite file there - but it isn't 
 necessarily a requirement.
  
 Hth,
 -Luther
  
  
   On 23-Aug-2014, at 10:24, Carl Hoefs newsli...@autonomy.caltech.edu 
   (mailto:newsli...@autonomy.caltech.edu) wrote:

   I’m writing a Cocoa-based iOS 8 app that needs to store and manage data 
   locally on the device. Is there a relational database available for 
   general purpose use in iOS 8? Is there a limitation to how much space an 
   app can use in its sandbox? I presume a database would necessarily need 
   to reside in Application_Home/Documents/...

   -Carl


   ___

   Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
   (mailto: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 
   (http://lists.apple.com)

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

   This email sent to mhow...@mahoward.com (mailto:mhow...@mahoward.com)
   
   
  ___
   
  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
  (mailto: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 
  (http://lists.apple.com)
   
  Help/Unsubscribe/Update your Subscription:
  https://lists.apple.com/mailman/options/cocoa-dev/lutherbaker%40gmail.com
   
  This email sent to lutherba...@gmail.com (mailto:lutherba...@gmail.com)
  
 ___
  
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
 (mailto: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 
 (http://lists.apple.com)
  
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/chasseurmic%40gmail.com
  
 This email sent to chasseur...@gmail.com (mailto:chasseur...@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

Swift Threads

2014-08-23 Thread Gerriet M. Denkmann
I searched the Swift book for thread and found nothing.

A quicksort algorithm works like:

quicksort(array)
{
partition(array)
quicksort( left side)
quicksort( right side)
}

On Obj-C I just did:

quicksort(array)
{
partition(array)
dispatch_apply( 2, queue, ^void(size_t idx)
{
quicksort( left or right side depending on idx )
}
}

Works fine and is twice as fast.

But how to do this in Swift?
Just doing the same as in Obj-C does not work (nor is it expected, as there is 
no documented thread-safeness of Swift arrays).


One other thing:
Trying to compare Apples to Apples I sorted an array of strings (using 
localizedCompare:) with Swift and Obj-C.
Swift (beta 6) is about 3 times slower (more if there are many identical 
strings in the array).

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: buggy sequence: miniaturize/close/makeKeyAndOrderFront

2014-08-23 Thread Cosmin Apreutesei
 I encountered this same issue.  Making the window a one-shot window 
 (window.oneShot = YES) works around it.

Hi Ken,

Thank you very much, that worked!

I also posted this question on so[1] if you want to answer it there too.

Thanks again,
Cosmin.


[1] http://stackoverflow.com/questions/25450233/
___

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: iOS database within sandbox

2014-08-23 Thread dangerwillrobinsondanger
FMDB is also a very popular and simple Objective-C wrapper to SQLite

You can be up and running with it in minutes. 
And it works on OS X the same so it's portable. 

Sent from my iPhone
___

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: iOS database within sandbox

2014-08-23 Thread Carl Hoefs
Wow, I didn’t realize there were so many options. I’ll be looking into all of 
these (SQLite, CoreData, FMDB, Realm) to see which fits into my project's 
design best (and which appeals to me).

Thanks for all the great suggestions!
-Carl


___

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: iOS database within sandbox

2014-08-23 Thread Gleb Dolgich
There is also YapDatabase https://github.com/yaptv/YapDatabase -- a KV-store 
built atop SQLite.

On 23 Aug 2014, at 16:17, Carl Hoefs newsli...@autonomy.caltech.edu wrote:

 Wow, I didn’t realize there were so many options. I’ll be looking into all of 
 these (SQLite, CoreData, FMDB, Realm) to see which fits into my project's 
 design best (and which appeals to me).
 
 Thanks for all the great suggestions!
 -Carl



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: iOS database within sandbox

2014-08-23 Thread Glenn L. Austin
CoreData is not a database (according to Marcus Zarra -- and he should know).  
Even though it *can* use an SQLite data store (and most people do that), it 
doesn't depend upon SQLite functionality.

SQLite is built-in and available pretty much everywhere, but you need to learn 
a bit of SQL.

On Aug 22, 2014, at 6:01 PM, Jim Geist velocity...@rodentia.net wrote:

 Can you use CoreData?
 
 On Aug 22, 2014, at 5:54 PM, Carl Hoefs newsli...@autonomy.caltech.edu 
 wrote:
 
 I’m writing a Cocoa-based iOS 8 app that needs to store and manage data 
 locally on the device. Is there a relational database available for general 
 purpose use in iOS 8? Is there a limitation to how much space an app can use 
 in its sandbox? I presume a database would necessarily need to reside in 
 Application_Home/Documents/...
 
 -Carl
 

-- 
Glenn L. Austin, Computer Wizard and Race Car Driver 
http://www.austinsoft.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: -glyphWithName:

2014-08-23 Thread Raglan T. Tiger

 So the question I have is: what are you actually trying to do?

Generally speaking, display the NSFontPanel with an accessory view containing a 
NSTextField, OK and Cancel buttons.

The user picks a font, types a phrase and clicks OK.

I now take the phrase and get the glyphs for each character in the phrase.

Glyhs are gotten by name.

So I need some mechanism to take the entered character, get its name and 
retrieve the glyph.

The resulting glyphs go into our model for further processing.

Note:  this is not a text process.

-rags
___

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: -glyphWithName:

2014-08-23 Thread Raglan T. Tiger

On Aug 23, 2014, at 10:26 AM, Raglan T. Tiger r...@crusaderrabbit.net wrote:

 So I need some mechanism to take the entered character, get its name and 
 retrieve the glyph.

If NSFont had a get by unicode … problem solved.

-rags
___

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: iOS database within sandbox

2014-08-23 Thread Carl Hoefs

On Aug 23, 2014, at 9:23 AM, Glenn L. Austin gl...@austinsoft.com wrote:

 CoreData is not a database (according to Marcus Zarra -- and he should know). 
  Even though it *can* use an SQLite data store (and most people do that), it 
 doesn't depend upon SQLite functionality.

However, specifically on iOS, I take it that SQLite is the *only* database 
available, the other items (CoreData, FMDB, Realm, YapDatabase) being 
object-management abstractions built atop it?

-Carl

___

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: iOS database within sandbox

2014-08-23 Thread Gleb Dolgich
From Realm home page: Realm is not built on SQLite.

On 23 Aug 2014, at 17:57, Carl Hoefs newsli...@autonomy.caltech.edu wrote:

 
 On Aug 23, 2014, at 9:23 AM, Glenn L. Austin gl...@austinsoft.com wrote:
 
 CoreData is not a database (according to Marcus Zarra -- and he should 
 know).  Even though it *can* use an SQLite data store (and most people do 
 that), it doesn't depend upon SQLite functionality.
 
 However, specifically on iOS, I take it that SQLite is the *only* database 
 available, the other items (CoreData, FMDB, Realm, YapDatabase) being 
 object-management abstractions built atop it?



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: -glyphWithName:

2014-08-23 Thread Holmberg Bertil
The first part of this method shows how to get the glyph from any character
Works fine with non-Latin characters such as Japanese too

- (UIBezierPath *)bezierPathFromChar:(NSString *)aChar inFont:(CTFontRef)aFont {
// Buffers
unichar chars[1];
CGGlyph glyphs[1];

// Copy the character into the buffer
chars[0] = [aChar characterAtIndex:0];

// Encode the glyph for the single character into another buffer
CTFontGetGlyphsForCharacters(aFont, chars, glyphs, 1);

// Get the single glyph
CGGlyph aGlyph = glyphs[0];

// Find a reference to the Core Graphics path for the glyph
CGPathRef glyphPath = CTFontCreatePathForGlyph(aFont, aGlyph, NULL);

// Create a bezier path from the CG path
UIBezierPath *glyphBezierPath = [UIBezierPath bezierPath];
[glyphBezierPath moveToPoint:CGPointZero];
[glyphBezierPath appendPath:[UIBezierPath bezierPathWithCGPath:glyphPath]];

CGPathRelease(glyphPath);

return glyphBezierPath;
}

___

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: Swift Threads

2014-08-23 Thread Jens Alfke

 On Aug 23, 2014, at 12:46 AM, Gerriet M. Denkmann gerr...@mdenkmann.de 
 wrote:

 Works fine and is twice as fast.

That approach is a bit naive, as it's going to spawn a huge number of dispatch 
queues (something like O(n) of them, I think.) Also, once the array sizes start 
getting smaller than a cache line the CPU cores are going to be fighting over 
access to memory. That's probably why you got only a 2x speedup instead of 4x 
or 8x (depending on your CPU).

 But how to do this in Swift?

The same way as in Objective-C.

 Just doing the same as in Obj-C does not work (nor is it expected, as there 
 is no documented thread-safeness of Swift arrays).

Well, Swift arrays are passed by value, not by reference. What does your Swift 
implementation look like?

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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: iOS database within sandbox

2014-08-23 Thread Jens Alfke

 On Aug 23, 2014, at 9:57 AM, Carl Hoefs newsli...@autonomy.caltech.edu 
 wrote:
 
 However, specifically on iOS, I take it that SQLite is the *only* database 
 available

It's the only one built into the OS with a public API. But there are a lot of 
options if you're willing to build and link in your own database — Tokyo 
Cabinet, LevelDB, etc. Most database engines are very portable, because they 
don't use any OS facilities other than the filesystem and maybe threads. On the 
other hand, SQLite is attractive because the effective code size is zero, there 
are a number of Objective-C bindings, and it's proven extremely reliable over 
many years.

Realm has a nice API, but I am skeptical of it because the database engine 
itself (tightdb) is closed-source and there is no public information about it. 
(Realm itself is open source, but if you look closely at the code you find that 
it's a thin Objective-C wrapper over a C++ database engine that the build 
system downloads as a precompiled static library.) I would not feel comfortable 
shipping an app based on a database engine whose source isn't available, where 
there's no information about future support, and which has an unknown track 
record of stability. Worst-case scenario is they go out of business, tightdb 
stops working in some future OS version, and you're SOL.

(But take that with a grain of salt, because I work on a somewhat-competing 
[and open-source] database, Couchbase Lite, so I'm hardly unbiased.)

—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: Swift Threads

2014-08-23 Thread Jens Alfke

 On Aug 23, 2014, at 11:23 AM, Jens Alfke j...@mooseyard.com wrote:
 
 it's going to spawn a huge number of dispatch queues (something like O(n) of 
 them, I think.)

Oops, I meant 'dispatched blocks'. Which still have overhead because the block 
contexts are heap-allocated.

—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: -glyphWithName:

2014-08-23 Thread Kyle Sluder
On Sat, Aug 23, 2014, at 11:26 AM, Raglan T. Tiger wrote:
 
  So the question I have is: what are you actually trying to do?
 
 Generally speaking, display the NSFontPanel with an accessory view
 containing a NSTextField, OK and Cancel buttons.
 
 The user picks a font, types a phrase and clicks OK.
 
 I now take the phrase and get the glyphs for each character in the
 phrase.

So the user types abcdef into your field and hits OK; you dismiss the
font panel and try to get the glyphs for a, b, c, d, e, and
f?

 
 Glyhs are gotten by name.

If my above understanding is correct, this is almost certainly the wrong
way to go about it. The Cocoa text system can go directly from Unicode
strings to glyphs; there's no need to convert the string to some sort of
intermediary form.

But I'm also concerned that you might not be aware of some of the more
complicated areas of Unicode-aware text rendering that make your desired
goal somewhat dubious.

There is not a 1-to-1 mapping of characters (what Unicode refers to as
graphemes) and glyphs. See Apple's documentation about grapheme
clusters:
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Strings/Articles/stringsClusters.html

In many writing systems, a single character may be composed of a base
letter plus an accent or other decoration. […] However, even if a string
is fully precomposed, there are still many combinations that must be
represented using a base character and combining marks. For most text
processing, substring ranges should be arranged so that their boundaries
do not separate a base character from its associated combining marks.

So what to the user might look like a single character (ö, for example),
might actually be generated from two separate glyphs. The header
comments for -[NSLayoutManager
characterRangeForGlyphRange:actualGlyphRange:] reinforces this:

For example, if the text storage contains the character (o-umlaut)
and the glyph store contains the two atomic glyphs o and (umlaut), and
if the glyph range given encloses only the first or second glyph, then
actualGlyphRange will be set to enclose both glyphs.

What glyphs get generated for any given character sequence (composed or
not) depend on the font and the glyph generator.

--Kyle Sluder

___

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: -glyphWithName:

2014-08-23 Thread Raglan T. Tiger

On Aug 23, 2014, at 3:30 PM, Kyle Sluder k...@ksluder.com wrote:

 So the user types abcdef into your field and hits OK; you dismiss the
 font panel and try to get the glyphs for a, b, c, d, e, and
 f?

short of dismissing the font panel, yeah

already have code that processes all the paths in a glyph and puts them 
together, holes, holes in holes , etc. in our model bezier class

-rags
___

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

Which NSWindow methods have asynchronous operation?

2014-08-23 Thread Cosmin Apreutesei
I was wondering if anyone knows which of the various NSWindow methods
have asynchronous operation and which are blocking, with their effects
guaranteed after the call?

I'm interested in these in particular:

orderFront  -- ?
orderOut-- ?
makeKeyWindow   -- async for sure
close -- looks blocking
miniaturize -- looks blocking
deminiaturize  -- looks blocking
zoom -- ?
setFrame:display-- ?
toggleFullScreen -- async for sure


Thanks,
Cosmin.
___

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: -glyphWithName:

2014-08-23 Thread Raglan T. Tiger

-rags



On Aug 23, 2014, at 3:30 PM, Kyle Sluder k...@ksluder.com wrote:

 So the user types abcdef into 

no, more like “Zoe’s First Birthday

- rags
___

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: -glyphWithName:

2014-08-23 Thread Kyle Sluder
On Aug 23, 2014, at 4:30 PM, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 
 
 -rags
 
 
 
 On Aug 23, 2014, at 3:30 PM, Kyle Sluder k...@ksluder.com wrote:
 
 So the user types abcdef into 
 
 no, more like “Zoe’s First Birthday

So what if Zöe’s name has an umlaut? As the documentation describes, that can 
result in two separate glyphs.

--Kyle Sluder
___

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: Which NSWindow methods have asynchronous operation?

2014-08-23 Thread Ken Thomases
On Aug 23, 2014, at 6:27 PM, Cosmin Apreutesei cosmin.apreute...@gmail.com 
wrote:

 I was wondering if anyone knows which of the various NSWindow methods
 have asynchronous operation and which are blocking, with their effects
 guaranteed after the call?

From what perspective?  All of the corresponding object and delegate methods 
having been called?  All programmatic tests (e.g. -[NSWindow makeKeyWindow] vs. 
-[NSApplication keyWindow] and -[NSWindow isKeyWindow], which, by the way, mean 
different things) reflecting the changed state?  Visible effects for the user?

As usual, the question arises: what are you trying to achieve?

Regards,
Ken


___

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: iOS database within sandbox

2014-08-23 Thread Shane Zatezalo
If you are going to go the core data route, you should look into using it with 
this most excellent tool: 

https://github.com/rentzsch/mogenerator

Shane

Sent from my iPhone

 On Aug 22, 2014, at 7:25 PM, Jim Geist velocity...@rodentia.net wrote:
 
 I don’t know of any storage quotas, I’ve seen debug logging fill up the 
 device before the app gets whacked. And some of the games I play have gigs of 
 data.
 
 CoreData has a bit of a curve, but it saves you a lot once you’re used to it. 
 It works at the object level, and just not having to serialize or deserialize 
 your data into SQL columns is a huge win. It also has built in migration 
 strategies so if you rev your schema between app versions, you usually don’t 
 have to write a ton of code to transition your data manually.
 
 The design I would recommend (and I’d love to hear if this is what others do) 
 is to use categories to extend the classes that Xcode generates for your 
 CoreData entities. I add methods for every type of query I need. You don’t 
 want to change the generated classes directly, since every time you change an 
 object, Xcode will overwrite any changes you’ve made.
 
 
 On Aug 22, 2014, at 6:07 PM, Carl Hoefs newsli...@autonomy.caltech.edu 
 wrote:
 
 
 On Aug 22, 2014, at 6:01 PM, Jim Geist velocity...@rodentia.net wrote:
 
 Can you use CoreData?
 
 On Aug 22, 2014, at 6:00 PM, Catchall catch...@rodentia.net wrote:
 
 Is there a reason to not use CoreData?
 
 Hmm, I guess that’s what CoreData is for, isn’t it? I had heard that it is 
 pretty difficult to learn, and since I’m used to accessing databases from 
 C/Linux, my first thought was to go the “easy” route. I’ll look into it.
 
 Regarding the other portion of my question, are there limitations to how 
 much storage space can be used on an iPhone? Is the space managed as 
 “first-come first-served”?
 Thx,
 -Carl
 
 
 ___
 
 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/lottadot%40gmail.com
 
 This email sent to lotta...@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: -glyphWithName:

2014-08-23 Thread Raglan T. Tiger

On Aug 23, 2014, at 5:43 PM, Kyle Sluder k...@ksluder.com wrote:

 So what if Zöe’s name has an umlaut? As the documentation describes, that can 
 result in two separate glyphs.
 

apparently -glyphWithName: returns all the paths required to make the unicode 
character

at this link you will see Zöe  interpreted from the NSBezierPaths returned by 
-glyphWithName:  and put into bezier our model

http://crusaderrabbit.net/zoe.png

this is what we want but again to the original question how to get glyphs 
unicode so we don’t have to know the names

-rags
___

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: -glyphWithName:

2014-08-23 Thread Raglan T. Tiger
On Aug 23, 2014, at 6:49 PM, Raglan T. Tiger r...@crusaderrabbit.net wrote:

 this is what we want but again to the original question how to get glyphs 
 unicode so we don’t have to know the names


I will look into the NSLayoutManager suggestions as they have appeared in otter 
searches
___

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: -glyphWithName:

2014-08-23 Thread Kyle Sluder
On Aug 23, 2014, at 5:49 PM, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 
 
 On Aug 23, 2014, at 5:43 PM, Kyle Sluder k...@ksluder.com wrote:
 
 So what if Zöe’s name has an umlaut? As the documentation describes, that 
 can result in two separate glyphs.
 
 apparently -glyphWithName: returns all the paths required to make the unicode 
 character
 
 at this link you will see Zöe  interpreted from the NSBezierPaths returned by 
 -glyphWithName:  and put into bezier our model
 
 http://crusaderrabbit.net/zoe.png

For *that specific font,* ö is one glyph. What about other fonts?

Also, have you tried with Hangul? What about overlays like COMBINING ENCLOSING 
CIRCLE?

 
 this is what we want but again to the original question how to get glyphs 
 unicode so we don’t have to know the names

As I said before, I don’t think any reasonable way of achieving your goal 
actually requires this knowledge.

--Kyle Sluder
___

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: -glyphWithName:

2014-08-23 Thread Roland King

 On 24 Aug 2014, at 8:49 am, Raglan T. Tiger r...@crusaderrabbit.net wrote:
 
 
 On Aug 23, 2014, at 5:43 PM, Kyle Sluder k...@ksluder.com wrote:
 
 So what if Zöe’s name has an umlaut? As the documentation describes, that 
 can result in two separate glyphs.
 
 
 apparently -glyphWithName: returns all the paths required to make the unicode 
 character
 
 at this link you will see Zöe  interpreted from the NSBezierPaths returned by 
 -glyphWithName:  and put into bezier our model
 
 http://crusaderrabbit.net/zoe.png
 
 this is what we want but again to the original question how to get glyphs 
 unicode so we don’t have to know the names
 
 -rags

This is why Apple has CoreText which is deep and gnarly and knows how to 
substitute fonts when glyphs are missing and deal with all aspects of unicode 
including the equivalence of composed characters to other characters (there are 
a lot of ways to write Zôe) and 1000 other things before finally mapping to a 
run of glyphs. Text is hard,  especially when Zôe turns out to be called 高清防 or 
A∉B or . The idea you can take an NSString, split it up into ‘characters’ 
and look them up in a random NSFont is too simplistic. It’ll work for ASCII, 
that’s about it. 

The last time I did anything like this I used CoreText. You make CTLines they 
have CTRuns, the CTRuns have properties which tell you what CTFont they were 
using. The CTRuns give you CGGlyphs (not a typo, it’s CGGlyph for some reason) 
and let you get the bezier paths for those glyphs. You can make CTLines from 
attributed strings. I seem to recall iOS wrapped some of this stuff up a couple 
of years ago into another framework to stop people having to use CoreText but 
I’m not sure it got a lot easier and I’m fairly sure it’s not on OSX either. 



___

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: -glyphWithName:

2014-08-23 Thread Raglan T. Tiger
On Aug 23, 2014, at 7:29 PM, Roland King r...@rols.org wrote:

 CoreText


going there now to see what it yields


-rags
___

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: Swift Threads

2014-08-23 Thread Gerriet M. Denkmann

On 24 Aug 2014, at 01:23, Jens Alfke j...@mooseyard.com wrote:

 
 On Aug 23, 2014, at 12:46 AM, Gerriet M. Denkmann gerr...@mdenkmann.de 
 wrote:
 
 Works fine and is twice as fast.
 
 That approach is a bit naive, as it's going to spawn a huge number of 
 [dispatched blocks] (something like O(n) of them, I think.) Also, once the 
 array sizes start getting smaller than a cache line the CPU cores are going 
 to be fighting over access to memory. That's probably why you got only a 2x 
 speedup instead of 4x or 8x (depending on your CPU).

My computer has 8 Cpus (4 of which are called logical, so the other 4 clearly 
are illogical, but they work quite fine nevertheless).

The actual implementation looks like:

quicksort( array, depth)
{
partition( array )
if ( depth  kLimit )
{
dispatch_apply(2...
{
quicksort( left or right side, depth + 1)
}
}
else
{
quicksort( left side, depth + 1)
quicksort( right side, depth + 1)
}
}

Depth starts with 0, so there are no more than 2^ kLimit dispatched blocks.

Messing around with kLimit shows: 
It gets faster up to kLimit = 3 or 4. I.e. 8 or 16 dispatched blocks.
The improvements by increasing kLimit are getting smaller.
Increasing kLimit even further than 4 makes it not faster.
Even tried kLimit = 1000 
Actual depths for an array of size 10 000 000 are about 54 ... 63; log2(10 mio) 
= 23.2, but the partition is not as good as theoretically possible - instead of 
halving the array, it partitions it into about 1/4 + 3/4 on average.


 
 But how to do this in Swift?
 
 The same way as in Objective-C.

 
 Just doing the same as in Obj-C does not work (nor is it expected, as there 
 is no documented thread-safeness of Swift arrays).
 
 Well, Swift arrays are passed by value, not by reference. What does your 
 Swift implementation look like?

Using the passed by value thing in Swift, quicksort() would sort the array, 
but the caller wouldn't notice; it's array would remain unchanged, which is not 
really useful.

So I use:
func quicksortArray( inout array: [UInt32], lowerIndex: UInt, upperIndex: UInt, 
depth: UInt )

1. problem: 
Even with kLimit = 0 this gets really slow
Reason: the compiler notices that dispatch_apply is kind of dangerous and 
always copies the arrays to be used.
And copies them back into the containing array afterwards.

So I changed it to:

quicksort( array, depth)
{
partition( array )
if ( depth  kLimit )
{
dispatch_apply(2...
{
quicksort( left or right side, depth + 1)
}
}
else
{
quicksortWithoutDispatch( left side, depth + 1) // same as 
quicksort, but without any mention of dispatch_apply
quicksortWithoutDispatch( right side, depth + 1)
}
}

2. problem:
Sometimes (not always) one of the two arrays sorted inside of dispatch_apply is 
not copied back.

3. problem
Sometimes (not always) random crashes
Which kind of proves that dispatch_apply with Swift is not a very good idea.
Or (more likely): my way of doing it is not very clever.


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