找到函数的函数定义

时间:2016-10-31 05:06:55

标签: c++ function sfml

我是新手并参与编程,所以如果已经回答或解释过,我会道歉。基本上,我一直在查看SFML库的文档,并遇到一些sf :: Font类的公共成员函数。例如,一个是:

bool sf::Font::loadFromFile  ( const std::string &  filename ) 

以下是该功能的作用:

/// \brief Load the font from a file
///
/// The supported font formats are: TrueType, Type 1, CFF,
/// OpenType, SFNT, X11 PCF, Windows FNT, BDF, PFR and Type 42.
/// Note that this function know nothing about the standard
/// fonts installed on the user's system, thus you can't
/// load them directly.
///
/// \warning SFML cannot preload all the font data in this
/// function, so the file has to remain accessible until
/// the sf::Font object loads a new font or is destroyed.
///
/// \param filename Path of the font file to load
///
/// \return True if loading succeeded, false if it failed
///
/// \see loadFromMemory, loadFromStream
///

我已经下载了库并查看了头文件,但我似乎无法找到loadFromFile函数如何实际完成加载(换句话说,我正在寻找一个函数正文或执行工作的函数定义。该文档仅解释了该功能的 ,而不是如何

对不起,如果这是一个愚蠢的问题,或者应该是显而易见的事情。我对这个功能的核心位置非常好奇。

顺便说一句,here是指向我所指的文档的页面和部分的确切链接。

感谢任何回答的人。

1 个答案:

答案 0 :(得分:0)

您正在寻找的方法可以在公共Github存储库中找到。

它位于第122行开始的Font.cpp文件中:

https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/Font.cpp#L122

文档不会提及这一点,因为文档是关于此函数的用户可以依赖的行为。方法如何实现此行为是用户不应该知道的私有实现细节。

相关问题