# Geomerative questions

**URL:** https://discourse.processing.org/t/geomerative-questions/23272
**Category:** Libraries
**Created:** [August 15, 2020, 9:20am UTC](https://discourse.processing.org/t/geomerative-questions/23272 "2020-08-15T09:20:34Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![yhlaskerimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yhlaskerimov/32/9725_2.png) [@yhlaskerimov](https://discourse.processing.org/u/yhlaskerimov)
#### Post date: [August 15, 2020, 9:20am UTC](https://discourse.processing.org/t/geomerative-questions/23272/1 "2020-08-15T09:20:34Z")

</div>

Hello everyone !

Nowadays I’m trying to learn geomerative library and i have questions.

1st question: “How to load fonts ?”. I can load only FreeSans.ttf. If I put another font it says “Null Pointer Exception”. I loaded my font to data folder.

2nd question: “I get points of font and learned the points’ position. But i couldnt know 2 points position”. Look screenshot below 👇

![Screenshot (158)|400x](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/bca2a8308b5f20cb96d37606a9e9b027f8432268.jpeg)

Thanks

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [August 15, 2020, 1:24pm UTC](https://discourse.processing.org/t/geomerative-questions/23272/2 "2020-08-15T13:24:27Z")

</div>

Hello,

It helps if you provide example code (simplify it) and a reference.

If you are going to post code be sure to format it properly:  
[https://discourse.processing.org/faq#format-your-code](https://discourse.processing.org/faq#format-your-code)

I am referencing this example from Geomerative library:  
Tutorial\_07\_HelloWorld\_getPoint.pde

This will print your first point:

```auto
  points = grp.getPoints();
  println(points.length);
  println(points[0].x , points[0].y );

```

You will have to loop through the others from 0 to points.length-1

`:)`

---

<div class="post-metadata">

### Author: ![yhlaskerimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yhlaskerimov/32/9725_2.png) [@yhlaskerimov](https://discourse.processing.org/u/yhlaskerimov)
#### Post date: [August 17, 2020, 6:02am UTC](https://discourse.processing.org/t/geomerative-questions/23272/3 "2020-08-17T06:02:26Z")

</div>

Thanks for your reply.

```auto
import geomerative.*;

RFont f;
RShape grp;
RPoint[] points;

void setup() {
  size(1200, 800);
  frameRate(1);

  RG.init(this);
  
  grp = RG.getText("A", "FreeSans.ttf", 300, CENTER);

  smooth();
}

void draw() {
  background(255);

  push();
  translate(width/2, height/3*2);

  RG.setPolygonizer(RG.ADAPTATIVE);
  stroke(255, 0, 0);
  strokeWeight(1);
  grp.draw();

  points = grp.getPoints();

  if (points != null)
  {
    noFill();
    strokeWeight(5);
    stroke(0, 0, 0);

    beginShape(POINTS);
    for (int i=0; i<points.length; i++)
    {
      float x1, y1; 
      if(i != frameCount)
        x1 = points[i].x;
      else
        x1 = 10000;
      
      y1 = points[i].y;
      vertex(x1, y1);
      //println("x -->", points[i].x);
      //println("y -->", points[i].y);
    }
    endShape(CLOSE);
    pop();
  }
}

```

@glv Here is my code. Every frame one point disappears which is equal to `points[i].x`. But when `i` equals to 8 or 12, there no point disappears.

And I couldn’t load my font to the sketch.

 ![Screenshot (160)](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/6/65a952fa5cb15b665e1a4011c5d913ec17414092.png)

Even my font was in data folder.

---

<div class="post-metadata">

### Author: ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)
#### Post date: [August 17, 2020, 9:18am UTC](https://discourse.processing.org/t/geomerative-questions/23272/4 "2020-08-17T09:18:12Z")

</div>

@yhlaskerimov safest thing to access fonts is to use absolute data path to file eg on linux:-

```bash
"/home/tux/sketchbook/sketch_folder/data/aktif.otf"

```

I know processing supports the `otf` extension, I’m not sure for geomerative.

---

<div class="post-metadata">

### Author: ![yhlaskerimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yhlaskerimov/32/9725_2.png) [@yhlaskerimov](https://discourse.processing.org/u/yhlaskerimov)
#### Post date: [August 17, 2020, 10:09am UTC](https://discourse.processing.org/t/geomerative-questions/23272/5 "2020-08-17T10:09:55Z")

</div>

@monkstone thanks for your reply !

I have tried but this didn’t help too. Look.

 ![Screenshot (164)](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/1/1f90344a7fa140db49007ab76dcd7641fa59b088.png)

---

<div class="post-metadata">

### Author: ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)
#### Post date: [August 17, 2020, 12:40pm UTC](https://discourse.processing.org/t/geomerative-questions/23272/6 "2020-08-17T12:40:22Z")

</div>

> [@yhlaskerimov](#):
>
> ```auto
> import geomerative.*;
> 
> RFont f;
> RShape grp;
> RPoint[] points;
> 
> void setup() {
> size(1200, 800);
> frameRate(1);
> 
> RG.init(this);
>   
> grp = RG.getText("A", "FreeSans.ttf", 300, CENTER);
> 
> smooth();
> }
> 
> void draw() {
> background(255);
> 
> push();
> translate(width/2, height/3*2);
> 
> RG.setPolygonizer(RG.ADAPTATIVE);
> stroke(255, 0, 0);
> strokeWeight(1);
> grp.draw();
> 
> points = grp.getPoints();
> 
> if (points != null)
> {
> noFill();
> strokeWeight(5);
> stroke(0, 0, 0);
> 
> beginShape(POINTS);
> for (int i=0; i<points.length; i++)
> {
> float x1, y1; 
> if(i != frameCount)
> x1 = points[i].x;
> else
> x1 = 10000;
>       
> y1 = points[i].y;
> vertex(x1, y1);
> //println("x -->", points[i].x);
> //println("y -->", points[i].y);
> }
> endShape(CLOSE);
> pop();
> }
> }
> 
> ```

Now this is weird and counter-intuitive but place font in the sketch-folder (ie not sketch-folder/data) and it gets found…, works for me

---

<div class="post-metadata">

### Author: ![yhlaskerimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yhlaskerimov/32/9725_2.png) [@yhlaskerimov](https://discourse.processing.org/u/yhlaskerimov)
#### Post date: [August 17, 2020, 2:49pm UTC](https://discourse.processing.org/t/geomerative-questions/23272/7 "2020-08-17T14:49:57Z")

</div>

Sorry, but it didn’t help too.

---

<div class="post-metadata">

### Author: ![yhlaskerimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yhlaskerimov/32/9725_2.png) [@yhlaskerimov](https://discourse.processing.org/u/yhlaskerimov)
#### Post date: [August 19, 2020, 6:33am UTC](https://discourse.processing.org/t/geomerative-questions/23272/8 "2020-08-19T06:33:21Z")

</div>

@glv Can you help me with this questions ?

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [August 19, 2020, 10:38am UTC](https://discourse.processing.org/t/geomerative-questions/23272/9 "2020-08-19T10:38:02Z")

</div>

Hello,

The answer is on the Geomerative page:  
[http://www.ricardmarxer.com/geomerative/](http://www.ricardmarxer.com/geomerative/)

> Includes a TrueType font and an SVG interpreters.

_ **Use a TrueType font.** _

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/0c93fa70df57e47de33e5713e727d2de8b926a08.png)

`:)`

---

<div class="post-metadata">

### Author: ![yhlaskerimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yhlaskerimov/32/9725_2.png) [@yhlaskerimov](https://discourse.processing.org/u/yhlaskerimov)
#### Post date: [August 19, 2020, 10:55am UTC](https://discourse.processing.org/t/geomerative-questions/23272/10 "2020-08-19T10:55:01Z")

</div>

How did u do it ? What is wrong in my code ??

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [August 19, 2020, 11:02am UTC](https://discourse.processing.org/t/geomerative-questions/23272/11 "2020-08-19T11:02:58Z")

</div>

You tried to use an otf font

Ending/ extension otf

Use ttf instead

Copy font into the folder of your Sketch

---

<div class="post-metadata">

### Author: ![yhlaskerimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yhlaskerimov/32/9725_2.png) [@yhlaskerimov](https://discourse.processing.org/u/yhlaskerimov)
#### Post date: [August 19, 2020, 11:12am UTC](https://discourse.processing.org/t/geomerative-questions/23272/12 "2020-08-19T11:12:13Z")

</div>

I renamed my `.otf` font to `.ttf` that didn’t help…  
I have to use only one font called `aktif`. I can’t find `.ttf` version of my font.

---

<div class="post-metadata">

### Author: ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)
#### Post date: [August 19, 2020, 11:15am UTC](https://discourse.processing.org/t/geomerative-questions/23272/13 "2020-08-19T11:15:29Z")

</div>

> [@yhlaskerimov](#):
>
> ```auto
> import geomerative.*;
> 
> RFont f;
> RShape grp;
> RPoint[] points;
> 
> void setup() {
> size(1200, 800);
> frameRate(1);
> 
> RG.init(this);
>   
> grp = RG.getText("A", "FreeSans.ttf", 300, CENTER);
> 
> smooth();
> }
> 
> void draw() {
> background(255);
> 
> push();
> translate(width/2, height/3*2);
> 
> RG.setPolygonizer(RG.ADAPTATIVE);
> stroke(255, 0, 0);
> strokeWeight(1);
> grp.draw();
> 
> points = grp.getPoints();
> 
> if (points != null)
> {
> noFill();
> strokeWeight(5);
> stroke(0, 0, 0);
> 
> beginShape(POINTS);
> for (int i=0; i<points.length; i++)
> {
> float x1, y1; 
> if(i != frameCount)
> x1 = points[i].x;
> else
> x1 = 10000;
>       
> y1 = points[i].y;
> vertex(x1, y1);
> //println("x -->", points[i].x);
> //println("y -->", points[i].y);
> }
> endShape(CLOSE);
> pop();
> }
> }
> 
> ```

Just tried on my computer using a random internet font and can confirm this works using monkstones code

![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/4383ebcc42960716c4b823f2822e23491d94eee9.png)

I simply placed the downloaded font into the sketch folder. I have also tried it with the font in the data folder and that works too.

---

<div class="post-metadata">

### Author: ![yhlaskerimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yhlaskerimov/32/9725_2.png) [@yhlaskerimov](https://discourse.processing.org/u/yhlaskerimov)
#### Post date: [August 19, 2020, 11:18am UTC](https://discourse.processing.org/t/geomerative-questions/23272/14 "2020-08-19T11:18:11Z")

</div>

This code works with `FreeSans.ttf` on my computer too. And i need to use my own font called `aktif`.

And i can’t get access to all of that points on the letter ! That is my problem that is have to solve

---

<div class="post-metadata">

### Author: ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)
#### Post date: [August 19, 2020, 11:19am UTC](https://discourse.processing.org/t/geomerative-questions/23272/15 "2020-08-19T11:19:54Z")

</div>

is this a font that you’ve made yourself or something you’ve downloaded, I cant seem to find any font called aktif online for free.

---

<div class="post-metadata">

### Author: ![yhlaskerimov](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/yhlaskerimov/32/9725_2.png) [@yhlaskerimov](https://discourse.processing.org/u/yhlaskerimov)
#### Post date: [August 19, 2020, 11:24am UTC](https://discourse.processing.org/t/geomerative-questions/23272/16 "2020-08-19T11:24:31Z")

</div>

@glv, @paulgoux, @monkstone I found `aktif.ttf` and it worked. Thank u all !

Just one problem, I can’t have an access to all of points on the Letter. What can i do ?

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [August 19, 2020, 11:27am UTC](https://discourse.processing.org/t/geomerative-questions/23272/17 "2020-08-19T11:27:10Z")

</div>

> [@yhlaskerimov](#):
>
> Just one problem, I can’t have an access to all of points on the Letter. What can i do ?

I can see all the points; you have to write code to visualize things to assist you.

> **Code**
>
> ```auto
> import geomerative.*;
> 
> RFont f;
> RShape grp;
> RPoint[] points;
> int i;
> 
> void setup() 
> {
> size(500, 500);
> frameRate(2);
> 
> RG.init(this);
> grp = RG.getText("A", "FreeSans.ttf", 300, CENTER);
>   
> textSize(18);
> }
> 
> void draw() 
> {
> background(255);
> 
> push();
> translate(width/2, height/3*2);
> 
> RG.setPolygonizer(RG.ADAPTATIVE);
> 
> stroke(255, 0, 0);
> strokeWeight(1);
> grp.draw();
> 
> points = grp.getPoints();
> 
> if (points != null)
> {
> noFill();
> strokeWeight(5);
> stroke(0, 0, 0);
> 
> beginShape(POINTS);
> //for (int i=0; i<points.length; i++)
> i = frameCount%points.length;
> {
> float x1, y1; 
> 
> x1 = points[i].x;
> y1 = points[i].y;
> vertex(x1, y1);
> fill(0, 0, 255);
> textAlign(CENTER);
> textSize(18);
> text(i , x1, y1);
> }
> endShape(CLOSE);
> pop();
> }
> }
> 
> ```

Look for a pattern and then write code to work with that.  
This may be documented somewhere; that is an exploration for you.

`:)`

Additional note to solution:

> [@Geomerative questions](https://discourse.processing.org/t/geomerative-questions/23272/9):
>
> Hello, The answer is on the Geomerative page: [http://www.ricardmarxer.com/geomerative/](http://www.ricardmarxer.com/geomerative/) Includes a TrueType font and an SVG interpreters. Use a TrueType font. slight_smile

---

<div class="post-metadata">

### Author: ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)
#### Post date: [August 19, 2020, 1:49pm UTC](https://discourse.processing.org/t/geomerative-questions/23272/18 "2020-08-19T13:49:56Z")

</div>

@glv @paulgoux @Chrisir, just an observation, geomerative methods `RG.getText(...)` uses PApplet instance method [loadBytes](https://processing.org/reference/loadBytes_.html) internally.
