Flutter Engine
paragraph_builder.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "paragraph_builder.h"
18 
19 #include "paragraph_builder_txt.h"
20 #include "paragraph_style.h"
21 #include "third_party/icu/source/common/unicode/unistr.h"
22 
23 #if FLUTTER_ENABLE_SKSHAPER
24 #include "flutter/third_party/txt/src/skia/paragraph_builder_skia.h"
25 #endif
26 
27 namespace txt {
28 
29 std::unique_ptr<ParagraphBuilder> ParagraphBuilder::CreateTxtBuilder(
30  const ParagraphStyle& style,
31  std::shared_ptr<FontCollection> font_collection) {
32  return std::make_unique<ParagraphBuilderTxt>(style, font_collection);
33 }
34 
35 #if FLUTTER_ENABLE_SKSHAPER
36 
37 std::unique_ptr<ParagraphBuilder> ParagraphBuilder::CreateSkiaBuilder(
38  const ParagraphStyle& style,
39  std::shared_ptr<FontCollection> font_collection) {
40  return std::make_unique<ParagraphBuilderSkia>(style, font_collection);
41 }
42 
43 #endif // FLUTTER_ENABLE_SKSHAPER
44 
45 } // namespace txt
static std::unique_ptr< ParagraphBuilder > CreateTxtBuilder(const ParagraphStyle &style, std::shared_ptr< FontCollection > font_collection)