本文整理汇总了C++中JString::Set方法的典型用法代码示例。如果您正苦于以下问题:C++ JString::Set方法的具体用法?C++ JString::Set怎么用?C++ JString::Set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JString
的用法示例。
在下文中一共展示了JString::Set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: input
void
JXFontManager::GetMonospaceFontNames
(
JPtrArray<JString>* fontNames
)
const
{
if (itsMonoFontNames != NULL)
{
fontNames->CopyObjects(*itsMonoFontNames, fontNames->GetCleanUpAction(), kJFalse);
}
else
{
(JXGetApplication())->DisplayBusyCursor();
fontNames->CleanOut();
fontNames->SetCompareFunction(JCompareStringsCaseInsensitive);
fontNames->SetSortOrder(JOrderedSetT::kSortAscending);
JPtrArray<JString> allFontNames(JPtrArrayT::kDeleteAll);
allFontNames.SetCompareFunction(JCompareStringsCaseInsensitive);
allFontNames.SetSortOrder(JOrderedSetT::kSortAscending);
JString name;
#if ENABLE_TRUE_TYPE
FcFontSet* set =
XftListFonts(*itsDisplay, itsDisplay->GetScreen(),
FC_SPACING, FcTypeInteger, FC_MONO, NULL,
FC_FAMILY, NULL);
for (int i=0; i < set->nfont; i++)
{
FcChar8* s = FcNameUnparse(set->fonts[i]);
name.Set((JCharacter*) s);
// cout << "tt mono: " << name << endl;
#if ONLY_STD_MONOSPACE
if (!name.BeginsWith("Courier") &&
!name.BeginsWith("Consolas") &&
!name.Contains(" Mono") &&
name != "LucidaTypewriter")
{
FcStrFree(s);
continue;
}
#endif
if (IsUseless(name))
{
FcStrFree(s);
continue;
}
JBoolean isDuplicate;
const JIndex index =
allFontNames.GetInsertionSortIndex(&name, &isDuplicate);
if (!isDuplicate)
{
allFontNames.InsertAtIndex(index, name);
JString* n = new JString(name);
assert( n != NULL );
const JBoolean ok = fontNames->InsertSorted(n, kJFalse);
assert( ok );
}
FcStrFree(s);
}
FcFontSetDestroy(set);
#else
for (int j=0; j<kMonospaceFontPatternCount; j++)
{
int nameCount;
char** nameList = XListFonts(*itsDisplay, kMonospaceFontPattern[j],
INT_MAX, &nameCount);
if (nameList == NULL)
{
return;
}
for (int i=0; i<nameCount; i++)
{
const std::string s(nameList[i], strlen(nameList[i]));
std::istringstream input(s);
input.ignore(); // initial dash
JIgnoreUntil(input, '-'); // foundry name
name = JReadUntil(input, '-'); // font name
if (name.IsEmpty() || name == "nil")
{
continue;
}
ConvertToPSFontName(&name);
// cout << "std mono: " << name << endl;
//.........这里部分代码省略.........