mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
Merge branch 'master' into windows
This commit is contained in:
@@ -10,7 +10,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#ifdef OSX
|
||||
#include <malloc/malloc.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include "vgui_surfacelib/BitmapFont.h"
|
||||
#include "vgui_surfacelib/FontManager.h"
|
||||
#include <tier0/dbg.h>
|
||||
|
||||
@@ -43,7 +43,7 @@ CFontManager::CFontManager()
|
||||
m_FontAmalgams.AddToTail();
|
||||
m_Win32Fonts.EnsureCapacity( MAX_INITIAL_FONTS );
|
||||
|
||||
#ifdef LINUX
|
||||
#if defined(LINUX) || defined(OSX)
|
||||
FT_Error error = FT_Init_FreeType( &library );
|
||||
if ( error )
|
||||
Error( "Unable to initalize freetype library, is it installed?" );
|
||||
@@ -75,7 +75,7 @@ CFontManager::~CFontManager()
|
||||
{
|
||||
ClearAllFonts();
|
||||
m_FontAmalgams.RemoveAll();
|
||||
#ifdef LINUX
|
||||
#if defined(LINUX) || defined(OSX)
|
||||
FT_Done_FreeType( library );
|
||||
#endif
|
||||
}
|
||||
@@ -280,7 +280,7 @@ font_t *CFontManager::CreateOrFindWin32Font(const char *windowsFontName, int tal
|
||||
i = m_Win32Fonts.AddToTail();
|
||||
m_Win32Fonts[i] = NULL;
|
||||
|
||||
#ifdef LINUX
|
||||
#if defined(LINUX) || defined(OSX)
|
||||
int memSize = 0;
|
||||
void *pchFontData = m_pFontDataHelper( windowsFontName, memSize, NULL );
|
||||
|
||||
@@ -730,7 +730,7 @@ void CFontManager::GetKernedCharWidth( vgui::HFont font, wchar_t ch, wchar_t chB
|
||||
{
|
||||
wide = 0.0f;
|
||||
flabcA = 0.0f;
|
||||
|
||||
|
||||
Assert( font != vgui::INVALID_FONT );
|
||||
if ( font == vgui::INVALID_FONT )
|
||||
return;
|
||||
@@ -749,8 +749,8 @@ void CFontManager::GetKernedCharWidth( vgui::HFont font, wchar_t ch, wchar_t chB
|
||||
|
||||
if ( m_FontAmalgams[font].GetFontForChar( chAfter ) != pFont )
|
||||
chAfter = 0;
|
||||
|
||||
#if defined(LINUX)
|
||||
|
||||
#if defined(LINUX) || defined(OSX)
|
||||
pFont->GetKernedCharWidth( ch, chBefore, chAfter, wide, flabcA, flabcC );
|
||||
#else
|
||||
pFont->GetKernedCharWidth( ch, chBefore, chAfter, wide, flabcA );
|
||||
|
||||
@@ -12,7 +12,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#ifdef OSX
|
||||
#include <malloc/malloc.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#include <tier0/dbg.h>
|
||||
#include <vgui/ISurface.h>
|
||||
#include <utlbuffer.h>
|
||||
@@ -42,8 +46,6 @@ inline int32_t INT_2FIXED6(int32_t x) { return x << 6; }
|
||||
bool CLinuxFont::ms_bSetFriendlyNameCacheLessFunc = false;
|
||||
CUtlRBTree< CLinuxFont::font_name_entry > CLinuxFont::m_FriendlyNameCache;
|
||||
|
||||
#define ANDROID 1
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Constructor
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -168,44 +170,40 @@ void CLinuxFont::CreateFontList()
|
||||
}
|
||||
|
||||
#ifndef ANDROID
|
||||
static FcPattern* FontMatch(const char* type, FcType vtype, const void* value,
|
||||
...)
|
||||
static FcPattern* FontMatch(const char* type, ...)
|
||||
{
|
||||
FcValue fcvalue;
|
||||
va_list ap;
|
||||
va_start(ap, value);
|
||||
va_start(ap, type);
|
||||
|
||||
FcPattern* pattern = FcPatternCreate();
|
||||
|
||||
for (;;)
|
||||
{
|
||||
FcValue fcvalue;
|
||||
fcvalue.type = vtype;
|
||||
switch (vtype) {
|
||||
for (;;) {
|
||||
// FcType is promoted to int when passed through ...
|
||||
fcvalue.type = static_cast<FcType>(va_arg(ap, int));
|
||||
switch (fcvalue.type) {
|
||||
case FcTypeString:
|
||||
fcvalue.u.s = (FcChar8*) value;
|
||||
fcvalue.u.s = va_arg(ap, const FcChar8 *);
|
||||
break;
|
||||
case FcTypeInteger:
|
||||
fcvalue.u.i = (int) value;
|
||||
fcvalue.u.i = va_arg(ap, int);
|
||||
break;
|
||||
default:
|
||||
Assert(!"FontMatch unhandled type");
|
||||
}
|
||||
FcPatternAdd(pattern, type, fcvalue, 0);
|
||||
FcPatternAdd(pattern, type, fcvalue, FcFalse);
|
||||
|
||||
type = va_arg(ap, const char *);
|
||||
if (!type)
|
||||
break;
|
||||
// FcType is promoted to int when passed through ...
|
||||
vtype = static_cast<FcType>(va_arg(ap, int));
|
||||
value = va_arg(ap, const void *);
|
||||
};
|
||||
va_end(ap);
|
||||
|
||||
FcConfigSubstitute(0, pattern, FcMatchPattern);
|
||||
FcConfigSubstitute(NULL, pattern, FcMatchPattern);
|
||||
FcDefaultSubstitute(pattern);
|
||||
|
||||
FcResult result;
|
||||
FcPattern* match = FcFontMatch(0, pattern, &result);
|
||||
FcPattern* match = FcFontMatch(NULL, pattern, &result);
|
||||
FcPatternDestroy(pattern);
|
||||
|
||||
return match;
|
||||
|
||||
Reference in New Issue
Block a user