freetype2

Why is FT_Load_Char giving me a garbage glyph bitmap?

末鹿安然 提交于 2021-02-10 18:42:43
问题 When I call FT_Load_Char, the glyph slot of the font face has garbage data for the bitmap, which changes every time the program is run. I've ensured that FT_Init_FreeType and FT_New_Face are returning successfully. I've set the pixel size with FT_Set_Pixel_Sizes(face, 0, 48). The FT_Load_Char function is being called with FT_LOAD_RENDER and is returning successfully. I've also tried downloading the source code for freetype2 and building it myself just in case the pacman distribution of it

How do I use a preprocessor macro inside an include?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-04 12:22:06
问题 I am trying to build freetype2 using my own build system (I do not want to use Jam, and I am prepared to put the time into figuring it out). I found something odd in the headers. Freetype defines macros like this: #define FT_CID_H <freetype/ftcid.h> and then uses them later like this: #include FT_CID_H I didn't think that this was possible, and indeed Clang 3.9.1 complains: error: expected "FILENAME" or <FILENAME> #include FT_CID_H What is the rationale behind these macros? Is this valid C/C+

PHP Fatal error: Call to undefined function imagettftext()

自古美人都是妖i 提交于 2020-01-09 06:51:48
问题 Why am I getting the error PHP Fatal error: Call to undefined function imagettftext() on line 29? <?php ob_start(); session_start(); $strings = '123456789'; $i = 0; $characters = 6; $code = ''; while ($i < $characters) { $code .= substr($strings, mt_rand(0, strlen($strings)-1), 1); $i++; } $_SESSION['captcha'] = $code; //generate image $im = imagecreatetruecolor(124, 40); $foreground = imagecolorallocate($im, 0, 0, 0); $shadow = imagecolorallocate($im, 173, 172, 168); $background =

Error 'module' object has no attribute 'freetype'

喜夏-厌秋 提交于 2020-01-04 13:48:50
问题 I am using this code Link but it displays error of module object has no attribute i tried to pip install freetype but nothing happened. Can anyone please guide me with this. import cv2 import numpy as np img = np.zeros((100, 300, 3), dtype=np.uint8) ft = cv2.freetype.createFreeType2() ft.loadFontData(fontFileName='Ubuntu-R.ttf', id=0) ft.putText(img=img, text='Quick Fox', org=(15, 70), fontHeight=60, color=(255, 255, 255), thickness=-1, line_type=cv2.LINE_AA, bottomLeftOrigin=True) cv2

unsigned char* buffer to System::Drawing::Bitmap

左心房为你撑大大i 提交于 2020-01-01 06:27:07
问题 I'm trying to create a tool/asset converter that rasterises a font to a texture page for an XNA game using the FreeType2 engine. Below, the first image is the direct output from the FreeType2]1 engine. The second image is the result after attempting to convert it to a System::Drawing::Bitmap . target http://www.freeimagehosting.net/uploads/fb102ee6da.jpg currentresult http://www.freeimagehosting.net/uploads/9ea77fa307.jpg Any hints/tips/ideas on what is going on here would be greatly

Why does num_glyphs not match the number of glyphs enumerated by FT_Get_First_Char / FT_Get_Next_Char

大憨熊 提交于 2019-12-24 23:17:23
问题 Consider the following example. It uses freetype (through a python wrapper) to load a font and then counts the glyphs . import freetype as FT f = FT.Face('/usr/share/fonts/truetype/Hack-Regular.ttf') f.num_glyphs # 1573 len([*f.get_chars()]) # 1549 As you can see the number obtained by counting does not match the number reported by the library when asked directly. Why? Note: Knowledge of the python wrapper shouldn't be necessary to address this question. The python functions used here are

Freetype FT_Request_Size() crashes on Android

杀马特。学长 韩版系。学妹 提交于 2019-12-23 03:13:00
问题 I've compiled freetype 2.4.2 on android and any time I try to use FT_Set_Char_Size() it will crash in the ftobjs.c file in the FT_Request_Size() function at this line error = clazz->request_size( face->size, req ); //line 2832 My code works perfectly fine on Windows, Linux, Mac, IPhone and IPad. But here is the deal. I was having the exact same issue, same crash at the same spot on Windows (vc++) until I compiled freetype with /Za "Disable Language Extensions". So I'm pretty sure it's how

Location of the fonts on the iPhone?

╄→гoц情女王★ 提交于 2019-12-21 17:39:27
问题 I'm using the FreeType2 library in an iPhone project, and I'm trying to simply load a TTF file from the system, if possible. FT_Library library; FT_Face face; int error; error = FT_Init_FreeType( &library ); if ( error == 0 ) printf("Initialized FreeType2\r\n"); /* Prints */ error = FT_New_Face(library, "/System/Library/Fonts/Helvetica.ttf", 0, &face); if ( error == FT_Err_Cannot_Open_Resource ) printf("Font not found\r\n"); /* Prints */ That error seems to be for file not found. Is /System

Cannot get the kerning of some specific .ttf fonts with freetype

不想你离开。 提交于 2019-12-21 09:35:05
问题 I am trying to extract kerning information out of some .ttf fonts with freetype 2.6 library. This is how I get kerning informations (looping through characters): if( FT_HAS_KERNING(face->getFace()) && previous ){ FT_Vector delta; FT_UInt glyph_index = FT_Get_Char_Index( face->getFace(), character ); FT_UInt prev_index = FT_Get_Char_Index( face->getFace(), previous ); FT_Get_Kerning( face->getFace(), prev_index, glyph_index, FT_KERNING_DEFAULT, &delta ); kerning = delta.x >> 6; } I tried the

Problem compiling freetype2 with MinGW/MSYS

痞子三分冷 提交于 2019-12-19 03:18:13
问题 There seems to be a problem compiling freetype2 with MinGW and MSYS My attempts on a clean copy of the freetype source, and an unadulterated MinGW and MSYS give: Andrew@MCARDLE-PC ~/documents/code $ cd freetype-2.3.11 Andrew@MCARDLE-PC ~/documents/code/freetype-2.3.11 $ ./configure FreeType build system -- automatic system detection The following settings are used: platform unix compiler cc configuration directory ./builds/unix configuration rules ./builds/unix/unix.mk If this does not