HPDF_FontDef
HPDF_Type1FontDef_Load  (HPDF_MMgr         mmgr,
                         HPDF_Stream       afm,
                         HPDF_Stream       font_data)
{
    HPDF_FontDef fontdef;
    HPDF_STATUS ret;

    HPDF_PTRACE (" HPDF_Type1FontDef_Load\n");

    if (!afm)
        return NULL;

    fontdef = HPDF_Type1FontDef_New (mmgr);

    if (!fontdef)
        return NULL;

    ret = LoadAfm (fontdef, afm);
    if (ret != HPDF_OK) {
        HPDF_FontDef_Free (fontdef);
        return NULL;
    }

    /* if font-data is specified, the font data is embeded */
    if (font_data) {
        ret = LoadFontData (fontdef, font_data);
        if (ret != HPDF_OK) {
            HPDF_FontDef_Free (fontdef);
            return NULL;
        }
    }

    return fontdef;
}
Beispiel #2
0
void CGuiFont::Initialize( string _fontDataFile, string _fontTextureFile )
{
	// Load in the text file containing the font data.
	LoadFontData( _fontDataFile );

	// Load the texture that has the font characters on it.
	uint32 result = m_material.SetDiffuse( _fontTextureFile );
	if(result != 0)
	{
		// Debug
	}
}
Beispiel #3
0
bool FontClass::Initialize(ID3D11Device* device, char* fontFilename, WCHAR* textureFilename)
{
	bool result;

	// Load in the text file containing the font data.
	result = LoadFontData(fontFilename);
	if (!result)
		return false;

	// Load the texture that has the font characters on it.
	result = LoadTexture(device, textureFilename);
	if (!result)
		return false;

	return true;
}
bool FontClass::Initialize(ID3D11Device* device, char* fontFilename, WCHAR* texutreFilename)
{
    bool result;

    result = LoadFontData(fontFilename);
    if (!result)
    {
        return false;
    }

    result = LoadTexture(device, texutreFilename);
    if (!result)
    {
        return false;
    }
    return true;
}
Beispiel #5
0
BOOL ClMsgWnd::InitMessageParts()
{
	LoadFontData();
	msgFrame.loadLGF(pack_gparts,"msgWndMain");
	msgWait.loadLGF(pack_gparts,"msgWait");
	nameFrame.loadLGF(pack_gparts,"nameFrame");
	offset.x = 0;
	offset.y = 422;
	msgPlate.createColorBuf(msgWndWidth,msgWndHeight,32,FALSE);
	FillMemory(msgPlate.pBuf,msgPlate.wPitch*msgPlate.height,0xff);	
	namePlate.createColorBuf(168,32,32,FALSE);
	FillMemory(namePlate.pBuf,namePlate.wPitch*namePlate.height,0xff);	
	namePlate.alpha = 0;
	MsgCLS();
	msgPlate.offset.x = 20;	msgPlate.offset.y = 26;
	return TRUE;
} // ClMsgWnd::InitMessageParts
bool FontHandler::Init(ID3D11Device* device, char* fontFilename, WCHAR* textureFilename)
{
	bool result;


	// Load in text file containing font data.
	result = LoadFontData(fontFilename);
	if(!result)
	{
		return false;
	}

	// Load texture that has font characters on it.
	result = LoadTexture(device, textureFilename);
	if(!result)
	{
		return false;
	}

	return true;
}
Beispiel #7
0
bool BMFont::Init(MAHandle fontResource, std::vector<MAHandle> &textureResources)
{
	// Load in the text file containing the font data.
	bool result = LoadFontData(fontResource);	// with its font specific data. (see BM font for more format info) use first example for now

	lprintfln("Info: BMFont::Init => load Font Textures %i (%i)",m_common.m_pages,(int)textureResources.size());

	if(result == false)
	{
		lprintfln("Error: BMFont::Init => load failed = %i",result);
		return false;
	}

	if (m_common.m_pages > (int)textureResources.size())
	{
		lprintfln("Error: BMFont::Init => pages=%i > amount of texture resources:%i",m_common.m_pages, (int)textureResources.size());
		return false;
	}

	// Load the texture that has the font characters on it.
	for(int i=0; i<m_common.m_pages; i++)
	{
		GLuint texHandle = CreateTexture(textureResources[i]);

		if (((int)texHandle) < 0)
		{
			lprintfln("Error: BMFont::Init => Invalid 2D Image err=%i",texHandle);
			return false;
		}
		else
		{
			lprintfln("Info: BMFont::Init Texture = %d => TexHandle = %x loaded", i, texHandle);
		}
		TextureStore t;
		t.m_texture = texHandle;
		m_texStores.push_back(t);
	}
	return true;
}
Beispiel #8
0
/*!***************************************************************************
	@Function			SetTextures
	@Input				pContext		Context
	@Input				pTexData		User-provided font texture
	@Input				uiDataSize		Size of the data provided
	@Input				dwScreenX		Screen resolution along X
	@Input				dwScreenY		Screen resolution along Y
	@Input				bRotate			Rotate print3D by 90 degrees
	@Input				bMakeCopy		This instance of Print3D creates a copy
										of it's data instead of sharing with previous
										contexts. Set this parameter if you require
										thread safety.	
	@Return			PVR_SUCCESS or PVR_FAIL
	@Description		Initialization and texture upload of user-provided font 
					data. Should be called only once for a Print3D object.
*****************************************************************************/
EPVRTError CPVRTPrint3D::SetTextures(
	const SPVRTContext	* const pContext,
	const void * const pTexData,
	const unsigned int	dwScreenX,
	const unsigned int	dwScreenY,
	const bool bRotate,
	const bool bMakeCopy)
{
	#if !defined (DISABLE_PRINT3D)

	unsigned short	i;
	bool			bStatus;

	// Set the aspect ratio, so we can change it without updating textures or anything else
	float fX, fY;

	m_bRotate = bRotate;
	m_ui32ScreenDim[0] = bRotate ? dwScreenY : dwScreenX;
	m_ui32ScreenDim[1] = bRotate ? dwScreenX : dwScreenY;

	// Alter the X, Y resolutions if the screen isn't portrait.
	if(dwScreenX > dwScreenY)
	{
		fX = (float) dwScreenX;
		fY = (float) dwScreenY;
	}
	else
	{
		fX = (float) dwScreenY;
		fY = (float) dwScreenX;
	}

	m_fScreenScale[0] = (bRotate ? fY : fX) /640.0f;
	m_fScreenScale[1] = (bRotate ? fX : fY) /480.0f;

	// Check whether textures are already set up just in case
	if (m_bTexturesSet)
		return PVR_SUCCESS;

	if(!APIInit(pContext, bMakeCopy))
		return PVR_FAIL;

	/*
		This is the texture with the fonts.
	*/
	PVRTextureHeaderV3 header;
	CPVRTMap<PVRTuint32, CPVRTMap<PVRTuint32, MetaDataBlock> > MetaDataMap;
	bStatus = APIUpLoadTexture((unsigned char *)pTexData, &header, MetaDataMap);
	if (!bStatus) return PVR_FAIL;

	/*
		This is the associated font data with the default font
	*/
	bStatus = LoadFontData(&header, MetaDataMap);
	if (!bStatus) return PVR_FAIL;

	// INDEX BUFFERS
	m_pwFacesFont = (unsigned short*)malloc(PVRTPRINT3D_MAX_RENDERABLE_LETTERS*2*3*sizeof(unsigned short));

	if(!m_pwFacesFont)
		return PVR_FAIL;

	bStatus = APIUpLoadIcons(PVRTPrint3DIMGLogo);
	if (!bStatus) return PVR_FAIL;

	// Vertex indices for letters
	for (i=0; i < PVRTPRINT3D_MAX_RENDERABLE_LETTERS; i++)
	{
		m_pwFacesFont[i*6+0] = 0+i*4;
		m_pwFacesFont[i*6+1] = 3+i*4;
		m_pwFacesFont[i*6+2] = 1+i*4;

		m_pwFacesFont[i*6+3] = 3+i*4;
		m_pwFacesFont[i*6+4] = 0+i*4;
		m_pwFacesFont[i*6+5] = 2+i*4;
	}

	m_nVtxCacheMax = MIN_CACHED_VTX;
	m_pVtxCache = (SPVRTPrint3DAPIVertex*)malloc(m_nVtxCacheMax * sizeof(*m_pVtxCache));
	m_nVtxCache = 0;

	if(!m_pVtxCache)
	{
		return PVR_FAIL;
	}

	// Everything is OK
	m_bTexturesSet = true;

	// Return Success
	return PVR_SUCCESS;

#else
	return PVR_SUCCESS;
#endif
}
Beispiel #9
0
//--------------------------------------------------------------------------------------
// Initialises the font.
// Param1: The device that should be used to initialise the font.
// Param2: The filename, or path, to the file containing the font data.
// Param3: The filename, or path, to the font texture to be used with this font object.
// Returns true if the font was initialised successfully, false otherwise.
//--------------------------------------------------------------------------------------
bool Font::Initialise(ID3D11Device* pDevice, const std::string& dataFileName, LPCWSTR textureFilename)
{
	// Load the font data and texture
	return(LoadFontData(dataFileName) && LoadFontTexture(pDevice, textureFilename));
}