freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2-demos] veeki-gsoc-experimental 9829337 6/7: Added comparator


From: Veeki Yadav
Subject: [freetype2-demos] veeki-gsoc-experimental 9829337 6/7: Added comparator files
Date: Wed, 17 Jul 2019 01:12:12 -0400 (EDT)

branch: veeki-gsoc-experimental
commit 982933793e1d30d3b570af8168923db4c0132f78
Author: gevic <address@hidden>
Commit: gevic <address@hidden>

    Added comparator files
---
 src/ftinspect/ftinspect.pro            |  2 +
 src/ftinspect/rendering/comparator.cpp | 86 ++++++++++++++++++++++++++++++++++
 src/ftinspect/rendering/comparator.hpp | 73 +++++++++++++++++++++++++++++
 src/ftview.c                           |  4 +-
 4 files changed, 164 insertions(+), 1 deletion(-)

diff --git a/src/ftinspect/ftinspect.pro b/src/ftinspect/ftinspect.pro
index 19c6542..d0e6b44 100644
--- a/src/ftinspect/ftinspect.pro
+++ b/src/ftinspect/ftinspect.pro
@@ -29,6 +29,7 @@ SOURCES += \
   rendering/glyphpointnumbers.cpp \
   rendering/glyphpoints.cpp \
   rendering/glyphsegment.cpp \
+  rendering/comparator.cpp \
   rendering/view.cpp \
   rendering/grid.cpp \
   widgets/qcomboboxx.cpp \
@@ -46,6 +47,7 @@ HEADERS += \
   rendering/glyphpoints.hpp \
   rendering/glyphsegment.hpp \
   rendering/view.hpp \
+  rendering/comparator.hpp \
   rendering/grid.hpp \
   widgets/qcomboboxx.hpp \
   widgets/qgraphicsviewx.hpp \
