How to set margins within a TextCtrl

I need to set the margins of a wx.RichTextCtrl, specially the left and top margins, such that the “overshoot” of some characters of a font I’m using still show.

(Don’t mind the red color at the end; it’s is only an app-specific characteristic). As you can see in the image above, the wx.RichTextCtrl in the image already has a margin with respect to the wx.Frame object, but NOT whithin itself. Any hints on how to achieve this?

I think I found a solution for you, SetMargins(), at http://wxpython.org/Phoenix/docs/html/TextEntry.html. Assuming you are naming your wx.RichTextCtrl “self.rtc” try adding “self.rtc.SetMargins((50,50))” near the beginning after BeginSuppressUndo(). Of course adjust the values to your liking. The first value controls the left margin while the second controls the top margin. I tested it with the RichTextCtrl demo and it added the specific spacing with no issues.

-Mike S

···

On Friday, January 31, 2014 10:59:23 AM UTC-5, LexLuengas wrote:

I need to set the margins of a wx.RichTextCtrl, specially the left and top margins, such that the “overshoot” of some characters of a font I’m using still show.

(Don’t mind the red color at the end; it’s is only an app-specific characteristic). As you can see in the image above, the wx.RichTextCtrl in the image already has a margin with respect to the wx.Frame object, but NOT whithin itself. Any hints on how to achieve this?

SetMargins soes set the margins within a TextCtrl (thanks!), but I’m afraid it still does the clipping. Here’s an increased left margin of 100 (!):

···

El viernes, 31 de enero de 2014 20:27:20 UTC+1, Mike Stover escribió:

I think I found a solution for you, SetMargins(), at http://wxpython.org/Phoenix/docs/html/TextEntry.html. Assuming you are naming your wx.RichTextCtrl “self.rtc” try adding “self.rtc.SetMargins((50,50))” near the beginning after BeginSuppressUndo(). Of course adjust the values to your liking. The first value controls the left margin while the second controls the top margin. I tested it with the RichTextCtrl demo and it added the specific spacing with no issues.

-Mike S

On Friday, January 31, 2014 10:59:23 AM UTC-5, LexLuengas wrote:

I need to set the margins of a wx.RichTextCtrl, specially the left and top margins, such that the “overshoot” of some characters of a font I’m using still show.

(Don’t mind the red color at the end; it’s is only an app-specific characteristic). As you can see in the image above, the wx.RichTextCtrl in the image already has a margin with respect to the wx.Frame object, but NOT whithin itself. Any hints on how to achieve this?

Admittedly, I don’t know how to fix the clipping. Looks to me like it isn’t handling the full width of the text properly, meaning its not detecting the pixels at the far left. Hopefully someone with a better understanding of the RichTextCtrl can assist further.
-Mike S

···

On Friday, January 31, 2014 10:59:23 AM UTC-5, LexLuengas wrote:

I need to set the margins of a wx.RichTextCtrl, specially the left and top margins, such that the “overshoot” of some characters of a font I’m using still show.

(Don’t mind the red color at the end; it’s is only an app-specific characteristic). As you can see in the image above, the wx.RichTextCtrl in the image already has a margin with respect to the wx.Frame object, but NOT whithin itself. Any hints on how to achieve this?

The issue lays in wxWidgets and it was already fixed by Julian Smart, I believe. Use the compiled wxPython Phoenix from here and try if the issue is gone.

···

On Mon, Feb 3, 2014 at 2:26 PM, Mike Stover hakugin.gin@gmail.com wrote:

Admittedly, I don’t know how to fix the clipping. Looks to me like it isn’t handling the full width of the text properly, meaning its not detecting the pixels at the far left. Hopefully someone with a better understanding of the RichTextCtrl can assist further.
-Mike S

On Friday, January 31, 2014 10:59:23 AM UTC-5, LexLuengas wrote:

I need to set the margins of a wx.RichTextCtrl, specially the left and top margins, such that the “overshoot” of some characters of a font I’m using still show.

(Don’t mind the red color at the end; it’s is only an app-specific characteristic). As you can see in the image above, the wx.RichTextCtrl in the image already has a margin with respect to the wx.Frame object, but NOT whithin itself. Any hints on how to achieve this?

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

I would do some reality checks here to help narrow down where the problem
is (by "it is clipped" below, I mean the letter f glyph is cut off a bit on
the left side):

- What's the name of this font?

- If you show a lower case f in this font in Word, a few browsers, and
maybe another text display program, at this font size, is it not clipped in
all of these?

- If you show another font (like Tahoma) of this word at this font size, is
it still clipped?

My point here is to see whether this is a problem with the font at the
level of the OS or if it really is a problem with wxRichTextCtrl.

Che

···

On Fri, Jan 31, 2014 at 10:59 AM, LexLuengas <alexis.luengas@gmail.com>wrote:

I need to set the margins of a wx.RichTextCtrl, specially the left and top
margins, such that the "overshoot" of some characters of a font I'm using
still show.

LexLuengas, before you spend any time getting Phoenix based on this
comment, I would first ask to see the bug report on this issue and its fix
on wxWidgets' Trac.

···

On Mon, Feb 3, 2014 at 9:03 AM, Boštjan Mejak <bostjan.galaxy@gmail.com>wrote:

The issue lays in wxWidgets and it was already fixed by Julian Smart, I
believe. Use the compiled wxPython Phoenix from here<http://wxpython.org/Phoenix/snapshot-builds/&gt; and
try if the issue is gone.

LexLuengas wrote:

SetMargins soes set the margins within a TextCtrl (thanks!), but I'm
afraid it still does the clipping. Here's an increased left margin of
100 (!):

This is one of the fundamental differences between Mac and other platforms. It is able to do more advanced kerning of the glyphs so they can actually overlap each other (see the 'l' and the 'y' at the end and try drawing a vertical line between them) when the glyph slanting allows for it. As a side effect you can end up with glyphs being drawn beyond the expected bounding box (at least the way that wx calculates it) of the drawn text.

Please do check the trac tickets to see if there is already one about this, and add one if not.

···

--
Robin Dunn
Software Craftsman