• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "rosen_text/properties/typography_create_txt.h"
17 #include "rosen_text/ui/typography.h"
18 #include "rosen_text/ui/typography_create.h"
19 
20 namespace rosen {
CreateRosenBuilder(const TypographyStyle & style,std::shared_ptr<FontCollection> font_collection)21 std::unique_ptr<TypographyCreate> TypographyCreate::CreateRosenBuilder(
22     const TypographyStyle& style,
23     std::shared_ptr<FontCollection> font_collection)
24 {
25     return std::make_unique<TypographyCreate>(style, font_collection);
26 }
27 
TypographyCreate(const TypographyStyle & style,std::shared_ptr<FontCollection> font_collection)28 TypographyCreate::TypographyCreate(const TypographyStyle& style,
29     std::shared_ptr<FontCollection> font_collection)
30 {
31     TypographyCreateBase_ = std::make_shared<TypographyCreateTxt>(style, font_collection);
32 }
33 
PushStyle(const TextStyle & style)34 void TypographyCreate::PushStyle(const TextStyle& style)
35 {
36     TypographyCreateBase_->PushStyle(style);
37 }
38 
Pop()39 void TypographyCreate::Pop()
40 {
41     TypographyCreateBase_->Pop();
42 }
43 
AddText(const std::u16string & text)44 void TypographyCreate::AddText(const std::u16string& text)
45 {
46     TypographyCreateBase_->AddText(text);
47 }
48 
AddPlaceholder(PlaceholderRun & span)49 void TypographyCreate::AddPlaceholder(PlaceholderRun& span)
50 {
51     TypographyCreateBase_->AddPlaceholder(span);
52 }
53 
Build()54 std::unique_ptr<Typography> TypographyCreate::Build()
55 {
56     std::unique_ptr<Typography> typography = TypographyCreateBase_->Build();
57     typography->Init(TypographyCreateBase_);
58     return typography;
59 }
60 } // namespace rosen
61