Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest API? #2

Open
drfiemost opened this issue Feb 12, 2022 · 5 comments
Open

Update to latest API? #2

drfiemost opened this issue Feb 12, 2022 · 5 comments

Comments

@drfiemost
Copy link

Imlib2 doesn't build anymore, I guess it requires the most recent API. Is there a plan to get on track with upstram?

  CC       svg_la-loader_svg.lo
loader_svg.c: In function ‘u2pix’:
loader_svg.c:17:11: error: ‘RSVG_UNIT_PERCENT’ undeclared (first use in this function)
   17 |      case RSVG_UNIT_PERCENT:   /* 0  percentage values where 1.0 means 100% */
      |           ^~~~~~~~~~~~~~~~~
loader_svg.c:17:11: note: each undeclared identifier is reported only once for each function it appears in
loader_svg.c:18:11: error: ‘RSVG_UNIT_PX’ undeclared (first use in this function)
   18 |      case RSVG_UNIT_PX:        /* 1  pixels */
      |           ^~~~~~~~~~~~
loader_svg.c:19:11: error: ‘RSVG_UNIT_EM’ undeclared (first use in this function)
   19 |      case RSVG_UNIT_EM:        /* 2  em, or the current font size */
      |           ^~~~~~~~~~~~
loader_svg.c:20:11: error: ‘RSVG_UNIT_EX’ undeclared (first use in this function)
   20 |      case RSVG_UNIT_EX:        /* 3  x-height of the current font */
      |           ^~~~~~~~~~~~
loader_svg.c:22:11: error: ‘RSVG_UNIT_IN’ undeclared (first use in this function)
   22 |      case RSVG_UNIT_IN:        /* 4  inches */
      |           ^~~~~~~~~~~~
loader_svg.c:24:11: error: ‘RSVG_UNIT_CM’ undeclared (first use in this function)
   24 |      case RSVG_UNIT_CM:        /* 5  centimeters */
      |           ^~~~~~~~~~~~
loader_svg.c:26:11: error: ‘RSVG_UNIT_MM’ undeclared (first use in this function)
   26 |      case RSVG_UNIT_MM:        /* 6  millimeters */
      |           ^~~~~~~~~~~~
loader_svg.c:28:11: error: ‘RSVG_UNIT_PT’ undeclared (first use in this function)
   28 |      case RSVG_UNIT_PT:        /* 7  points, or 1/72 inch */
      |           ^~~~~~~~~~~~
loader_svg.c:30:11: error: ‘RSVG_UNIT_PC’ undeclared (first use in this function)
   30 |      case RSVG_UNIT_PC:        /* 8  picas, or 1/6 inch (12 points) */
      |           ^~~~~~~~~~~~
loader_svg.c: In function ‘load2’:
loader_svg.c:52:4: error: unknown type name ‘RsvgRectangle’; did you mean ‘RsvgHandle’?
   52 |    RsvgRectangle       cvb;
      |    ^~~~~~~~~~~~~
      |    RsvgHandle
loader_svg.c:72:7: error: unknown type name ‘RsvgLength’
   72 |       RsvgLength          out_width = { }, out_height = { };
      |       ^~~~~~~~~~
loader_svg.c:72:39: error: empty scalar initializer
   72 |       RsvgLength          out_width = { }, out_height = { };
      |                                       ^
loader_svg.c:72:39: note: (near initialization for ‘out_width’)
loader_svg.c:72:57: error: empty scalar initializer
   72 |       RsvgLength          out_width = { }, out_height = { };
      |                                                         ^
loader_svg.c:72:57: note: (near initialization for ‘out_height’)
loader_svg.c:73:7: error: unknown type name ‘RsvgRectangle’; did you mean ‘RsvgHandle’?
   73 |       RsvgRectangle       out_viewbox = { };
      |       ^~~~~~~~~~~~~
      |       RsvgHandle
loader_svg.c:73:41: error: empty scalar initializer
   73 |       RsvgRectangle       out_viewbox = { };
      |                                         ^
