forked from Samsung/TizenFX
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[NUI] Add FontClient related classes
Change-Id: Ib24bc2852ff704c250fa466ed7149b5100fbc1c7
- Loading branch information
1 parent
78fd087
commit e3a64bd
Showing
10 changed files
with
1,992 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
/* | ||
* Copyright(c) 2017 Samsung Electronics Co., Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
namespace Tizen.NUI | ||
{ | ||
|
||
internal class FontDescription : global::System.IDisposable | ||
{ | ||
private global::System.Runtime.InteropServices.HandleRef swigCPtr; | ||
protected bool swigCMemOwn; | ||
|
||
internal FontDescription(global::System.IntPtr cPtr, bool cMemoryOwn) | ||
{ | ||
swigCMemOwn = cMemoryOwn; | ||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); | ||
} | ||
|
||
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FontDescription obj) | ||
{ | ||
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; | ||
} | ||
|
||
//A Flag to check who called Dispose(). (By User or DisposeQueue) | ||
private bool isDisposeQueued = false; | ||
/// <summary> | ||
/// A Flat to check if it is already disposed. | ||
/// </summary> | ||
protected bool disposed = false; | ||
|
||
~FontDescription() | ||
{ | ||
if (!isDisposeQueued) | ||
{ | ||
isDisposeQueued = true; | ||
DisposeQueue.Instance.Add(this); | ||
} | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
//Throw excpetion if Dispose() is called in separate thread. | ||
if (!Window.IsInstalled()) | ||
{ | ||
throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); | ||
} | ||
|
||
if (isDisposeQueued) | ||
{ | ||
Dispose(DisposeTypes.Implicit); | ||
} | ||
else | ||
{ | ||
Dispose(DisposeTypes.Explicit); | ||
System.GC.SuppressFinalize(this); | ||
} | ||
} | ||
|
||
protected virtual void Dispose(DisposeTypes type) | ||
{ | ||
if (disposed) | ||
{ | ||
return; | ||
} | ||
|
||
if (type == DisposeTypes.Explicit) | ||
{ | ||
//Called by User | ||
//Release your own managed resources here. | ||
//You should release all of your own disposable objects here. | ||
} | ||
|
||
//Release your own unmanaged resources here. | ||
//You should not access any managed member here except static instance. | ||
//because the execution order of Finalizes is non-deterministic. | ||
|
||
if (swigCPtr.Handle != global::System.IntPtr.Zero) | ||
{ | ||
if (swigCMemOwn) | ||
{ | ||
swigCMemOwn = false; | ||
NDalicManualPINVOKE.delete_FontDescription(swigCPtr); | ||
} | ||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); | ||
} | ||
disposed = true; | ||
} | ||
|
||
public FontDescription() : this(NDalicManualPINVOKE.new_FontDescription(), true) | ||
{ | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
|
||
public string Path | ||
{ | ||
set | ||
{ | ||
NDalicManualPINVOKE.FontDescription_path_set(swigCPtr, value); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
get | ||
{ | ||
string ret = NDalicManualPINVOKE.FontDescription_path_get(swigCPtr); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
return ret; | ||
} | ||
} | ||
|
||
public string Family | ||
{ | ||
set | ||
{ | ||
NDalicManualPINVOKE.FontDescription_family_set(swigCPtr, value); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
get | ||
{ | ||
string ret = NDalicManualPINVOKE.FontDescription_family_get(swigCPtr); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
return ret; | ||
} | ||
} | ||
|
||
public FontWidthType Width | ||
{ | ||
set | ||
{ | ||
NDalicManualPINVOKE.FontDescription_width_set(swigCPtr, (int)value); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
get | ||
{ | ||
FontWidthType ret = (FontWidthType)NDalicManualPINVOKE.FontDescription_width_get(swigCPtr); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
return ret; | ||
} | ||
} | ||
|
||
public FontWeightType Weight | ||
{ | ||
set | ||
{ | ||
NDalicManualPINVOKE.FontDescription_weight_set(swigCPtr, (int)value); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
get | ||
{ | ||
FontWeightType ret = (FontWeightType)NDalicManualPINVOKE.FontDescription_weight_get(swigCPtr); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
return ret; | ||
} | ||
} | ||
|
||
public FontSlantType Slant | ||
{ | ||
set | ||
{ | ||
NDalicManualPINVOKE.FontDescription_slant_set(swigCPtr, (int)value); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
get | ||
{ | ||
FontSlantType ret = (FontSlantType)NDalicManualPINVOKE.FontDescription_slant_get(swigCPtr); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
return ret; | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
/* | ||
* Copyright(c) 2017 Samsung Electronics Co., Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
namespace Tizen.NUI | ||
{ | ||
|
||
internal class FontMetrics : global::System.IDisposable | ||
{ | ||
private global::System.Runtime.InteropServices.HandleRef swigCPtr; | ||
protected bool swigCMemOwn; | ||
|
||
internal FontMetrics(global::System.IntPtr cPtr, bool cMemoryOwn) | ||
{ | ||
swigCMemOwn = cMemoryOwn; | ||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); | ||
} | ||
|
||
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FontMetrics obj) | ||
{ | ||
return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; | ||
} | ||
|
||
//A Flag to check who called Dispose(). (By User or DisposeQueue) | ||
private bool isDisposeQueued = false; | ||
/// <summary> | ||
/// A Flat to check if it is already disposed. | ||
/// </summary> | ||
protected bool disposed = false; | ||
|
||
~FontMetrics() | ||
{ | ||
if (!isDisposeQueued) | ||
{ | ||
isDisposeQueued = true; | ||
DisposeQueue.Instance.Add(this); | ||
} | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
//Throw excpetion if Dispose() is called in separate thread. | ||
if (!Window.IsInstalled()) | ||
{ | ||
throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); | ||
} | ||
|
||
if (isDisposeQueued) | ||
{ | ||
Dispose(DisposeTypes.Implicit); | ||
} | ||
else | ||
{ | ||
Dispose(DisposeTypes.Explicit); | ||
System.GC.SuppressFinalize(this); | ||
} | ||
} | ||
|
||
protected virtual void Dispose(DisposeTypes type) | ||
{ | ||
if (disposed) | ||
{ | ||
return; | ||
} | ||
|
||
if (type == DisposeTypes.Explicit) | ||
{ | ||
//Called by User | ||
//Release your own managed resources here. | ||
//You should release all of your own disposable objects here. | ||
} | ||
|
||
//Release your own unmanaged resources here. | ||
//You should not access any managed member here except static instance. | ||
//because the execution order of Finalizes is non-deterministic. | ||
|
||
if (swigCPtr.Handle != global::System.IntPtr.Zero) | ||
{ | ||
if (swigCMemOwn) | ||
{ | ||
swigCMemOwn = false; | ||
NDalicManualPINVOKE.delete_FontMetrics(swigCPtr); | ||
} | ||
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); | ||
} | ||
disposed = true; | ||
} | ||
|
||
public FontMetrics() : this(NDalicManualPINVOKE.new_FontMetrics__SWIG_0(), true) | ||
{ | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
|
||
public FontMetrics(float ascenderPixels, float descenderPixels, float heightPixels, float underlinePositionPixels, float underlinePositionThickness) : this(NDalicManualPINVOKE.new_FontMetrics__SWIG_1(ascenderPixels, descenderPixels, heightPixels, underlinePositionPixels, underlinePositionThickness), true) | ||
{ | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
|
||
public float Ascender | ||
{ | ||
set | ||
{ | ||
NDalicManualPINVOKE.FontMetrics_ascender_set(swigCPtr, value); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
get | ||
{ | ||
float ret = NDalicManualPINVOKE.FontMetrics_ascender_get(swigCPtr); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
return ret; | ||
} | ||
} | ||
|
||
public float Descender | ||
{ | ||
set | ||
{ | ||
NDalicManualPINVOKE.FontMetrics_descender_set(swigCPtr, value); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
get | ||
{ | ||
float ret = NDalicManualPINVOKE.FontMetrics_descender_get(swigCPtr); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
return ret; | ||
} | ||
} | ||
|
||
public float Height | ||
{ | ||
set | ||
{ | ||
NDalicManualPINVOKE.FontMetrics_height_set(swigCPtr, value); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
get | ||
{ | ||
float ret = NDalicManualPINVOKE.FontMetrics_height_get(swigCPtr); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
return ret; | ||
} | ||
} | ||
|
||
public float UnderlinePosition | ||
{ | ||
set | ||
{ | ||
NDalicManualPINVOKE.FontMetrics_underlinePosition_set(swigCPtr, value); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
get | ||
{ | ||
float ret = NDalicManualPINVOKE.FontMetrics_underlinePosition_get(swigCPtr); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
return ret; | ||
} | ||
} | ||
|
||
public float UnderlineThickness | ||
{ | ||
set | ||
{ | ||
NDalicManualPINVOKE.FontMetrics_underlineThickness_set(swigCPtr, value); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
} | ||
get | ||
{ | ||
float ret = NDalicManualPINVOKE.FontMetrics_underlineThickness_get(swigCPtr); | ||
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); | ||
return ret; | ||
} | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.