• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Setting line height exactly - fails for certain unicode chars
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting line height exactly - fails for certain unicode chars


  • Subject: Setting line height exactly - fails for certain unicode chars
  • From: "B.A. Winckler" <email@hidden>
  • Date: Mon, 2 Jul 2007 21:50:02 +0200

Hi,

I am trying to have a text view with one fixed pitch font and such that each line has a fixed height. The way I try to accomplish this is by setting the min and max line height (using NSParagraphStyle) on all characters in the text storage, but I am running into problems. The problem is that certain unicode characters will cause font substitution and some non-Monaco font is used to display certain glyphs and these are higher than the Monaco glyphs so that some lines will end up higher than others.

I have managed to replicate this in TextEdit (on Mac OS X Ver. 10.4.10, PowerPC) by creating a file containing the following three lines:

b
b#
b

The hash (#) on the second line should not the usual one but the one with unicode number 9839 (a stylized hash). Then I go to "Format -> Text -> Spacing..." and set "Line height" to "Exactly 22.0 pt" and the font should be Monaco. (I have attached a similar file to this email.)

For me the above three lines will be displayed with the first and second of equal height whereas the middle one will be slightly higher than the other two. It seems the middle line has more space under it.

This leads to the questions:

1. Is it even possible to "force" a line height like I am trying to do, or does setMaximumLineHeight / setMinimumLineHeight simply give the text system a hint as to which line height to use?

2. Assuming it is possible to accomplish what I am trying to do, can somebody please enlighten me as to how it should be done?


Thanks, B. Winckler

{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410
{\fonttbl\f0\fnil\fcharset77 Monaco;\f1\fnil\fcharset78 HiraKakuPro-W3;}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\margl1440\margr1440\vieww9360\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\sl-440\ql\qnatural\pardirnatural

\f0\fs24 \cf0 b\
b\
b
\f1 \'81\'f2
\f0 \
b\
}
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Setting line height exactly - fails for certain unicode chars
      • From: Martin Wierschin <email@hidden>
  • Prev by Date: Re: Cocoa and dead-code stripping
  • Next by Date: Re: Cocoa and dead-code stripping
  • Previous by thread: Re: NSFontPanel selected font?
  • Next by thread: Re: Setting line height exactly - fails for certain unicode chars
  • Index(es):
    • Date
    • Thread