Re: [Kicad-developers] Tab handling in text rendering and bbox calculation

2019-11-12 Thread Jeff Young
D’oh.  I was thinking our stroke font was mono-spaced, but then why would we 
have to look up widths in the width-table.  I think my brain worked better 
years ago, but perhaps it’s just nostalgia…. ;)

> On 12 Nov 2019, at 12:35, Johannes Sprigode  wrote:
> 
> If that is so then I rest my case.
> Apart from that a change in the anti-aliasing settings
> as suggested by Jeff didn't have any influence at all.
> 
> Cheers
> 
> On 13/11/19 1:26 am, Seth Hillbrand wrote:
>> On 2019-11-12 03:57, Johannes Sprigode wrote:
>>> Howdy guys,
>>> 
>>> hate to burst your bubble. The tab/space issue appears consistent,
>>> however the actual character alignment kind of sucks. Lower case a, b
>>> etc. are only part of the equation. The big guys still seem to have
>>> some sway.
>>> 
>>> Screen shot attached.
>>> 
>>> Cheers
>> 
>> The characters are not monospaced.  So, you shouldn't expect the line
>> of characters to align with the tab characters.
>> 
>> The tab character is meant to align with other tabs.
>> 
>> -Seth
>> 
>> Seth Hillbrand
>> KiCad Services Corporation
>> https://www.kipro-pcb.com
>> +1 530 302 5483 | +1 212 603 9372
>> 
>> ___
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Tab handling in text rendering and bbox calculation

2019-11-12 Thread Johannes Sprigode
If that is so then I rest my case.
Apart from that a change in the anti-aliasing settings
as suggested by Jeff didn't have any influence at all.

Cheers

On 13/11/19 1:26 am, Seth Hillbrand wrote:
> On 2019-11-12 03:57, Johannes Sprigode wrote:
>> Howdy guys,
>>
>> hate to burst your bubble. The tab/space issue appears consistent,
>> however the actual character alignment kind of sucks. Lower case a, b
>> etc. are only part of the equation. The big guys still seem to have
>> some sway.
>>
>> Screen shot attached.
>>
>> Cheers
>
> The characters are not monospaced.  So, you shouldn't expect the line
> of characters to align with the tab characters.
>
> The tab character is meant to align with other tabs.
>
> -Seth
>
> Seth Hillbrand
> KiCad Services Corporation
> https://www.kipro-pcb.com
> +1 530 302 5483 | +1 212 603 9372
>
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp



signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Tab handling in text rendering and bbox calculation

2019-11-12 Thread Seth Hillbrand

On 2019-11-12 03:57, Johannes Sprigode wrote:

Howdy guys,

hate to burst your bubble. The tab/space issue appears consistent,
however the actual character alignment kind of sucks. Lower case a, b
etc. are only part of the equation. The big guys still seem to have
some sway.

Screen shot attached.

Cheers


The characters are not monospaced.  So, you shouldn't expect the line of 
characters to align with the tab characters.


The tab character is meant to align with other tabs.

-Seth

Seth Hillbrand
KiCad Services Corporation
https://www.kipro-pcb.com
+1 530 302 5483 | +1 212 603 9372

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Tab handling in text rendering and bbox calculation

2019-11-12 Thread Jeff Young
The artificial fattening of the middle of the character strokes suggests that 
Johannes has one of the subpixel anti-aliasing methods turned on.  While it 
doesn’t seem like that would have a cumulative effect of more than a single 
pixel, maybe it's somehow involved.

Johannes, does it change any if you set anti-aliasing to one of the 
supersampling methods?  (Preferences > Common > Accelerated Graphics)

> On 12 Nov 2019, at 11:57, Johannes Sprigode  wrote:
> 
> Howdy guys,
> 
> hate to burst your bubble. The tab/space issue appears consistent, however 
> the actual character alignment kind of sucks. Lower case a, b etc. are only 
> part of the equation. The big guys still seem to have some sway.
> 
> Screen shot attached.
> 
> Cheers
> 
> On 12/11/19 5:24 pm, Seth Hillbrand wrote:
>> On 2019-11-11 17:48, Andrew Lutsenko wrote:
>> 
>>> Hi Seth, Jeff,
>>> I see you have touched this code recently. I've noticed that tabs are 
>>> handled differently for bbox calculation resulting in slightly oversized 
>>> bbox.
>>>  
>>> When rendering tabs we count them as whatever width is needed to align to 
>>> multiple of 4 and  +1 additional space but when calculating bbox it is 
>>> align to 4 spaces + '?' width, which is a bit wider.
>>>  
>>> I attached a patch that fixes this particular issue to count tab as align 
>>> to 4 spaces + 1 space.
>>> But I think this is confusing in general, why do we still render another 
>>> space after aligning width to multiple of 4?
>>> Here is a picture of left-justified text in pcbnew. First line is 
>>> "ab", second "<4 spaces>b", third "<5 spaces>b".
>>>  
>>>  
>>> 
>>>  
>>> Regards,
>>> Andrew
>> 
>> Good catch.  I hadn't noticed that.  The intention (in the comments) was to 
>> align to the 4th column.  I pushed a fix as well as yours to the code.  
>> Thank you for your contribution to KiCad!
>> 
>> 
>> 
>> Best-
>> 
>> Seth
>> 
>> 
>> 
>>  
>> Seth Hillbrand
>> Lead Developer
>> +1-530-302-5483‬ 
>> Davis, CA
>> www.kipro-pcb.com i...@kipro-pcb.com 
>> 
>>       
>>    
>> 
>> 
>> ___
>> Mailing list: https://launchpad.net/~kicad-developers 
>> 
>> Post to : kicad-developers@lists.launchpad.net 
>> 
>> Unsubscribe : https://launchpad.net/~kicad-developers 
>> 
>> More help   : https://help.launchpad.net/ListHelp 
>> 
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Tab handling in text rendering and bbox calculation

