mirror of
https://github.com/rvtr/TwlIPL_commit-99.git
synced 2025-10-31 06:21:11 -04:00
665 lines
22 KiB
C
Executable File
665 lines
22 KiB
C
Executable File
/*---------------------------------------------------------------------------*
|
||
Project: NITRO-System - include - nnsys - g2d
|
||
File: g2d_TextCanvas.h
|
||
|
||
Copyright 2004-2008 Nintendo. All rights reserved.
|
||
|
||
These coded instructions, statements, and computer programs contain
|
||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||
Company Ltd., and are protected by Federal copyright law. They may
|
||
not be disclosed to third parties or copied or duplicated in any form,
|
||
in whole or in part, without the prior written consent of Nintendo.
|
||
|
||
$Revision: 172 $
|
||
*---------------------------------------------------------------------------*/
|
||
#ifndef G2D_TEXTAREA_H_
|
||
#define G2D_TEXTAREA_H_
|
||
|
||
#include <nnsys/g2d/g2d_Font.h>
|
||
#include <nnsys/g2d/g2d_CharCanvas.h>
|
||
#include <nnsys/g2d/g2di_AssertUtil.h>
|
||
#include <nnsys/g2d/g2di_SplitChar.h>
|
||
#include <nnsys/g2d/g2di_Char.h>
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
//---------------------------------------------------------------------
|
||
|
||
//---------------------------------------------------------------------
|
||
// TextCanvas ƒ}ƒNƒ<4E>
|
||
//---------------------------------------------------------------------
|
||
#define NNS_G2D_TEXTCANVAS_ASSERT( pTxn ) \
|
||
NNS_G2D_ASSERTMSG( \
|
||
NNS_G2D_IS_VALID_POINTER(pTxn) \
|
||
&& NNS_G2D_IS_VALID_POINTER((pTxn)->pCanvas) \
|
||
&& NNS_G2D_IS_VALID_POINTER((pTxn)->pFont) \
|
||
, "Illegal NNSG2dTextCanvas." )
|
||
|
||
#define NNS_G2D_CHARENCODING_ASSERT( enc ) \
|
||
NNS_G2D_ASSERTMSG( \
|
||
(0 <= (enc)) && ((enc) < NNS_G2D_NUM_OF_CHARENCODING) \
|
||
, "Illegal NNSG2dCharEncoding(=%d).", (enc) ) \
|
||
|
||
|
||
|
||
//---------------------------------------------------------------------
|
||
// TextCanvas ’è‹`
|
||
//---------------------------------------------------------------------
|
||
|
||
// <20>‚’¼•ûŒüŠî<C5A0>€“_”z’u
|
||
typedef enum NNSG2dVerticalOrigin
|
||
{
|
||
NNS_G2D_VERTICALORIGIN_TOP = 0x1,
|
||
NNS_G2D_VERTICALORIGIN_MIDDLE = 0x2,
|
||
NNS_G2D_VERTICALORIGIN_BOTTOM = 0x4
|
||
}
|
||
NNSG2dVerticalOrigin;
|
||
|
||
// <20>…•½•ûŒüŠî<C5A0>€“_”z’u
|
||
typedef enum NNSG2dHorizontalOrigin
|
||
{
|
||
NNS_G2D_HORIZONTALORIGIN_LEFT = 0x8,
|
||
NNS_G2D_HORIZONTALORIGIN_CENTER = 0x10,
|
||
NNS_G2D_HORIZONTALORIGIN_RIGHT = 0x20
|
||
}
|
||
NNSG2dHorizontalOrigin;
|
||
|
||
// <20>‚’¼•ûŒü‘µ‚¦
|
||
typedef enum NNSG2dVerticalAlign
|
||
{
|
||
NNS_G2D_VERTICALALIGN_TOP = 0x40,
|
||
NNS_G2D_VERTICALALIGN_MIDDLE = 0x80,
|
||
NNS_G2D_VERTICALALIGN_BOTTOM = 0x100
|
||
}
|
||
NNSG2dVerticalAlign;
|
||
|
||
// <20>…•½•ûŒü‘µ‚¦
|
||
typedef enum NNSG2dHorizontalAlign
|
||
{
|
||
NNS_G2D_HORIZONTALALIGN_LEFT = 0x200,
|
||
NNS_G2D_HORIZONTALALIGN_CENTER = 0x400,
|
||
NNS_G2D_HORIZONTALALIGN_RIGHT = 0x800
|
||
}
|
||
NNSG2dHorizontalAlign;
|
||
|
||
|
||
|
||
// TextCanvas
|
||
typedef struct NNSG2dTextCanvas
|
||
{
|
||
const NNSG2dCharCanvas* pCanvas;
|
||
const NNSG2dFont* pFont;
|
||
int hSpace;
|
||
int vSpace;
|
||
}
|
||
NNSG2dTextCanvas;
|
||
|
||
|
||
|
||
// NNS_G2dTextCanvasDrawTaggedText —pƒR<C692>[ƒ‹ƒoƒbƒNƒpƒ‰ƒ<E280B0><C692>[ƒ^
|
||
typedef struct NNSG2dTagCallbackInfo
|
||
{
|
||
NNSG2dTextCanvas txn; // •`‰æ‚ÉŽg—p‚µ‚Ä‚¢‚éTextCanvas<61>B
|
||
const NNSG2dChar* str; // •`‰æ’†‚Ì•¶Žš—ñ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
int x; // •`‰æ’†‚Ì<E2809A>À•W x
|
||
int y; // •`‰æ’†‚Ì<E2809A>À•W y
|
||
int clr; // •`‰æ’†‚Ì<E2809A>F”Ô<E2809D>†<EFBFBD>B
|
||
void* cbParam; // NNS_G2dTextCanvasDrawTaggedText ‚Ì‘æ7ˆø<CB86>”<EFBFBD>B
|
||
}
|
||
NNSG2dTagCallbackInfo;
|
||
|
||
// NNS_G2dTextCanvasDrawTaggedText —pƒR<C692>[ƒ‹ƒoƒbƒNŠÖ<C5A0>”
|
||
typedef void (*NNSG2dTagCallback)(u16 c, NNSG2dTagCallbackInfo* pInfo);
|
||
|
||
// •¶Žš—ñ•`‰æŽž‚Ì•¶Žš‚Ì”z’u•ûŒü
|
||
typedef struct NNSiG2dTextDirection
|
||
{
|
||
s8 x;
|
||
s8 y;
|
||
}
|
||
NNSiG2dTextDirection;
|
||
|
||
|
||
|
||
//---------------------------------------------------------------------
|
||
// TextCanvas ‘€<E28098>ì
|
||
//---------------------------------------------------------------------
|
||
|
||
//--------------------------------------------
|
||
// •`‰æ
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasDrawString
|
||
|
||
Description: <20>Å<EFBFBD>‰‚̉ü<E280B0>s•¶Žš‚à‚µ‚‚Í<E2809A>I’[•¶Žš‚܂łð•`‰æ‚µ‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: •`‰æ‘Î<E28098>Û‚Ì TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
x: •`‰æŠJŽnˆÊ’u‚Ì x <20>À•W<E280A2>B
|
||
y: •`‰æŠJŽnˆÊ’u‚Ì y <20>À•W<E280A2>B
|
||
cl: •¶Žš<C5BD>F‚Ì<E2809A>F”Ô<E2809D>†<EFBFBD>B
|
||
str: •`‰æ‚·‚é•¶Žš—ñ<E28094>B
|
||
pPos: ‰ü<E280B0>s•¶Žš‚܂ŕ`‰æ‚µ‚½<E2809A>ê<EFBFBD>‡‚͉ü<E280B0>s•¶Žš‚ÌŽŸ‚Ì•¶Žš‚Ö‚Ì
|
||
ƒ|ƒCƒ“ƒ^‚ð<E2809A>A<EFBFBD>I’[•¶Žš‚܂ŕ`‰æ‚µ‚½<E2809A>ê<EFBFBD>‡‚ÍNULL‚ðŠi”[‚·‚é
|
||
ƒoƒbƒtƒ@‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
•s—v‚È<E2809A>ê<EFBFBD>‡‚ÍNULL‚ðŽw’è‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·<E2809A>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
void NNSi_G2dTextCanvasDrawString(
|
||
const NNSG2dTextCanvas* pTxn,
|
||
int x,
|
||
int y,
|
||
int cl,
|
||
const void* str,
|
||
const void** pPos
|
||
#ifdef NNS_G2D_FONT_ENABLE_DIRECTION_SUPPORT
|
||
, NNSiG2dTextDirection d
|
||
#endif
|
||
);
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNSi_G2dDrawTextAlign
|
||
|
||
Description: <20>Å<EFBFBD>‰‚̉ü<E280B0>s•¶Žš‚à‚µ‚‚Í<E2809A>I’[•¶Žš‚܂łð•`‰æ‚µ‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: •`‰æ‘Î<E28098>Û‚Ì TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
x: •`‰æŠJŽnˆÊ’u‚Ì x <20>À•W<E280A2>B
|
||
y: •`‰æŠJŽnˆÊ’u‚Ì y <20>À•W<E280A2>B
|
||
cl: •¶Žš<C5BD>F‚Ì<E2809A>F”Ô<E2809D>†<EFBFBD>B
|
||
flags: •`‰æˆÊ’u‚ðŽw’è‚·‚éƒtƒ‰ƒO<C692>B
|
||
txt: •`‰æ‚·‚é•¶Žš—ñ<E28094>B
|
||
areaWidth: ‰EŠñ‚¹<E2809A>A’†Šñ‚¹‚Ì<E2809A>Û‚ÉŽQ<C5BD>Æ‚³‚ê‚é•`‰æ—̈æ•<C3A6><E280A2>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
void NNSi_G2dTextCanvasDrawTextAlign(
|
||
const NNSG2dTextCanvas* pTxn,
|
||
int x,
|
||
int y,
|
||
int areaWidth,
|
||
int cl,
|
||
u32 flags,
|
||
const void* txt
|
||
#ifdef NNS_G2D_FONT_ENABLE_DIRECTION_SUPPORT
|
||
, NNSiG2dTextDirection d
|
||
#endif
|
||
);
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasDrawText
|
||
|
||
Description: •¡<E280A2>”<EFBFBD>s‚Ì•¶Žš—ñ‚ð•`‰æ‚µ‚Ü‚·<E2809A>B
|
||
“_‚ðŠî<C5A0>€‚É•`‰æˆÊ’u‚ðŽw’è‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: •`‰æ‘Î<E28098>Û‚Ì TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
x: •`‰æŠî<C5A0>€ˆÊ’u‚Ì x <20>À•W<E280A2>B
|
||
y: •`‰æŠî<C5A0>€ˆÊ’u‚Ì y <20>À•W<E280A2>B
|
||
cl: •¶Žš<C5BD>F‚Ì<E2809A>F”Ô<E2809D>†<EFBFBD>B
|
||
flags: •`‰æˆÊ’u‚ðŽw’è‚·‚éƒtƒ‰ƒO<C692>B
|
||
txt: •`‰æ‚·‚é•¶Žš—ñ<E28094>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
void NNSi_G2dTextCanvasDrawText(
|
||
const NNSG2dTextCanvas* pTxn,
|
||
int x,
|
||
int y,
|
||
int cl,
|
||
u32 flags,
|
||
const void* txt
|
||
#ifdef NNS_G2D_FONT_ENABLE_DIRECTION_SUPPORT
|
||
, NNSiG2dTextDirection d
|
||
#endif
|
||
);
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasDrawTextRect
|
||
|
||
Description: •¡<E280A2>”<EFBFBD>s‚Ì•¶Žš—ñ‚ð•`‰æ‚µ‚Ü‚·<E2809A>B
|
||
‹éŒ`‚ðŠî<C5A0>€‚É•`‰æˆÊ’u‚ðŽw’è‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·<E2809A>B
|
||
‹éŒ`‚ð‚Í‚Ý<E2809A>o‚½•¶Žš‚à’Ê<E28099>í‚Ç‚¨‚è•`‰æ‚³‚ê‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: •`‰æ‘Î<E28098>Û‚Ì TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
x: •`‰æ‹éŒ`<60>¶<EFBFBD>ã‚Ì x <20>À•W<E280A2>B
|
||
y: •`‰æ‹éŒ`<60>¶<EFBFBD>ã‚Ì y <20>À•W<E280A2>B
|
||
cl: •¶Žš<C5BD>F‚Ì<E2809A>F”Ô<E2809D>†<EFBFBD>B
|
||
flags: •`‰æˆÊ’u‚ðŽw’è‚·‚éƒtƒ‰ƒO<C692>B
|
||
txt: •`‰æ‚·‚é•¶Žš—ñ<E28094>B
|
||
w: •`‰æ‹éŒ`‚Ì•<C38C><E280A2>B
|
||
h: •`‰æ‹éŒ`‚Ì<E2809A>‚‚³<E2809A>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
void NNSi_G2dTextCanvasDrawTextRect(
|
||
const NNSG2dTextCanvas* pTxn,
|
||
int x,
|
||
int y,
|
||
int w,
|
||
int h,
|
||
int cl,
|
||
u32 flags,
|
||
const void* txt
|
||
#ifdef NNS_G2D_FONT_ENABLE_DIRECTION_SUPPORT
|
||
, NNSiG2dTextDirection d
|
||
#endif
|
||
);
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasDrawTaggedText
|
||
|
||
Description: ƒ^ƒO‚ª–„‚ß<E2809A>ž‚܂ꂽ•¡<E280A2>”<EFBFBD>s‚Ì•¶Žš—ñ‚ð•`‰æ‚µ‚Ü‚·<E2809A>B
|
||
ƒ^ƒO‚É‚æ‚Á‚Ä•`‰æ‚ð<E2809A>§Œä‚·‚鎖‚ª‚Å‚«‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: •`‰æ‘Î<E28098>Û‚Ì TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
x: •`‰æŠî<C5A0>€ˆÊ’u‚Ì x <20>À•W<E280A2>B
|
||
y: •`‰æŠî<C5A0>€ˆÊ’u‚Ì y <20>À•W<E280A2>B
|
||
cl: •¶Žš<C5BD>F‚Ì<E2809A>F”Ô<E2809D>†<EFBFBD>B
|
||
txt: •`‰æ‚·‚é•¶Žš—ñ<E28094>B
|
||
cbFunc: ƒ^ƒO‚É‚æ‚Á‚ČĂ΂ê‚éƒR<C692>[ƒ‹ƒoƒbƒNŠÖ<C5A0>”<EFBFBD>B
|
||
cbParam: ƒR<C692>[ƒ‹ƒoƒbƒNŠÖ<C5A0>”‚É“n‚³‚ê‚郆<C692>[ƒUƒf<C692>[ƒ^<5E>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
void NNSi_G2dTextCanvasDrawTaggedText(
|
||
const NNSG2dTextCanvas* pTxn,
|
||
int x,
|
||
int y,
|
||
int cl,
|
||
const void* txt,
|
||
NNSG2dTagCallback cbFunc,
|
||
void* cbParam
|
||
#ifdef NNS_G2D_FONT_ENABLE_DIRECTION_SUPPORT
|
||
, NNSiG2dTextDirection d
|
||
#endif
|
||
);
|
||
|
||
|
||
|
||
|
||
|
||
//--------------------------------------------
|
||
// <20>\’z
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasInit*
|
||
|
||
Description: TextCanvas ‚ð<E2809A>‰Šú‰»‚µ‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: <20>‰Šú‰»‚·‚é TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
pCC: •`‰æ<E280B0>æ‚Ì CharCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
pFont: •`‰æ‚É—p‚¢‚éƒtƒHƒ“ƒg‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
hSpace: •¶ŽšŠÔŠu<C5A0>B
|
||
vSpace: ƒtƒHƒ“ƒg‚ÌŽ<C38C>‚Â<E2809A>sŠÔŠu‚Ì•â<E280A2>³<EFBFBD>·•ª<E280A2>B
|
||
encode: •¶Žš<C5BD>Ø‚è<E2809A>o‚µƒR<C692>[ƒ‹ƒoƒbƒNŠÖ<C5A0>”‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasInit(
|
||
NNSG2dTextCanvas* pTxn,
|
||
const NNSG2dCharCanvas* pCC,
|
||
const NNSG2dFont* pFont,
|
||
int hSpace,
|
||
int vSpace
|
||
)
|
||
{
|
||
NNS_G2D_POINTER_ASSERT( pTxn );
|
||
NNS_G2D_CHARCANVAS_ASSERT( pCC );
|
||
NNS_G2D_FONT_ASSERT( pFont );
|
||
|
||
pTxn->pCanvas = pCC;
|
||
pTxn->pFont = pFont;
|
||
pTxn->hSpace = hSpace;
|
||
pTxn->vSpace = vSpace;
|
||
}
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasInit*
|
||
|
||
Description: TextCanvas ‚ð<E2809A>‰Šú‰»‚µ‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: <20>‰Šú‰»‚·‚é TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
pCC: •`‰æ<E280B0>æ‚Ì CharCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
pFont: •`‰æ‚É—p‚¢‚éƒtƒHƒ“ƒg‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
hSpace: •¶ŽšŠÔŠu<C5A0>B
|
||
vSpace: ƒtƒHƒ“ƒg‚ÌŽ<C38C>‚Â<E2809A>sŠÔŠu‚Ì•â<E280A2>³<EFBFBD>·•ª<E280A2>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
#define NNS_G2dTextCanvasInit1Byte NNS_G2dTextCanvasInit
|
||
#define NNS_G2dTextCanvasInitUTF8 NNS_G2dTextCanvasInit
|
||
#define NNS_G2dTextCanvasInitUTF16 NNS_G2dTextCanvasInit
|
||
#define NNS_G2dTextCanvasInitShiftJIS NNS_G2dTextCanvasInit
|
||
|
||
|
||
//--------
|
||
// getter
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasGetCharCanvas
|
||
|
||
Description: TextCanvas ‚Ì•`‰æ‘Î<E28098>Û‚Ì CharCanvas ‚ð<E2809A>ݒ肵‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: ƒtƒHƒ“ƒg‚ð<E2809A>Ý’è‚·‚é TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
pCC: <20>V‚µ‚<E2809A>Ý’è‚·‚é CharCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE const NNSG2dCharCanvas* NNS_G2dTextCanvasGetCharCanvas(
|
||
const NNSG2dTextCanvas* pTxn
|
||
)
|
||
{
|
||
NNS_G2D_TEXTCANVAS_ASSERT( pTxn );
|
||
return pTxn->pCanvas;
|
||
}
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasGetFont
|
||
|
||
Description: TextCanvas ‚ɃtƒHƒ“ƒg‚ð<E2809A>ݒ肵‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: ƒtƒHƒ“ƒg‚ð<E2809A>Ý’è‚·‚é TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
pFont: <20>V‚µ‚<E2809A>Ý’è‚·‚éƒtƒHƒ“ƒg‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE const NNSG2dFont* NNS_G2dTextCanvasGetFont( const NNSG2dTextCanvas* pTxn )
|
||
{
|
||
NNS_G2D_TEXTCANVAS_ASSERT( pTxn );
|
||
return pTxn->pFont;
|
||
}
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasGetHSpace
|
||
|
||
Description: TextCanvas ‚ª•¶Žš—ñ‚Ì•`‰æŽž‚É—p‚¢‚éŠÔŠu‚ð<E2809A>ݒ肵‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: ƒtƒHƒ“ƒg‚ð<E2809A>Ý’è‚·‚é TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE int NNS_G2dTextCanvasGetHSpace( const NNSG2dTextCanvas* pTxn )
|
||
{
|
||
NNS_G2D_TEXTCANVAS_ASSERT( pTxn );
|
||
return pTxn->hSpace;
|
||
}
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasGetVSpace
|
||
|
||
Description: TextCanvas ‚ª•¶Žš—ñ‚Ì•`‰æŽž‚É—p‚¢‚éŠÔŠu‚ð<E2809A>ݒ肵‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: ƒtƒHƒ“ƒg‚ð<E2809A>Ý’è‚·‚é TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE int NNS_G2dTextCanvasGetVSpace( const NNSG2dTextCanvas* pTxn )
|
||
{
|
||
NNS_G2D_TEXTCANVAS_ASSERT( pTxn );
|
||
return pTxn->vSpace;
|
||
}
|
||
|
||
|
||
|
||
//--------
|
||
// setter
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasSetCharCanvas
|
||
|
||
Description: TextCanvas ‚Ì•`‰æ‘Î<E28098>Û‚Ì CharCanvas ‚ð<E2809A>ݒ肵‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: ƒtƒHƒ“ƒg‚ð<E2809A>Ý’è‚·‚é TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
pCC: <20>V‚µ‚<E2809A>Ý’è‚·‚é CharCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasSetCharCanvas(
|
||
NNSG2dTextCanvas* pTxn,
|
||
const NNSG2dCharCanvas* pCC
|
||
)
|
||
{
|
||
NNS_G2D_TEXTCANVAS_ASSERT( pTxn );
|
||
NNS_G2D_CHARCANVAS_ASSERT( pCC );
|
||
pTxn->pCanvas = pCC;
|
||
}
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasSetFont
|
||
|
||
Description: TextCanvas ‚ɃtƒHƒ“ƒg‚ð<E2809A>ݒ肵‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: ƒtƒHƒ“ƒg‚ð<E2809A>Ý’è‚·‚é TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
pFont: <20>V‚µ‚<E2809A>Ý’è‚·‚éƒtƒHƒ“ƒg‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasSetFont( NNSG2dTextCanvas* pTxn, const NNSG2dFont* pFont )
|
||
{
|
||
NNS_G2D_TEXTCANVAS_ASSERT( pTxn );
|
||
NNS_G2D_FONT_ASSERT( pFont );
|
||
pTxn->pFont = pFont;
|
||
}
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasSetHSpace
|
||
|
||
Description: TextCanvas ‚ª•¶Žš—ñ‚Ì•`‰æŽž‚É—p‚¢‚éŠÔŠu‚ð<E2809A>ݒ肵‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: ƒtƒHƒ“ƒg‚ð<E2809A>Ý’è‚·‚é TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
hSpace: <20>V‚µ‚<E2809A>Ý’è‚·‚é•¶ŽšŠÔ<C5A0>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasSetHSpace( NNSG2dTextCanvas* pTxn, int hSpace )
|
||
{
|
||
NNS_G2D_TEXTCANVAS_ASSERT( pTxn );
|
||
pTxn->hSpace = hSpace;
|
||
}
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasSetVSpace
|
||
|
||
Description: TextCanvas ‚ª•¶Žš—ñ‚Ì•`‰æŽž‚É—p‚¢‚éŠÔŠu‚ð<E2809A>ݒ肵‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: ƒtƒHƒ“ƒg‚ð<E2809A>Ý’è‚·‚é TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
vSpace: <20>V‚µ‚<E2809A>Ý’è‚·‚é<E2809A>sŠÔ<C5A0>B
|
||
|
||
Returns: ‚È‚µ<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasSetVSpace( NNSG2dTextCanvas* pTxn, int vSpace )
|
||
{
|
||
NNS_G2D_TEXTCANVAS_ASSERT( pTxn );
|
||
pTxn->vSpace = vSpace;
|
||
}
|
||
|
||
|
||
|
||
//--------------------------------------------
|
||
// <20>î•ñŽæ“¾
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasGetStringWidth
|
||
|
||
Description: <20>Å<EFBFBD>‰‚̉ü<E280B0>s•¶Žš‚à‚µ‚‚Í<E2809A>I’[•¶Žš‚܂łð•`‰æ‚µ‚½<E2809A>ê<EFBFBD>‡‚Ì•<C38C>‚ð‹<C3B0>‚߂܂·<E2809A>B
|
||
|
||
Arguments: pTxn: ŒvŽZ‚ÌŠî<C5A0>€‚ƂȂé TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
str: •¶Žš—ñ<E28094>B
|
||
pPos: ‰ü<E280B0>s•¶Žš‚Å<E2809A>ˆ—<CB86>‚ð’âŽ~‚µ‚½<E2809A>ê<EFBFBD>‡‚͉ü<E280B0>s•¶Žš‚ÌŽŸ‚Ì•¶Žš‚Ö‚Ì
|
||
ƒ|ƒCƒ“ƒ^‚ð<E2809A>A<EFBFBD>I’[•¶Žš‚Å’âŽ~‚µ‚½<E2809A>ê<EFBFBD>‡‚ÍNULL‚ðŠi”[‚·‚é
|
||
ƒoƒbƒtƒ@‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
•s—v‚È<E2809A>ê<EFBFBD>‡‚ÍNULL‚ðŽw’è‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·<E2809A>B
|
||
|
||
|
||
Returns: •¶Žš—ñ‚ð•`‰æ‚µ‚½<E2809A>ê<EFBFBD>‡‚Ì•<C38C><E280A2>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE int NNS_G2dTextCanvasGetStringWidth(
|
||
const NNSG2dTextCanvas* pTxn,
|
||
const NNSG2dChar* str,
|
||
const NNSG2dChar** pPos
|
||
)
|
||
{
|
||
return NNS_G2dFontGetStringWidth(
|
||
pTxn->pFont,
|
||
pTxn->hSpace,
|
||
str,
|
||
pPos );
|
||
}
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasGetTextHeight
|
||
|
||
Description: •¶Žš—ñ‚ð•`‰æ‚µ‚½<E2809A>ê<EFBFBD>‡‚Ì<E2809A>‚‚³‚ð‹<C3B0>‚߂܂·<E2809A>B
|
||
|
||
Arguments: pTxn: ŒvŽZ‚ÌŠî<C5A0>€‚ƂȂé TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
txt: •¶Žš—ñ<E28094>B
|
||
|
||
Returns: •¶Žš—ñ‚ð•`‰æ‚µ‚½<E2809A>ê<EFBFBD>‡‚Ì<E2809A>‚‚³<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE int NNS_G2dTextCanvasGetTextHeight(
|
||
const NNSG2dTextCanvas* pTxn,
|
||
const NNSG2dChar* txt
|
||
)
|
||
{
|
||
return NNS_G2dFontGetTextHeight(
|
||
pTxn->pFont,
|
||
pTxn->vSpace,
|
||
txt );
|
||
}
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasGetTextWidth
|
||
|
||
Description: •¶Žš—ñ‚ð•`‰æ‚µ‚½<E2809A>ê<EFBFBD>‡‚Ì•<C38C>‚ð‹<C3B0>‚߂܂·<E2809A>B
|
||
‚±‚ê‚ÍŠe<C5A0>s‚Ì•<C38C>‚Ì<E2809A>Å‘å’l‚ɂȂè‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pTxn: ŒvŽZ‚ÌŠî<C5A0>€‚ƂȂé TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
txt: •¶Žš—ñ<E28094>B
|
||
|
||
Returns: •¶Žš—ñ‚ð•`‰æ‚µ‚½<E2809A>ê<EFBFBD>‡‚Ì•<C38C><E280A2>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE int NNS_G2dTextCanvasGetTextWidth(
|
||
const NNSG2dTextCanvas* pTxn,
|
||
const NNSG2dChar* txt
|
||
)
|
||
{
|
||
return NNS_G2dFontGetTextWidth(
|
||
pTxn->pFont,
|
||
pTxn->hSpace,
|
||
txt );
|
||
}
|
||
|
||
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNS_G2dTextCanvasGetTextRect
|
||
|
||
Description: •¶Žš—ñ‚ð•`‰æ‚µ‚½<E2809A>ê<EFBFBD>‡‚Ì<E2809A>‚‚³‚Æ•<C386>‚ð‹<C3B0>‚߂܂·<E2809A>B
|
||
|
||
Arguments: pTxn: ŒvŽZ‚ÌŠî<C5A0>€‚ƂȂé TextCanvas ‚ւ̃|ƒCƒ“ƒ^<5E>B
|
||
txt: •¶Žš—ñ<E28094>B
|
||
|
||
Returns: •¶Žš—ñ‚ð•`‰æ‚µ‚½<E2809A>ê<EFBFBD>‡‚Ì<E2809A>‚‚³‚Æ•<C386><E280A2>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE NNSG2dTextRect NNS_G2dTextCanvasGetTextRect(
|
||
const NNSG2dTextCanvas* pTxn,
|
||
const NNSG2dChar* txt
|
||
)
|
||
{
|
||
return NNS_G2dFontGetTextRect(
|
||
pTxn->pFont,
|
||
pTxn->hSpace,
|
||
pTxn->vSpace,
|
||
txt );
|
||
}
|
||
|
||
|
||
|
||
//---------------------------------------------------------------------
|
||
|
||
/*---------------------------------------------------------------------------*
|
||
Name: NNSi_G2dGetTextDirection
|
||
|
||
Description: ƒtƒHƒ“ƒg‚ɉž‚¶‚½•¶Žš—ñ”z’u•ûŒü‚ðŽæ“¾‚µ‚Ü‚·<E2809A>B
|
||
|
||
Arguments: pFont: •¶Žš—ñ”z’u•ûŒüŽæ“¾Œ³‚̃tƒHƒ“ƒg
|
||
|
||
Returns: ƒtƒHƒ“ƒg‚ɉž‚¶‚½•¶Žš—ñ”z’u•ûŒü‚ð•Ô‚µ‚Ü‚·<E2809A>B
|
||
*---------------------------------------------------------------------------*/
|
||
NNS_G2D_INLINE NNSiG2dTextDirection NNSi_G2dGetTextDirection(const NNSG2dFont* pFont)
|
||
{
|
||
NNSiG2dTextDirection d = { 0, 0 };
|
||
switch( NNS_G2dFontGetFlags(pFont) )
|
||
{
|
||
case (NNS_G2D_FONT_FLAG_ROT_0):
|
||
case (NNS_G2D_FONT_FLAG_ROT_270|NNS_G2D_FONT_FLAG_TBRL): d.x = 1; break;
|
||
case (NNS_G2D_FONT_FLAG_ROT_90):
|
||
case (NNS_G2D_FONT_FLAG_ROT_0|NNS_G2D_FONT_FLAG_TBRL): d.y = 1; break;
|
||
case (NNS_G2D_FONT_FLAG_ROT_180):
|
||
case (NNS_G2D_FONT_FLAG_ROT_90|NNS_G2D_FONT_FLAG_TBRL): d.x = -1; break;
|
||
case (NNS_G2D_FONT_FLAG_ROT_270):
|
||
case (NNS_G2D_FONT_FLAG_ROT_180|NNS_G2D_FONT_FLAG_TBRL): d.y = -1; break;
|
||
}
|
||
return d;
|
||
}
|
||
|
||
#ifdef NNS_G2D_FONT_ENABLE_DIRECTION_SUPPORT
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasDrawString(const NNSG2dTextCanvas* pTxn, int x, int y, int cl, const NNSG2dChar* str, const NNSG2dChar** pPos)
|
||
{ NNSi_G2dTextCanvasDrawString(pTxn, x, y, cl, str, (const void**)pPos,
|
||
NNSi_G2dGetTextDirection(NNS_G2dTextCanvasGetFont(pTxn))); }
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasDrawText(const NNSG2dTextCanvas* pTxn, int x, int y, int cl, u32 flags, const NNSG2dChar* txt)
|
||
{ NNSi_G2dTextCanvasDrawText(pTxn, x, y, cl, flags, txt,
|
||
NNSi_G2dGetTextDirection(NNS_G2dTextCanvasGetFont(pTxn))); }
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasDrawTextRect(const NNSG2dTextCanvas* pTxn, int x, int y, int w, int h, int cl, u32 flags, const NNSG2dChar* txt)
|
||
{ NNSi_G2dTextCanvasDrawTextRect(pTxn, x, y, w, h, cl, flags, txt,
|
||
NNSi_G2dGetTextDirection(NNS_G2dTextCanvasGetFont(pTxn))); }
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasDrawTaggedText(const NNSG2dTextCanvas* pTxn, int x, int y, int cl, const NNSG2dChar* txt, NNSG2dTagCallback cbFunc, void* cbParam)
|
||
{ NNSi_G2dTextCanvasDrawTaggedText(pTxn, x, y, cl, txt, cbFunc, cbParam,
|
||
NNSi_G2dGetTextDirection(NNS_G2dTextCanvasGetFont(pTxn))); }
|
||
#else
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasDrawString(const NNSG2dTextCanvas* pTxn, int x, int y, int cl, const NNSG2dChar* str, const NNSG2dChar** pPos)
|
||
{ NNSi_G2dTextCanvasDrawString(pTxn, x, y, cl, str, (const void**)pPos); }
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasDrawText(const NNSG2dTextCanvas* pTxn, int x, int y, int cl, u32 flags, const NNSG2dChar* txt)
|
||
{ NNSi_G2dTextCanvasDrawText(pTxn, x, y, cl, flags, txt); }
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasDrawTextRect(const NNSG2dTextCanvas* pTxn, int x, int y, int w, int h, int cl, u32 flags, const NNSG2dChar* txt)
|
||
{ NNSi_G2dTextCanvasDrawTextRect(pTxn, x, y, w, h, cl, flags, txt); }
|
||
NNS_G2D_INLINE void NNS_G2dTextCanvasDrawTaggedText(const NNSG2dTextCanvas* pTxn, int x, int y, int cl, const NNSG2dChar* txt, NNSG2dTagCallback cbFunc, void* cbParam)
|
||
{ NNSi_G2dTextCanvasDrawTaggedText(pTxn, x, y, cl, txt, cbFunc, cbParam); }
|
||
#endif
|
||
|
||
//---------------------------------------------------------------------
|
||
|
||
#ifdef __cplusplus
|
||
}/* extern "C" */
|
||
#endif
|
||
|
||
#endif // G2D_TEXTAREA_H_
|
||
|