Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
QuartzText.h
Go to the documentation of this file.
1// @(#)root/graf2d:$Id$
2// Author: Timur Pocheptsov 26/01/2012
3
4/*************************************************************************
5 * Copyright (C) 1995-2012, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_QuartzText
13#define ROOT_QuartzText
14
15#include <vector>
16
17#include <Cocoa/Cocoa.h>
18
19#include "CocoaUtils.h"
20#include "GuiTypes.h"
21
22
23class TAttText;
24
25/////////////////////////////////////////////////
26// //
27// TextLine - wrapper class for a CoreText's //
28// CTLine: hide all the API, calls, objects, //
29// CoreFoundation objects required to draw //
30// a simple line of text and be able to //
31// calculate text metrics. //
32// //
33/////////////////////////////////////////////////
34
35namespace ROOT {
36namespace Quartz {
37
38// Core Text's CTLine wrapper.
39class TextLine {
40public:
41 TextLine(const char *textLine, CTFontRef font);
42 TextLine(const std::vector<UniChar> &textLine, CTFontRef font);
43
44 TextLine(const char *textLine, CTFontRef font, Color_t color);
45 TextLine(const std::vector<UniChar> &textLine, CTFontRef font, Color_t color);
46 TextLine(const char *textLine, CTFontRef font, const CGFloat *rgb);
47
48 ~TextLine();
49
50 void GetBounds(UInt_t &w, UInt_t &h)const;
51 void GetAscentDescent(Int_t &asc, Int_t &desc)const;
52
53 void DrawLine(CGContextRef ctx) const;
54 void DrawLine(CGContextRef ctx, Double_t x, Double_t y, const TAttText &att) const;
55private:
56 CTLineRef fCTLine; //Core Text line, created from Attributed string.
57 CTFontRef fCTFont; //A font used for this CTLine.
58
59 void Init(const char *textLine, UInt_t nAttribs, CFStringRef *keys, CFTypeRef *values);
60 void Init(const std::vector<UniChar> &textLine, UInt_t nAttribs, CFStringRef *keys, CFTypeRef *values);
61
64};
65
66//Aux. function which extracts glyphs, calculates their positions, draws glyphs with manual layout (GUI text).
67void DrawTextLineNoKerning(CGContextRef ctx, CTFontRef font, const std::vector<UniChar> &text, Int_t x, Int_t y);
68
72
73}
74}
75
76#endif
#define h(i)
Definition RSha256.hxx:106
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
short Color_t
Color number (short)
Definition RtypesCore.h:99
Option_t Option_t TPoint TPoint const char DrawLine
Option_t Option_t TPoint TPoint const char text
void GetBounds(UInt_t &w, UInt_t &h) const
TextLine & operator=(const TextLine &rhs)
TextLine(const TextLine &rhs)
void GetAscentDescent(Int_t &asc, Int_t &desc) const
void Init(const char *textLine, UInt_t nAttribs, CFStringRef *keys, CFTypeRef *values)
TextLine(const char *textLine, CTFontRef font)
Definition QuartzText.mm:75
Text Attributes class.
Definition TAttText.h:21
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const CTFontOrientation defaultFontOrientation
Definition QuartzText.mm:38
void DrawTextLineNoKerning(CGContextRef ctx, CTFontRef font, const std::vector< UniChar > &text, Int_t x, Int_t y)
const CTFontOrientation horizontalFontOrientation
Definition QuartzText.mm:39
const CTFontOrientation verticalFontOrientation
Definition QuartzText.mm:40