Commit c752347f authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

использование системных шрифтов и своих одновременно

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@61349 954022d7-b5bf-4e40-9824-e11837661b57
parent f923dbc9
......@@ -19,6 +19,10 @@
namespace NSDirectory
{
#ifdef _IOS
void GetFiles2_ios(std::wstring strDirectory, CArray<std::wstring>& oArray, bool bIsRecursion);
#endif
static void GetFiles2(std::wstring strDirectory, CArray<std::wstring>& oArray, bool bIsRecursion = false)
{
#ifdef WIN32
......@@ -78,6 +82,13 @@ namespace NSDirectory
#endif
#ifdef MAC
#endif
#if 0
// нормально работает и линукс версия
#ifdef _IOS
return GetFiles2_ios(strDirectory, oArray, bIsRecursion);
#endif
#endif
}
......
......@@ -1637,6 +1637,8 @@ static long GetNextNameValue(HKEY key, const std::wstring& sSubkey, std::wstring
return retval;
}
#endif
CArray<std::wstring> CApplicationFonts::GetSetupFontFiles()
{
#ifdef WIN32
......@@ -1708,11 +1710,23 @@ CArray<std::wstring> CApplicationFonts::GetSetupFontFiles()
#if defined(_MAC) && !defined(_IOS)
return NSDirectory::GetFiles(L"/Library/Fonts", true);
#endif
#ifdef _IOS
// own realization (objective c code)
return GetSetupFontFiles_ios();
#endif
CArray<std::wstring> ret;
return ret;
}
void CApplicationFonts::InitializeFromArrayFiles(CArray<std::wstring>& files)
{
m_oList.LoadFromArrayFiles(files);
}
#ifdef WIN32
void CApplicationFonts::InitFromReg()
{
CArray<std::wstring> oArray = GetSetupFontFiles();
......
#ifndef _BUILD_APPLICATIONFONTS_H_
#ifndef _BUILD_APPLICATIONFONTS_H_
#define _BUILD_APPLICATIONFONTS_H_
#define UNKNOWN_CHARSET 3 // для случаев, когда задано значение DEFAULT_CHARSET, но
......@@ -211,11 +211,17 @@ public:
void InitializeFromFolder(std::wstring strFolder, bool bIsCheckSelection = true);
void Initialize(bool bIsCheckSelection = true);
CArray<std::wstring> GetSetupFontFiles();
void InitializeFromArrayFiles(CArray<std::wstring>& files);
#ifdef WIN32
void InitFromReg();
#endif
#ifdef _IOS
CArray<std::wstring> GetSetupFontFiles_ios();
#endif
CFontManager* GenerateFontManager();
};
......
This diff is collapsed.
#ifndef _BUILD_APPLICATIONFONTSWORKER_H_
#define _BUILD_APPLICATIONFONTSWORKER_H_
#include <string>
#include <vector>
class CApplicationFontsWorker
{
public:
std::vector<std::wstring> m_arAdditionalFolders;
public:
CApplicationFontsWorker();
~CApplicationFontsWorker();
std::vector<std::wstring> CheckApplication(bool bIsNeedSystemFonts,
unsigned char* pDataSrc, unsigned int nLenSrc,
unsigned char*& pDataDst, unsigned int& nLenDst);
};
#endif // _BUILD_APPLICATIONFONTSWORKER_H_
#include "ApplicationFonts.h"
#include "../common/Directory.h"
#ifdef BOOL
#undef BOOL
#endif
#import <UIKit/UIKit.h>
CArray<std::wstring> CApplicationFonts::GetSetupFontFiles_ios()
{
CArray<std::wstring> oArray;
NSDirectory::GetFiles2(L"/System/Library/Fonts", oArray, true);
return oArray;
}
namespace NSDirectory
{
void GetFiles2_ios(std::wstring strDirectory, CArray<std::wstring>& oArray, bool bIsRecursion)
{
NSString* directoryPath = [ [ NSString alloc ]
initWithBytes : (char*)strDirectory.data()
length : strDirectory.size() * sizeof(wchar_t)
encoding : CFStringConvertEncodingToNSStringEncoding ( kCFStringEncodingUTF32LE ) ];
int count;
NSArray* directoryContent = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryPath error:NULL];
for (count = 0; count < (int)[directoryContent count]; count++)
{
NSStringEncoding pEncode = CFStringConvertEncodingToNSStringEncoding ( kCFStringEncodingUTF32LE );
NSData* pSData = [[ directoryContent objectAtIndex:count] dataUsingEncoding : pEncode ];
std::wstring sTmp( (wchar_t*) [ pSData bytes ], [ pSData length] / sizeof ( wchar_t ) );
oArray.Add(sTmp);
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment