/** Copyright 2013-2019 Haiku, Inc. All rights reserved.* Distributed under the terms of the MIT License.** Authors:* John Scipione, jscipione@gmail.com** Corresponds to:* headers/os/interface/Font.h hrev52784* src/kits/interface/Font.cpp hrev52784*//*!\file Font.h\ingroup interface\ingroup libbe\brief BFont class definition, unicode_block class definition, andfont-related struct and enum definitions.*//*!\var B_CHAR_SPACINGPosition each character without adjustment. Best mode for printing.\since BeOS R3*//*!\var B_STRING_SPACINGOptimizes the position of each character within its space. Collisionsare unlikely but characters may touch each other. Best mode to use whenthe screen needs to match what appears on the printed page.\since BeOS R3*//*!\var B_BITMAP_SPACINGThe widths of the characters are chosen so that they never collide andrarely touch. Best mode for drawing small amounts of text.\since BeOS R3*//*!\var B_FIXED_SPACINGPositions characters at a constant width. Best mode for fixed-width fonts.\since BeOS R3*//*!\enum font_direction\ingroup interfaceDetermines the direction of the text rendered by the font,left-to-right or right-to-left.\since BeOS R3*//*!\var font_direction B_FONT_LEFT_TO_RIGHTLeft to right.\since BeOS R3*//*!\var font_direction B_FONT_RIGHT_TO_LEFTRight to left.\since BeOS R3*//*!\var B_DISABLE_ANTIALIASINGDisable antialiasing. Used by BFont::Flags() and BFont::SetFlags().\since BeOS R3*//*!\var B_FORCE_ANTIALIASINGForce antialiasing. Used by BFont::Flags() and BFont::SetFlags().\since BeOS R3*//*!\var B_TRUNCATE_ENDTruncate from the end of the string.\since BeOS R3*//*!\var B_TRUNCATE_BEGINNINGTruncate from the beginning of the string.\since BeOS R3*//*!\var B_TRUNCATE_MIDDLETruncate from the middle of the string.\since BeOS R3*//*!\var B_TRUNCATE_SMARTTruncate while keeping each string unique.\since BeOS R3*//*!\var B_UNICODE_UTF8UTF-8 font encoding.\since BeOS R3*//*!\var B_ISO_8859_1ISO 8859-1 aka Latin 1 "Western European" font encoding.\since BeOS R3*//*!\var B_ISO_8859_2ISO 8859-2 aka Latin 2 "Eastern European" font encoding.\since BeOS R3*//*!\var B_ISO_8859_3ISO 8859-3 aka Latin 3 "South European" font encoding.\since BeOS R3*//*!\var B_ISO_8859_4ISO 8859-4 aka Latin 4 "Northern European" font encoding.\since BeOS R3*//*!\var B_ISO_8859_5ISO 8859-5 "Latin/Cyrillic" font encoding.\since BeOS R3*//*!\var B_ISO_8859_6ISO 8859-6 "Latin/Arabic" font encoding.\since BeOS R3*//*!\var B_ISO_8859_7ISO 8859-7 "Latin/Greek" font encoding.\since BeOS R3*//*!\var B_ISO_8859_8ISO 8859-8 "Latin/Hebrew" font encoding.\since BeOS R3*//*!\var B_ISO_8859_9ISO 8859-9 aka Latin 5 "Latin/Turkish" font encoding.\since BeOS R3*//*!\var B_ISO_8859_10ISO 8859-10 aka Latin 6 "Nordic" font encoding.\since BeOS R3*//*!\var B_MACINTOSH_ROMANMacintosh Roman font encoding.\since BeOS R3*//*!\var B_HAS_TUNED_FONTIndicates that the font has been adjusted to look good on the screen.\since BeOS R4*//*!\var B_IS_FIXEDIndicates that the font is non-proportional.\since BeOS R4*//*!\var B_ITALIC_FACEItalic font face flag.\since BeOS R4*//*!\var B_UNDERSCORE_FACEUnderscore font face flag.\since BeOS R4*//*!\var B_NEGATIVE_FACENegative font face flag.\since BeOS R4*//*!\var B_OUTLINED_FACEOutline font face flag.\since BeOS R4*//*!\var B_STRIKEOUT_FACEStrikeout font face flag.\since BeOS R4*//*!\var B_BOLD_FACEBold font face flag.\since BeOS R4*//*!\var B_REGULAR_FACERegular font face flag.\since BeOS R4*//*!\var B_CONDENSED_FACECondensed font face flag.\since Haiku R1*//*!\var B_LIGHT_FACELight font face flag.\since Haiku R1*//*!\var B_HEAVY_FACEHeavy font face flag.\since Haiku R1*//*!\enum font_metric_modeFont metric mode, screen or printing.\since BeOS R4*//*!\var font_metric_mode B_SCREEN_METRICScreen font metric mode.\since BeOS R4*//*!\var font_metric_mode B_PRINTING_METRICPrinting font metric mode.\since BeOS R4*//*!\enum font_file_format\ingroup interfaceFont file format, TrueTypeโข or PostScriptโข Type1.\see BFont::FileFormat()\since BeOS R4*//*!\var font_file_format B_TRUETYPE_WINDOWSTrueTypeโข font file format.\since BeOS R4*//*!\var font_file_format B_POSTSCRIPT_TYPE1_WINDOWSPostScriptโข Type1 font file format.\since BeOS R4*//*!\class unicode_block\ingroup interface\ingroup libbe\brief Describes the blocks of Unicode characters supported by a font.\see BFont::Blocks()\since BeOS R4*//*!\fn unicode_block::unicode_block()\brief Construct a \c unicode_block and set block data to 0.You must initialize the block data before before using this object.\since BeOS R4*//*!\fn unicode_block::unicode_block(uint64 block2, uint64 block1)\brief Construct a \c unicode_block object and initialize it with thesupplied Unicode block range.\param block2 End block.\param block1 Begin block.\since BeOS R4*//*!\fn bool unicode_block::Includes(const unicode_block& block) const\brief Determines if \a block is a subset of the \c unicode_block object.\param block The Unicode block to check.\returns Whether or not \a block is a subset of the \c unicode_blockobject.\retval true \a block is a subset of the current \c unicode_block.\retval false \a block is NOT a subset of the current \c unicode_block.\since BeOS R4*//*!\name Operators*///! @{/*!\fn unicode_block unicode_block::operator&(const unicode_block& block) const\brief Creates and returns a new \c unicode_block object that is theintersection of \a block and the \c unicode_block object.\param block The Unicode block to intersect with.\returns The intersection of \a block and the \c unicode_block object.\since BeOS R4*//*!\fn unicode_block unicode_block::operator|(const unicode_block& block) const\brief Creates and returns a new \c unicode_block object that is the unionof \a block and the \c unicode_block object.\param block The Unicode block to form a union with.\returns The union of \a block and the \c unicode_block object.\since BeOS R4*//*!\fn unicode_block& unicode_block::operator=(const unicode_block& block)\brief Copies \a block data into the left-hand side object.\param block The unicode block to copy from.\returns A copy of \a block.\since BeOS R4*//*!\fn bool unicode_block::operator==(const unicode_block& block) const\brief Determines if the block object are exactly equal.\param block The unicode block to compare against.\returns \c true if the block object are exactly equal, \c falseotherwise.\since BeOS R4*//*!\fn bool unicode_block::operator!=(const unicode_block& block) const\brief Determines if the block object are not equal.\param block The unicode block to compare against.\returns \c true if the block object are NOT equal, \c falseif the block objects are exactly equal.\since BeOS R4*///! @}/*!\struct edge_info\ingroup interface\ingroup libbe\brief The distance that a character outline is inset from its escapementboundaries.Edge values, like escapements, need to be multiplied by the font size toget the correct value for the font.\see BFont::GetEdges()\since BeOS R3*//*!\var edge_info::leftThe distance that the character outline is inset from the leftescapement boundary.\since BeOS R3*//*!\var edge_info::rightThe distance that the character outline is inset from the rightescapement boundary.\since BeOS R3*//*!\struct font_height\ingroup interface\ingroup libbe\brief The amount of vertical space surrounding a character.\see BFont::GetHeight()\since BeOS R3*//*!\var font_height::ascentThe distance characters can ascend above the baseline.\since BeOS R3*//*!\var font_height::descentThe distance characters can descend below the baseline.\since BeOS R3*//*!\var font_height::leadingThe distance between lines, descent above to ascent below.\since BeOS R3*//*!\struct escapement_delta\ingroup interface\ingroup libbe\brief A struct that allows you to specify extra horizontal space to surroundeach character with.Escapements need to be multiplied by the font size to get the correctvalue for the font.\see BFont::GetEscapements()\since BeOS R3*//*!\var escapement_delta::nonspaceThe amount of horizontal space to surround a visible glyph character with.\since BeOS R3*//*!\var escapement_delta::spaceThe amount of horizontal space to surround a whitespace character with, forexample \c B_TAB or \c B_SPACE.\since BeOS R3*//*!\struct font_cache_info\ingroup interface\ingroup libbe\brief Font cache parameters.\since BeOS R3*//*!\var font_cache_info::sheared_font_penaltySheared font penalty.\since BeOS R3*//*!\var font_cache_info::rotated_font_penaltyRotated font penalty.\since BeOS R3*//*!\var font_cache_info::oversize_thresholdOversize threshold.\since BeOS R3*//*!\var font_cache_info::oversize_penaltyOversize penalty.\since BeOS R3*//*!\var font_cache_info::cache_sizeCache size.\since BeOS R3*//*!\var font_cache_info::spacing_size_thresholdSpacing size threshold.\since BeOS R3*//*!\struct tuned_font_info\ingroup interface\ingroup libbe\brief Tuning information of fonts used to make it look better whendisplayed on-screen.\see BFont::GetTunedInfo()\see BFont::CountTuned()\since BeOS R3*//*!\var tuned_font_info::sizeFont size.\since BeOS R3*//*!\var tuned_font_info::shearFont shear.\since BeOS R3*//*!\var tuned_font_info::rotationFont rotation.\since BeOS R3*//*!\var tuned_font_info::flagsFont flags.\since BeOS R3*//*!\var tuned_font_info::faceFont face.\since BeOS R3*//*!\fn int32 count_font_families()\brief Gets the number of installed font families\return The number of installed font families\since BeOS R3*//*!\fn int32 count_font_styles(font_family family)\brief Gets the number of styles available for a font family.\return The number of styles available for a font family.\since BeOS R3*//*!\fn status_t get_font_family(int32 index, font_family *_name,uint32 *_flags)\brief Retrieves the family name at the specified index.\param index Unique font identifier code.\param _name font_family String to receive the name of the family.\param _flags if non-<tt>NULL</tt>, the values of the flags \c IS_FIXEDand \c B_HAS_TUNED_FONT are returned.\return A status code, \c B_OK on success or an error code.\retval B_BAD_VALUE \a _name is \c NULL.\retval B_ERROR \a index does not correspond to a font family.\since BeOS R3*//*!\fn status_t get_font_style(font_family family, int32 index,font_style *_name, uint32 *_flags)\brief Retrieves the family name at the specified index.\param family The font family.\param index Unique font identifier code.\param _name string to receive the name of the family.\param _flags if non-<tt>NULL</tt>, the values of the flags \c IS_FIXEDand \c B_HAS_TUNED_FONT are returned\return A status code, \c B_OK on success or an error code.\retval B_ERROR \a index does not correspond to a font style.\since BeOS R3*//*!\fn status_t get_font_style(font_family family, int32 index,font_style *_name, uint16 *_face, uint32 *_flags)\brief Retrieves the family name at the specified index.The face value returned by this function is not very reliable. At the sametime, the value returned should be fairly reliable, returning the properflag for 90%-99% of font names.\param family The font family.\param index Unique font identifier code.\param _name String to receive the name of the family.\param _face recipient of font face value, such as \c B_REGULAR_FACE.\param _flags if non-<tt>NULL</tt>, the values of the flags \c IS_FIXEDand \c B_HAS_TUNED_FONT are returned.\return A status code, \c B_OK on success or an error code.\retval B_ERROR \a index does not correspond to a font style.\since BeOS R3*//*!\fn bool update_font_families(bool checkOnly)\brief Updates the font families list.\param checkOnly Parameter is ignored.\return \c true if the font list has changed, \c false if not.\since BeOS R3*//*!\class BFont\ingroup interface\ingroup libbe\brief Represents a typeface including its family, style and size.The Interface Kit provides three prebuilt BFont objects which can be usedbut not modified.- \c const BFont* \c be_plain_font A plain font used by many controls.- \c const BFont* \c be_bold_font A bold font used by titles.- \c const BFont* \c be_fixed_font A fixed-width font.A BFont object does nothing on its own but is used in combination witha view or control. Here is an example of creating a BFont object from asystem font and assigning it to a view:\codeBFont font(be_plain_font);font.SetSize(12.0);font.SetEncoding(B_ISO_8859_1);view->SetFont(&font);\endcodeYou may also create a BFont object from a view, modify it and reassign itback to the view like this:\codeBFont font;view->GetFont(&font);font.SetFace(B_ITALIC_FACE);font.SetSpacing(B_CHAR_SPACING);myView->SetFont(&font);\endcodeYou can change the way a font renders with the SetFamilyAndStyle(),SetFamilyAndFace(), SetSize(), SetShear(), SetRotation(),SetFalseBoldWidth(), SetSpacing(), SetEncoding(), SetFace(), andSetFlags() methods.More information about the space taken up by a font can be determinedby querying a BFont object using the following methods:StringWidth(), GetStringWidths() GetEscapements(), GetEdges(),GetHeight(), BoundingBox() GetBoundingBoxesAsGlyphs(),GetBoundingBoxesAsString(), and GetBoundingBoxesForStrings().You can also perform intelligent string truncation with theTruncateString() and GetTruncatedStrings() methods.\since BeOS R3*//*!\fn BFont::BFont()\brief Creates a BFont object initialized to \c be_plain_font.\see BView::GetFont()\since BeOS R3*//*!\fn BFont::BFont(const BFont& font)\brief Creates and initializes a BFont object from another BFont object.\param font The BFont object to initialize from.\since BeOS R3*//*!\fn BFont::BFont(const BFont* font)\brief Creates and initializes a BFont object from a pointer to a BFontobject.\param font The pointer to a BFont object to initialize from.\since BeOS R3*//*!\fn BFont::BFont(const BFont* font)\brief Creates and initializes a BFont object from a pointer to a BFontobject.\param font The pointer to a BFont object to initialize from.\since BeOS R3*//*!\fn status_t BFont::SetFamilyAndStyle(const font_family family,const font_style style)\brief Sets the font's family and style all at once.\param family Font family to set.\param style Font style to set.\returns A status code, \c B_OK on success or an error code.\retval B_BAD_VALUE \a family is \c NULL and \a style is \c NULL.\retval B_NAME_NOT_FOUND Family or style do not exist.\since BeOS R3*//*!\fn void BFont::SetFamilyAndStyle(uint32 code)\brief Sets the font's family and style from a font identifier.\param code Unique font identifier obtained from the server.\since BeOS R3*//*!\fn status_t BFont::SetFamilyAndFace(const font_family family, uint16 face)\brief Sets the font's family and face all at once.\param family Font family to set.\param face Font face to set.\note To comply with the BeBook, this function will only set valid values,i.e. passing a nonexistent family will cause only the face to be set.Additionally, if a particular face does not exist in a family, theclosest match will be chosen.\returns A status code, \c B_OK on success or an error code.\retval B_ERROR Family does not exists or face has an invalid value.\since BeOS R4*//*!\fn void BFont::SetSize(float size)\brief Sets the font size.\param size The point size to set the font to.\since BeOS R3*//*!\fn void BFont::SetShear(float shear)\brief Sets the angle in degrees relative to the baseline.The default shear is 90.0ยฐ measured counterclockwise. The shearrange is from 45.0ยฐ to 135.0ยฐ.\param shear The shear in degrees to set the font to.\since BeOS R3*//*!\fn void BFont::SetRotation(float rotation)\brief Sets the font rotation from the baseline in degrees.The default baseline is 0ยฐ and rotates counterclockwise. Rotation is notsupported by BTextView.\param rotation The rotation in degrees to set the font to.\since BeOS R3*//*!\fn void BFont::SetFalseBoldWidth(float width)\brief Sets the false bold width.\param width The false bold width to set.\since Haiku R1*//*!\fn void BFont::SetSpacing(uint8 spacing)\brief Sets how characters are horizontally spaced relative to each other.- \c B_CHAR_SPACING Position each character without adjustment. Best modefor printing. Characters may collide or overlap at small font sizes.- \c B_STRING_SPACING Optimizes the position of each character within itsspace. Collisions are unlikely but characters may touch each other.Best mode to use when the screen needs to match what appears on theprinted page. Adding new characters requires the entire string tobe redrawn.- \c B_BITMAP_SPACING The widths of the characters are chosen so that theynever collide and rarely touch. Best mode for drawing small amountsof text. Character widths are integral values. Spacing on screen willnot match spacing used by \c B_CHAR_SPACING mode for printing.- \c B_FIXED_SPACING Positions characters at a constant width. Must beused with fixed-width fonts otherwise \c B_CHAR_SPACING mode is used.All characters have an identical integral escapement.\c B_STRING_SPACING and \c B_BITMAP_SPACING modes are relevant only forfont sizes from 7.0pt to 18.0pt, above and below that range\c B_CHAR_SPACING produces nicer results. \c B_CHAR_SPACING is also alwaysused for rotated or sheared text and when antialiasing is disabled.\param spacing The spacing mode to set.\see BView::DrawString()\see GetEscapements()\since BeOS R3*//*!\fn void BFont::SetEncoding(uint8 encoding)\brief Sets the character encoding of the font for example\c B_UNICODE_UTF8 or \c B_ISO_8859_1.The following character encodings are supported:- \c B_UNICODE_UTF8- \c B_ISO_8859_1 aka Latin 1 aka "Western European".- \c B_ISO_8859_2 aka Latin 2 aka "Eastern European".- \c B_ISO_8859_3 aka Latin 3 aka "South European".- \c B_ISO_8859_4 aka Latin 4 aka "Northern European".- \c B_ISO_8859_5 aka "Latin/Cyrillic".- \c B_ISO_8859_6 aka "Latin/Arabic".- \c B_ISO_8859_7 aka "Latin/Greek".- \c B_ISO_8859_8 aka "Latin/Hebrew".- \c B_ISO_8859_9 aka Latin 5 aka "Latin/Turkish".- \c B_ISO_8859_10 aka Latin 6 aka "Nordic".- \c B_MACINTOSH_ROMANUTF-8 is the standard encoding used by classes in the Interface Kit. Itis part of the Unicodeยฎ standard and allows Haiku to represent charactersfrom all over the world while maintaining backwards compatibility with7-bit ASCII codes.Each of the encodings extend the ASCII codes and differ from each otheronly when the highest bit is set to 1, in other words, the value isgreater than 127. Furthermore each of the encodings except for UTF-8are represented by a single byte and consequently encompass a limited setof characters. Most of the encodings are in the ISO/IEC 8859 family ofcharacter codes with the notable exception of Macintosh Roman which isthe standard encoding used by the classic Mac OSยฎ.If the value of the first byte of a UTF-8 character is greater than 127it indicates that the character is a multibyte character and therefore youmust look at the next byte (and possibly the third byte, or rarely evenforth byte) to get the whole character.Setting the character encoding on a view determines how BView::DrawString()interprets the values passed to it and also how BView::KeyDown() interpretsthe values representing the keys that the user presses.\param encoding The character encoding to set the font to.\since BeOS R3*//*!\fn void BFont::SetFace(uint16 face)\brief Sets the font face according to the flags set by \a face.The following font face flags are supported:- \c B_ITALIC_FACE Characters are slanted to the right.- \c B_UNDERSCORE_FACE Characters are underlined.- \c B_NEGATIVE_FACE High and low colors are reversed when drawingcharacters.- \c B_OUTLINED_FACE Characters are drawn hollowed out.- \c B_STRIKEOUT_FACE A horizontal line is drawn through their middle.- \c B_BOLD_FACE Characters are bold.- \c B_REGULAR_FACE Characters are drawn normally.- \c B_CONDENSED_FACE Characters are drawn condensed. Not in BeOS 5.- \c B_LIGHT_FACE Characters are drawn thiner than normal. Not in BeOS 5.- \c B_HEAVY_FACE Characters are drawn heavier than normal. Not in BeOS 5.\param face The bitmap of font face flags to set.\since BeOS R3*//*!\fn void BFont::SetFlags(uint32 flags)\brief Sets font flags controlling antialiasing.The following flags are supported:- \c B_DISABLE_ANTIALIASING Disable antialiasing.- \c B_FORCE_ANTIALIASING Force antialiasing.\param flags The bitmap of flags to set.\since Haiku R1*//*!\fn void BFont::GetFamilyAndStyle(font_family* family,font_style *style) const\brief Writes out the name of the font family and/or font style.This method may be called with either \a family or \a style set to\c NULL in order to get one or the other.\param family A font_family pointer to be filled out.\param style A font_style pointer to be filled out.\since BeOS R3*//*!\fn uint32 BFont::FamilyAndStyle() const\brief Gets the code of the font family and style combination.\returns The family and style combination encoded as a unique integer.\see SetFamilyAndStyle(uint32 code)\since BeOS R3*//*!\fn float BFont::Size() const\brief Gets the font size.\returns The font size in points.\see SetSize()\since BeOS R3*//*!\fn float BFont::Shear() const\brief Gets the font shear.\returns The font shear as an angle from 45.0ยฐ to 135.0ยฐ.\see SetShear()\since BeOS R3*//*!\fn float BFont::Rotation() const\brief Gets the font rotation.\returns The font rotation as an angle in degrees.\see SetRotation()\since BeOS R3*//*!\fn float BFont::FalseBoldWidth() const\brief Gets the width of the font as if it were bold.\returns The font width of the bold font variety.\see SetFalseBoldWidth()\since Haiku R1*//*!\fn uint8 BFont::Spacing() const\brief Gets the spacing constant.\returns The spacing constant.\see SetSpacing()\since BeOS R3*//*!\fn uint8 BFont::Encoding() const\brief Gets the character encoding constant.\returns The character encoding constant.\see SetEncoding()\since BeOS R3*//*!\fn uint16 BFont::Face() const\brief Gets the font face flags bitmap.\returns The font face flags bitmap.\see SetFace()\since BeOS R3*//*!\fn uint32 BFont::Flags() const\brief Gets the antialiasing flags.\returns The antialiasing flags.\see SetFlags()\since BeOS R3*//*!\fn font_direction BFont::Direction() const\brief Gets the font direction, left-to-right or right-to left.\returns The font direction.\since BeOS R3*//*!\fn bool BFont::IsFixed() const\brief Gets whether or not the font is fixed width.\returns \c true if the font is fixed width, \c false otherwise.\since BeOS R4*//*!\fn bool BFont::IsFullAndHalfFixed() const\brief Returns whether or not the font is fixed-width and contains bothfull and half-width characters.A full-and-half-fixed font is one that contains characters of onlytwo sizes, so that CJK languages can be properly supported.\note This was unimplemented in BeOS R5, but is implemented in Haiku.\since BeOS R4*//*!\fn BRect BFont::BoundingBox() const\brief Gets a BRect that encloses the font text.\returns A BRect that encloses the font text.\since BeOS R4*//*!\fn unicode_block BFont::Blocks() const\brief Gets a \c unicode_block object that identifies the Unicode blockssupported by this font face and family.\returns A \c unicode_block object containing supported Unicode blocks.\since BeOS R4*//*!\fn bool BFont::IncludesBlock(uint32 start, uint32 end) const\brief Gets whether the font includes the specified Unicode block.\since Haiku R1*//*!\fn font_file_format BFont::FileFormat() const\brief Gets whether the font is a TrueTypeโข or PostScriptโข Type1 font.\returns A \c font_file_format struct containing the font file format.\since BeOS R4*//*!\fn int32 BFont::CountTuned() const\brief Gets the number of tuned fonts for the font family and style.\returns The number of tuned fonts.\since BeOS R3*//*!\fn void BFont::GetTunedInfo(int32 index, tuned_font_info *info) const\brief Writes information about the tuned font at \a index into \a info.The index begins at 0 and counts tuned fonts for current font family andstyle only.\param index The index of desired tuned font.\param info The \a turned_font_info struct to be filled out.\since BeOS R3*//*!\fn void BFont::TruncateString(BString *inOut, uint32 mode,float width) const\brief Truncates \a inOut to be no longer than \a width using thesupplied truncation \a mode.The following truncation modes are supported:- \c B_NO_TRUNCATION Does nothing.- \c B_TRUNCATE_BEGINNING Truncate from the beginning of the string.- \c B_TRUNCATE_MIDDLE Truncate from the middle of the string.- \c B_TRUNCATE_END Truncate from the end of the string.- \c B_TRUNCATE_SMART Truncate from anywhere, but do so so that eachstring is made unique after being truncated.\param inOut The BString to truncate.\param mode Truncation mode to use.\param width The maximum width to truncate to.\since BeOS R5*//*!\fn void BFont::GetTruncatedStrings(const char *stringArray[],int32 numStrings, uint32 mode, float width,BString resultArray[]) const\brief Write truncated BString objects to \a resultArray given sourceBString objects in \a stringArray.The following truncation modes are supported:- \c B_TRUNCATE_BEGINNING Truncate from the beginning of the string.- \c B_TRUNCATE_MIDDLE Truncate from the middle of the string.- \c B_TRUNCATE_END Truncate from the end of the string.- \c B_TRUNCATE_SMART Truncate from anywhere, but do so so that eachstring is made unique after being truncated.\param stringArray The source string array.\param numStrings The number of strings in \a stringArray.\param mode Truncation mode to use.\param width The maximum width to truncate to.\param resultArray The destination string array.\since BeOS R5*//*!\fn void BFont::GetTruncatedStrings(const char *stringArray[],int32 numStrings, uint32 mode, float width, char *resultArray[]) const\brief Write truncated strings to \a resultArray given sourceBString objects in \a stringArray.\a resultArray is an array of pointers to string buffers which should beallocated ahead of time and should be at least 3 bytes longer than thematching input string. The 3 extra bytes provide enough room for thetruncated output given that GetTruncatedStrings() truncates only asingle-byte character from the input string and replaces it with anellipsis character (which takes three bytes for the UTF-8 encoding),and adds a \c NUL-terminator.The following truncation modes are supported:- \c B_TRUNCATE_BEGINNING Truncate from the beginning of the string.- \c B_TRUNCATE_MIDDLE Truncate from the middle of the string.- \c B_TRUNCATE_END Truncate from the end of the string.- \c B_TRUNCATE_SMART Truncate from anywhere, but do so so that eachstring is made unique after being truncated.\param stringArray The source string array.\param numStrings The number of strings in \a stringArray.\param mode Truncation mode to use.\param width The maximum width to truncate to.\param resultArray The destination string array.\since BeOS R5*//*!\fn float BFont::StringWidth(const char *string) const\brief Determines the amount of space required to draw \a string in thecurrent font.\param string The source string.\returns The width required to draw the string.\since BeOS R3*//*!\fn float BFont::StringWidth(const char *string, int32 length) const\brief Determines the amount of space required to draw \a string in thecurrent font up to \a length characters.\param string The source string.\param length The number of characters in \a string to consider.\returns The width required to draw the string.\since BeOS R3*//*!\fn void BFont::GetStringWidths(const char *stringArray[],const int32 lengthArray[], int32 numStrings, float widthArray[]) const\brief Determines the amount of space required to draw each string in\a stringArray and writes the result in \a widthArray.\param stringArray The source string array.\param lengthArray The number of characters to consider for each string in\a stringArray\param numStrings The number of strings in \a stringArray.\param widthArray The destination array to put the widths required to draweach string.\since BeOS R3*//*!\fn void BFont::GetEscapements(const char charArray[], int32 numChars,float escapementArray[]) const\brief Determines the escapements for each char in \a charArray and writesthe result in \a escapementArray.\param charArray The source character array.\param numChars The number of characters to consider in \a charArray.\param escapementArray The destination array to put the escapements.\since BeOS R3*//*!\fn void BFont::GetEscapements(const char charArray[], int32 numChars,escapement_delta* delta, float escapementArray[]) const\brief Determines the escapements for each char in \a charArray and writesthe result in \a escapementArray with consideration to the horizontalspace provided by the escapement \a delta.The escapement_delta structure contains the following values:- \c nonspace The amount of horizontal space to surround a visible glyphcharacter with.- \c space The amount of horizontal space to surround a whitespace characterwith, for example \c B_TAB or \c B_SPACE.\param charArray The source character array.\param numChars The number of characters to consider in \a charArray.\param delta The escapement_delta structure to use.\param escapementArray The destination array to put the escapements.\since BeOS R3*//*!\fn void BFont::GetEscapements(const char charArray[], int32 numChars,escapement_delta *delta, BPoint escapementArray[]) const\brief Determines the escapements for each char in \a charArray and writesthe result in \a escapementArray as an array of BPoint objectswith consideration to the horizontal space provided by the escapement\a delta.The escapement_delta structure contains the following values:- \c nonspace The amount of horizontal space to surround a visible glyphcharacter with.- \c space The amount of horizontal space to surround a whitespace characterwith, for example \c B_TAB or \c B_SPACE.\param charArray The source character array.\param numChars The number of characters to consider in \a charArray.\param delta The escapement_delta structure to use.\param escapementArray The destination array of escapements as BPointobjects.\since BeOS R4*//*!\fn void BFont::GetEscapements(const char charArray[], int32 numChars,escapement_delta *delta, BPoint escapementArray[],BPoint offsetArray[]) const\brief Determines the escapements for each char in \a charArray and writesthe result in \a escapementArray as an array of BPoint objectswith consideration to the horizontal space provided by the escapement\a delta and writes the offsets to \a offsetArray.The escapement_delta structure contains the following values:- \c nonspace The amount of horizontal space to surround a visible glyphcharacter with.- \c space The amount of horizontal space to surround a whitespace characterwith, for example \c B_TAB or \c B_SPACE.\param charArray The source character array.\param numChars The number of characters to consider in \a charArray.\param delta The escapement_delta structure to use.\param escapementArray The destination array of escapements as BPointobjects.\param offsetArray The destination array of offsets as BPoint objects.\since BeOS R4*//*!\fn void BFont::GetEdges(const char charArray[], int32 numChars,edge_info edgeArray[]) const\brief Determines the edge information for each character in \a charArrayand writes the result in \a edgeArray.The \c edge_info struct contains the following values:- \c left The distance that the character outline is inset from the leftescapement boundary.- \c right The distance that the character outline is inset from theright escapement boundary.\param charArray The source character array.\param numChars The number of characters to consider in \a charArray.\param edgeArray The destination array of \c edge_info structs.\since BeOS R3*//*!\fn void BFont::GetHeight(font_height *_height) const\brief Fills out the \c font_height struct with the amount of verticalspace surrounding a character.The \c font_height struct contains the following values:- \c ascent The distance characters can ascend above the baseline.- \c descent The distance characters can descend below the baseline.- \c leading The distance between lines, descent above to ascent below.\param _height The \c font_height struct to fill out.\since BeOS R3*//*!\fn void BFont::GetBoundingBoxesAsGlyphs(const char charArray[],int32 numChars, font_metric_mode mode, BRect boundingBoxArray[]) const\brief Writes an array of BRect objects to \a boundingBoxArrayrepresenting the bounding rectangles of each character in\a charArray.Each BRect object corresponds to the glyph of one character.The \c font_metric_mode should contain one of the following values:- \c B_SCREEN_METRIC The bounding boxes should use the screen metric.- \c B_PRINTING_METRIC The bounding boxes should use the print metric.\param charArray The source character array.\param numChars The number of characters to consider in \a charArray.\param mode The \c font_metric_mode to use, screen or printing.\param boundingBoxArray The destination array of BRect bounding boxes.\since BeOS R4*//*!\fn void BFont::GetBoundingBoxesAsString(const char charArray[],int32 numChars, font_metric_mode mode, escapement_delta *delta,BRect boundingBoxArray[]) const\brief Writes an array of BRect objects to \a boundingBoxArray representingthe bounding rectangles of each character in \a charArray withconsideration to the horizontal space provided by the escapement\a delta.Each BRect object corresponds to the glyph of one character.The \c font_metric_mode should contain one of the following values:- \c B_SCREEN_METRIC The bounding boxes should use the screen metric.- \c B_PRINTING_METRIC The bounding boxes should use the print metric.The provided escapement \a delta is applied as part of the bounding boxcalculations. This lets you specify a character spacing is looser ortighter than normal.The escapement_delta structure contains the following values:- \c nonspace The amount of horizontal space to surround a visible glyphcharacter with.- \c space The amount of horizontal space to surround a whitespace characterwith, for example \c B_TAB or \c B_SPACE.\param charArray The source character array.\param numChars The number of characters to consider in \a charArray.\param mode The \c font_metric_mode to use, screen or printing.\param delta The escapement_delta structure to use.\param boundingBoxArray The destination array of BRect bounding boxes.\since BeOS R4*//*!\fn void BFont::GetBoundingBoxesForStrings(const char *stringArray[],int32 numStrings, font_metric_mode mode, escapement_delta deltas[],BRect boundingBoxArray[]) const\brief Writes an array of BRect objects to \a boundingBoxArray representingthe bounding rectangles of each string in \a stringArray withconsideration to the horizontal space provided by the escapement\a deltas.Each BRect object corresponds to the bounding box of the entire string.The \c font_metric_mode should contain one of the following values:- \c B_SCREEN_METRIC The bounding boxes should use the screen metric.- \c B_PRINTING_METRIC The bounding boxes should use the print metric.The provided escapement \a deltas are applied as part of the bounding boxcalculations. This lets you specify a character spacing is looser or tighterthan normal.The escapement_delta structure contains the following values:- \c nonspace The amount of horizontal space to surround a visible glyphcharacter with.- \c space The amount of horizontal space to surround a whitespace characterwith, for example \c B_TAB or \c B_SPACE.\param stringArray The source string array.\param numStrings The number of strings to consider in \a stringArray.\param mode The \c font_metric_mode to use, screen or printing.\param deltas The array of escapement_delta structures to use.\param boundingBoxArray The destination array of BRect bounding boxes.\since BeOS R4*//*!\fn void BFont::GetGlyphShapes(const char charArray[], int32 numChars,BShape *glyphShapeArray[]) const\brief Writes an array of BShape objects to \a glyphShapeArrayrepresenting the glyph shapes of each character in\a charArray.Each BShape object corresponds to the glyph of one character.\param charArray The source character array.\param numChars The number of characters to consider in \a charArray.\param glyphShapeArray The destination array of BShape glyphs.\since BeOS R4*//*!\fn void BFont::GetHasGlyphs(const char charArray[], int32 numChars,bool hasArray[]) const\brief Fills out \a hasArray with whether or not the font has a glyphfor each character in \a charArray.\c true is written in \a hasArray if a glyph is found for the character,\c false otherwise.\remark After the introduction of fallback fonts for missing glyphs,this is not exaclty what the name or the original desciption imply. Asthe objective of this method is to know if a string can be presentedto the user without getting "no glyph" symbols, it will still write\c true if the queried font does not provide a glyph for a characterbut a fallback font does.\param charArray The source character array.\param numChars The number of characters to consider in \a charArray.\param hasArray The destination array of booleans.\since BeOS R4*//*!\fn void BFont::GetHasGlyphs(const char charArray[], int32 numChars,bool hasArray[], bool useFallbacks) const\brief Fills out \a hasArray with whether or not the font has a glyphfor each character in \a charArray.\c true is written in \a hasArray if the character has a glyph in thecurrent font and \c false otherwise. Fallback fonts are also consideredin the search if \a useFallbacks is \c true.\param charArray The source character array.\param numChars The number of characters to consider in \a charArray.\param hasArray The destination array of booleans.\param useFallbacks Whether to consider fallback fonts in the answer.\since Haiku R1*//*!\fn BFont& BFont::operator=(const BFont &font)\brief Assignment overload method.\param font The BFont object to assign from.\since BeOS R3*//*!\fn bool BFont::operator==(const BFont &font) const\brief Equality comparison overload method.\param font The BFont object to compare the current font to.\returns \c true if the fonts objects are identical, \c false otherwise.\since BeOS R3*//*!\fn bool BFont::operator!=(const BFont &font) const\brief Inequality comparison overload method.\param font The BFont object to compare the current font to.\returns \c true if the fonts objects are NOT identical, \c trueotherwise.\since BeOS R3*//*!\fn void BFont::PrintToStream() const\brief Writes information about the font to \c stdout.printf("BFont { %s (%d), %s (%d) 0x%x %f/%f %fpt (%f %f %f), %d }\n",family, fFamilyID, style, fStyleID, fFace, fShear, fRotation, fSize,fHeight.ascent, fHeight.descent, fHeight.leading, fEncoding);\since BeOS R3*/