Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
f6db8af1
Kaydet (Commit)
f6db8af1
authored
Tem 06, 2016
tarafından
Akash Jain
Kaydeden (comit)
Khaled Hosny
Eki 18, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
GSoC: Integrate new CommonSalLayout in win/ code
Change-Id: Ifeb2fa7ca9e2cd0da1c504d4e770aa0bb1b0b0de
üst
828b8cf4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
53 deletions
+97
-53
CommonSalLayout.cxx
vcl/source/gdi/CommonSalLayout.cxx
+11
-0
salfont.cxx
vcl/win/gdi/salfont.cxx
+0
-3
winlayout.cxx
vcl/win/gdi/winlayout.cxx
+86
-50
No files found.
vcl/source/gdi/CommonSalLayout.cxx
Dosyayı görüntüle @
f6db8af1
...
...
@@ -57,7 +57,12 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU
hb_blob_t
*
pBlob
=
nullptr
;
if
(
pBuffer
!=
nullptr
)
#if defined(_WIN32)
pBlob
=
hb_blob_create
(
reinterpret_cast
<
const
char
*>
(
pBuffer
),
nLength
,
HB_MEMORY_MODE_READONLY
,
const_cast
<
unsigned
char
*>
(
pBuffer
),
[](
void
*
data
){
delete
[]
reinterpret_cast
<
unsigned
char
*>
(
data
);
});
#else
pBlob
=
hb_blob_create
(
reinterpret_cast
<
const
char
*>
(
pBuffer
),
nLength
,
HB_MEMORY_MODE_READONLY
,
nullptr
,
nullptr
);
#endif
return
pBlob
;
}
...
...
@@ -74,12 +79,18 @@ static hb_unicode_funcs_t* getUnicodeFuncs()
#if defined(_WIN32)
CommonSalLayout
::
CommonSalLayout
(
HDC
hDC
,
WinFontInstance
&
rWinFontInstance
)
:
mhDC
(
hDC
),
mhFont
((
HFONT
)
GetCurrentObject
(
hDC
,
OBJ_FONT
)),
mpHbFace
(
nullptr
),
maFontSelData
(
rWinFontInstance
.
maFontSelData
)
{
mpHbFace
=
hb_face_create_for_tables
(
getFontTable
,
&
hDC
,
nullptr
);
}
void
CommonSalLayout
::
InitFont
()
const
{
SelectObject
(
mhDC
,
mhFont
);
}
#elif defined(MACOSX) || defined(IOS)
CommonSalLayout
::
CommonSalLayout
(
const
CoreTextStyle
&
rCoreTextStyle
)
:
mpHbFace
(
nullptr
),
...
...
vcl/win/gdi/salfont.cxx
Dosyayı görüntüle @
f6db8af1
...
...
@@ -2454,7 +2454,4 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
}
}
void
WinSalGraphics
::
DrawSalLayout
(
const
CommonSalLayout
&
)
{}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl/win/gdi/winlayout.cxx
Dosyayı görüntüle @
f6db8af1
...
...
@@ -34,6 +34,7 @@
#include "sft.hxx"
#include "sallayout.hxx"
#include "CommonSalLayout.hxx"
#include <cstdio>
#include <cstdlib>
...
...
@@ -67,7 +68,7 @@ public:
virtual
~
TextOutRenderer
()
=
default
;
virtual
bool
operator
()(
Win
Layout
const
&
rLayout
,
HDC
hDC
,
virtual
bool
operator
()(
Sal
Layout
const
&
rLayout
,
HDC
hDC
,
const
Rectangle
*
pRectToErase
,
Point
*
pPos
,
int
*
pGetNextGlypInfo
)
=
0
;
};
...
...
@@ -81,7 +82,7 @@ public:
explicit
ExTextOutRenderer
()
=
default
;
virtual
~
ExTextOutRenderer
()
override
=
default
;
bool
operator
()(
Win
Layout
const
&
rLayout
,
HDC
hDC
,
bool
operator
()(
Sal
Layout
const
&
rLayout
,
HDC
hDC
,
const
Rectangle
*
pRectToErase
,
Point
*
pPos
,
int
*
pGetNextGlypInfo
)
override
;
};
...
...
@@ -106,7 +107,7 @@ public:
explicit
D2DWriteTextOutRenderer
();
virtual
~
D2DWriteTextOutRenderer
()
override
;
bool
operator
()(
Win
Layout
const
&
rLayout
,
HDC
hDC
,
bool
operator
()(
Sal
Layout
const
&
rLayout
,
HDC
hDC
,
const
Rectangle
*
pRectToErase
,
Point
*
pPos
,
int
*
pGetNextGlypInfo
)
override
;
...
...
@@ -138,7 +139,7 @@ private:
D2DWriteTextOutRenderer
&
operator
=
(
const
D2DWriteTextOutRenderer
&
)
=
delete
;
bool
GetDWriteFaceFromHDC
(
HDC
hDC
,
IDWriteFontFace
**
ppFontFace
,
float
*
lfSize
)
const
;
bool
GetDWriteInkBox
(
IDWriteFontFace
&
rFontFace
,
Win
Layout
const
&
rLayout
,
float
const
lfEmHeight
,
Rectangle
&
)
const
;
bool
GetDWriteInkBox
(
IDWriteFontFace
&
rFontFace
,
Sal
Layout
const
&
rLayout
,
float
const
lfEmHeight
,
Rectangle
&
)
const
;
ID2D1Factory
*
mpD2DFactory
;
IDWriteFactory
*
mpDWriteFactory
;
...
...
@@ -3483,7 +3484,7 @@ TextOutRenderer & TextOutRenderer::get()
}
bool
ExTextOutRenderer
::
operator
()(
Win
Layout
const
&
rLayout
,
HDC
hDC
,
bool
ExTextOutRenderer
::
operator
()(
Sal
Layout
const
&
rLayout
,
HDC
hDC
,
const
Rectangle
*
pRectToErase
,
Point
*
pPos
,
int
*
pGetNextGlypInfo
)
{
...
...
@@ -3542,7 +3543,7 @@ D2DWriteTextOutRenderer::~D2DWriteTextOutRenderer()
CleanupModules
();
}
bool
D2DWriteTextOutRenderer
::
operator
()(
Win
Layout
const
&
rLayout
,
HDC
hDC
,
bool
D2DWriteTextOutRenderer
::
operator
()(
Sal
Layout
const
&
rLayout
,
HDC
hDC
,
const
Rectangle
*
pRectToErase
,
Point
*
pPos
,
int
*
pGetNextGlypInfo
)
{
...
...
@@ -3708,7 +3709,7 @@ bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** p
return
succeeded
;
}
bool
D2DWriteTextOutRenderer
::
GetDWriteInkBox
(
IDWriteFontFace
&
rFontFace
,
Win
Layout
const
&
rLayout
,
float
const
/*lfEmHeight*/
,
Rectangle
&
rOut
)
const
bool
D2DWriteTextOutRenderer
::
GetDWriteInkBox
(
IDWriteFontFace
&
rFontFace
,
Sal
Layout
const
&
rLayout
,
float
const
/*lfEmHeight*/
,
Rectangle
&
rOut
)
const
{
rOut
.
SetEmpty
();
...
...
@@ -3903,66 +3904,73 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
const
WinFontFace
&
rFontFace
=
*
mpWinFontData
[
nFallbackLevel
];
WinFontInstance
&
rFontInstance
=
*
mpWinFontEntry
[
nFallbackLevel
];
bool
bUseOpenGL
=
OpenGLHelper
::
isVCLOpenGLEnabled
()
&&
!
mbPrinter
;
if
(
!
bUspInited
)
InitUSP
();
if
(
!
(
rArgs
.
mnFlags
&
SalLayoutFlags
::
ComplexDisabled
)
)
if
(
getenv
(
"SAL_USE_COMMON_LAYOUT"
))
{
#if ENABLE_GRAPHITE
if
(
rFontFace
.
SupportsGraphite
())
{
pWinLayout
=
new
GraphiteWinLayout
(
getHDC
(),
rFontFace
,
rFontInstance
,
bUseOpenGL
);
}
else
#endif // ENABLE_GRAPHITE
{
// script complexity is determined in upper layers
pWinLayout
=
new
UniscribeLayout
(
getHDC
(),
rFontFace
,
rFontInstance
,
bUseOpenGL
);
// NOTE: it must be guaranteed that the WinSalGraphics lives longer than
// the created UniscribeLayout, otherwise the data passed into the
// constructor might become invalid too early
}
return
new
CommonSalLayout
(
getHDC
(),
rFontInstance
);
}
else
{
#if ENABLE_GRAPHITE
if
(
rFontFace
.
SupportsGraphite
())
{
pWinLayout
=
new
GraphiteWinLayout
(
getHDC
(),
rFontFace
,
rFontInstance
,
bUseOpenGL
);
}
else
#endif // ENABLE_GRAPHITE
{
static
bool
bAvoidSimpleWinLayout
=
(
std
::
getenv
(
"VCL_NO_SIMPLEWINLAYOUT"
)
!=
nullptr
);
bool
bUseOpenGL
=
OpenGLHelper
::
isVCLOpenGLEnabled
()
&&
!
mbPrinter
;
if
(
!
bAvoidSimpleWinLayout
)
{
if
(
(
rArgs
.
mnFlags
&
SalLayoutFlags
::
KerningPairs
)
&&
!
rFontInstance
.
HasKernData
()
)
{
// TODO: directly cache kerning info in the rFontInstance
// TODO: get rid of kerning methods+data in WinSalGraphics object
GetKernPairs
();
rFontInstance
.
SetKernData
(
mnFontKernPairCount
,
mpFontKernPairs
);
}
if
(
!
bUspInited
)
InitUSP
();
pWinLayout
=
new
SimpleWinLayout
(
getHDC
(),
rFontFace
,
rFontInstance
,
bUseOpenGL
);
if
(
!
(
rArgs
.
mnFlags
&
SalLayoutFlags
::
ComplexDisabled
)
)
{
#if ENABLE_GRAPHITE
if
(
rFontFace
.
SupportsGraphite
())
{
pWinLayout
=
new
GraphiteWinLayout
(
getHDC
(),
rFontFace
,
rFontInstance
,
bUseOpenGL
);
}
else
#endif // ENABLE_GRAPHITE
{
// script complexity is determined in upper layers
pWinLayout
=
new
UniscribeLayout
(
getHDC
(),
rFontFace
,
rFontInstance
,
bUseOpenGL
);
// NOTE: it must be guaranteed that the WinSalGraphics lives longer than
// the created UniscribeLayout, otherwise the data passed into the
// constructor might become invalid too early
}
}
}
else
{
#if ENABLE_GRAPHITE
if
(
rFontFace
.
SupportsGraphite
())
{
pWinLayout
=
new
GraphiteWinLayout
(
getHDC
(),
rFontFace
,
rFontInstance
,
bUseOpenGL
);
}
else
#endif // ENABLE_GRAPHITE
{
static
bool
bAvoidSimpleWinLayout
=
(
std
::
getenv
(
"VCL_NO_SIMPLEWINLAYOUT"
)
!=
nullptr
);
if
(
mfFontScale
[
nFallbackLevel
]
!=
1.0
)
pWinLayout
->
SetFontScale
(
mfFontScale
[
nFallbackLevel
]
);
if
(
!
bAvoidSimpleWinLayout
)
{
if
(
(
rArgs
.
mnFlags
&
SalLayoutFlags
::
KerningPairs
)
&&
!
rFontInstance
.
HasKernData
()
)
{
// TODO: directly cache kerning info in the rFontInstance
// TODO: get rid of kerning methods+data in WinSalGraphics object
GetKernPairs
();
rFontInstance
.
SetKernData
(
mnFontKernPairCount
,
mpFontKernPairs
);
}
return
pWinLayout
;
pWinLayout
=
new
SimpleWinLayout
(
getHDC
(),
rFontFace
,
rFontInstance
,
bUseOpenGL
);
}
else
{
pWinLayout
=
new
UniscribeLayout
(
getHDC
(),
rFontFace
,
rFontInstance
,
bUseOpenGL
);
// NOTE: it must be guaranteed that the WinSalGraphics lives longer than
// the created UniscribeLayout, otherwise the data passed into the
// constructor might become invalid too early
}
}
}
if
(
mfFontScale
[
nFallbackLevel
]
!=
1.0
)
pWinLayout
->
SetFontScale
(
mfFontScale
[
nFallbackLevel
]
);
return
pWinLayout
;
}
}
int
WinSalGraphics
::
GetMinKashidaWidth
()
...
...
@@ -4071,4 +4079,32 @@ LogicalFontInstance* WinFontFace::CreateFontInstance( FontSelectPattern& rFSD )
return
pFontInstance
;
}
void
WinSalGraphics
::
DrawSalLayout
(
const
CommonSalLayout
&
rLayout
)
{
HDC
hDC
=
getHDC
();
if
(
getenv
(
"SAL_DWRITE_COMMON_LAYOUT"
))
{
Point
aPos
(
0
,
0
);
int
nGlyphCount
(
0
);
TextOutRenderer
&
render
=
TextOutRenderer
::
get
();
bool
result
=
render
(
rLayout
,
hDC
,
nullptr
,
&
aPos
,
&
nGlyphCount
);
assert
(
!
result
);
}
else
{
Point
aPos
;
sal_GlyphId
aGlyphId
;
int
nFetchedGlyphs
=
0
;
UINT
oldTa
=
GetTextAlign
(
hDC
);
SetTextAlign
(
hDC
,
(
oldTa
&
~
TA_NOUPDATECP
));
while
(
rLayout
.
GetNextGlyphs
(
1
,
&
aGlyphId
,
aPos
,
nFetchedGlyphs
))
{
ExtTextOutW
(
hDC
,
aPos
.
X
(),
aPos
.
Y
(),
ETO_GLYPH_INDEX
,
nullptr
,
reinterpret_cast
<
LPCWSTR
>
(
&
aGlyphId
),
1
,
nullptr
);
}
SetTextAlign
(
hDC
,
oldTa
);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment