标题: border_pixels! [打印本页] 作者: Alex 时间: 2013-11-9 13:46:07 标题: border_pixels!
Is there way that we can do a border pixels?
like convert text to shape (border only), after that convert border shape to pixel ?
so after that we can get a border pixel only ?作者: saiyaku 时间: 2013-11-9 17:10:39
## Initialize a font and retrieves a PIX of the specified text from the font.
# @param font_file a string, filename of the target font file
# @param face_id an integer, font face id, should always be 1 in TTF files
# @param font_size an integer, font size, in em height
# @param spacing an integer, spacing between texts, can be negative
# @param space_scale a float, scale of white spaces
# @param color an integer, rgb color of the font
# @param bord an integer, border of the font, can be negative
# @param is_outline an integer, 0 - include body, 1 - only retrieve the outline
# @param text a string, the text that is going to generate a PIX
# @return PIX the target PIX
def TextPix(font_file, face_id, font_size, spacing, space_scale, color, bord, is_outline, text):
## Retrieve a PIX of the specified text from a font.
# @param font a handler, the handler to the font
# @param text a string, the text that is going to generate a PIX
# @return PIX the target PIX
def TextPix(font, text):
## Get text outline points. (outline curve to points in order)
# @param font_file a string, filename of the target font file
# @param face_id an integer, font face id, should always be 1 in TTF files
# @param font_size an integer, font size, in em height
# @param text a string, the text of which the outline will be retrieved
# @param density a float, the density of points that we want to have, 1.0 is commonly used, however it can be less or larger than 1 according to the need
# @return ((x1, y1), (x2, y2), ...)
def TextOutlinePoints(font_file, face_id, font_size, text, density):
## Get text outline points.
# @param font a handler, the handler to the font
# @param text a string, the text of which the outline will be retrieved
# @param density a float, the density of points that we want to have, 1.0 is commonly used, however it can be less or larger than 1 according to the need
# @return ((x1, y1), (x2, y2), ...)
def TextOutlinePoints(pyFont, text, density):作者: Alex 时间: 2013-11-12 14:14:42
hmmm. I didn't get you
do I have to focus what written in red color?作者: milkyjing 时间: 2013-11-12 22:43:25
Alex 发表于 2013-11-12 14:14
hmmm. I didn't get you
do I have to focus what written in red color?
yes, focus on the text in red, indeed, there are two kinds of functions, to get a PIX structure that only contain the boarder pixels, the other, get points of the boarder.
below is a demo of usage of TextOutlinePoints.
from tcaxPy import *
def tcaxPy_Init():
global _Fs
global Font
_Fs = GetVal(val_FontSize)
Font = InitFont(GetVal(val_FontFileName), GetVal(val_FaceID), _Fs, GetVal(val_Spacing), GetVal(val_SpaceScale), 0xFFFFFF, 0, 0)