Commit 6a5218a4 by Jessica Hawkwell

finished font stuffs

1 parent 2f1da0a6
......@@ -67,3 +67,20 @@ nbactions.xml
# End of https://www.gitignore.io/api/git,c++,cmake,netbeans,kdevelop4
*.core
# Created by https://www.gitignore.io/api/codeblocks
### CodeBlocks ###
# specific to CodeBlocks IDE
*.cbp
*.save
*.layout
*.depend
# generated directories
bin/
obj/
# End of https://www.gitignore.io/api/codeblocks
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="100">
<logicalFolder name="root" displayName="root" projectFiles="true" kind="ROOT">
<df root="src/libnde" name="0">
</df>
<df root="src/libntk" name="1">
</df>
<df root="src/NitroWin" name="2">
</df>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="false"
kind="IMPORTANT_FILES_FOLDER">
<itemPath>CMakeLists.txt</itemPath>
<itemPath>Makefile</itemPath>
<itemPath>nbproject/private/launcher.properties</itemPath>
</logicalFolder>
</logicalFolder>
<sourceFolderFilter>^(nbproject|CMakeFiles|build)$</sourceFolderFilter>
<sourceRootList>
<Elem>src/libnde</Elem>
<Elem>src/libntk</Elem>
<Elem>src/NitroWin</Elem>
</sourceRootList>
<projectmakefile>Makefile</projectmakefile>
<confs>
<conf name="Default" type="0" platformSpecific="true">
<toolsSet>
<compilerSet>CLang|CLang</compilerSet>
<platform>5</platform>
<dependencyChecking>false</dependencyChecking>
<rebuildPropChanged>false</rebuildPropChanged>
</toolsSet>
<codeAssistance>
</codeAssistance>
<makefileType>
<makeTool>
<buildCommandWorkingDir>.</buildCommandWorkingDir>
<buildCommand>${MAKE} -f Makefile</buildCommand>
<cleanCommand>${MAKE} -f Makefile clean</cleanCommand>
<executablePath>test_NitroWin.sh</executablePath>
<cTool>
<standard>10</standard>
</cTool>
<ccTool>
<standard>11</standard>
</ccTool>
</makeTool>
<preBuild>
<preBuildCommandWorkingDir>.</preBuildCommandWorkingDir>
<preBuildCommand>${CMAKE} -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${IDE_CC} -DCMAKE_CXX_COMPILER=${IDE_CXX} -DCMAKE_C_FLAGS_DEBUG="-g3 -gdwarf-2" -DCMAKE_CXX_FLAGS_DEBUG="-g3 -gdwarf-2" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .</preBuildCommand>
<preBuildFirst>true</preBuildFirst>
</preBuild>
</makefileType>
</conf>
</confs>
</configurationDescriptor>
#Sat Mar 10 11:33:39 EST 2018
project.license=bsd
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.cnd.makeproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>Nitrogen</name>
<c-extensions/>
<cpp-extensions>cpp</cpp-extensions>
<header-extensions>h</header-extensions>
<sourceEncoding>UTF-8</sourceEncoding>
<make-dep-projects/>
<sourceRootList>
<sourceRootElem>src/libnde</sourceRootElem>
<sourceRootElem>src/libntk</sourceRootElem>
<sourceRootElem>src/NitroWin</sourceRootElem>
</sourceRootList>
<confList>
<confElem>
<name>Default</name>
<type>0</type>
</confElem>
</confList>
<formatting>
<project-formatting-style>false</project-formatting-style>
</formatting>
</data>
</configuration>
</project>
......@@ -9,6 +9,7 @@ add_library(${PROJECT_NAME} SHARED ntkMain.cpp
NObject.cpp
Color.cpp
Font.cpp
FontMetrics.cpp
)
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION lib/${PROJECT_NAME})
......
......@@ -24,10 +24,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
/*
* File: FontMetrics.cpp
* Author: jlhawkwell
*
*
* Created on March 16, 2018, 11:46 PM
*/
......@@ -35,24 +35,25 @@
namespace nitrogen {
FontMetrics::FontMetrics(Font* f) {
font_info = XLoadQueryFont(disp, f->getFontName()->c_str());
}
unsigned int FontMetrics::getAscent() {
unsigned int FontMetrics::getAscent() const {
return font_info->max_bounds.ascent;
}
unsigned int FontMetrics::getHeight() {
unsigned int FontMetrics::getHeight() const {
return font_info->max_bounds.ascent + font_info->max_bounds.descent;
}
unsigned int FontMetrics::stringWidth(std::string* str) {
unsigned int FontMetrics::stringWidth(std::string* str) const {
return XTextWidth(font_info, str->c_str(), str->length());
}
unsigned int FontMetrics::stringWidth(std::string& str) {
unsigned int FontMetrics::stringWidth(std::string& str) const {
return stringWidth(&str);
}
FontMetrics::~FontMetrics() {
delete font_info;
}
}
......@@ -24,7 +24,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
/*
* File: FontMetrics.h
* Author: jlhawkwell
*
......@@ -37,6 +37,7 @@
#include <Font.h>
#include <string>
#include <X11/X.h>
#include <X11/Xlib.h>
namespace nitrogen {
class FontMetrics : public NObject {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!