Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
text_glyph_pos.cpp
Go to the documentation of this file.
1// Copyright 2019 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "core/fxge/text_glyph_pos.h"
8
9#include "core/fxcrt/fx_safe_types.h"
10#include "core/fxge/cfx_glyphbitmap.h"
11
12TextGlyphPos::TextGlyphPos() = default;
13
14TextGlyphPos::TextGlyphPos(const TextGlyphPos&) = default;
15
16TextGlyphPos::~TextGlyphPos() = default;
17
19 const CFX_Point& offset) const {
20 FX_SAFE_INT32 left = m_Origin.x;
21 left += m_pGlyph->left();
22 left -= offset.x;
23 if (!left.IsValid())
24 return absl::nullopt;
25
26 FX_SAFE_INT32 top = m_Origin.y;
27 top -= m_pGlyph->top();
28 top -= offset.y;
29 if (!top.IsValid())
30 return absl::nullopt;
31
32 return CFX_Point(left.ValueOrDie(), top.ValueOrDie());
33}
absl::optional< CFX_Point > GetOrigin(const CFX_Point &offset) const
TextGlyphPos(const TextGlyphPos &)