Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HaikuDepot: More work on custom TextView
* TextLayout produces some first visible results...
- Loading branch information
Showing
10 changed files
with
626 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright 2013, Stephan Aßmus <superstippi@gmx.de>. | ||
* All rights reserved. Distributed under the terms of the MIT License. | ||
*/ | ||
#ifndef GLYPH_INFO_H | ||
#define GLYPH_INFO_H | ||
|
||
#include "TextStyle.h" | ||
|
||
|
||
class GlyphInfo { | ||
public: | ||
GlyphInfo() | ||
: | ||
charCode(0), | ||
x(0.0f), | ||
y(0.0f), | ||
advanceX(0.0f), | ||
maxAscend(0.0f), | ||
maxDescend(0.0f), | ||
lineIndex(0), | ||
style() | ||
{ | ||
} | ||
|
||
GlyphInfo(uint32 charCode, float x, float y, float advanceX, | ||
float maxAscend, float maxDescend, int lineIndex, | ||
const TextStyleRef& style) | ||
: | ||
charCode(charCode), | ||
x(x), | ||
y(y), | ||
advanceX(advanceX), | ||
maxAscend(maxAscend), | ||
maxDescend(maxDescend), | ||
lineIndex(lineIndex), | ||
style(style) | ||
{ | ||
} | ||
|
||
GlyphInfo(const GlyphInfo& other) | ||
: | ||
charCode(other.charCode), | ||
x(other.x), | ||
y(other.y), | ||
advanceX(other.advanceX), | ||
maxAscend(other.maxAscend), | ||
maxDescend(other.maxDescend), | ||
lineIndex(other.lineIndex), | ||
style(other.style) | ||
{ | ||
} | ||
|
||
GlyphInfo& operator=(const GlyphInfo& other) | ||
{ | ||
charCode = other.charCode; | ||
x = other.x; | ||
y = other.y; | ||
advanceX = other.advanceX; | ||
maxAscend = other.maxAscend; | ||
maxDescend = other.maxDescend; | ||
lineIndex = other.lineIndex; | ||
style = other.style; | ||
return *this; | ||
} | ||
|
||
bool operator==(const GlyphInfo& other) const | ||
{ | ||
return charCode == other.charCode | ||
&& x == other.x | ||
&& y == other.y | ||
&& advanceX == other.advanceX | ||
&& maxAscend == other.maxAscend | ||
&& maxDescend == other.maxDescend | ||
&& lineIndex == other.lineIndex | ||
&& style == other.style; | ||
} | ||
|
||
bool operator!=(const GlyphInfo& other) const | ||
{ | ||
return !(*this == other); | ||
} | ||
|
||
public: | ||
uint32 charCode; | ||
|
||
float x; | ||
float y; | ||
float advanceX; | ||
|
||
float maxAscend; | ||
float maxDescend; | ||
|
||
int lineIndex; | ||
|
||
TextStyleRef style; | ||
}; | ||
|
||
|
||
#endif // GLYPH_INFO_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright 2013, Stephan Aßmus <superstippi@gmx.de>. | ||
* All rights reserved. Distributed under the terms of the MIT License. | ||
*/ | ||
#ifndef LINE_INFO_H | ||
#define LINE_INFO_H | ||
|
||
#include "List.h" | ||
|
||
|
||
class LineInfo { | ||
public: | ||
LineInfo() | ||
: | ||
textOffset(0), | ||
y(0.0f), | ||
height(0.0f), | ||
maxAscent(0.0f), | ||
maxDescent(0.0f) | ||
{ | ||
} | ||
|
||
LineInfo(int textOffset, float y, float height, float maxAscent, | ||
float maxDescent) | ||
: | ||
textOffset(textOffset), | ||
y(y), | ||
height(height), | ||
maxAscent(maxAscent), | ||
maxDescent(maxDescent) | ||
{ | ||
} | ||
|
||
LineInfo(const LineInfo& other) | ||
: | ||
textOffset(other.textOffset), | ||
y(other.y), | ||
height(other.height), | ||
maxAscent(other.maxAscent), | ||
maxDescent(other.maxDescent) | ||
{ | ||
} | ||
|
||
LineInfo& operator=(const LineInfo& other) | ||
{ | ||
textOffset = other.textOffset; | ||
y = other.y; | ||
height = other.height; | ||
maxAscent = other.maxAscent; | ||
maxDescent = other.maxDescent; | ||
return *this; | ||
} | ||
|
||
bool operator==(const LineInfo& other) const | ||
{ | ||
return textOffset == other.textOffset | ||
&& y == other.y | ||
&& height == other.height | ||
&& maxAscent == other.maxAscent | ||
&& maxDescent == other.maxDescent; | ||
} | ||
|
||
bool operator!=(const LineInfo& other) const | ||
{ | ||
return !(*this == other); | ||
} | ||
|
||
public: | ||
int textOffset; | ||
float y; | ||
float height; | ||
float maxAscent; | ||
float maxDescent; | ||
}; | ||
|
||
|
||
typedef List<LineInfo, false> LineInfoList; | ||
|
||
|
||
#endif // LINE_INFO_H |
Oops, something went wrong.