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
This commit is contained in:
ydong10
2012-05-29 11:07:05 +00:00
parent 2721fabc53
commit 6c310dfb78
4 changed files with 232 additions and 92 deletions

View File

@ -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;
TotalRowNum = 0;
CheckedNum = 0;
GlyphWidth = 1;
Index = 0;
MaxStringLen = 0;
StringLen = 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;
}