Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341140 - TextLayout lacks line height configuration
Summary: TextLayout lacks line height configuration
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-28 12:54 EDT by Hugo Corbucci CLA
Modified: 2019-11-08 04:40 EST (History)
1 user (show)

See Also:


Attachments
patch that includes code to add line height configuration support (5.98 KB, patch)
2011-03-28 12:58 EDT, Hugo Corbucci CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hugo Corbucci CLA 2011-03-28 12:54:29 EDT
Build Identifier: 20100617-1415

TextLayout line heights are bigger in cocoa than they were in carbon. Default line height in cocoa for courier 12 font is 14 pixels, and in carbon it was 12.
Cocoa native libraries support setting maximum and minimum line heights using MutableParagraphStyles. Binding to those functions would allow controlling these attributes in TextLayout class. 

Reproducible: Always

Steps to Reproduce:
1. create a fixed width wrapped TextLayout in cocoa
2. create the same layout in carbon
3. compare the paragraphs' height
Comment 1 Hugo Corbucci CLA 2011-03-28 12:58:10 EDT
Created attachment 192027 [details]
patch that includes code to add line height configuration support

This patch creates the binding between native functions and cocoa through OS and NSMutableParagraphStyle. It also adds setters for minumimLineHeight and maximumLineHeight in the TextLayout class. There is no implementation for other platforms than macosx cocoa.
Comment 2 Felipe Heidrich CLA 2011-03-28 13:03:34 EDT
can you achieve the same look using setAscent / setDescent ?
Comment 3 Hugo Corbucci CLA 2011-03-28 13:06:39 EDT
No. Ascent and Descent can only be used to increase the lineHeight above the default. In this case, cocoa's default value is 14 and it should be 12 (to match carbon).
Comment 4 Felipe Heidrich CLA 2011-03-28 14:07:25 EDT
(In reply to comment #3)
> No. Ascent and Descent can only be used to increase the lineHeight above the
> default. In this case, cocoa's default value is 14 and it should be 12 (to
> match carbon).

You want to force the line height to be smaller then ?

why do you need cocoa and carbon to look the same ?
Comment 5 Hugo Corbucci CLA 2011-03-28 14:17:46 EDT
(In reply to comment #4)
> You want to force the line height to be smaller then ?
> 
> why do you need cocoa and carbon to look the same ?

We are developing an Eclipse RCP application with a WYSIWYG text editor with pages.
With cocoa's bigger line height, less text fits within one page and inccurs into more pages (20% more) existing for a same text. This change impacts also whenever comparing printed text from our app to any other text editor.
TextEdit itself won't match the default cocoa behavior. Given the same text, TextEdit's result is smaller because it uses a smaller line height than the 14 pixels value returned by the SWT binding.
We're trying to migrate the app from carbon to cocoa but we need to keep control over the amount of pages of a same document. A small difference would be acceptable but the difference is caused by this extra line height which we would like to change.
Comment 6 Lars Vogel CLA 2019-11-08 04:40:01 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant please remove the stalebug whiteboard tag.