// convert VC -> PC
float pcSpace = _ResUtil::ConvertToPhyCoordWidth(vcSpace);
- _pNativeFont->SetCharSpace(pcSpace);
+ _pNativeFont->SetCharSpace(_FloatToIntForPos(pcSpace));
return;
}
_FontImpl::SetSize(float vcSize)
{
IF_NOT_CONSTRUCTED(return E_OPERATION_FAILED);
- SysTryReturnResult(NID_GRP, vcSize > 0.0f, E_INVALID_ARG, "font size should be greater than 0");
+ SysTryReturnResult(NID_GRP, vcSize > 0.0f, E_INVALID_ARG, "Font size should be greater than 0");
_pCoordHolder->Reset(vcSize);
{
pcSize = _Util::FixedPoint26_6(1.0f);
- _pCoordHolder->sizeF.phyCoord = pcSize;
+ _pCoordHolder->sizeF.phyCoord = pcSize.ToFloat();
_pCoordHolder->sizeF.virCoord = vcSize;
}
return _Font::UpdateDefaultFont(key);
}
+result
+_FontImpl::GetTextExtentList(const Tizen::Base::String& string, int startIndex, int length, Tizen::Base::Collection::ArrayListT<_FloatPair>& outList)
+{
+ IF_NOT_CONSTRUCTED(return E_OPERATION_FAILED);
+
+ SysTryReturnResult(NID_GRP, startIndex >= 0 && length >= 0 && startIndex < string.GetLength(), E_OUT_OF_RANGE,
+ "The length(%d) & startIndex(%d) of the given text is out of range", length, startIndex);
+
+ _Util::String text(string.GetPointer(), string.GetLength(), startIndex, length);
+ _Util::AccumList<_Util::Pair<int, int> > outAccumList;
+
+ result r = _pNativeFont->GetTextExtentList(text, outAccumList);
+
+ SysTryReturn(NID_GRP, r == E_SUCCESS, r, r, "[%s] Failed to get the internal text extent information", GetErrorMessage(r));
+
+ outList.RemoveAll();
+
+ for (_Util::AccumList<_Util::Pair<int, int> >::Iterator iter = outAccumList.Begin(); iter != outAccumList.End(); ++iter)
+ {
+ _FloatPair pairF =
+ {
+ _ResUtil::ConvertToVirCoord(static_cast<float>(iter->first)),
+ _ResUtil::ConvertToVirCoord(static_cast<float>(iter->second))
+ };
+
+ outList.Add(pairF);
+ }
+
+ return true;
+}
+
}} // Tizen::Graphics
class _Font;
+struct _FloatPair
+{
+ float first;
+ float second;
+
+ friend bool operator ==(const _FloatPair& lhs, const _FloatPair& rhs)
+ {
+ return (lhs.first == rhs.first) && (lhs.second == rhs.second);
+ }
+
+ friend bool operator !=(const _FloatPair& lhs, const _FloatPair& rhs)
+ {
+ return !(operator ==(lhs, rhs));
+ }
+};
+
class _OSP_EXPORT_ _FontImpl
: public Tizen::Base::Object
{
result GetTextExtent(int width, const Tizen::Base::String& text, int startIndex, int length, bool outline, const Tizen::Base::String& delimiter, int& count, Dimension& dim) const;
result GetTextExtent(float width, const Tizen::Base::String& text, int startIndex, int length, bool outline, const Tizen::Base::String& delimiter, int& count, FloatDimension& dim) const;
+ result GetTextExtentList(const Tizen::Base::String& text, int startIndex, int length, Tizen::Base::Collection::ArrayListT<_FloatPair>& outList);
+
/*
* Sets the font size.
*