Skip to content

Instantly share code, notes, and snippets.

@dglazkov
Created November 14, 2013 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dglazkov/7458814 to your computer and use it in GitHub Desktop.
Save dglazkov/7458814 to your computer and use it in GitHub Desktop.
// stays as is
class FontDescription;
// stays as is
class FontData;
class FontContext : public RefCounted<FontContext> {
PassRefPtr<FontData> getFontData(const FontDescription&);
void addFontDataProvider(const AtomicString& familyName,
PassRefPtr<FontDataProvider>);
};
enum FontRequestStatus {
// failed, succeeded, etc.
};
// interface to inform that the font is ready
class FontRequestCallback {
void requestComplete(const FontDescription&,
PassRefPtr<FontData>,
FontRequestStatus);
};
// added for each @font-face rule
class FontDataProvider : public RefCounted<FontDataProvider> {
// returns 0 if resource isn’t available.
PassRefPtr<FontData> getFontData(const FontDescription&);
// FontRequestCallback’s lifetime must be managed by the caller.
void requestFontData(const FontDescription&, FontRequestCallback*);
};
// the actual font engine
class FontEngine {
// Only has built-in fonts.
static const FontContext* platformContext();
static PassRefPtr<FontContext> createContext();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment