2019-04-11 14:40:54 +08:00
|
|
|
|
// Copyright (c) 2016-2018 Kiwano - Nomango
|
2019-03-31 01:37:06 +08:00
|
|
|
|
//
|
|
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
|
// in the Software without restriction, including without limitation the rights
|
|
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
|
|
//
|
|
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
|
|
//
|
|
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
|
// THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
#include "include-forwards.h"
|
|
|
|
|
|
|
2019-04-11 14:40:54 +08:00
|
|
|
|
namespace kiwano
|
2019-03-31 01:37:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
// <20>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>뷽ʽ
|
|
|
|
|
|
enum class TextAlign
|
|
|
|
|
|
{
|
|
|
|
|
|
Left, /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
|
Right, /* <20>Ҷ<EFBFBD><D2B6><EFBFBD> */
|
|
|
|
|
|
Center /* <20><><EFBFBD>ж<EFBFBD><D0B6><EFBFBD> */
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// <20>ı<EFBFBD><C4B1><EFBFBD>ʽ
|
2019-04-11 14:40:54 +08:00
|
|
|
|
class KGE_API TextStyle
|
2019-03-31 01:37:06 +08:00
|
|
|
|
{
|
|
|
|
|
|
public:
|
|
|
|
|
|
Color color; // <20><>ɫ
|
|
|
|
|
|
TextAlign alignment; // <20><><EFBFBD>뷽ʽ
|
|
|
|
|
|
bool wrap; // <20><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
float wrap_width; // <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>п<EFBFBD><D0BF><EFBFBD>
|
|
|
|
|
|
float line_spacing; // <20>м<EFBFBD><D0BC><EFBFBD>
|
|
|
|
|
|
bool underline; // <20>»<EFBFBD><C2BB><EFBFBD>
|
|
|
|
|
|
bool strikethrough; // ɾ<><C9BE><EFBFBD><EFBFBD>
|
|
|
|
|
|
bool outline; // <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
|
Color outline_color; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|
|
|
|
|
float outline_width; // <20><><EFBFBD><EFBFBD><EFBFBD>߿<EFBFBD>
|
|
|
|
|
|
StrokeStyle outline_stroke; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ཻ<EFBFBD><E0BDBB>ʽ
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
TextStyle()
|
|
|
|
|
|
: color(Color::White)
|
|
|
|
|
|
, alignment(TextAlign::Left)
|
|
|
|
|
|
, wrap(false)
|
|
|
|
|
|
, wrap_width(0.f)
|
|
|
|
|
|
, line_spacing(0.f)
|
|
|
|
|
|
, underline(false)
|
|
|
|
|
|
, strikethrough(false)
|
|
|
|
|
|
, outline(true)
|
|
|
|
|
|
, outline_color(Color(Color::Black, 0.5))
|
|
|
|
|
|
, outline_width(1.f)
|
|
|
|
|
|
, outline_stroke(StrokeStyle::Round)
|
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
TextStyle(
|
|
|
|
|
|
Color color,
|
|
|
|
|
|
TextAlign alignment = TextAlign::Left,
|
|
|
|
|
|
bool wrap = false,
|
|
|
|
|
|
float wrap_width = 0.f,
|
|
|
|
|
|
float line_spacing = 0.f,
|
|
|
|
|
|
bool underline = false,
|
|
|
|
|
|
bool strikethrough = false,
|
|
|
|
|
|
bool outline = true,
|
|
|
|
|
|
Color outline_color = Color(Color::Black, 0.5),
|
|
|
|
|
|
float outline_width = 1.f,
|
|
|
|
|
|
StrokeStyle outline_stroke = StrokeStyle::Round
|
|
|
|
|
|
)
|
|
|
|
|
|
: color(color)
|
|
|
|
|
|
, alignment(alignment)
|
|
|
|
|
|
, wrap(wrap)
|
|
|
|
|
|
, wrap_width(wrap_width)
|
|
|
|
|
|
, line_spacing(line_spacing)
|
|
|
|
|
|
, underline(underline)
|
|
|
|
|
|
, strikethrough(strikethrough)
|
|
|
|
|
|
, outline(outline)
|
|
|
|
|
|
, outline_color(outline_color)
|
|
|
|
|
|
, outline_width(outline_width)
|
|
|
|
|
|
, outline_stroke(outline_stroke)
|
|
|
|
|
|
{}
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|