Logo ROOT  
Reference Guide
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
23/////////////////////////////////////////////////
24// //
25// TextLine - wrapper class for a CoreText's //
26// CTLine: hide all the API, calls, objects, //
27// CoreFoundation objects required to draw //
28// a simple line of text and be able to //
29// calculate text metrics. //
30// //
31/////////////////////////////////////////////////
32
33namespace ROOT {
34namespace Quartz {
35
36// Core Text's CTLine wrapper.
37class TextLine {
38public:
39 TextLine(const char *textLine, CTFontRef font);
40 TextLine(const std::vector<UniChar> &textLine, CTFontRef font);
41
42 TextLine(const char *textLine, CTFontRef font, Color_t color);
43 TextLine(const std::vector<UniChar> &textLine, CTFontRef font, Color_t color);
44 TextLine(const char *textLine, CTFontRef font, const CGFloat *rgb);
45
46 ~TextLine();
47
48 void GetBounds(UInt_t &w, UInt_t &h)const;
49 void GetAscentDescent(Int_t &asc, Int_t &desc)const;
50
51 void DrawLine(CGContextRef ctx)const;
52 void DrawLine(CGContextRef ctx, Double_t x, Double_t y)const;
53private:
54 CTLineRef fCTLine; //Core Text line, created from Attributed string.
55 CTFontRef fCTFont; //A font used for this CTLine.
56
57 void Init(const char *textLine, UInt_t nAttribs, CFStringRef *keys, CFTypeRef *values);
58 void Init(const std::vector<UniChar> &textLine, UInt_t nAttribs, CFStringRef *keys, CFTypeRef *values);
59
60 TextLine(const TextLine &rhs);
62};
63
64//Aux. function which extracts glyphs, calculates their positions, draws glyphs with manual layout (GUI text).
65void DrawTextLineNoKerning(CGContextRef ctx, CTFontRef font, const std::vector<UniChar> &text, Int_t x, Int_t y);
66
67const extern CTFontOrientation defaultFontOrientation;
68const extern CTFontOrientation horizontalFontOrientation;
69const extern CTFontOrientation verticalFontOrientation;
70
71}
72}
73
74#endif
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:45
unsigned int UInt_t
Definition: RtypesCore.h:46
double Double_t
Definition: RtypesCore.h:59
short Color_t
Definition: RtypesCore.h:92
void GetBounds(UInt_t &w, UInt_t &h) const
Definition: QuartzText.mm:179
TextLine & operator=(const TextLine &rhs)
TextLine(const TextLine &rhs)
void GetAscentDescent(Int_t &asc, Int_t &desc) const
Definition: QuartzText.mm:189
void Init(const char *textLine, UInt_t nAttribs, CFStringRef *keys, CFTypeRef *values)
Definition: QuartzText.mm:221
TextLine(const char *textLine, CTFontRef font)
Definition: QuartzText.mm:75
void DrawLine(CGContextRef ctx) const
Definition: QuartzText.mm:267
TText * text
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)
Definition: QuartzText.mm:319
const CTFontOrientation horizontalFontOrientation
Definition: QuartzText.mm:39
const CTFontOrientation verticalFontOrientation
Definition: QuartzText.mm:40
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...