AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Name von Unicode-Zeichen

Ein Thema von Codehunter · begonnen am 27. Jun 2017 · letzter Beitrag vom 3. Jul 2017
 
TiGü

Registriert seit: 6. Apr 2011
Ort: Berlin
3.075 Beiträge
 
Delphi 10.4 Sydney
 
#15

AW: Name von Unicode-Zeichen

  Alt 28. Jun 2017, 09:09
Du kannst dich auch mal mit DirectWrite beschäftigen!
Da steckt sehr viel drin, was du sicherlich gebrauchen kannst.

Bspw. hat das IDWriteFont Interface eine HasCharacter-Methode.
Daneben gibt es noch eine Vielzahl weiterer Sachen, die sicherlich weiterhelfen:
https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx

Delphi-Quellcode:
unit Unit1;

interface

uses
  Winapi.Windows, System.SysUtils, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Direct2D, Winapi.D2D1;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    function GetCharExists(const Chr: Char): Boolean;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Caption := GetCharExists('').ToString(TUseBoolStrs.True);
end;

function TForm1.GetCharExists(const Chr: Char): Boolean;
var
  hr: HRESULT;
  FontHandle: HFont;
  LogFont: TLogFont;
  GdiInterop: IDWriteGdiInterop;
  WriteFont: IDWriteFont;
  CharacterExists: BOOL;
begin
  Result := False;
  hr := DWriteFactory.GetGdiInterop(GdiInterop);
  if SUCCEEDED(hr) and Assigned(GdiInterop) then
  begin
    FontHandle := Self.Font.Handle;
    if GetObject(FontHandle, SizeOf(LogFont), @LogFont) <> 0 then
    begin
      hr := GdiInterop.CreateFontFromLOGFONT(LogFont, WriteFont);
      if SUCCEEDED(hr) and Assigned(WriteFont) then
      begin
        hr := WriteFont.HasCharacter(Ord(Chr), CharacterExists);
        Result := SUCCEEDED(hr) and CharacterExists;
      end;
    end;
  end;
end;

end.

Geändert von TiGü (28. Jun 2017 um 09:18 Uhr)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:40 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz