bool ServerFont::operator==(const ServerFont& other) const { if (GetFamilyAndStyle() != other.GetFamilyAndStyle()) return false; return fSize == other.fSize && fRotation == other.fRotation && fShear == other.fShear && fFalseBoldWidth == other.fFalseBoldWidth && fFlags == other.fFlags && fSpacing == other.fSpacing && fEncoding == other.fEncoding && fBounds == other.fBounds && fDirection == other.fDirection && fFace == other.fFace; }
status_t FFont::Flatten(void *buffer, ssize_t size) const { if( size < sizeof(flat_font_data) ) return B_BAD_VALUE; // Easy reference to the buffer. flat_font_data* fdat = (flat_font_data*)buffer; memset(fdat,0,sizeof(*fdat)); // Stash away name of family and style. GetFamilyAndStyle(&fdat->family,&fdat->style); // This is used as a temporary when byte-swapping floats. // Note that we are assuming a float is 4 bytes. union { uint32 aslong; float asfloat; } swap; // Byte-swap size, shear, and rotation into the flattened // structure. This is written for clarity more than speed, // since the additional overhead will be entirely subsumed // by everything else going on. swap.asfloat = Size(); swap.aslong = htonl(swap.aslong); fdat->size = swap.asfloat; swap.asfloat = Shear(); swap.aslong = htonl(swap.aslong); fdat->shear = swap.asfloat; swap.asfloat = Rotation(); swap.aslong = htonl(swap.aslong); fdat->rotation = swap.asfloat; // Byte-swap the remaining data into the flattened structure. fdat->flags = htonl(Flags()); fdat->face = htons(Face()); fdat->spacing = Spacing(); fdat->encoding = Encoding(); fdat->mask = htonl(Mask()); return B_NO_ERROR; }