loader_svg.c:73:41: note: (near initialization for ‘out_viewbox’)
loader_svg.c:74:7: warning: implicit declaration of function ‘rsvg_handle_get_intrinsic_dimensions’; did you mean ‘rsvg_handle_get_dimensions’? [-Wimplicit-function-declaration]
   74 |       rsvg_handle_get_intrinsic_dimensions(rsvg,
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |       rsvg_handle_get_dimensions
loader_svg.c:90:41: error: request for member ‘length’ in something not a structure or union
   90 |            im->w = lrint(u2pix(out_width.length, out_width.unit));
      |                                         ^
loader_svg.c:90:59: error: request for member ‘unit’ in something not a structure or union
   90 |            im->w = lrint(u2pix(out_width.length, out_width.unit));
      |                                                           ^
loader_svg.c:91:42: error: request for member ‘length’ in something not a structure or union
   91 |            im->h = lrint(u2pix(out_height.length, out_height.unit));
      |                                          ^
loader_svg.c:91:61: error: request for member ‘unit’ in something not a structure or union
   91 |            im->h = lrint(u2pix(out_height.length, out_height.unit));
      |                                                             ^
loader_svg.c:100:36: error: request for member ‘width’ in something not a structure or union
  100 |            im->w = ceil(out_viewbox.width);
      |                                    ^
loader_svg.c:101:36: error: request for member ‘height’ in something not a structure or union
  101 |            im->h = ceil(out_viewbox.height);
      |                                    ^
loader_svg.c:130:7: error: unknown type name ‘RsvgRectangle’; did you mean ‘RsvgHandle’?
  130 |       RsvgRectangle       out_ink_rect = { }, out_logical_rect = { };
      |       ^~~~~~~~~~~~~
      |       RsvgHandle
loader_svg.c:130:42: error: empty scalar initializer
  130 |       RsvgRectangle       out_ink_rect = { }, out_logical_rect = { };
      |                                          ^
loader_svg.c:130:42: note: (near initialization for ‘out_ink_rect’)
loader_svg.c:130:66: error: empty scalar initializer
  130 |       RsvgRectangle       out_ink_rect = { }, out_logical_rect = { };
      |                                                                  ^
loader_svg.c:130:66: note: (near initialization for ‘out_logical_rect’)
loader_svg.c:132:12: warning: implicit declaration of function ‘rsvg_handle_get_geometry_for_element’ [-Wimplicit-function-declaration]
  132 |       ok = rsvg_handle_get_geometry_for_element(rsvg, NULL,
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
loader_svg.c:141:37: error: request for member ‘width’ in something not a structure or union
  141 |            im->w = ceil(out_ink_rect.width);
      |                                     ^
loader_svg.c:142:37: error: request for member ‘height’ in something not a structure or union
  142 |            im->h = ceil(out_ink_rect.height);
      |                                     ^
loader_svg.c:178:7: error: request for member ‘x’ in something not a structure or union
  178 |    cvb.x = cvb.y = 0;
      |       ^
loader_svg.c:178:15: error: request for member ‘y’ in something not a structure or union
  178 |    cvb.x = cvb.y = 0;
      |               ^
loader_svg.c:179:7: error: request for member ‘width’ in something not a structure or union
  179 |    cvb.width = im->w;
      |       ^
loader_svg.c:180:7: error: request for member ‘height’ in something not a structure or union
  180 |    cvb.height = im->h;
      |       ^
loader_svg.c:181:4: warning: implicit d
```eclaration of function ‘rsvg_handle_render_document’; did you mean ‘rsvg_handle_render_cairo’? [-Wimplicit-function-declaration]
  181 |    rsvg_handle_render_document(rsvg, cr, &cvb, &error);
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |    rsvg_handle_render_cairo
@oaken-source
Copy link
Owner

thanks for the report. It was a matter of time until problems like this appeared, unfortunately.

At the moment, I can't afford the time to chase breaking API changes from upstream and integrate them into this version of librsvg, but I'd happily review pull requests to that end :)

@drfiemost
Copy link
Author

Well, that's not really my cup of tea, hope that someone can pick up the task.
I don't want to end up with rust on my PC :P

Anyway, here's some info on the new API:
https://gnome.pages.gitlab.gnome.org/librsvg/Rsvg-2.0/migrating.html

@drfiemost
Copy link
Author

As a first step I've added the new API interfaces

drfiemost@b9185b1

Unfortunately the definition of RsvgLength conflicts with the older one, so it's not just a matter of adding new functions but some refactoring is required.

https://github.com/drfiemost/librsvg-og/blob/b9185b1517a6797499e300743ae3285d031c8c72/rsvg.h#L177-L180

librsvg-og/rsvg-private.h

Lines 258 to 261 in 586e75f

typedef struct {
double length;
char factor;
} RsvgLength;

@andreasbaumann
Copy link

andreasbaumann@79890f6

I'm basically leaving out the implementation because I only want freetype2 for instance to compile, not
necessarily render SVGs..

The RsvgLength was used as a private struct which can be renamed to _RsvgLength for instance.

@barracuda156
Copy link

It may be worth persuading the upstream of librsvg to unbreak it. Many people are unhappy about Rust dependency, and it is indeed a poor choice for multiple reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants