Hi D.J.Peters
I did recompile FBImage-src on Raspberry PI 3. (I can send .a file you if you want).
make.sh
Code: Select all
gcc -c -o FBTrueType.o FBTrueType.c
ar rcs libFBTrueType-armv7a-hf-static.a FBTrueType.o
rm FBTrueType.o
and I changed the code in FBTrueType.bi which makes selection of Library depending on architecture
FBTrueType.bi
Code: Select all
#ifndef __FBTrueType_bi__
#define __FBTrueType_bi__
#include once "crt.bi"
#ifdef __FB_WIN32__
# libpath "lib/win"
#Ifdef __FB_64BIT__
# inclib "FBTrueType-64-static"
#Else
# inclib "FBTrueType-32-static"
#EndIf
#EndIf
#ifdef __FB_LINUX__
# libpath "lib/lin"
#Ifdef __FB_64BIT__
# inclib "FBTrueType-64-static"
#Else
#ifdef __FB_ARM__
# inclib "FBTrueType-armv7a-hf-static"
#Else
# inclib "FBTrueType-32-static"
#EndIf
#EndIf
#endif
' error codes (<0) returned by FontLoad()
#define FONT_NOT_LOADED (-1)
#define FONT_NOT_SUPPORTED (-2)
' maximal 64 font ids can be used at once (should be enough)
#define NO_FREE_FONTID (-3)
' error code if a font id are not legal (not in range of 0-63 or font was not loaded before)
#define WRONG_FONTID (-4)
' error code if a value are out of range (e.g. pixelheight <=0 ...)
#define WRONG_VALUE (-5)
' error code if a unicode char was not found in font
#define GLYPH_NOT_FOUND (-6)
function ErrorText(byval errcode as long) as string
select case errcode
case FONT_NOT_LOADED : return "font not loaded"
case FONT_NOT_SUPPORTED : return "font not supported"
case NO_FREE_FONTID : return "no free font id (64 fonts in use)"
case WRONG_FONTID : return "font id is illegal"
case WRONG_VALUE : return "wrong value (parameter out of range)"
case GLYPH_NOT_FOUND : return "no glyph for unicode in font"
case else : return "no error"
end select
end function
' font properties
type FontProps
as single scale
as long advanceHeight ' space to the next cursor y position (ascent - descent + linegap)
as long ascent ' the space between base line to top of the font
as long descent ' space from bottom of the font to base line (negativ)
as long linegap ' space from bottom of the font to next font top line
end type
' glyph properties
type GlyphProps
as long advanceWidth ' the space to the next cursor x position
as long kernAdvance ' the kerning can be added to advanceWidth if the glyph has a neighbor glyph
as long leftSideBearing ' the space from current x position to the most left of the glyph
as long y ' the absolute y position of the glyph (from font ascent)
as long w,h ' width and height of the visibe part of the glyph
end type
extern "C"
' init the library and prepare 64 font id's (it's not strictly required)
declare sub FontInit()
' free all loaded fonts at once (not strictly required)
declare sub FontDestroy()
' ########
' # Font #
' ########
' load a *.ttf file from memory (returns a new font id or error code)
declare function FontCopy(byval filedata as any ptr) as long
' load a *.ttf file from filesystem (returns a new font id or error code)
declare function FontLoad(byval filename as const zstring ptr) as long
' free a loaded font (mark the font ID as illegal WRONG_FONTID)
declare sub FontFree(byref font as long)
' get the bounding box of all possible characters (return 0 on success or error code)
declare function FontBoundingBox(byval font as long,byref x0 as long,byref y0 as long,byref x1 as long,byref y1 as long) as long
' get font properties based on height in pixels (return 0 on success or error code)
declare function FontPorperties(byval font as long, byval HeightInPixel as long, byref pops as FontProps) as long
' #########
' # Glyph #
' #########
' get glyph index return the glyph position inside the font
declare function GlyphIndex(byval font as long, byval char as long) as long
' returns true if the glyph has a renderable shape
declare function GlyphHasShape(byval font as long, byval gindex as long) as boolean
' get the bounding box of the visible shape of a glyph (return 0 on success or error code)
declare function GlyphBoundingBox(byval font as long, byval glyphIndex as long, byref x0 as long, byref y0 as long, byref x1 as long, byref y1 as long) as long
' get glyph properties based on glyph index 1 and optional the neighbor glyph index 2
' fill the glypprops members (return 0 on success or error code)
declare function GlyphProperties(byval font as long, byref fProps as const FontProps, byref gProps as GlyphProps, byval glyphIndex1 as long, byval glyphIndex2 as long=0) as long
' render the glyph antialias return a 8-bit FBGFX image or NULL on error
declare function GlyphImageCreate(byval font as long, byref fProps as const FontProps, byref gProps as const GlyphProps,byval glyphindex as long) as any ptr
' you can use ImageDestroy also
declare sub GlyphImageDestroy(byref img as any ptr)
end extern
#endif ' __FBTrueType_bi__
I tested it on:
Intel:
Windows 10 64-bit gcc32
Windows 10 64-bit gcc64
Windows 10 64-bit GAS32
Ubuntu 16.10 64-bit gcc64
ARM:
Ubumtu Mate 16.04 armv7a-hf RPI3 gcc
I think it will work on all armv7a-hf machines.
I plan to test tegra2 (Toshiba ac100 and Asus tf101)