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 #ifndef ROSEN_TEXT_PROPERTIES_TYPOGRAPHY_CREATE_BASE_H_ 17 #define ROSEN_TEXT_PROPERTIES_TYPOGRAPHY_CREATE_BASE_H_ 18 19 #include <memory> 20 #include <string> 21 #include "rosen_text/ui/font_collection.h" 22 #include "rosen_text/ui/typography.h" 23 24 #include "rosen_text/properties/placeholder_run.h" 25 #include "rosen_text/properties/text_style.h" 26 #include "rosen_text/properties/typography_style.h" 27 28 namespace rosen { 29 class Typography; 30 class TypographyCreateBase { 31 public: TypographyCreateBase()32 TypographyCreateBase() {}; 33 TypographyCreateBase(const TypographyStyle& style, std::shared_ptr<FontCollection> font_collection); ~TypographyCreateBase()34 virtual ~TypographyCreateBase() {}; 35 virtual void PushStyle(const TextStyle& style); 36 virtual void Pop(); 37 virtual void AddText(const std::u16string& text); 38 virtual void AddPlaceholder(PlaceholderRun& span); 39 virtual std::unique_ptr<Typography> Build(); 40 TypographyCreateBase(const TypographyCreateBase&) = delete; 41 TypographyCreateBase& operator=(const TypographyCreateBase&) = delete; 42 }; 43 } // namespace rosen 44 #endif // ROSEN_TEXT_PROPERTIES_TYPOGRAPHY_CREATE_BASE_H_ 45