/*************************************************************** ** (c)2009 Broadcom Corporation ** ** This program is the proprietary software of Broadcom Corporation and/or its licensors, ** and may only be used, duplicated, modified or distributed pursuant to the terms and ** conditions of a separate, written license agreement executed between you and Broadcom ** (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants ** no license (express or implied), right to use, or waiver of any kind with respect to the ** Software, and Broadcom expressly reserves all rights in and to the Software and all ** intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU ** HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY ** NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. ** ** Except as expressly set forth in the Authorized License, ** ** 1. This program, including its structure, sequence and organization, constitutes the valuable trade ** secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, ** and to use this information only in connection with your use of Broadcom integrated circuit products. ** ** 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" ** AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR ** WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO ** THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES ** OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, ** LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION ** OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF ** USE OR PERFORMANCE OF THE SOFTWARE. ** ** 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS ** LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR ** EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR ** USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF ** THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT ** ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE ** LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ** ANY LIMITED REMEDY. ** ** Created: 8/22/2002 by Jeffrey P. Fisher ** ** $brcm_Workfile: bgfx_font.h $ ** $brcm_Revision: Refsw_7550/2 $ ** $brcm_Date: 9/25/09 12:54p $ ** ** Revision History: ** ** $brcm_Log: /nexus/lib/softgfx/src/bgfx_font.h $ ** ** Refsw_7550/2 9/25/09 12:54p kagrawal ** SW7550-50: Performance optimized gfx from 7003 latest ** ** Refsw_7550/1 9/7/09 5:04p kagrawal ** SW7550-3: Initial check-in for Soft Graphics ** ****************************************************************/ #ifndef __sgil_font_h__ #define __sgil_font_h__ #include "bgfx_types.h" /* Uncomment to build with freetype support */ /* #define CONFIG_FREETYPE */ #ifdef CONFIG_FREETYPE #include #include #endif /* CONFIG_FREETYPE */ /* * Definitions */ /* * font flags */ #define SGL_MONO (1 << 0) #define SGL_CACHE_GLYPHS (1 << 1) #define SGL_PRELOAD_GLYPHS (1 << 2) #ifdef __cplusplus extern "C" { #endif /**************************************************************** * Initialize global font management structures. * Called by sgil_init. ****************************************************************/ int bgfx_font_init(void); /**************************************************************** * Cleanup global font management structures. * Called by sgil_done. ****************************************************************/ void bgfx_font_done(void); /**************************************************************** * Create a new font give an typeface name and size. * The font_p should be a pointer to an allocated * but uninitialized bgfx_font_t structure. The typeface must be * a valid full path name to the font file. Valid flags can be any * combination of SGL_MONO,SGL_CACHE_GLYPHS and SGL_PRELOAD_GLYPHS * REQUIRES FREETYPE SUPPORT ****************************************************************/ int bgfx_new_font( bgfx_font_t *font_p, /* reference to allocated uninitialized bgfx_font_t structure */ const char *typeface_name, /* full path name of the typeface file */ unsigned char height, /* font size in pixels */ unsigned long flags /* font format and handling flags */ ); /**************************************************************** * Free all resources associated with the font * It is important to free fonts when done using them to return memory * resources consumed by the font cache and Freetype. ****************************************************************/ void bgfx_free_font( bgfx_font_t *font_p /* reference to initialized bgfx_font_t structure */ ); /**************************************************************** * Get a glyph from the glyph cache if it exists or by rendering it * with Freetype * The font_p should be a pointer to an initialized bgfx_font_t structure. * Called internally by sgil. ****************************************************************/ bgfx_glyph_t *bgfx_get_glyph(bgfx_font_t *font_p, /* reference to initialized bgfx_font_t structure */ unsigned long a_char /* 32-bit unicode character */ ); /**************************************************************** * Calculate the width and height of the null terminated string. * Calculate the bounding rectangle for the null terminated string. ****************************************************************/ void bgfx_string_info(bgfx_font_t *font_p, /* initialized font structure */ const unsigned long *str_p, /* array of single 32-bit unicode characters */ int str_len, /* number of 32-bit characters in string */ int *w, /* width in pixels */ int *h /* height in pixels */ ); /**************************************************************** * Load the entire set of font info and glyph cache from a file. * The file must have been produced by the bgfx_save_font function. * This is the only way to draw text when there is no * Freetype support. ****************************************************************/ int bgfx_load_font(bgfx_font_t *font_p, /* reference to initialized bgfx_font_t structure */ void *file_p /* open initialized file pointer to read font from */ ); /**************************************************************** * External function required to load SGIL bitmap font files. ****************************************************************/ extern long bgfx_read(void *buffer, long size, long count, void *fp ); /**************************************************************** * External functions to lock and unlock access to global data structures * Required for freetype support only ****************************************************************/ #ifdef CONFIG_FREETYPE extern void bgfx_lock(void); extern void bgfx_unlock(void); #endif /* CONFIG_FREETYPE */ #ifdef __cplusplus } #endif #endif /* __sgil_font_h__ */