flutter_flutter/lib/ui/text/paragraph_builder.h
Chinmay Garde eec74e5c92
Rename the blink namespace to flutter. (#8517)
Some components in the Flutter engine were derived from the forked blink codebase. While the forked components have either been removed or rewritten, the use of the blink namespace has mostly (and inconsistently) remained. This renames the blink namesapce to flutter for consistency. There are no functional changes in this patch.
2019-04-09 12:44:42 -07:00

78 lines
2.4 KiB
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_LIB_UI_TEXT_PARAGRAPH_BUILDER_H_
#define FLUTTER_LIB_UI_TEXT_PARAGRAPH_BUILDER_H_
#include <memory>
#include "flutter/lib/ui/dart_wrapper.h"
#include "flutter/lib/ui/painting/paint.h"
#include "flutter/lib/ui/text/paragraph.h"
#include "flutter/third_party/txt/src/txt/paragraph_builder.h"
#include "third_party/tonic/typed_data/int32_list.h"
namespace tonic {
class DartLibraryNatives;
} // namespace tonic
namespace flutter {
class Paragraph;
class ParagraphBuilder : public RefCountedDartWrappable<ParagraphBuilder> {
DEFINE_WRAPPERTYPEINFO();
FML_FRIEND_MAKE_REF_COUNTED(ParagraphBuilder);
public:
static fml::RefPtr<ParagraphBuilder> create(
tonic::Int32List& encoded,
Dart_Handle strutData,
const std::string& fontFamily,
const std::vector<std::string>& strutFontFamilies,
double fontSize,
double height,
const std::u16string& ellipsis,
const std::string& locale);
~ParagraphBuilder() override;
void pushStyle(tonic::Int32List& encoded,
const std::vector<std::string>& fontFamilies,
double fontSize,
double letterSpacing,
double wordSpacing,
double height,
double decorationThickness,
const std::string& locale,
Dart_Handle background_objects,
Dart_Handle background_data,
Dart_Handle foreground_objects,
Dart_Handle foreground_data,
Dart_Handle shadows_data);
void pop();
Dart_Handle addText(const std::u16string& text);
fml::RefPtr<Paragraph> build();
static void RegisterNatives(tonic::DartLibraryNatives* natives);
private:
explicit ParagraphBuilder(tonic::Int32List& encoded,
Dart_Handle strutData,
const std::string& fontFamily,
const std::vector<std::string>& strutFontFamilies,
double fontSize,
double height,
const std::u16string& ellipsis,
const std::string& locale);
std::unique_ptr<txt::ParagraphBuilder> m_paragraphBuilder;
};
} // namespace flutter
#endif // FLUTTER_LIB_UI_TEXT_PARAGRAPH_BUILDER_H_