kicad-developers team mailing list archive
Mailing list archive
Re: [PATCH] Ruler tool asserts when mirrored text is visible
Sorry, that patch doesn't have the right comment. Please use this one.
On Wed, Mar 29, 2017 at 7:37 PM, John Beard <john.j.beard@xxxxxxxxx> wrote:
> This resolves https://bugs.launchpad.net/kicad/+bug/1677210.
> This is caused because the GAL ruler tool didn't reset its text
> mirroring flag before drawing bitmap text. This means if the GAL had
> just drawn mirrored text, it would be set, but this is invalid for
> OpenGL bitmap fonts (and if it were, would still be incorrect).
> I also reset bold/italic, though bitmaps text doesn't seem to care
> about that at all.
> This fixes the bug. In the longer run, this is still not really ideal,
> as every draw-er on the GAL seems to need to reset every single
> parametert that it might need. If a parameter is added, all these
> "reset loci" need to be vetted for possibly adding or resetting that
> Would some kind of stack mechanism make sense here? Unrelated
> functions probably should start from a blank slate of some sort. Maybe
> a way to avoid unnecessary stack shuffling if you /know/ you don't
> need to reset GAL parameters and it's a performance hit to do so
From 3309e395a405eaeeaec80e2a36156fb2a0a25c03 Mon Sep 17 00:00:00 2001
From: John Beard <john.j.beard@xxxxxxxxx>
Date: Wed, 29 Mar 2017 19:35:03 +0800
Subject: [PATCH] Ruler tool: reset text mirror/bold/italic before painting
This is required as the OpenGL GAL doesn't support mirrored
text, and if the state is not cleared after painting other mirrored
text, this is what is attempted.
common/preview_items/ruler_item.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/common/preview_items/ruler_item.cpp b/common/preview_items/ruler_item.cpp
index c820f7f87..629fc1d94 100644
@@ -238,6 +238,9 @@ void RULER_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
gal.SetIsStroke( true );
gal.SetIsFill( false );
gal.SetStrokeColor( PreviewOverlayDefaultColor() );
+ gal.SetFontBold( false );
+ gal.SetFontItalic( false );
+ gal.SetTextMirrored( false );
// draw the main line from the origin to cursor
gal.DrawLine( origin, end );