gvtextlayout.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*************************************************************************
  2. * Copyright (c) 2011 AT&T Intellectual Property
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * https://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors: Details at https://graphviz.org
  9. *************************************************************************/
  10. /*
  11. * textlayout engine wrapper
  12. */
  13. #include "config.h"
  14. #include <common/const.h>
  15. #include <gvc/gvplugin_textlayout.h>
  16. #include <gvc/gvcint.h>
  17. #include <gvc/gvcproc.h>
  18. #include <stdbool.h>
  19. #include <stdio.h>
  20. int gvtextlayout_select(GVC_t * gvc)
  21. {
  22. gvplugin_available_t *plugin;
  23. gvplugin_installed_t *typeptr;
  24. plugin = gvplugin_load(gvc, API_textlayout, "textlayout", NULL);
  25. if (plugin) {
  26. typeptr = plugin->typeptr;
  27. gvc->textlayout.engine = typeptr->engine;
  28. return GVRENDER_PLUGIN; /* FIXME - need more suitable success code */
  29. }
  30. return NO_SUPPORT;
  31. }
  32. bool gvtextlayout(GVC_t *gvc, textspan_t *span, char **fontpath)
  33. {
  34. gvtextlayout_engine_t *gvte = gvc->textlayout.engine;
  35. if (gvte && gvte->textlayout)
  36. return gvte->textlayout(span, fontpath);
  37. return false;
  38. }