• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
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 "line_typography.h"
17 #include "text_line_base.h"
18 #include "typography.h"
19 
20 namespace OHOS {
21 namespace Rosen {
22 namespace AdapterTxt {
LineTypography(std::unique_ptr<SPText::ParagraphLineFetcher> lineFetcher)23 LineTypography::LineTypography(std::unique_ptr<SPText::ParagraphLineFetcher> lineFetcher)
24     : lineFetcher_(std::move(lineFetcher))
25 {
26 }
27 
GetLineBreak(size_t startIndex,double width) const28 size_t LineTypography::GetLineBreak(size_t startIndex, double width) const
29 {
30     return lineFetcher_->GetLineBreak(startIndex, width);
31 }
32 
CreateLine(size_t startIndex,size_t count)33 std::unique_ptr<TextLineBase> LineTypography::CreateLine(size_t startIndex, size_t count)
34 {
35     return std::make_unique<TextLineBaseImpl>(lineFetcher_->CreateLine(startIndex, count));
36 }
37 
GetTempTypography()38 std::unique_ptr<OHOS::Rosen::Typography> LineTypography::GetTempTypography()
39 {
40     return std::make_unique<AdapterTxt::Typography>(lineFetcher_->GetTempParagraph());
41 }
42 } // namespace AdapterTxt
43 } // namespace Rosen
44 } // namespace OHOS
45