Re: Kerning Pairs

2014-10-13 Thread Aandi Inston
>
> > It sounds like you're trying rrreay hard to avoid admitting to
> > yourself that your model code needs to be rewritten.
>
> I don't think so as our model code works just fine when driven from
> Windows V-C that get a font, gets it its outline and mer table and call the
> model.  Beautiful output.
>

Maybe you are both right. See
http://www.microsoft.com/typography/otspec/kern.htm
"NOTE: Apple has extended the definition of the 'kern' table to provide
additional functionality. The Apple extensions are not supported on
Windows. Fonts intended for cross-platform use or for the Windows platform
in general should conform to the 'kern' table format specified here."

So the chances are most fonts for general consumption (but not necessarily
those from Apple) will have the older format even if they have the new one.
You may be rubbish results for Apple fonts, in which case the new Apple
table 'kerx' becomes relevant. You can support both.

Kerx might give better results but that is a trap in itself if you want
cross-platform consistency; your needs might be for consistent layout cross
platform rather than better kerning on one platform. Only you can know this.

>
>
> Is it possible to get the 'kern' table if it exists?


In CTFont Reference see "Getting Font Table Data". Be particularly careful
of endianness.
___

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: Kerning Pairs

2014-10-12 Thread Jens Alfke

> On Oct 12, 2014, at 7:44 PM, Raglan T. Tiger  wrote:
> 
> I don't think so as our model code works just fine when driven from Windows 
> V-C that get a font, gets it its outline and mer table and call the model.  
> Beautiful output.

Sure, it's just going to be limited by pair-based kerning, which is less 
flexible than what OS X supports. Frankly I'm wondering how Windows APIs can 
give you a list of kern pairs if the font itself doesn't provide kerning as 
pairs. Maybe it just doesn't give you any; you may not have tested yet with 
fonts that use the fancy state-machine-based kerning.

> There is a 'kern' table andI am trying to find out how to get a pointer to it 
> for a given font. 

I think you've gone beyond the boundaries of what cocoa-dev collectively can 
help with. You'd be better off asking deep-dive font/type questions on the 
coretext-dev list. (I believe that's the right name; try searching the list of 
lists here.)

—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: Kerning Pairs

2014-10-12 Thread Raglan T. Tiger


On Oct 12, 2014, at 9:31 AM, Kyle Sluder  wrote:

> It sounds like you're trying rrreay hard to avoid admitting to
> yourself that your model code needs to be rewritten.

I don't think so as our model code works just fine when driven from Windows V-C 
that get a font, gets it its outline and mer table and call the model.  
Beautiful output.

There is a 'kern' table andI am trying to find out how to get a pointer to it 
for a given font. 

Is it possible to get the 'kern' table if it exists?

-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: Kerning Pairs

2014-10-12 Thread Kyle Sluder
On Sun, Oct 12, 2014, at 08:36 AM, Raglan T. Tiger wrote:
> My task is to make the Mac view and controller to capture the selected
> font. The rendering of the font is all good. So now I just need kerning
> data that I can put into a KERNINGPAIR structure and my task is complete. 

That's a means, not an end. The purpose of your program isn't to extract
kerning information. The question now thrice posed to you: what does
your program *do* that involves kerning information?

> 
> I have read the reference from Kyle that describes the 'kerx' extended
> kerning table which is supported on OS X 10.7 and iOS 7 onward. Our
> deployment is 10.5 and greater.
> 
> I suspect that the 'kern' table will give what I need. 
> 
> How does one get a pointer to a 'kern' table for a specified font?


Not all fonts have a 'kern' table, so this is not the way forward.

It sounds like you're trying rrreay hard to avoid admitting to
yourself that your model code needs to be rewritten.

--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: Kerning Pairs

2014-10-12 Thread Raglan T. Tiger


On Oct 11, 2014, at 12:47 PM, Scott Ribe  wrote:

> So Kyle's question is: what are you trying to accomplish with that table?


We have model code that handles the kerning and it is currently being driven by 
a Windows view and controller and gives the results we need.

My task is to make the Mac view and controller to capture the selected font. 
The rendering of the font is all good. So now I just need kerning data that I 
can put into a KERNINGPAIR structure and my task is complete. 

I have read the reference from Kyle that describes the 'kerx' extended kerning 
table which is supported on OS X 10.7 and iOS 7 onward. Our deployment is 10.5 
and greater.

I suspect that the 'kern' table will give what I need. 

How does one get a pointer to a 'kern' table for a specified font?

-rags

typedef struct tagKERNINGPAIR {
WORD wFirst;
WORD wSecond;
int  iKernAmount;
} KERNINGPAIR, *LPKERNINGPAIR;

wFirst
The character code for the first character in the kerning pair.
wSecond
The character code for the second character in the kerning pair.
iKernAmount
The amount this pair will be kerned if they appear side by side in the same 
font and size. This value is typically negative, because pair kerning usually 
results in two characters being set more tightly than normal. The value is 
specified in logical units; that is, it depends on the current mapping mode.


___

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: Kerning Pairs

2014-10-11 Thread Scott Ribe
On Oct 11, 2014, at 11:18 AM, Raglan T. Tiger  wrote:

> For the selected font I want to find the number of kerning pairs kpcnt, make 
> a new KERNINGPAIR [ kpcnt ] structure and then fill it out.
> 
> The  kpcnt and KERNINGPAIR are passed to model code for kerning the glyphs 
> into our model.

You missed his point. Kerning can be much more complicated than what can be 
expressed in that kind of table. So Kyle's question is: what are you trying to 
accomplish with that table?

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





___

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: Kerning Pairs

2014-10-11 Thread Raglan T. Tiger
On Oct 11, 2014, at 10:16 AM, Kyle Sluder  wrote:

> So the question, as usual, becomes: what are you actually trying to do?


For the selected font I want to find the number of kerning pairs kpcnt, make a 
new KERNINGPAIR [ kpcnt ] structure and then fill it out.

The  kpcnt and KERNINGPAIR are passed to model code for kerning the glyphs into 
our model.





-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: Kerning Pairs

2014-10-11 Thread Kyle Sluder
On Oct 11, 2014, at 8:20 AM, Raglan T. Tiger  wrote:
> 
> The Windows CDC class has a function:
> 
> DWORD GetKerningPairs( DWORD nNumPairs, LPKERNINGPAIR lpkrnpair );
> 
> 
> What would be the equivalent in a Cocoa class?  I cannot find any methods 
> that have kerning in their name.

Kerning can be much more complicated than can be represented by a simple 
pairing table. See Apple’s documentation for the Kerx table, specifically 
Format 1, which encodes a state machine: 
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6kerx.html

So the question, as usual, becomes: what are you actually trying to do? I bet 
you could get it done via the NSTypesetter API.

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

Kerning Pairs

2014-10-11 Thread Raglan T. Tiger
The Windows CDC class has a function:

 DWORD GetKerningPairs( DWORD nNumPairs, LPKERNINGPAIR lpkrnpair );


What would be the equivalent in a Cocoa class?  I cannot find any methods that 
have kerning in their name.




-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