215 FT_Init_FreeType(&freetypeData->
library);
238 newFreetype->fontData = file.readAll();
243 if (!newFreetype->fontData.isEmpty()) {
244 if (FT_New_Memory_Face(freetypeData->
library, (
const FT_Byte *)newFreetype->fontData.constData(), newFreetype->fontData.size(), face_id.
index, &
face)) {
250 newFreetype->face =
face;
254 newFreetype->ref = 1;
255 newFreetype->xsize = 0;
256 newFreetype->ysize = 0;
257 newFreetype->matrix.xx = 0x10000;
258 newFreetype->matrix.yy = 0x10000;
259 newFreetype->matrix.xy = 0;
260 newFreetype->matrix.yx = 0;
261 newFreetype->unicode_map = 0;
262 newFreetype->symbol_map = 0;
263 #ifndef QT_NO_FONTCONFIG 264 newFreetype->charset = 0;
267 memset(newFreetype->cmapCache, 0,
sizeof(newFreetype->cmapCache));
269 for (
int i = 0; i < newFreetype->face->num_charmaps; ++i) {
270 FT_CharMap cm = newFreetype->face->charmaps[i];
271 switch(cm->encoding) {
272 case FT_ENCODING_UNICODE:
273 newFreetype->unicode_map = cm;
275 case FT_ENCODING_APPLE_ROMAN:
276 case FT_ENCODING_ADOBE_LATIN_1:
277 if (!newFreetype->unicode_map || newFreetype->unicode_map->encoding != FT_ENCODING_UNICODE)
278 newFreetype->unicode_map = cm;
280 case FT_ENCODING_ADOBE_CUSTOM:
281 case FT_ENCODING_MS_SYMBOL:
282 if (!newFreetype->symbol_map)
283 newFreetype->symbol_map = cm;
290 if (!FT_IS_SCALABLE(newFreetype->face) && newFreetype->face->num_fixed_sizes == 1)
291 FT_Set_Char_Size (face,
X_SIZE(newFreetype->face, 0),
Y_SIZE(newFreetype->face, 0), 0, 0);
294 FcPatternGetString(pattern, FC_FAMILY, 0, &name);
295 qDebug(
"%s: using maps: default: %x unicode: %x, symbol: %x", name,
296 newFreetype->face->charmap ? newFreetype->face->charmap->encoding : 0,
297 newFreetype->unicode_map ? newFreetype->unicode_map->encoding : 0,
298 newFreetype->symbol_map ? newFreetype->symbol_map->encoding : 0);
300 for (
int i = 0; i < 256; i += 8)
301 qDebug(
" %x: %d %d %d %d %d %d %d %d", i,
302 FcCharSetHasChar(newFreetype->charset, i), FcCharSetHasChar(newFreetype->charset, i),
303 FcCharSetHasChar(newFreetype->charset, i), FcCharSetHasChar(newFreetype->charset, i),
304 FcCharSetHasChar(newFreetype->charset, i), FcCharSetHasChar(newFreetype->charset, i),
305 FcCharSetHasChar(newFreetype->charset, i), FcCharSetHasChar(newFreetype->charset, i));
308 FT_Set_Charmap(newFreetype->face, newFreetype->unicode_map);
310 freetypeData->
faces.
insert(face_id, newFreetype.data());
312 newFreetype.take()->release(face_id);
316 freetype = newFreetype.take();
Q_GUI_EXPORT QByteArray qt_fontdata_from_index(int index)
static HB_Error hb_getSFntTable(void *font, HB_Tag tableTag, HB_Byte *buffer, HB_UInt *length)
The QByteArray class provides an array of bytes.
bool ref()
Atomically increments the value of this QAtomicInt.
bool startsWith(const QByteArray &a) const
Returns true if this byte array starts with byte array ba; otherwise returns false.
const T value(const Key &key) const
Returns the value associated with the key.
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Q_CORE_EXPORT void qDebug(const char *,...)
struct FT_FaceRec_ * FT_Face
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
QtFreetypeData * qt_getFreetypeData()
HB_Face qHBNewFace(void *font, HB_GetFontTableFunc tableFunc)
The QFile class provides an interface for reading from and writing to files.
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
QByteArray & remove(int index, int len)
Removes len bytes from the array, starting at index position pos, and returns a reference to the arra...
QHash< QFontEngine::FaceId, QFreetypeFace * > faces