2018-05-08 00:43:07 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2018-05-08 00:43:07 +00:00
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <limits>
|
|
|
|
|
2018-05-14 22:43:45 +00:00
|
|
|
#include <fabric/attributedstring/primitives.h>
|
2018-05-08 00:43:07 +00:00
|
|
|
#include <fabric/debug/DebugStringConvertible.h>
|
|
|
|
#include <fabric/graphics/Geometry.h>
|
|
|
|
|
|
|
|
namespace facebook {
|
|
|
|
namespace react {
|
|
|
|
|
|
|
|
class ParagraphAttributes;
|
|
|
|
|
|
|
|
using SharedParagraphAttributes = std::shared_ptr<const ParagraphAttributes>;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Represents all visual attributes of a paragraph of text.
|
|
|
|
* Two data structures, ParagraphAttributes and AttributedText, should be
|
|
|
|
* enough to define visual representation of a piece of text on the screen.
|
|
|
|
*/
|
|
|
|
class ParagraphAttributes:
|
|
|
|
public DebugStringConvertible {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
#pragma mark - Fields
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Maximum number of lines which paragraph can take.
|
|
|
|
* Zero value represents "no limit".
|
|
|
|
*/
|
2018-06-26 18:32:57 +00:00
|
|
|
int maximumNumberOfLines {};
|
2018-05-08 00:43:07 +00:00
|
|
|
|
|
|
|
/*
|
2018-05-14 22:43:40 +00:00
|
|
|
* In case if a text cannot fit given boundaries, defines a place where
|
2018-05-08 00:43:07 +00:00
|
|
|
* an ellipsize should be placed.
|
|
|
|
*/
|
2018-06-26 18:32:57 +00:00
|
|
|
EllipsizeMode ellipsizeMode {};
|
2018-05-08 00:43:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Enables font size adjustment to fit constrained boundaries.
|
|
|
|
*/
|
2018-06-26 18:32:57 +00:00
|
|
|
bool adjustsFontSizeToFit {};
|
2018-05-08 00:43:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* In case of font size adjustment enabled, defines minimum and maximum
|
|
|
|
* font sizes.
|
|
|
|
*/
|
|
|
|
Float minimumFontSize {std::numeric_limits<Float>::quiet_NaN()};
|
|
|
|
Float maximumFontSize {std::numeric_limits<Float>::quiet_NaN()};
|
|
|
|
|
|
|
|
#pragma mark - DebugStringConvertible
|
|
|
|
|
|
|
|
SharedDebugStringConvertibleList getDebugProps() const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace react
|
|
|
|
} // namespace facebook
|