diff options
author | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-05-29 11:07:05 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-05-29 11:07:05 +0000 |
commit | 6c310dfb78cdbda612b9f5850097580a5e3aa95c (patch) | |
tree | b5f187af3bec56f5c00ad24a9a929de40c4303db /MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c | |
parent | 2721fabc5353114660dc53ac04939d29cb685263 (diff) | |
download | edk2-platforms-6c310dfb78cdbda612b9f5850097580a5e3aa95c.tar.xz |
Enable wide string for title and help string
Sign-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13371 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c')
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c index 82907df092..2a51af8e2f 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/ProcessOptions.c @@ -978,6 +978,7 @@ ProcessOptions ( @param StringPtr The entire help string.
@param FormattedString The oupput formatted string.
+ @param EachLineWidth The max string length of each line in the formatted string.
@param RowCount TRUE: if Question is selected.
**/
@@ -985,6 +986,7 @@ UINTN ProcessHelpString (
IN CHAR16 *StringPtr,
OUT CHAR16 **FormattedString,
+ OUT UINT16 *EachLineWidth,
IN UINTN RowCount
)
{
@@ -992,27 +994,49 @@ ProcessHelpString ( CHAR16 *OutputString;
UINTN TotalRowNum;
UINTN CheckedNum;
+ UINT16 GlyphWidth;
+ UINT16 LineWidth;
+ UINT16 MaxStringLen;
+ UINT16 StringLen;
+
+ TotalRowNum = 0;
+ CheckedNum = 0;
+ GlyphWidth = 1;
+ Index = 0;
+ MaxStringLen = 0;
+ StringLen = 0;
- TotalRowNum = 0;
- CheckedNum = 0;
+ //
+ // Set default help string width.
+ //
+ LineWidth = (UINT16) (gHelpBlockWidth - 1);
//
// Get row number of the String.
//
- for (Index = 0; GetLineByWidth (StringPtr, (UINT16) (gHelpBlockWidth - 1), &Index, &OutputString) != 0x0000; ) {
+ while ((StringLen = GetLineByWidth (StringPtr, LineWidth, &GlyphWidth, &Index, &OutputString)) != 0) {
+ if (StringLen > MaxStringLen) {
+ MaxStringLen = StringLen;
+ }
+
TotalRowNum ++;
FreePool (OutputString);
}
-
- *FormattedString = AllocateZeroPool (TotalRowNum * gHelpBlockWidth * sizeof (CHAR16) * 2);
+ *EachLineWidth = MaxStringLen;
+
+ *FormattedString = AllocateZeroPool (TotalRowNum * MaxStringLen * sizeof (CHAR16));
ASSERT (*FormattedString != NULL);
- for (Index = 0; GetLineByWidth (StringPtr, (UINT16) (gHelpBlockWidth - 1), &Index, &OutputString) != 0x0000; CheckedNum ++) {
- CopyMem (*FormattedString + CheckedNum * gHelpBlockWidth * sizeof (CHAR16), OutputString, gHelpBlockWidth * sizeof (CHAR16));
+ //
+ // Generate formatted help string array.
+ //
+ GlyphWidth = 1;
+ Index = 0;
+ while((StringLen = GetLineByWidth (StringPtr, LineWidth, &GlyphWidth, &Index, &OutputString)) != 0) {
+ CopyMem (*FormattedString + CheckedNum * MaxStringLen, OutputString, StringLen * sizeof (CHAR16));
+ CheckedNum ++;
FreePool (OutputString);
}
- ASSERT (CheckedNum == TotalRowNum);
-
return TotalRowNum;
}
|