Re: Fixed pitch font - glyphs sometimes drawn fixed, sometimes variable
Re: Fixed pitch font - glyphs sometimes drawn fixed, sometimes variable
- Subject: Re: Fixed pitch font - glyphs sometimes drawn fixed, sometimes variable
- From: Simon Liu <email@hidden>
- Date: Tue, 8 Mar 2005 23:22:56 +0000
Hi Aki,
Thanks for the info about the font substitution. It makes sense. I
am now using the Hiragino font and it displays the star ratings the
way I want them.
A quick Google search seems to confirm that Hiragino is part of the
standard OS X install - from public beta to 10.3.
http://www.microsoft.com/typography/fonts/mac.htm
http://docs.info.apple.com/article.html?artnum=25710
Thanks,
Simon
On Tue, 8 Mar 2005 12:13:21 -0800, Aki Inoue <email@hidden> wrote:
> Simon,
>
> The Courier New family actually doesn't have glyphs for these
> characters.
> Further U25AA is covered by various fonts in the system including
> LucidaGrande, but U2605 is by limited Asian fonts.
>
> The string only with U25AA is most likely rendered by LucidaGrande.
> The string that contains both characters are most likely rendered by
> Hiragino because AppKit tries to keep font substitution consistent
> for longest run.
>
> By specifying LucidaGrande instead of Courier New, U25AA will be
> rendered with the font regardless of font substitution for other
> characters.
>
> Aki Inoue
> Apple Computer Inc.
>
> On 2005/03/08, at 11:47, Simon Liu wrote:
>
> > Hi John & David,
> >
> > The stars are being displayed in my custom NSCell subclass in a
> > NSTableView. The font is always the same. I've attached a picture.
> > Look at the last row.
> >
> > A slight correction to the original post would be that if I do not set
> > a font for the cell, where [myCell font] returns nil, this problem
> > occurs for one case. If I do set a font, such as a fixed pitch font,
> > all cases fail like the last row.
> >
> > While my custom cell draws the text via [attributedString drawInRect:]
> > I have found that the same problem exists even when simply setting the
> > string value of an NSTextFieldCell,
> >
> > [aCell setStringValue:[NSString stringWithFormat:@"%C%C%C%C%C",0x25aa,
> > 0x25aa, 0x25aa, 0x25aa, 0x25aa]];
> >
> > David, if the font doesn't have the glyph and it obtains from another
> > font family, I can see why the glyph would be of a different width,
> > but as the screenshot shows, the glyph can certainly be drawn in a
> > fixed pitch fashion.
> >
> > Regards,
> > --Simon
> >
> >
> >
> > On Tue, 08 Mar 2005 11:26:10 -0800, Douglas Davidson
> > <email@hidden> wrote:
> >> On 2005-03-08 09:41:13 -0800 Simon Liu <email@hidden>
> >> wrote:
> >>
> >>> Hi,
> >>> Using an NSAttributedString, with a fixed pitch font (Courier New,
> >>> Size 11.0) I am trying to display black stars and centre blocks to
> >>> simulate an iTunes style rating cell. This works okay, except
> >>> for the
> >>> case where no stars are displayed and only 5 centre blocks are
> >>> displayed.
> >>>
> >>> // Case 1 --> 3 stars with 2 blocks [OK]
> >>> stringWithFormat:@"%C%C%C%C%C",0x2605, 0x2605, 0x2605, 0x25aa,
> >>> 0x25aa];
> >>>
> >>> // Case 2 --> 0 stars with 5 blocks [FAILS , the blocks are not
> >>> displayed in fixed width, and are bunched up]
> >>> stringWithFormat:@"%C%C%C%C%C",0x25aa, 0x25aa, 0x25aa, 0x25aa,
> >>> 0x25aa];
> >>>
> >>> I am not sure why Case 2 fails. Can anybody shed some light on
> >>> this?
> >>> Thanks.
> >>
> >> I suspect your font doesn't actually contain glyphs for these
> >> characters. I'm not sure why this would work in any case. It seems
> >> to me that you're really not interested in using the font metrics for
> >> this particular use, so you might well be better off drawing each
> >> glyph individually at a location that you calculate.
> >>
> >> Douglas Davidson
> >>
> >>
> >> <rating_stars.jpg>
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Cocoa-dev mailing list (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> >
> > This email sent to email@hidden
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden