You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

84 lines
3.2 KiB

  1. unit ultsChar;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5. Classes, SysUtils,
  6. utsTextSuite, ultsTypes;
  7. function ltsCharGetCharCode (aHandle: TltsCharHandle; out aValue: WideChar): TltsErrorCode; stdcall;
  8. function ltsCharGetGlyphMetric(aHandle: TltsCharHandle; out aValue: TtsGlyphMetric): TltsErrorCode; stdcall;
  9. function ltsCharSetGlyphMetric(aHandle: TltsCharHandle; constref aValue: TtsGlyphMetric): TltsErrorCode; stdcall;
  10. implementation
  11. uses
  12. ultsUtils{$IFDEF DEBUG}, uutlLogger{$ENDIF};
  13. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  14. //ltsChar///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  15. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  16. function ltsCharGetCharCode(aHandle: TltsCharHandle; out aValue: WideChar): TltsErrorCode; stdcall;
  17. var
  18. c: TtsChar;
  19. begin
  20. try
  21. {$IFDEF DEBUG}utlLogger.log(nil, 'ltsCharGetCharCode(Handle=%p; Value=%p)', [Pointer(aHandle), Pointer(@aValue)]);{$ENDIF}
  22. result := ltsErrNone;
  23. if CheckCharHandle(aHandle, c)
  24. then aValue := c.CharCode
  25. else result := LastErrorCode;
  26. except
  27. on ex: Exception do begin
  28. SetLastError(ex);
  29. result := LastErrorCode;
  30. end;
  31. end;
  32. {$IFDEF DEBUG}utlLogger.log(nil, 'ltsCharGetCharCode=%d', [Integer(result)]);{$ENDIF}
  33. end;
  34. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  35. function ltsCharGetGlyphMetric(aHandle: TltsCharHandle; out aValue: TtsGlyphMetric): TltsErrorCode; stdcall;
  36. var
  37. c: TtsChar;
  38. begin
  39. try
  40. {$IFDEF DEBUG}utlLogger.log(nil, 'ltsCharGetGlyphMetric(Handle=%p; Value=%p)', [Pointer(aHandle), Pointer(@aValue)]);{$ENDIF}
  41. result := ltsErrNone;
  42. if CheckCharHandle(aHandle, c)
  43. then aValue := c.GlyphMetric
  44. else result := LastErrorCode;
  45. except
  46. on ex: Exception do begin
  47. SetLastError(ex);
  48. result := LastErrorCode;
  49. end;
  50. end;
  51. {$IFDEF DEBUG}utlLogger.log(nil, 'ltsCharGetGlyphMetric=%d', [Integer(result)]);{$ENDIF}
  52. end;
  53. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  54. function ltsCharSetGlyphMetric(aHandle: TltsCharHandle; constref aValue: TtsGlyphMetric): TltsErrorCode; stdcall;
  55. var
  56. c: TtsChar;
  57. begin
  58. try
  59. {$IFDEF DEBUG}utlLogger.log(nil, 'ltsCharSetGlyphMetric(Handle=%p; Value=%p)', [Pointer(aHandle), Pointer(@aValue)]);{$ENDIF}
  60. result := ltsErrNone;
  61. if CheckCharHandle(aHandle, c)
  62. then c.GlyphMetric := aValue
  63. else result := LastErrorCode;
  64. except
  65. on ex: Exception do begin
  66. SetLastError(ex);
  67. result := LastErrorCode;
  68. end;
  69. end;
  70. {$IFDEF DEBUG}utlLogger.log(nil, 'ltsCharSetGlyphMetric=%d', [Integer(result)]);{$ENDIF}
  71. end;
  72. end.