This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 213999

Summary: org.netbeans.editor.EditorUI.getLineheigth returns line heigth +1
Product: editor Reporter: gwaldon <gwaldon>
Component: Painting & PrintingAssignee: Miloslav Metelka <mmetelka>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 7.1.2   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description gwaldon 2012-06-11 16:43:25 UTC
I draw my own GlyphGlutter and noticed since 7.1.2 each line of text is drawn 1 pixel further down than what it should be, created a increasing gap with text in the editor as we go down the component. 

Looking at the code, iteration for each line use EditorUI.getLineheigth; removing 1 pixel (EditorUI.getLineheigth()-1) solves the issue.

Finally using textUI.getYFromPos(view.getStartOffset()) as in 7.0.1 GlyphGutter code give also correct spacing.

This bug is reminiscent of issue 182810 but the value of 1 is independent of font size.
Comment 1 Miloslav Metelka 2012-06-14 08:02:18 UTC
The best way is to use the view hierarchy's methods (it properly handles possible line wrapping etc.) please see lines below GlyphGutter:525.
Unfortunately I did not succeed to finish a View API for NB 7.2 - issue #205707 so please use an implementation module dependency if possible.
I mark as dup of issue #205707 since it will be the only proper way for the future.

*** This bug has been marked as a duplicate of bug 205707 ***