Aric Stewart : user32: Have a fallback in linebreaking if uniscribe fails to analyse a string.
Alexandre Julliard
julliard at winehq.org
Mon Jan 30 14:05:57 CST 2012
Module: wine
Branch: master
Commit: 1967fae847abff72ac1ccd415a15ec11b5af6527
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1967fae847abff72ac1ccd415a15ec11b5af6527
Author: Aric Stewart <aric at codeweavers.com>
Date: Mon Jan 30 07:30:12 2012 -0600
user32: Have a fallback in linebreaking if uniscribe fails to analyse a string.
---
dlls/user32/edit.c | 39 ++++++++++++++++++++++++---------------
1 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index ab58145..ab87418 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -598,9 +598,13 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta
const SIZE *sz;
EDIT_InvalidateUniscribeData_linedef(current_line);
EDIT_UpdateUniscribeData_linedef(es, NULL, current_line);
- sz = ScriptString_pSize(current_line->ssa);
- /* Calculate line width */
- current_line->width = sz->cx;
+ if (current_line->ssa)
+ {
+ sz = ScriptString_pSize(current_line->ssa);
+ /* Calculate line width */
+ current_line->width = sz->cx;
+ }
+ else current_line->width = es->char_width * current_line->net_length;
}
else current_line->width = 0;
@@ -644,18 +648,23 @@ static void EDIT_BuildLineDefs_ML(EDITSTATE *es, INT istart, INT iend, INT delta
EDIT_InvalidateUniscribeData_linedef(current_line);
EDIT_UpdateUniscribeData_linedef(es, NULL, current_line);
- count = ScriptString_pcOutChars(current_line->ssa);
- piDx = HeapAlloc(GetProcessHeap(),0,sizeof(INT) * (*count));
- ScriptStringGetLogicalWidths(current_line->ssa,piDx);
-
- prev = current_line->net_length-1;
- do {
- current_line->width -= piDx[prev];
- prev--;
- } while ( prev > 0 && current_line->width > fw);
- if (prev<=0)
- prev = 1;
- HeapFree(GetProcessHeap(),0,piDx);
+ if (current_line->ssa)
+ {
+ count = ScriptString_pcOutChars(current_line->ssa);
+ piDx = HeapAlloc(GetProcessHeap(),0,sizeof(INT) * (*count));
+ ScriptStringGetLogicalWidths(current_line->ssa,piDx);
+
+ prev = current_line->net_length-1;
+ do {
+ current_line->width -= piDx[prev];
+ prev--;
+ } while ( prev > 0 && current_line->width > fw);
+ if (prev<=0)
+ prev = 1;
+ HeapFree(GetProcessHeap(),0,piDx);
+ }
+ else
+ prev = (fw / es->char_width);
}
/* If the first line we are calculating, wrapped before istart, we must
More information about the wine-cvs
mailing list