2019-11-12 Thread Johannes Sprigode
Howdy guys,

hate to burst your bubble. The tab/space issue appears consistent,
however the actual character alignment kind of sucks. Lower case a, b
etc. are only part of the equation. The big guys still seem to have some
sway.

Screen shot attached.

Cheers

On 12/11/19 5:24 pm, Seth Hillbrand wrote:
>
> On 2019-11-11 17:48, Andrew Lutsenko wrote:
>
>> Hi Seth, Jeff,
>> I see you have touched this code recently. I've noticed that tabs are
>> handled differently for bbox calculation resulting in slightly
>> oversized bbox.
>>  
>> When rendering tabs we count them as whatever width is needed to
>> align to multiple of 4 and  +1 additional space but when calculating
>> bbox it is align to 4 spaces + '?' width, which is a bit wider.
>>  
>> I attached a patch that fixes this particular issue to count tab as
>> align to 4 spaces + 1 space.
>> But I think this is confusing in general, why do we still render
>> another space after aligning width to multiple of 4?
>> Here is a picture of left-justified text in pcbnew. First line is
>> "ab", second "<4 spaces>b", third "<5 spaces>b".
>>  
>>  
>> image.png
>>  
>> Regards,
>> Andrew
>
>
> Good catch.  I hadn't noticed that.  The intention (in the comments)
> was to align to the 4th column.  I pushed a fix as well as yours to
> the code.  Thank you for your contribution to KiCad!
>
>
> Best-
>
> Seth
>
>
> KiCad Services Corporation KiCad Services Corporation Logo
> Seth Hillbrand
> *Lead Developer*
> +1-530-302-5483‬ 
> Davis, CA
> www.kipro-pcb.com     i...@kipro-pcb.com
> 
> https://twitter.com/KiProEDA 
> https://www.linkedin.com/company/kicad
> 
>
>
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


signature.asc
Description: OpenPGP digital signature
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Tab handling in text rendering and bbox calculation

2019-11-11 Thread Seth Hillbrand
On 2019-11-11 17:48, Andrew Lutsenko wrote:

> Hi Seth, Jeff, 
> I see you have touched this code recently. I've noticed that tabs are handled 
> differently for bbox calculation resulting in slightly oversized bbox. 
> 
> When rendering tabs we count them as whatever width is needed to align to 
> multiple of 4 and  +1 additional space but when calculating bbox it is align 
> to 4 spaces + '?' width, which is a bit wider. 
> 
> I attached a patch that fixes this particular issue to count tab as align to 
> 4 spaces + 1 space. 
> But I think this is confusing in general, why do we still render another 
> space after aligning width to multiple of 4? 
> Here is a picture of left-justified text in pcbnew. First line is "ab", 
> second "<4 spaces>b", third "<5 spaces>b". 
> 
> Regards, 
> Andrew

Good catch.  I hadn't noticed that.  The intention (in the comments) was
to align to the 4th column.  I pushed a fix as well as yours to the
code.  Thank you for your contribution to KiCad! 

Best- 

Seth 

KiCad Services Corporation 

Seth Hillbrand

LEAD DEVELOPER

+1-530-302-5483‬ [1]

Davis, CA

www.kipro-pcb.com [2]i...@kipro-pcb.com

https://twitter.com/KiProEDA [3]
https://www.linkedin.com/company/kicad [4]

 

Links:
--
[1] tel:+12126039372
[2] http://www.kipro-pcb.com/
[3] https://twitter.com/KiProEDA
[4] https://www.linkedin.com/company/kicad___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] Tab handling in text rendering and bbox calculation

2019-11-11 Thread Andrew Lutsenko
Hi Seth, Jeff,
I see you have touched this code recently. I've noticed that tabs are
handled differently for bbox calculation resulting in slightly oversized
bbox.

When rendering tabs we count them as whatever width is needed to align to
multiple of 4 and  +1 additional space but when calculating bbox it is
align to 4 spaces + '?' width, which is a bit wider.

I attached a patch that fixes this particular issue to count tab as align
to 4 spaces + 1 space.
But I think this is confusing in general, why do we still render another
space after aligning width to multiple of 4?
Here is a picture of left-justified text in pcbnew. First line is
"ab", second "<4 spaces>b", third "<5 spaces>b".


[image: image.png]

Regards,
Andrew
From 264b656fdbfedbe2631840f7c67bb320e557c7d8 Mon Sep 17 00:00:00 2001
From: qu1ck 
Date: Mon, 11 Nov 2019 17:25:24 -0800
Subject: [PATCH] Make stroke font bbox calculation consistent with rendering

When rendering tabs we count them as 4 + 1 space but when calculating
bbox it is 4 spaces + '?' width, which is a bit wider.
---
 common/gal/stroke_font.cpp | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/gal/stroke_font.cpp b/common/gal/stroke_font.cpp
index 81ffe6f93..94913c605 100644
--- a/common/gal/stroke_font.cpp
+++ b/common/gal/stroke_font.cpp
@@ -572,7 +572,10 @@ VECTOR2D STROKE_FONT::ComputeStringBoundaryLimits( const UTF8& aText, const VECT
 int dd = (signed) *it - ' ';
 
 if( dd >= (int) m_glyphBoundingBoxes.size() || dd < 0 )
-dd = '?' - ' ';
+{
+int substitute = *it == '\t' ? ' ' : '?';
+dd = substitute - ' ';
+}
 
 const BOX2D& box = m_glyphBoundingBoxes[dd];
 curX += box.GetEnd().x * curScale;
-- 
2.24.0.rc1.363.gb1bccd3e3d-goog

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp