Permalink
Browse files

2007-08-13 Sebastien Pouliot <sebastien@ximian.com>

	* text.notes: New. Notes about text rendering.
	* text-cairo.c: Add correct support for MeasureTrailingSpaces
	* text-pango.c: Optimize the case where the font is underlined and
	HotkeyPrefixShow is used.


svn path=/trunk/libgdiplus/; revision=83943
  • Loading branch information...
Sebastien Pouliot
Sebastien Pouliot committed Aug 13, 2007
1 parent cb60cda commit 76067f686a5bf0ce8d6d90f6e65fd0ab00c79b97
Showing with 49 additions and 9 deletions.
  1. +7 −0 src/ChangeLog
  2. +7 −5 src/text-cairo.c
  3. +10 −4 src/text-pango.c
  4. +25 −0 src/text.notes
View
@@ -1,3 +1,10 @@
+2007-08-13 Sebastien Pouliot <sebastien@ximian.com>
+
+ * text.notes: New. Notes about text rendering.
+ * text-cairo.c: Add correct support for MeasureTrailingSpaces
+ * text-pango.c: Optimize the case where the font is underlined and
+ HotkeyPrefixShow is used.
+
2007-08-10 Sebastien Pouliot <sebastien@ximian.com>
* graphics-path.c: Reuse gdip_pango_setup_layout for paths (needs
View
@@ -233,11 +233,13 @@ MeasureString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int *length
Src=stringUnicode;
- /* Handle trailing spaces like MS GDI+, see http://bugzilla.ximian.com/show_bug.cgi?id=80680 */
- while ((StringLen > 0) && (isspace (*(Src + StringLen - 1))))
- StringLen--;
- if (StringLen == 0)
- StringLen = 1;
+ /* unless specified we don't consider the trailing spaces, unless there is just one space (#80680) */
+ if ((format->formatFlags & StringFormatFlagsMeasureTrailingSpaces) == 0) {
+ while ((StringLen > 0) && (isspace (*(Src + StringLen - 1))))
+ StringLen--;
+ if (StringLen == 0)
+ StringLen = 1;
+ }
Dest=CleanString;
CurrentDetail=StringDetails;
View
@@ -239,10 +239,16 @@ gdip_pango_setup_layout (cairo_t *ct, GDIPCONST WCHAR *stringUnicode, int length
gdip_process_accelerators (text, length, NULL);
break;
case HotkeyPrefixShow:
- /* find accelerator and add attribute to the next character (unless it's the prefix too) */
- if (!list)
- list = gdip_get_layout_attributes (layout);
- gdip_process_accelerators (text, length, list);
+ /* optimization: is seems that we never see the hotkey when using an underline font */
+ if (font->style & FontStyleUnderline) {
+ /* so don't bother drawing it (and simply add the '&' character) */
+ gdip_process_accelerators (text, length, NULL);
+ } else {
+ /* find accelerator and add attribute to the next character (unless it's the prefix too) */
+ if (!list)
+ list = gdip_get_layout_attributes (layout);
+ gdip_process_accelerators (text, length, list);
+ }
break;
default:
break;
View
@@ -0,0 +1,25 @@
+Notes, funny facts and $#&^*@# stuff on text rendering
+------------------------------------------------------
+
+Since there's not much documentation on every options (and parts of it is
+wrong) here's are my little rambling^H notes on the subject...
+
+
+GDI+
+
+- It seems that HotkeyPrefixShow is never seen when we use an underline font;
+
+- StringFormatFlagsMeasureTrailingSpaces not only measure the trailing space,
+it also render them (e.g. underline and strikeout) - but that's not true if
+ - DirectionRightToLeft is specified; or
+ - DirectionVertical is specified; or
+ - both DirectionRightToLeft and DirectionVertical are specified; or
+ - there's more than a single line being rendered
+
+
+- StringFormatFlagsMeasureTrailingSpaces doesn't affect the number of
+characters reported by GdipMeasureString *codepointsFitted out parameter.
+I.e. all trailing space are "fitted" - even if not measured.
+
+- HotkeyPrefix[None|Hide|Show] also has no effect on GdipMeasureString
+*codepointsFitted out parameter.

0 comments on commit 76067f6

Please sign in to comment.