diff --git a/src/ftinspect/rendering/comparator.cpp 
b/src/ftinspect/rendering/comparator.cpp
new file mode 100644
index 0000000..d77a71a
--- /dev/null
+++ b/src/ftinspect/rendering/comparator.cpp
@@ -0,0 +1,86 @@
+#include "comparator.hpp"
+
+#include <cmath>
+#include <QPainter>
+#include <QStyleOptionGraphicsItem>
+#include <QWidget>
+#include <QFile>
+#include <QImage>
+#include <iostream>
+#include <QtDebug>
+
+
+static const char*  default_text =
+  "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras sit amet"
+  " dui.  Nam sapien. Fusce vestibulum ornare metus. Maecenas ligula orci,"
+  " consequat vitae, dictum nec, lacinia non, elit. Aliquam iaculis"
+  " molestie neque. Maecenas suscipit felis ut pede convallis malesuada."
+  " Aliquam erat volutpat. Nunc pulvinar condimentum nunc. Donec ac sem vel"
+  " leo bibendum aliquam. Pellentesque habitant morbi tristique senectus et"
+  " netus et malesuada fames ac turpis egestas.\n"
+  "\n"
+  "Sed commodo. Nulla ut libero sit amet justo varius blandit. Mauris vitae"
+  " nulla eget lorem pretium ornare. Proin vulputate erat porta risus."
+  " Vestibulum malesuada, odio at vehicula lobortis, nisi metus hendrerit"
+  " est, vitae feugiat quam massa a ligula. Aenean in tellus. Praesent"
+  " convallis. Nullam vel lacus.  Aliquam congue erat non urna mollis"
+  " faucibus. Morbi vitae mauris faucibus quam condimentum ornare. Quisque"
+  " sit amet augue. Morbi ullamcorper mattis enim. Aliquam erat volutpat."
+  " Morbi nec felis non enim pulvinar lobortis.  Ut libero. Nullam id orci"
+  " quis nisl dapibus rutrum. Suspendisse consequat vulputate leo. Aenean"
+  " non orci non tellus iaculis vestibulum. Sed neque.\n"
+  "\n";
+
+
+RenderAll::RenderAll(FT_Face face,
+          FT_Size  size,
+          FTC_Manager cacheManager,
+          FTC_FaceID  face_id,
+          FTC_CMapCache  cmap_cache,
+          FT_Library lib,
+          int render_mode,
+          FTC_ScalerRec scaler,
+          FTC_ImageCache imageCache,
+          double x,
+          double y,
+          double slant_factor,
+          double stroke_factor)
+:face(face),
+size(size),
+cacheManager(cacheManager),
+face_id(face_id),
+cmap_cache(cmap_cache),
+library(lib),
+mode(render_mode),
+scaler(scaler),
+imageCache(imageCache),
+x_factor(x),
+y_factor(y),
+slant_factor(slant_factor),
+stroke_factor(stroke_factor)
+{
+}
+
+
+RenderAll::~RenderAll()
+{
+  //FT_Stroker_Done(stroker);
+  //FTC_Manager_Done(cacheManager);
+}
+
+QRectF
+RenderAll::boundingRect() const
+{
+  return QRectF(-320, -200,
+                640, 400);
+}
+
+
+void
+RenderAll::paint(QPainter* painter,
+                   const QStyleOptionGraphicsItem* option,
+                   QWidget*)
+{
+}
+
+// end of RenderAll.cpp
diff --git a/src/ftinspect/rendering/comparator.hpp 
b/src/ftinspect/rendering/comparator.hpp
new file mode 100644
index 0000000..49af748
--- /dev/null
+++ b/src/ftinspect/rendering/comparator.hpp
@@ -0,0 +1,73 @@
+#pragma once
+
+#include <QGraphicsItem>
+#include <QPen>
+
+#include <ft2build.h>
+#include "../engine/engine.hpp"
+#include FT_FREETYPE_H
+#include FT_OUTLINE_H
+#include FT_GLYPH_H
+#include FT_TYPES_H
+#include FT_RENDER_H
+#include FT_STROKER_H
+
+#include FT_INTERNAL_DEBUG_H
+
+  /* showing driver name */
+#include FT_MODULE_H
+#include FT_INTERNAL_OBJECTS_H
+#include FT_INTERNAL_DRIVER_H
+
+#include FT_SYNTHESIS_H
+#include FT_LCD_FILTER_H
+#include FT_DRIVER_H
+
+#include FT_COLOR_H
+#include FT_BITMAP_H
+
+
+class RenderAll
+: public QGraphicsItem
+{
+public:
+  RenderAll(FT_Face face,
+       FT_Size  size,
+       FTC_Manager cacheManager,
+       FTC_FaceID  face_id,
+       FTC_CMapCache  cmap_cache,
+       FT_Library library,
+       int mode,
+       FTC_ScalerRec scaler,
+       FTC_ImageCache imageCache,
+       double x_factor,
+       double y_factor,
+       double slant_factor,
+       double stroke_factor);
+  ~RenderAll();
+  QRectF boundingRect() const;
+  void paint(QPainter* painter,
+             const QStyleOptionGraphicsItem* option,
+             QWidget* widget);
+
+private:
+  FT_Face face;
+  FT_Library library;
+  QRectF m_glyphRect;
+  FT_Error error;
+  FTC_Manager cacheManager;
+  FTC_FaceID face_id;
+  FTC_CMapCache cmap_cache;
+  FT_Size size;
+  int mode;
+  Engine* engine;
+  FTC_ScalerRec scaler;
+  FTC_ImageCache imageCache;
+  double x_factor;
+  double y_factor;
+  double slant_factor;
+  double stroke_factor;
+};
+
+
+// end of glyphbitmap.hpp
diff --git a/src/ftview.c b/src/ftview.c
index f196f99..998ad11 100644
--- a/src/ftview.c
+++ b/src/ftview.c
@@ -322,9 +322,11 @@
     shear.xy = (FT_Fixed)( status.slant * ( 1 << 16 ) );
     shear.yx = 0;
     shear.yy = 1 << 16;
-
+printf("state is\n");
     xstr = (FT_Pos)( size->metrics.y_ppem * 64 * status.xbold_factor );
     ystr = (FT_Pos)( size->metrics.y_ppem * 64 * status.ybold_factor );
+    printf("statex is %lf\n",64 * status.xbold_factor);
+    printf("statey is %lf\n",64 * status.ybold_factor);
 
     have_topleft = 0;
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]