diff font/font_layout.cc @ 52:15a18fbe6f21

* Known bugs added to the README * Code cleaning (0 -> NULL when needed, indentation, spaces, ...)
author thib
date Sat, 18 Apr 2009 18:35:39 +0000
parents 35ce1a30f3f9
children ddbcbd000206
line wrap: on
line diff
--- a/font/font_layout.cc
+++ b/font/font_layout.cc
@@ -28,14 +28,14 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include<vector>
-#include<map>
-#include<iostream>
+#include <vector>
+#include <map>
+#include <iostream>
 
 using namespace std;
 
-#include"font.h"
-#include"text.h"
+#include "font.h"
+#include "text.h"
 
 const int line_skip = 1; // 行と行の間の間隔
 const int ruby_textskip = 0; // 文字とルビの間の間隔
@@ -78,28 +78,29 @@ inline int Kinsoku(int code) {
 }
 
 class TextGlyphStreamHelper {
-	typedef TextStream::Iterator Iterator;
-	typedef TextGlyphStream::iterator iterator;
+	private:
+		typedef TextStream::Iterator Iterator;
+		typedef TextGlyphStream::iterator iterator;
 
-	TextGlyphStream* data;
+		TextGlyphStream* data;
 
-	// information for rendering
-	unsigned char r, g, b;
-	XKFont::Face* face;
-	XKFont::Face* ruby_face;
-	XKFont::Font* font;
+		// information for rendering
+		unsigned char r, g, b;
+		XKFont::Face* face;
+		XKFont::Face* ruby_face;
+		XKFont::Font* font;
 
-public:
-	int min_lineheight;
-	TextGlyphStreamHelper(XKFont::Font* font);
-	// helper functions
-	void Init(TextGlyphStream* data);
-	Iterator Add(int& x, Iterator begin, Iterator end, int max_x = 0);
-	Iterator AddRuby(int& x, Iterator begin, Iterator end);
-	int CharWidth(int code);
-	void SetGroup(iterator begin, iterator end);
-	void CalcHeight(int& ascent, int& descent, iterator begin, iterator end);
-	void AdjustPosition(int xstart_add, int xend_add, int y_add, iterator begin, iterator end);
+	public:
+		int min_lineheight;
+		TextGlyphStreamHelper(XKFont::Font* font);
+		// helper functions
+		void Init(TextGlyphStream* data);
+		Iterator Add(int& x, Iterator begin, Iterator end, int max_x = 0);
+		Iterator AddRuby(int& x, Iterator begin, Iterator end);
+		int CharWidth(int code);
+		void SetGroup(iterator begin, iterator end);
+		void CalcHeight(int& ascent, int& descent, iterator begin, iterator end);
+		void AdjustPosition(int xstart_add, int xend_add, int y_add, iterator begin, iterator end);
 };
 
 TextGlyphStreamHelper::TextGlyphStreamHelper(XKFont::Font* __font) {
@@ -492,28 +493,29 @@ void TextHorizLayout::MakeLine(int line_
 
 namespace XKFont {
 
-HorizLayout::HorizLayout(const char* fontname, int size) {
-	font = new Font(fontname, size);
-	pimpl = new ::TextHorizLayout(font);
-}
+	HorizLayout::HorizLayout(const char* fontname, int size) {
+		font = new Font(fontname, size);
+		pimpl = new ::TextHorizLayout(font);
+	}
 
-HorizLayout::~HorizLayout() {
-	delete pimpl;
-	delete font;
-}
+	HorizLayout::~HorizLayout() {
+		delete pimpl;
+		delete font;
+	}
 
-void HorizLayout::Layout(TextStream& stream, TextGlyphStream& glyph, vector<int>& lineheights, int width) {
-	pimpl->Layout(stream, glyph, lineheights, width);
-};
-TextGlyphStream HorizLayout::Layout(const char* str, int width, int r, int gc, int b) {
-	TextStream s;
-	s.SetColor(r,gc,b);
-	s.Add(str);
-	TextGlyphStream g;
-	vector<int> h;
-	Layout(s, g, h, width);
-	return g;
-}
+	void HorizLayout::Layout(TextStream& stream, TextGlyphStream& glyph, vector<int>& lineheights, int width) {
+		pimpl->Layout(stream, glyph, lineheights, width);
+	};
+
+	TextGlyphStream HorizLayout::Layout(const char* str, int width, int r, int gc, int b) {
+		TextStream s;
+		s.SetColor(r,gc,b);
+		s.Add(str);
+		TextGlyphStream g;
+		vector<int> h;
+		Layout(s, g, h, width);
+		return g;
+	}
 
 };